vendredi 17 juillet 2015

Seeding curandGenerateLongLong

How can I seed the curandGenerateLongLong? Because it gives me the same numbers every time I run it and I can't use curandSetPseudoRandomGeneratorSeed with curandGenerateLongLong.

size_t n = 10;
curandGenerator_t gen;
unsigned long long *devData, *hostData;

hostData = (unsigned long long *)calloc(n, sizeof(unsigned long long));

cudaMalloc(&devData, n*sizeof(unsigned long long));
curandCreateGenerator(&gen, curandRngType_t::CURAND_RNG_QUASI_SCRAMBLED_SOBOL64);

for (size_t j = 0; j < 3; j++)
{
    curandGenerateLongLong(gen, devData, n);
    cudaMemcpy(hostData, devData, n * sizeof(unsigned long long), cudaMemcpyDeviceToHost);
    for (size_t i = 0; i < 3; i++) {
        printf("%llx\n", hostData[i]);
    }
    printf("\n\n");
}

curandDestroyGenerator(gen);
cudaFree(devData);
free(hostData);




Aucun commentaire:

Enregistrer un commentaire