In java we can declare a static variable. ie, if a variable is declared as static, its same through out that program. If I declare a variable inside CUDA kernel, each kernel will create that variable (multiple individual copies).
For example, if "int x=5" is initialized and if we launch two kernels. If we change the value of x to 6 (x=6) in one kernel. This change is not visible in the other kernel (value of x remains 5).
I want to declare a static variable in CUDA, every kernel should be able to access that variable value, if a change is made to that variable from one kernel, it should be visible in other kernel ( if x=6 in one kernel, other kernel should update to x=6).
I need this to find, whether a number exists in a matrix or not . For example a matrix and a number to find (say 5) is given.
2 3 0 0 0
1 4 5 0 0
7 8 0 0 0
0 0 0 0 0
0 0 0 0 0
I should get yes, row = 1 and col = 2 (assuming row and column starts at 0).