Cloo icon indicating copy to clipboard operation
Cloo copied to clipboard

How to set global variables not included in kernel?

Open eocron opened this issue 2 years ago • 1 comments

int someGlobal1;
int[] someGlobal2;

kernel void SomeKernel()
{
    //some code
}

How can I set values of two global variables defined like this in C#? Is there a way to get variable index by variable name?

eocron avatar Jul 21 '22 08:07 eocron

As this question is not specific to Cloo, but a general OpenCL question, I suggest you read the OpenCL documentation or ask in an OpenCL forum.

However, as far as I understand global variables have to be defined at compile time and you can not change them from code. See: https://stackoverflow.com/questions/22471466/why-program-global-scope-variables-must-be-constant

clSharp avatar Jul 21 '22 12:07 clSharp