PDA

View Full Version : Initializing constant variables



Sakuri
05-23-2010, 08:00 AM
Hi,

I am trying to overwrite code from CUDA to OpenCl.
Is there a way how to initialize constants variables declared in program source from host source?
In CUDA you can read global variables with the function cuModuleGetGlobal() and set their values. I would like to do something like that in OpenCL.


Thanks

santtt
05-25-2010, 07:56 AM
You can create the constants variables on the host, then initialize a memory object that contains it, do the corresponding copy of data, add this memory object in the kernel args and finally add the lline on you r kernel function file with __constant prefix.