Browse Source

Added run script, fix for cpu particlefiler benchmark

Fixed selection of the OCL platform and changed the hardcoded variable
to select a CPU device
Andrea Gussoni 8 years ago
parent
commit
47627c54ae

+ 4 - 4
opencl/particlefilter/ex_particle_OCL_naive_seq.cpp

@@ -85,12 +85,12 @@ static int initialize(int use_gpu) {
     size_t size;
 
     // create OpenCL context
-    cl_platform_id platform_id;
-    if (clGetPlatformIDs(1, &platform_id, NULL) != CL_SUCCESS) {
+    cl_platform_id platform_id[2];
+    if (clGetPlatformIDs(2, platform_id, NULL) != CL_SUCCESS) {
         printf("ERROR: clGetPlatformIDs(1,*,0) failed\n");
         return -1;
     }
-    cl_context_properties ctxprop[] = {CL_CONTEXT_PLATFORM, (cl_context_properties) platform_id, 0};
+    cl_context_properties ctxprop[] = {CL_CONTEXT_PLATFORM, (cl_context_properties) platform_id[1], 0};
     device_type = use_gpu ? CL_DEVICE_TYPE_GPU : CL_DEVICE_TYPE_CPU;
     context = clCreateContextFromType(ctxprop, device_type, NULL, NULL, NULL);
     if (!context) {
@@ -453,7 +453,7 @@ static int allocate(int Nparticles, int countOnes){
 	fclose(fp);
 
 	// OpenCL initialization
-	int use_gpu = 1;
+	int use_gpu = 0;
 	if (initialize(use_gpu)) return -1;
 
 	// compile kernel

+ 4 - 0
opencl/particlefilter/run-cpu

@@ -0,0 +1,4 @@
+./OCL_particlefilter_naive -x 128 -y 128 -z 10 -np 100000
+#./OCL_particlefilter_double -x 128 -y 128 -z 10 -np 400000
+#./OCL_particlefilter_single -x 128 -y 128 -z 10 -np 400000
+#cat ./output.txt