Community
cancel
Showing results for 
Search instead for 
Did you mean: 
AKafi
Beginner
1,304 Views

clEnqueueTask() failed with error code CL_INVALID_COMMAND_QUEUE.

Hello,

I am implementing channel in multi-kernel application. There are 5 single task kernel assume named K1, K2, K3, K4 and K5. There are called Following sequence K1 K1 K2 K3 K4 K4. I am creating channel between K2 and K4. Here is the kernel arguments.

 

I am getting error CL_INVALID_COMMAND_QUEUE from bold line.

 

Can anyone help about this error. Thank you.

 

GetTime(start);

CL_SAFE_CALL( clSetKernelArg(kernel1, 0, sizeof(void *), (void*) &input_ocl     ) );

CL_SAFE_CALL( clSetKernelArg(kernel1, 1, sizeof(void *), (void*) &output_hidden_ocl ) );

CL_SAFE_CALL( clSetKernelArg(kernel1, 2, sizeof(void *), (void*) &input_hidden_ocl ) );

CL_SAFE_CALL( clSetKernelArg(kernel1, 3, sizeof(cl_int), (void*) &in        ) );

CL_SAFE_CALL( clSetKernelArg(kernel1, 4, sizeof(cl_int), (void*) &hid        ) );

 

#ifdef PROFILE

GetTime(start1);

#endif

 

CL_SAFE_CALL( clEnqueueTask(cmd_queue, kernel1, 0, NULL, NULL) );

 

#ifdef PROFILE

//clFinish(cmd_queue);

GetTime(end1);

printf("Kernel 1: %f ms\n", TimeDiff(start1, end1));

#endif

 

CL_SAFE_CALL( clSetKernelArg(kernel1, 0, sizeof(void *), (void*) &output_hidden_ocl ) );

CL_SAFE_CALL( clSetKernelArg(kernel1, 1, sizeof(void *), (void*) &output_hidden_ocl2) );

CL_SAFE_CALL( clSetKernelArg(kernel1, 2, sizeof(void *), (void*) &input_hidden_ocl2 ) );

CL_SAFE_CALL( clSetKernelArg(kernel1, 3, sizeof(cl_int), (void*) &hid        ) );

CL_SAFE_CALL( clSetKernelArg(kernel1, 4, sizeof(cl_int), (void*) &out        ) );

 

#ifdef PROFILE

GetTime(start1);

#endif

 

CL_SAFE_CALL( clEnqueueTask(cmd_queue, kernel1, 0, NULL, &k1_1) );

 

#ifdef PROFILE

//clFinish(cmd_queue);

GetTime(end1);

printf("Kernel 2: %f ms\n", TimeDiff(start1, end1));

#endif

 

//CL_SAFE_CALL( clSetKernelArg(kernel2, 0, sizeof(void *), (void*) &output_delta_ocl ) );

CL_SAFE_CALL( clSetKernelArg(kernel2, 0, sizeof(void *), (void*) &target_ocl    ) );

CL_SAFE_CALL( clSetKernelArg(kernel2, 1, sizeof(void *), (void*) &output_hidden_ocl2) );

CL_SAFE_CALL( clSetKernelArg(kernel2, 2, sizeof(cl_int), (void*) &out        ) );

CL_SAFE_CALL( clSetKernelArg(kernel2, 3, sizeof(void *), (void*) &out_err_ocl    ) );

 

#ifdef PROFILE

GetTime(start1);

#endif

 

CL_SAFE_CALL( clEnqueueTask(cmd_queue, kernel2, 0 , NULL, NULL) );

 

#ifdef PROFILE

//clFinish(cmd_queue);

GetTime(end1);

printf("Kernel 3: %f ms\n", TimeDiff(start1, end1));

#endif

 

CL_SAFE_CALL( clSetKernelArg(kernel3, 0, sizeof(void *), (void*) &hidden_delta_ocl ) );

CL_SAFE_CALL( clSetKernelArg(kernel3, 1, sizeof(cl_int), (void*) &hid       ) );

//CL_SAFE_CALL( clSetKernelArg(kernel3, 2, sizeof(void *), (void*) &output_delta_ocl ) );

CL_SAFE_CALL( clSetKernelArg(kernel3, 2, sizeof(cl_int), (void*) &out       ) );

CL_SAFE_CALL( clSetKernelArg(kernel3, 3, sizeof(void *), (void*) &input_hidden_ocl2) );

CL_SAFE_CALL( clSetKernelArg(kernel3, 4, sizeof(void *), (void*) &output_hidden_ocl) );

CL_SAFE_CALL( clSetKernelArg(kernel3, 5, sizeof(void *), (void*) &hid_err_ocl   ) );

 

#ifdef PROFILE

GetTime(start1);

#endif

 

CL_SAFE_CALL( clEnqueueTask(cmd_queue2, kernel3, 1, &k1_1, &k3) );

 

#ifdef PROFILE

//clFinish(cmd_queue2);

GetTime(end1);

printf("Kernel 4: %f ms\n", TimeDiff(start1, end1));

#endif

 

CL_SAFE_CALL( clSetKernelArg(kernel4, 0, sizeof(void *), (void*) &output_delta_ocl    ) );

CL_SAFE_CALL( clSetKernelArg(kernel4, 1, sizeof(cl_int), (void*) &out          ) );

CL_SAFE_CALL( clSetKernelArg(kernel4, 2, sizeof(void *), (void*) &output_hidden_ocl   ) );

CL_SAFE_CALL( clSetKernelArg(kernel4, 3, sizeof(cl_int), (void*) &hid          ) );

CL_SAFE_CALL( clSetKernelArg(kernel4, 4, sizeof(void *), (void*) &input_hidden_ocl2   ) ); //read back

CL_SAFE_CALL( clSetKernelArg(kernel4, 5, sizeof(void *), (void*) &hidden_prev_weights_ocl) );

 

#ifdef PROFILE

GetTime(start1);

#endif

 

CL_SAFE_CALL( clEnqueueTask(cmd_queue, kernel4, 1, &k3, NULL) );

 

#ifdef PROFILE

//clFinish(cmd_queue);

GetTime(end1);

printf("Kernel 5: %f ms\n", TimeDiff(start1, end1));

#endif

 

CL_SAFE_CALL( clSetKernelArg(kernel4, 0, sizeof(void *), (void*) &hidden_delta_ocl    ) );

CL_SAFE_CALL( clSetKernelArg(kernel4, 1, sizeof(cl_int), (void*) &hid          ) );

CL_SAFE_CALL( clSetKernelArg(kernel4, 2, sizeof(void *), (void*) &input_ocl       ) );

CL_SAFE_CALL( clSetKernelArg(kernel4, 3, sizeof(cl_int), (void*) &in           ) );

CL_SAFE_CALL( clSetKernelArg(kernel4, 4, sizeof(void *), (void*) &input_hidden_ocl    ) ); // read back

CL_SAFE_CALL( clSetKernelArg(kernel4, 5, sizeof(void *), (void*) &input_prev_weights_ocl ) );

 

#ifdef PROFILE

GetTime(start1);

#endif

0 Kudos
4 Replies
HRZ
Valued Contributor II
132 Views

Looks like you are trying to modify this code:

 

https://github.com/fpga-opencl-benchmarks/rodinia_fpga/blob/master/opencl/backprop/backprop_ocl.cpp

 

I guess you did not create the cmd_queue2 queue using clCreateCommandQueue() and that is why you are getting that error. If you attach your complete host code, I can give you a more concrete answer.

AKafi
Beginner
132 Views

Hi HRZ,

 

Thanks for your reply. Yes, you are right. I am trying to modify the backprop kernel. And I have added the clCreateCommandQueue(). Here is my modified host code.

 

https://github.ncsu.edu/akafi2/multi_kernel_openCL/blob/master/backprop_V1/backprop_ocl.cpp

 

Thank you for your help.

 

 

 

 

AKafi
Beginner
132 Views

prev github link won’t work. Please use the following link.

 

https://github.com/akafi2/multi_kernel_openCL/blob/master/backprop_V1/backprop_ocl.cpp

 

 

HRZ
Valued Contributor II
132 Views

You should remove the "return 0" on line 60; the initialization function is returning before creating the second queue. 😅

Reply