Using a nvfortran compiled library with nvcc

Hi,
I am trying to compile a library using nvfortran -O3 -cudalib -lpgc -fortranlibs -Mmkl -fopenmp -mp -cpp -fPIC -Mmkl -c file.f90 -o file.o and then use them with another CUDA project with nvcc, but I get multiple undefined referance errors such as undefined reference to ``pgf90_auto_dealloc_i8'.

The fortran library currently includes no CUDA code so I can compile it with gfortran and then successfully use nvcc with -lgfortran. But I don’t know how can I compile and use it after I added the CUDA code.

Solved the issue by adding -L/opt/nvidia/hpc_sdk/Linux_x86_64/25.3/compilers/lib -I/opt/nvidia/hpc_sdk/Linux_x86_64/25.3/compilers/include -lnvf -lpgmath -lnvc while compiling with nvcc.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.