Question

as I'm working on a easy to use OpenCL implementation I ran into the error -36 clEnqueueWriteBuffer. I'm using the OpenCL C++ Wrapper for spec 1.1 with enabled throwing exceptions. So I have this function - I've commented, what it should do (or what I think it should do..):

void createBuffers(std::vector< OpType > arrays) {
        for (int i = 0; i < arrays.size(); i++) {
            buffer.push_back( cl::Buffer(contextCL, CL_MEM_READ_WRITE, sizeof(OpType)*length)); //creating the buffers depending on how big arrays is - buffer has been declared as cl::vector<cl::Buffer> buffer;

//here the Exception is thrown
            queueCL.enqueueWriteBuffer(buffer[i], CL_TRUE, 0, sizeof(OpType)*length,arrays[i]); //writing the contents of arrays[i] (arrays[i] is a C Array) to the buffer i

            kernelCL.setArg(i, buffer[i]);
        }
        result_buffer = cl::Buffer(contextCL, CL_MEM_WRITE_ONLY, length*sizeof(OpType));
        kernelCL.setArg(arrays.size(), result_buffer);
    }

Should this be able to work? For further information just ask!
Thank you in advance,
- fodinabor

Was it helpful?

Solution

Well error -36 is CL_INVALID_COMMAND_QUEUE. You can't fix it inside the function. The command queue is already not created when you call it.

The real error is elsewhere. It is just showing up there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top