Undefine reference to 'cudafor_'

I have a strange case I would like to share and look for your help.


I have a licence for MVPICH2, and it is located in

/usr/local/mpich2-1.4.1p1.pgi/bin/mpif90

When I try to build my code as normal fortran (i.e subroutine without attributes (global)) , the builds works fine.

When I add cudafor and change my subroutines to cuda kernels, the compile fails giving me the following output

 undefined reference to `__cudaRegisterFatBinary'
 undefined reference to `__cudaRegisterFunction'
: undefined reference to `__cudaUnregisterFatBinary'

The compiler command is

/usr/local/mpich2-1.4.1p1.pgi/bin/mpif90 -c -Mpreprocess -Mcuda -Minfo=ccff -O3 -V -ta=nvidia -Mfixed myfile1.f myfile2.f … myfilen.f

I will appreciate your help

All my apologies to the community. I could solve my problem.

I missed to add the -Mcuda in the linker option of my make file.

Hope this will help someone one day