In CUDA driver API, there is a function called cuModuleGetGlobal which allows you to get the value of a global variable in a CUDA module (an object of already built CUDA program) by its name. I’m wondering if OpenCL has the same function?
In CUDA driver API, there is a function called cuModuleGetGlobal which allows you to
Share
No, OpenCL 1.2 does not offer a method to read back the value of a global variable.
However, this is not a huge restriction. In OpenCL, program scope variables (i.e. global variables) must be defined in the
__constantaddress space and must be initialized using a compile-time constant. In consequence, kernels can never change the value of global variables. So one can easily track the value of the global variable in the host code.