invalid command queue

Hi forum,

I am declared a global variable to hold the command queue and initialized it with the following command:


   commandQueue = clCreateCommandQueue(context,device,0,&errNum);

   if(errNum != CL_SUCCESS)
   {
      std::cerr << "Failed to create the Command Queue: "
		<< get_error_string(errNum)
		<< std::endl;
      cleanup(EXIT_FAILURE);
   }

Later in some other function i need to use this command queue, while using it i am getting the error : CL_INVALID_COMMAND_QUEUE with the following command:


   cl_int errNum;
   //forward FFT
   errNum = clfftEnqueueTransform(planr2c,CLFFT_FORWARD,1,&commandQueue,0,NULL,NULL,&vx,NULL,NULL);

   //wait for the calculations to finish
   errNum = clFinish(commandQueue);

   if(errNum != CL_SUCCESS)
   {
      std::cerr << "the clFinish() failed  in the diffuse projection stage at forward FFT of X-component: "
		<<  get_error_string(errNum) << std::endl;
      cleanup(EXIT_FAILURE);
   }   

The last errNum is giving me failure mentioning CL_INVALID_COMMAND_QUEUE

I am clueless what might have went wrong. I have checked while creating the command queue and it returned CL_SUCCESS.

Any idea ?

Thanks

Search the specification for all references to CL_INVALID_COMMAND_QUEUE; each API lists the conditions it might return this error code. You might find that one of those conditions exists in your code.

Are you sure ? My card so far supports the 1.1 spec and i checked all the instances of the CL_INVALID_COMMAND_QUEUE. Each of the instances mentions that

“if command_queue is not a valid command-queue”.

I have seen some OpenCL implementations return CL_INVALID_COMMAND_QUEUE after something catastrophic happens inside a kernel. Like perhaps an out-of-bounds access. You might try and comment out your call to clfftEnqueueTransform and see if you still get an error when you call clFinish. Maybe something inside clfftEnqueueTransform is making trouble. Just a guess on my part…

good ideas kunze. It sounds like a mystery. @sajis997, can you try your code on a different platform (if you don’t have a GPU from a different vendor, perhaps use the Intel CPU driver). It might give you a better error message or some other clue as to what is up.

I have no access to any other platform other than nvidia gtx 560m . Now if clFinish() returns CL_SUCCESS are we validated that the enqueued kernels completed execution successfully ?

No, getting CL_SUCCESS from clFinish only means that command worked.

If you install the (free) Intel OpenCL SDK then you have another OpenCL compiler available that may give better error messages.