diff options
author | Determinant <ted.sybil@gmail.com> | 2016-02-15 16:18:13 +0800 |
---|---|---|
committer | Determinant <ted.sybil@gmail.com> | 2016-02-15 16:18:13 +0800 |
commit | a7608a67f16f745309409f6a004354121e0b3ba6 (patch) | |
tree | b36ec7c4e8b252f540f049d374a13915ca5ba9a3 /nerv/lib/matrix/cumatrix.c | |
parent | 3362020a6bc43766a92882abe6d127c8bb98a628 (diff) |
move curand_gen out of the matrix layout
Diffstat (limited to 'nerv/lib/matrix/cumatrix.c')
-rw-r--r-- | nerv/lib/matrix/cumatrix.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/nerv/lib/matrix/cumatrix.c b/nerv/lib/matrix/cumatrix.c index a8ed075..04205e4 100644 --- a/nerv/lib/matrix/cumatrix.c +++ b/nerv/lib/matrix/cumatrix.c @@ -2,9 +2,11 @@ #include "../common.h" #include "cuda_helper.h" #include <string.h> +#include <time.h> #define PROFILE_HASHMAP_SIZE 123457 static cublasHandle_t cublas_handle; static cudaEvent_t profile_start, profile_stop; +curandGenerator_t curand_gen; static HashMap *profile; void nerv_cumatrix_print_profile() { @@ -37,6 +39,8 @@ void accu_profile(const char *name, float delta) { void nerv_cumatrix_init() { cublasCreate(&cublas_handle); + curandCreateGenerator(&curand_gen, CURAND_RNG_PSEUDO_DEFAULT); + curandSetPseudoRandomGeneratorSeed(curand_gen, time(NULL)); cudaEventCreate(&profile_start); cudaEventCreate(&profile_stop); profile = hashmap_create(PROFILE_HASHMAP_SIZE, bkdr_hash, strcmp); |