Josh Vo
Josh Vo

Reputation: 159

openCL returns error -58 while executing larga amount of data

I am writing an openCL code to find shortest paths from each node to others in a graph using BFS. (Here is the details of what I am doing: Shortest paths by BFS, porting a code from CUDA to openCL

and here is how I split the data to pass to clEnqueueNDRangeKernel

size_t global_size, local_size;
local_size=1024;
global_size=ceil(e_count/(float)local_size)*local_size;
cl_event sync1;
err = clEnqueueNDRangeKernel(queue, kernel, 1, NULL, 
    &global_size, &local_size, 0, NULL, &sync1); //wait for this to finish (to synchronize);

err = clWaitForEvents(1, &sync1)

The code works well with number of edge <= 50000 (through considerably slower than its equivalent cpu version). When I increased the number of edge, the program just exited and gave error -58 (after clEnqueueNDRangeKernel )

I am using NVIDIA Geforce 630M.

How can I figure out what happened and how to fix the problem?

Best Regards

Upvotes: 1

Views: 692

Answers (1)

faken
faken

Reputation: 6852

Error -58 is a CL_INVALID_EVENT (as you can see in cl.h), and it isn't returned by clEnqueueNDRangeKernel, only by clWaitForEvents. So you're probably only checking for errors on the latter function. In order to find what the actual error is, you should check the return value clEnqueueNDRangeKernel against the different status constants it can return. In fact, you should do this for all host OpenCL functions, or else it will be very difficult to determine exactly what type of errors are occurring.

In this specific case, I bet you have a memory related error, such as CL_OUT_OF_RESOURCES (not enough local or private memory for your kernels).

Hope this helps.

Upvotes: 3

Related Questions