Hello! I tried to link a CUDA FORTRAN code with the Fortran code.
I eidt the Makefile as follows:
pgf90 -Mcuda -c bgpu.cuf
OBJS += bgpu.o
CUDALIBS = -L/opt/pgi/linux86-64/15.10/lib -lcudafor -lcudacemu -lcudadevice -lcudafor75 -lcudaforblas -lcudaforemu -lcudapgi
CUDAFLIBS = -L/opt/pgi/linux86-64/2015/cuda/7.5/lib64 -lcublas -lcusparse -lcurand -lcudart -lcufft -lcupti
$(EXEC_SE): $(OBJS) $(ULIBDEP)
$(LD) -o $(EXEC_SE) $(OBJS) $(CLIBS) $(ULIBS) $(SLIBS) $(MLIBS) $(CUDALIBS) $(CUDAFLIBS) $(LDFLAGS)
As you can see, I compiled the bgpu.cuf to bgpu.o, and then I link the bgpu.o object with other object files.
The compilation process was all right. But when I run the EXEC_SE ( that is cesm.exe), I got the error message “libcublas.7.5 no such file or directory” .
So I add the libcublas.7.5 into the LD_LIBRARY_PATH, then I got another message, which is “No CUDA device code available”.
It seems that the program treats the code bgpu.cuf as the F90 file, just because I directly linked the bgpu.o(which was compiled using pgf90) with other .o files(which were compiled from .F90 files using pgf90).
Is there any proper strategy to solve the problem? Thanks