How to use device pointer in kernel?

In CUDA Fortran, I am trying to use a device pointer inside a kernel. However, this leads to run-time error of illegal memory usage.
That is, I have
d_pnt => d_obj%component_array

where the intent is that the d_pnt will point to the array. Then this d_pnt is used inside a device function called by a kernel.


Hi Abhi,

Do you have a minimal reproducing example you can share?

Device pointer assignment should work as expected but I’d like to see your code in context, as well as how you’ve created “d_obj”. Device types can be somewhat tricky to set-up when having allocable members.