mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 13:44:15 +08:00
Trying something simpler.
This commit is contained in:
@ -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()
|
||||||
|
Reference in New Issue
Block a user