Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What should replace "memcpy" inside OpenCL kernels?

Tags:

c99

memcpy

opencl

The OpenCL language, which extends C99, does not provide the memcpy function. What should be used instead?

like image 330
grrussel Avatar asked Apr 13 '11 17:04

grrussel


1 Answers

As far as I know, there is nothing like that defined in OpenCL. OpenCL does not provide a concept like dynamic memory and therefore, such functionality is not needed.

You could just run over your array with for and copy the data element by element. But, the target array is of fixed size due to the need to specify the array length at compile time.

On the other side, OpenCL (and OpenGL as a kind of origin) was defined in a more static way. The data needs to be provided to the GPU and the result size needs to be defined. The GPU calculates the input to the pre-defined output location. It is not meant to create more processes within the GPU and it is also not meant to allocate dynamically memory to not disturbed the host doing it.

like image 125
Rick-Rainer Ludwig Avatar answered Oct 13 '22 07:10

Rick-Rainer Ludwig