Usage of CudaMemcpy2DArrayToArray()

Hello,
I am interested in copying a 3D host array to a 3D device array in Cuda fortran. The problem is that their dimensions don’t match so I have to use CudaMemcpy2DArrayToArray(). The command I am using so far and is working fine is the following:

temp1_d(proc%ijks(1):proc%ijke(1),proc%ijks(2):proc%ijke(2),1:nz)=val(1:proc%nxyz(1),1:proc%nxyz(2),1:nz)

I would like to use the CudaMemcpy2DArrayToArray() command as a more efficient way, inside a do loop to account for the third dimension. What I am trying is the following :

istat=CudaMemcpy2DArrayToArray(temp1_d(:,:,1),proc%ijks(1),proc%ijks(2),val(:,:,1),1,1,proc%nxyz(1),proc%nxyz(2),cudaMemcpyHostToDevice)

but I am getting the following error during compilation

NVFORTRAN-S-0446-Argument number 1 to cudamemcpy2darraytoarray: rank mismatch (main.f90: 141)
NVFORTRAN-S-0446-Argument number 4 to cudamemcpy2darraytoarray: rank mismatch (main.f90: 141)

Could you please assist me on how to use the above command or suggest a more efficient way to copy 3D arrays with different dimensions?

Thank you in advance
VT

cudaArrays are used for low-level programming for things like textures and surfaces. You don’t want to use that API. If they are normal Fortran arrays, you either want to use the regular cudaMemcpy functions, or just use array assignment, like this:
temp1_d(1:proc%ijks(1), 1:proc%ijks(2), 1) = val(1:proc%nxyz(1), 1:proc%nxyz(2), 1)

Thank you bleblack.