cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

iLoop
Journeyman III

Porting from CUDA to OpenCL

<<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

 



0 Likes
2 Replies
nou
Exemplar

yes it seems correct.

0 Likes
genaganna
Journeyman III

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.

 



0 Likes