static array declaration in Cuda


I have some static arrays declared in the C header file.

static unsigned int abc[4][2] = {{0,1},{0,1},{1,0},{1,0}};

Is there any way to declare this type of static arrays in Cuda C.

Please suggest me a best way to access such defined arrays globally in GPU.


Make it a flat array such as this:

int abc[8];

and copy the contents to constant memory. If there are too many items/arrays use flat arrays in global memory and

in the kernel read it to shared memory.

Hope this helps,


What’s wrong with
[font=“Courier New”]constant static unsigned int abc[4][2] = {{0,1},{0,1},{1,0},{1,0}};[/font]
[font=“Courier New”]device static unsigned int abc[4][2] = {{0,1},{0,1},{1,0},{1,0}};[/font]