use time for seed value

This commit is contained in:
Evghenii
2014-02-19 11:57:21 +01:00
parent c513493757
commit 946d2c17c8
2 changed files with 7 additions and 2 deletions

View File

@@ -4,8 +4,10 @@
#include <fstream> #include <fstream>
#include <cassert> #include <cassert>
#include <algorithm> #include <algorithm>
#include <sys/time.h>
#include "PTXParser.h" #include "PTXParser.h"
/* /*
* The C++ code below is based on the following bash-script: * The C++ code below is based on the following bash-script:
#!/bin/sh #!/bin/sh
@@ -42,6 +44,9 @@ static char lRandomAlNum()
static std::string lRandomString(const size_t length) static std::string lRandomString(const size_t length)
{ {
timeval t1;
gettimeofday(&t1, NULL);
srand(t1.tv_usec * t1.tv_sec);
std::string str(length,0); std::string str(length,0);
std::generate_n( str.begin(), length, lRandomAlNum); std::generate_n( str.begin(), length, lRandomAlNum);
return str; return str;

View File

@@ -9,10 +9,10 @@ then
LLVMDIS=$LLVM32/bin/llvm-dis LLVMDIS=$LLVM32/bin/llvm-dis
PTXGEN=$ISPC_HOME/examples_ptx/ptxgen/ptxgen PTXGEN=$ISPC_HOME/examples_ptx/ptxgen/ptxgen
$($LLVMDIS $1 -o $1.ll) && $($PTXGEN $1.ll > $1.ptx) && \ $($LLVMDIS $1 -o $1.ll) && $($PTXGEN $1.ll > $1.ptx) && \
$($PTXCC $1.ptx -o $1.o -G) && \ $($PTXCC $1.ptx -o $1.o -Xnvcc="-G") && \
$(nvcc test_static_nvptx.cpp examples_ptx/nvcc_helpers.cu examples_ptx/ispc_malloc.cpp $1.o -arch=sm_35 -Iexamples_ptx/ -D_CUDA_ -lcudadevrt $ARGS); $(nvcc test_static_nvptx.cpp examples_ptx/nvcc_helpers.cu examples_ptx/ispc_malloc.cpp $1.o -arch=sm_35 -Iexamples_ptx/ -D_CUDA_ -lcudadevrt $ARGS);
else else
$($PTXCC $1 -o $1.o -G) && \ $($PTXCC $1 -o $1.o -Xnvcc="-G") && \
$(nvcc test_static_nvptx.cpp examples_ptx/nvcc_helpers.cu examples_ptx/ispc_malloc.cpp $1.o -arch=sm_35 -Iexamples_ptx/ -D_CUDA_ -lcudadevrt $ARGS); $(nvcc test_static_nvptx.cpp examples_ptx/nvcc_helpers.cu examples_ptx/ispc_malloc.cpp $1.o -arch=sm_35 -Iexamples_ptx/ -D_CUDA_ -lcudadevrt $ARGS);
fi fi