From f98bf6bbdb5ed81f2ea2071ad8e705130f7ba596 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Sat, 28 Mar 2015 23:11:37 +0000
Subject: [PATCH] We do our OWN resizing!
---
src/cuda.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/src/cuda.c b/src/cuda.c
index c914290..1b914a5 100644
--- a/src/cuda.c
+++ b/src/cuda.c
@@ -7,6 +7,7 @@
#include "blas.h"
#include "assert.h"
#include <stdlib.h>
+#include <time.h>
void check_error(cudaError_t status)
@@ -59,6 +60,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, time(0));
+ 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