CUDA Fortran and CUDA C (with nvcc) error

OpenACC and CUDA Fortran
mkcolg
Posts: 8050
Joined: Jun 30 2004

Re: CUDA Fortran and CUDA C (with nvcc) error

Post by mkcolg » Wed Jun 12, 2019 7:55 pm

Hi Victor,

I was able to reproduce the error but with only CUDA 9.2. Compiling with CUDA 10.0 or 10.1 worked fine.

I also found with CUDA 9.2, I could work around the error by not including "-lcudart" on the link. pgfortran will also include -lcudart and it seems that including it twice may be to blame. Unclear exactly why.

Also, I'd recommend that you use the PGI flag "-Mcudalib=cufft" instead of adding -lcufft directly. This is a convenience flag where we'll put the version of CUFFT that matches the CUDA version on the link so you don't need to add a "-L" path.

Code: Select all

% pgfortran -o fortran-test.exe  fortran-test.o fortran_cufft1d_interface.o fortran_cufft1d.o -Mcuda=cuda9.2 -V19.4 -Mcudalib=cufft
% ./fortran-test.exe
 Hello world fortran!
 Original array
 array(            1 )=    1.000000
 array(            2 )=    2.000000
 array(            3 )=    3.000000
 array(            4 )=    4.000000
 array(            5 )=    5.000000
GPU memory usage: used = 376.94MB, free = 15753.56MB, total = 16130.50MB

 FFT fwd
 arrayF(            1 )=    15.00000      -2.0861626E-07
 arrayF(            2 )=   -2.500000        3.440955
 arrayF(            3 )=   -2.500000       0.8122992

 FFT back
 array(            1 )=    1.000000
 array(            2 )=    2.000000
 array(            3 )=    3.000000
 array(            4 )=    4.000000
 array(            5 )=    5.000000
Hope this helps,
Mat

Post Reply