From 4af116e996fe04b739bf6eee211be36660c212f4 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Sat, 21 Mar 2015 19:25:14 +0000
Subject: [PATCH] gonna change im2col

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

diff --git a/src/cuda.c b/src/cuda.c
index 8849fb1..7982953 100644
--- a/src/cuda.c
+++ b/src/cuda.c
@@ -5,6 +5,7 @@
 #include "cuda.h"
 #include "utils.h"
 #include "blas.h"
+#include "assert.h"
 #include <stdlib.h>
 
 
@@ -15,6 +16,7 @@
         const char *s = cudaGetErrorString(status);
         char buffer[256];
         printf("CUDA Error: %s\n", s);
+        assert(0);
         snprintf(buffer, 256, "CUDA Error: %s", s);
         error(buffer);
     } 
@@ -57,6 +59,18 @@
     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);
+    }
+    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