host array into the kernel in pgi fortran

Hi,

Does anyone know whether it is possible to pass a host array into the kernel and use it within the kernel? If so, how should it be declared within the kernel?

I can make this for scalars by declaring them with the ‘value’ definition within the kernel, but couldn’t figure out how to do the same for the arrays?

I know it is possible to do it by storing the host array into a device array and then pass it to the kernel that way. But I am trying to find an alternative way if there is any.

Thanks

Hi bguler,

Does anyone know whether it is possible to pass a host array into the kernel and use it within the kernel?

No, you must create a device array and then copy the data.

With scalars, you’re just passing a single value so is fine but arrays must be passed by reference. Hence, you must pass a pointer to the array held in the device’s memory. Passing a pointer to the host array would not work since the device can’t access host memory.

  • Mat