From 664c5dd2f2d1c4ad177d5122df6ce3e2900c6648 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Sun, 22 Mar 2015 16:56:40 +0000
Subject: [PATCH] Subdivisions for batches

---
 src/cuda.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/cuda.c b/src/cuda.c
index c914290..fb7485e 100644
--- a/src/cuda.c
+++ b/src/cuda.c
@@ -59,6 +59,19 @@
     return x_gpu;
 }
 
+void cuda_random(float *x_gpu, int n)
+{
+    static curandGenerator_t gen;
+    static int init = 0;
+    if(!init){
+        curandCreateGenerator(&gen, CURAND_RNG_PSEUDO_DEFAULT);
+        curandSetPseudoRandomGeneratorSeed(gen, 0ULL);
+        init = 1;
+    }
+    curandGenerateUniform(gen, x_gpu, n);
+    check_error(cudaPeekAtLastError());
+}
+
 float cuda_compare(float *x_gpu, float *x, int n, char *s)
 {
     float *tmp = calloc(n, sizeof(float));

--
Gitblit v1.10.0