How to use cudaMemCpy2D in CUDA Fortran

Hello!

I want to implement copy from device array to device array in the host code in CUDA Fortran by PVF 13.9.

I found that in the books they use cudaMemCpy2D to implement this. How to use this API to implement this.

Is there any other method to implement this in PVF 13.9?

Thanks in advance.

Nightwish

I have read this link which is about how to use cudaMemcpy2D

https://forums.developer.nvidia.com/t/cudamemcpy2dasync/132350/1

But failed to compile. The error message is

Compiling Project …
mul2.cuf
ptxas : info : 192 bytes gmem, 4 bytes cmem[14]
ptxas : info : Compiling entry function ‘mul2_mod_mymul2_’ for ‘sm_13’
ptxas : info : Used 8 registers, 24 bytes smem
ptxas : info : 192 bytes gmem, 4 bytes cmem[14]
ptxas : info : Compiling entry function ‘mul2_mod_mymul2_’ for ‘sm_20’
ptxas : info : Function properties for mul2_mod_mymul2_
0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas : info : Used 9 registers, 40 bytes cmem[0]
ptxas : info : 192 bytes gmem
ptxas : info : Compiling entry function ‘mul2_mod_mymul2_’ for ‘sm_30’
ptxas : info : Function properties for mul2_mod_mymul2_
0 bytes stack frame, 0 bytes spill stores, 0 bytes spill loads
ptxas : info : Used 10 registers, 328 bytes cmem[0]
Linking…
libcudafor4.lib(cudamemcpy2d.obj) : error LNK2019: unresolved external symbol _cudaMemcpy2D@36 referenced in function _CUDAMEMCPY2DC1@36
libcudafor4.lib(cudamemcpy2d.obj) : error LNK2019: unresolved external symbol _cudaMemcpy2DAsync@40 referenced in function _CUDAMEMCPY2DASYNCC1IN@40
C:\Users\KanGuangyuan\Desktop\Test\Test\Win32\Debug\Test.exe : fatal error LNK1120: 2 unresolved externals
Test build failed.

I use the 64-bit Windows 7 and PVF 13.9.

How to solve this?

Nightwish

Hi Nightwish,

Did you mean to compile from Win32?

The example will compile in 64-bits but it looks like I would need to do a bit of work to get it to work in 32-bits.

  • Mat

Thank you Mat!

I want to compile it to Win32

Nightwish

It can be compiled in win64.

However, can not run. The error message is:

Error in init_GPU:
invalid pitch argument

Warning: ieee_inexact is signaling
FORTRAN STOP

How to solve these?

Nightwish