First the error:
error: a value of type "float *" cannot be used to initialize an entity of type "float (*)[2000]"
Heres the relevant code:
#define opType float
const int N = 2000;
opType *a_h,*b_h,*d_h, *a_d,*b_d, *d_d;
opType (*normalized_a)[N] = a_h;
opType (*normalized_b)[N] = b_h;
opType (*normalized_d)[N] = d_h;
opType (*normalized_a_d)[N] = a_d;
opType (*normalized_b_d)[N] = b_d;
opType (*normalized_d_d)[N] = d_d;
I am attempting to normalize it to two dimensions so that I can pass a double pointer to a function later on and reference the two dimensions using the shorthand bracket syntax. I am using CUDA so I must have one dimensional declarations for the copying of the memory. Is there any way to make the above work?
This construct is borrowed from http://forums.nvidia.com/index.php?showtopic=83941&view=findpost&p=475901
int linear[10*32]; // linear array
int (*twodim)[32] = linear; // interpreted as a two-dimensional [10][32] array.
assert(&twodim[2][4] == &linear[2*32 + 4]); // these are the same