2 Replies Latest reply on Mar 29, 2010 8:41 AM by genaganna

    Porting from CUDA to OpenCL

    iLoop
      <<grid,block , x >> problems

      Hi

      I have a CUDA program running like this:

      modSerial<<grid,block,threads>>(x,y,z);

      How can i translate this to OpenCL :

       

      clEnqueueNDRangeKernel(cmd_queue, kernel[0], 1, NULL, &global_work_size,NULL, 0, NULL, NULL);

      Is it correct to fill in like this?

      clEnqueueNDRangeKernel(cmd_queue, kernel[0], gridNULL, block,threads0NULLNULL);

       

      I hope someone can give me advice

       



        • Porting from CUDA to OpenCL
          nou

          yes it seems correct.

          • Porting from CUDA to OpenCL
            genaganna

             

            Originally posted by: iLoop Hi

             

            I have a CUDA program running like this:

             

            modSerial<>(x,y,z);

             

            How can i translate this to OpenCL :

             

            clEnqueueNDRangeKernel(cmd_queue, kernel[0], 1, NULL, &global_work_size,NULL, 0, NULL, NULL);

             

            Is it correct to fill in like this?

             

            clEnqueueNDRangeKernel(cmd_queue, kernel[0], gridNULL, block,threads0NULLNULL);

             

             

            I hope someone can give me advice

             

             

             

            It is wrong,

             

                It should be like this

                 clEnqueueNDRangeKernel(cmd_queue, kernel[0, dim(grid), NULL, grid * block, block,NULL, NULL, NULL);

                  Remember dimension of grid and block must be same. 

             

                 3rd paremeter of execution configuration of CUDA is size of shared memory.  You need to use clSetKernelArg function to set shared memory size.