From edbccdfcaf46f11e631afe98796f3e6e170da5d0 Mon Sep 17 00:00:00 2001
From: Joseph Redmon <pjreddie@gmail.com>
Date: Sun, 26 Oct 2014 05:04:34 +0000
Subject: [PATCH] Maybe something changed?
---
src/opencl.c | 29 +++++++++++++++++++++++++++--
1 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/src/opencl.c b/src/opencl.c
index 5aec33c..604a2e3 100644
--- a/src/opencl.c
+++ b/src/opencl.c
@@ -4,6 +4,7 @@
#include <string.h>
#include <time.h>
#include <unistd.h>
+#include <clBLAS.h>
#include "opencl.h"
#include "utils.h"
@@ -80,9 +81,9 @@
}
int index = getpid()%num_devices;
+ index = 1;
printf("%d rand, %d devices, %d index\n", getpid(), num_devices, index);
- //info.device = devices[index];
- info.device = devices[0];
+ info.device = devices[index];
fprintf(stderr, "Found %d device(s)\n", num_devices);
check_error(info);
@@ -94,10 +95,24 @@
check_error(info);
info.queue = clCreateCommandQueue(info.context, info.device, 0, &info.error);
check_error(info);
+ for(i = 0; i < NUM_QUEUES; ++i){
+ info.queues[i] = clCreateCommandQueue(info.context, info.device, 0, &info.error);
+ check_error(info);
+ }
+ info.error = clblasSetup();
+ check_error(info);
info.initialized = 1;
return info;
}
+void wait_for_queues()
+{
+ int i;
+ for(i = 0; i < NUM_QUEUES; ++i){
+ clFinish(cl.queues[i]);
+ }
+}
+
cl_program cl_fprog(char *filename, char *options, cl_info info)
{
size_t srcsize;
@@ -180,4 +195,14 @@
return mem;
}
+cl_mem cl_make_int_array(int *x, int n)
+{
+ cl_setup();
+ cl_mem mem = clCreateBuffer(cl.context,
+ CL_MEM_READ_WRITE|CL_MEM_COPY_HOST_PTR,
+ sizeof(int)*n, x, &cl.error);
+ check_error(cl);
+ return mem;
+}
+
#endif
--
Gitblit v1.10.0