Can I use multiple shared arrays in one kernel?

I want to use multiple dynamically allocated shared arrays with different data types. In CUDA Fortran, I declare as
integer, shared :: arr1(m,n), arr2(a)
real, shared :: arr3(p,q), arr4(b)
where m, n, a, p, q and b may be constant integers defined in the same module of the kernel

Even though these code can be compiled and run with right answers, however, as far as I know, we can use only one shared array in CUDA C. I’m afraid that these code may be wrong.

Is it correct that arr1, arr2, arr3 and arr4 all point to the same address? In CUDA C, shared arrays (in a kernel) with dynamically allocated memory start from the same address in the shared memory.

If arr1, arr2, arr3 and arr4 all point to the same address as in CUDA C, I need a way to tell how to use them.

Thanks,

Nightwish

Hi Nightwish,

Yes, you can use multiple shared arrays in CUDA Fortran. We may implement them as one single array in the generated code but from your perspective they are multiple.

  • Mat