Trying something simpler.

This commit is contained in:
Clement Farabet
2012-09-05 00:19:47 -04:00
parent a8aef4e9ee
commit de87f835bb

View File

@ -23,9 +23,15 @@ __host__ unsigned long THCRandom_seed()
__host__ void THCRandom_manualSeed(unsigned long the_seed_) __host__ void THCRandom_manualSeed(unsigned long the_seed_)
{ {
the_initial_seed = the_seed_; the_initial_seed = the_seed_;
if (rng==NULL) rng = new thrust::minstd_rand(the_initial_seed); if (initf == 0) {
else rng->seed(the_initial_seed); cudaMalloc(&rng, sizeof(thrust::minstd_rand));
initf = 1; thrust::minstd_rand rnghost(the_initial_seed);
cudaMemcpy(rng, &rnghost, sizeof(thrust::minstd_rand), cudaMemcpyHostToDevice);
cudaThreadSynchronize();
initf = 1;
} else {
rng->seed(the_initial_seed);
}
} }
__host__ unsigned long THCRandom_initialSeed() __host__ unsigned long THCRandom_initialSeed()