Results 1 to 6 of 6

Thread: Error - 52 with clEnqueueNDRangeKernel

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    10

    Error - 52 with clEnqueueNDRangeKernel

    Hi Everyone,

    I got a problem with :
    Code :
    size_t globalWorkSize[1] = {11};
     size_t localWorkSize[1] = {1};
     
    errNum = clEnqueueNDRangeKernel( commandQueue,kernel,1,NULL, globalWorkSize,localWorkSize,0,NULL,NULL);

    It returns the error : -52.
    commandQueue exists, kernel too GlobalWorkSize/localWorkSize is an integer.
    I really don't see where does the mistake comes from.

    If someone got an idea, he is welcome

    Cheers,

    Elrachal

    __________________________________________________ ______________________
    Edit : I found what error - 52 means : CL_INVALID_KERNEL_ARGS Kernel arguments have not been set.

  2. #2
    Senior Member
    Join Date
    Mar 2011
    Location
    Seoul
    Posts
    118

    Re: Error - 52 with clEnqueueNDRangeKernel

    The error message hints at performing clSetKernelArg(), did you do that correctly?

  3. #3
    Junior Member
    Join Date
    May 2012
    Posts
    10

    Re: Error - 52 with clEnqueueNDRangeKernel

    I assume :

    I have this in the main:

    Code :
    if(!CreateMemObjects(context,memObjects,tableauObjet,F))
        {
            Cleanup(context,commandQueue,program,kernel,&memObjects[0]);
            return 1;
        }
     
        errNum = clSetKernelArg(kernel,0,sizeof(cl_mem),&memObjects[0]);
        errNum |= clSetKernelArg(kernel,1,sizeof(cl_mem),&memObjects[1]);
        errNum |= clSetKernelArg(kernel,1,sizeof(cl_mem),&memObjects[2]);
        errNum |= clSetKernelArg(kernel,1,sizeof(cl_mem),&memObjects[3]);

    and in the function, i wrote :
    Code :
    int CreateMemObjects(cl_context context, cl_mem memObjects[4], knapSack *tableauObjet, int *F)
    {
       int nbElement1 = nbElement;  
        memObjects[0] = clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR,
                                       sizeof(knapSack) * nbElement, tableauObjet, NULL);
        memObjects[1] = clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR,
                                       sizeof(int) * capacityMax, F, NULL);
        memObjects[2] = clCreateBuffer(context, CL_MEM_READ_ONLY | CL_MEM_COPY_HOST_PTR,
                                       sizeof(int), &nbElement1, NULL);
        memObjects[3] = clCreateBuffer(context, CL_MEM_READ_WRITE,
                                       sizeof(int), NULL, NULL);
     
       if(memObjects[0] == NULL ||memObjects[1] == NULL ||memObjects[2] == NULL ||memObjects[3] == NULL )
       {
           printf("Error creating memory objects."");
           return 0;
       }
       return 1;
    }

    and in the .cl file I wrote :
    Code :
    __kernel void knapSack_kernel(__global knapSack *tableauObjet, __global int *F, int nbElement, __global int *resultat)

    Does it looks right?

  4. #4
    Senior Member
    Join Date
    Mar 2011
    Location
    Seoul
    Posts
    118

    Re: Error - 52 with clEnqueueNDRangeKernel

    Are those typos in your clSetKernelArg, the ordering is really 0, 1, 2, 3, not 0, 1, 1, 1?

  5. #5
    Junior Member
    Join Date
    May 2012
    Posts
    10

    Re: Error - 52 with clEnqueueNDRangeKernel

    Each parameter in the kernel function has an index associated with it.
    The first argument has index 0, the second has index 1, the third has index 2 and so on.
    Or am I wrong?

  6. #6
    Junior Member
    Join Date
    May 2012
    Posts
    10

    Re: Error - 52 with clEnqueueNDRangeKernel

    Sorry for the double posting. but I found out where the mistake were :
    errNum = clSetKernelArg(kernel,0,sizeof(cl_mem),&memObjects[0]);
    errNum |= clSetKernelArg(kernel,1,sizeof(cl_mem),&memObjects[1]);
    errNum |= clSetKernelArg(kernel,2,sizeof(cl_int),&memObjects[2]);
    errNum |= clSetKernelArg(kernel,3,sizeof(cl_mem),&memObjects[3]);

    I put 0,1,1,1 and cl_mem instead of cl_int.

    Thank you !!

Similar Threads

  1. clEnqueueNDRangeKernel : Error -38
    By beuleuppeup in forum OpenCL
    Replies: 6
    Last Post: 04-07-2013, 08:42 PM
  2. error - clEnqueueNDRangeKernel( -52)
    By sajis997 in forum OpenCL
    Replies: 1
    Last Post: 05-22-2012, 03:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •