Hi,
Do you have any recommendations for pointer (device) member in a class.
Previously, I cudaMalloc() and cudaMemcpy() the pointers in the constructor function and passed the object to a kernel.
Now I have to pass a dynamic array of this objects. I did like this
multipole **pisotopes;
pisotopes = (multipole**)malloc(sizeof(multipole)*numIsos);
for(int i=0;i<numIsos;i++)
pisotopes[i]=new multipole(data[i]);
//copy data in host struct data[i] to device
And in the kernel, I called the device function of the class
isotope[i]->xs_eval_fast(localenergy, sqrt(300.0*KB), sigT, sigA, sigF);
But program exit at this line.
CUDA Exception: Device Illegal Address
The exception was triggered in device 0.
Program received signal CUDA_EXCEPTION_10, Device Illegal Address.
0x0000000000e174a0 in history<<<(512,1,1),(128,1,1)>>> (Info=…, num_src=1000000, devstep=1, numIso=1, isotope=0xe8d760) at src/simulation.cu:49
49 isotope->xs_eval_fast(localenergy, sqrt(300.0*KB), sigT, sigA, sigF);
And I cannot print the variables
(cuda-gdb) p isotope
$2 = (@generic multipole * @generic * @parameter) 0xe8d760
(cuda-gdb) p isotope[0]
Error: Failed to read generic memory at address 0xe8d760 on device 0 sm 10 warp 1 lane 0 (error=7).
(cuda-gdb) p isotope[0]->dev_double[0]
Error: Failed to read generic memory at address 0xe8d760 on device 0 sm 10 warp 1 lane 0 (error=7).
Any ideas?
Thanks!