Browse Source

Added run script, fix for cpu bfs benchmark

Fixed the initialization of the OCL platform in order to take into
consideration the right one
Andrea Gussoni 8 years ago
parent
commit
e6f332b2ae
2 changed files with 6 additions and 5 deletions
  1. 5 5
      opencl/bfs/CLHelper.h
  2. 1 0
      opencl/bfs/run-cpu

+ 5 - 5
opencl/bfs/CLHelper.h

@@ -162,7 +162,7 @@ void _clInit()
         throw (string("InitCL()::Error: Getting platform ids (clGetPlatformIDs)"));
 
     /* Select the target platform. Default: first platform */
-    targetPlatform = allPlatforms[0];
+    targetPlatform = allPlatforms[1];
     for (int i = 0; i < numPlatforms; i++)
     {
         char pbuff[128];
@@ -174,7 +174,7 @@ void _clInit()
         if (resultCL != CL_SUCCESS)
             throw (string("InitCL()::Error: Getting platform info (clGetPlatformInfo)"));
 
-		//printf("vedor is %s\n",pbuff);
+		printf("vedor is %s\n",pbuff);
 
     }
     free(allPlatforms);
@@ -183,7 +183,7 @@ void _clInit()
     //--cambine-2: create an OpenCL context
     cl_context_properties cprops[3] = { CL_CONTEXT_PLATFORM, (cl_context_properties)targetPlatform, 0 };
     oclHandles.context = clCreateContextFromType(cprops, 
-                                                CL_DEVICE_TYPE_GPU, 
+                                                CL_DEVICE_TYPE_CPU, 
                                                 NULL, 
                                                 NULL, 
                                                 &resultCL);
@@ -193,7 +193,7 @@ void _clInit()
     //-----------------------------------------------
     //--cambine-3: detect OpenCL devices	
     /* First, get the size of device list */
-   oclHandles.cl_status = clGetDeviceIDs(targetPlatform, CL_DEVICE_TYPE_GPU, 0, NULL, &deviceListSize);
+   oclHandles.cl_status = clGetDeviceIDs(targetPlatform, CL_DEVICE_TYPE_CPU, 0, NULL, &deviceListSize);
    if(oclHandles.cl_status!=CL_SUCCESS){
    	throw(string("exception in _clInit -> clGetDeviceIDs"));   	
    }
@@ -209,7 +209,7 @@ void _clInit()
         throw(string("InitCL()::Error: Could not allocate memory."));
 
     /* Next, get the device list data */
-   oclHandles.cl_status = clGetDeviceIDs(targetPlatform, CL_DEVICE_TYPE_GPU, deviceListSize, \
+   oclHandles.cl_status = clGetDeviceIDs(targetPlatform, CL_DEVICE_TYPE_CPU, deviceListSize, \
 								oclHandles.devices, NULL);
    if(oclHandles.cl_status!=CL_SUCCESS){
    	throw(string("exception in _clInit -> clGetDeviceIDs-2"));   	

+ 1 - 0
opencl/bfs/run-cpu

@@ -0,0 +1 @@
+./bfs ../../data/bfs/graph1MW_6.txt