My kernel function has a two-dimension array, three one-dimension array.
When I access the two-dimension array, i will get the warning
" Advisory: Cannot tell what pointer points to, assuming global memory space "
My code is as following:
-----------------------------------------------My code------------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <cuda_runtime.h>
#include <cutil.h>
global static void HelloCUDA(char** device_patt,char *device_out0,char *device_out1,char *device_out2)
{
device_out0[0] = device_patt[0][0];
device_out1[0] = device_patt[1][0];
device_out2[0] = device_patt[2][0];
}
int main(int argc, char* argv)
{
host_patt[0][0] = 'A';
host_patt[1][0] = 'B';
host_patt[2][0] = 'C';
HelloCUDA<<<1,1>>>(device_patt,device_out0,device_out1,device_out2);
printf("host_out0 = %c\n",host_out0[0]);
printf("host_out1 = %c\n",host_out1[0]);
printf("host_out2 = %c\n",host_out2[0]);
system("pause");
return 0;
}
In the above code, I expect the results are
host_out0 = A
host_out1 = B
host_out2 = C
But in fact , it will print
host_out0 = ?
host_out1 = ?
host_out2 = ?
When I replace kernel function with the another kernel function, the another function is as following
global static void HelloCUDA(char** device_patt,char *device_out0,char *device_out1,char *device_out2)
{
device_out0[0] = 'A';
device_out1[0] = 'B';
device_out2[0] = 'C';
}
It will print the result
host_out0 = A
host_out1 = B
host_out2 = C
If I don’t access the two-dimension input, it will run correctly,
I don’t know how to access the two-dimension array in kernel function correctly.
Can anyone give me some advice or information?
I would appreciate that