1
votes

In the Intel opencl 2.0 tutorial resource SierpiƄski Carpet, they use the device side enqueue properties added in opencl 2.0. In the source code, there is a segment like this:

// You need to create device side queue for enqueue_kernel to work
// We set the device side queue to 16MB, since we are going to have a large 
// number of enqueues
cl_queue_properties qprop[] = {CL_QUEUE_SIZE, 16*1024*1024, 
      CL_QUEUE_PROPERTIES,                              
      (cl_command_queue_properties)CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | 
      CL_QUEUE_ON_DEVICE | CL_QUEUE_ON_DEVICE_DEFAULT, 0};    
cl_command_queue my_device_q = 
      clCreateCommandQueueWithProperties(CLU_CONTEXT, 
            cluGetDevice(CL_DEVICE_TYPE_GPU), qprop, &status);

Now I want to use pyopencl to rewrite the code in python to learn dynamic parallelism method. But I can't find any instruction to set the queue size as the code shows. The CommandQueue API has the properties option, but in the document these options/values don't include size. Any suggestion?

1

1 Answers

0
votes

I am actually facing the exact same issue as you. Looking at the PyOpenCL backend only the function clCreateCommandQueue [1] is used but you actually need the clCreateCommandQueueWithProperties to be used.

As a quick change I tried, was to edit src/c_wrapper/command_queue.cpp and add code that creates the queue of the type described in Sierpinski carpet when PYOPENCL_CL_VERSION >= 0x2000.

It follows that the queue creation will be ok - or so it seems. But later on when I call the enqueue function I am getting INVALID_COMMAND_QUEUE. This error is both for AMD CL2.0 GPU as well as the INTEL 2.1 CPU EXPERIMENTAL. I am still debugging this.

[1] https://www.khronos.org/registry/OpenCL/sdk/1.0/docs/man/xhtml/clCreateCommandQueue.html [2] https://www.khronos.org/registry/OpenCL/sdk/2.0/docs/man/xhtml/clCreateCommandQueueWithProperties.html