- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have a problem when I'm doing tests with opencl, when I keep restarting the computer and then running the following code, the thread hangs Incidentally (very low probability, occurs once in a hundred times) on the event of clEnqueueNDRangeKernel,and does not return any error number. All initialisations return success.
The CPU driver version is 30.0.101.1069;
My code:
init opencl...
queue = clCreateCommandQueue(context,
device,
CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &err);
if (err != CL_SUCCESS) {
LOGI_(ErrorLog) << "Error: Failed to creat command queue!" << err;
return false;
}
device,
CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE, &err);
if (err != CL_SUCCESS) {
LOGI_(ErrorLog) << "Error: Failed to creat command queue!" << err;
return false;
}
cl_event write_evt;
status = clEnqueueWriteBuffer(queue, cl_input, 1,
0, data_size * sizeof(cl_float), input_data, 0, 0, &write_evt);
if (status != CL_SUCCESS) {
LOGI_(ErrorLog) << "Error: Failed to transport input_data to device!" << status;
return false;
}
err = clWaitForEvents(1, &write_evt);
0, data_size * sizeof(cl_float), input_data, 0, 0, &write_evt);
if (status != CL_SUCCESS) {
LOGI_(ErrorLog) << "Error: Failed to transport input_data to device!" << status;
return false;
}
err = clWaitForEvents(1, &write_evt);
err = clSetKernelArg(kernel, 0, sizeof(cl_mem), (void*)&cl_input);
err = clSetKernelArg(kernel, 1, sizeof(cl_mem), (void*)&cl_output);
err = clSetKernelArg(kernel, 2, sizeof(cl_int), (void*)&image_row);
err = clSetKernelArg(kernel, 3, sizeof(cl_int), (void*)&image_col);
err = clSetKernelArg(kernel, 4, sizeof(cl_int), (void*)&d);
err = clSetKernelArg(kernel, 5, sizeof(cl_int), (void*)&d);
err = clSetKernelArg(kernel, 6, sizeof(cl_float), (void*)&alpha1);
err = clSetKernelArg(kernel, 7, sizeof(cl_float), (void*)&alpha2);
err = clSetKernelArg(kernel, 1, sizeof(cl_mem), (void*)&cl_output);
err = clSetKernelArg(kernel, 2, sizeof(cl_int), (void*)&image_row);
err = clSetKernelArg(kernel, 3, sizeof(cl_int), (void*)&image_col);
err = clSetKernelArg(kernel, 4, sizeof(cl_int), (void*)&d);
err = clSetKernelArg(kernel, 5, sizeof(cl_int), (void*)&d);
err = clSetKernelArg(kernel, 6, sizeof(cl_float), (void*)&alpha1);
err = clSetKernelArg(kernel, 7, sizeof(cl_float), (void*)&alpha2);
if (err != CL_SUCCESS)
{
LOGI_(ErrorLog) << "Error: Failed to set kernel parameters!" << err;
return false;
}
{
LOGI_(ErrorLog) << "Error: Failed to set kernel parameters!" << err;
return false;
}
err = clEnqueueNDRangeKernel(queue,
kernel,
2,
NULL,
globalThreads,
localThreads, 0, NULL, &run_evt);
if (err != CL_SUCCESS)
{
LOGI_(ErrorLog) << "Error: Failed to run range kernel!" << err;
return false;
}
err = clWaitForEvents(1, &run_evt);-------------------------------------------------hangs here
if (err != CL_SUCCESS)
{
LOGI_(ErrorLog) << "Error: Failed to wait event run_evt!" << err;
return false;
}
{
LOGI_(ErrorLog) << "Error: Failed to wait event run_evt!" << err;
return false;
}
cl_event read_evt;
status = clEnqueueReadBuffer(queue, cl_output, 1,
0, data_size * sizeof(cl_float), output_data, 0, 0, &read_evt);
if (status != CL_SUCCESS) {
LOGI_(ErrorLog) << "Error: Failed to transport input_data to device!" << status;
return false;
}
status = clEnqueueReadBuffer(queue, cl_output, 1,
0, data_size * sizeof(cl_float), output_data, 0, 0, &read_evt);
if (status != CL_SUCCESS) {
LOGI_(ErrorLog) << "Error: Failed to transport input_data to device!" << status;
return false;
}
err = clWaitForEvents(1, &read_evt);
release........
My kernel Code:
__kernel void Test(__global float *input_data, __global float *output_data, int in_rows, int in_cols, int kernel_rows, int kernel_cols,
float alpha1, float alpha2)
{
int x = get_global_id(0);
int y = get_global_id(1);
return;
}
Link Copied
0 Replies
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page