Causes have been found---- The “calling convention” is set to “unix”. When set to “default”, it works.
Now I have another question: In my visual Fortran project, some Fourtran subroutine has to call some static library from the cuda c files. As the regular fortran subroutine calling c functions, the “calling convention” should be set to “unix”. Now there is an conflict.
How should I handle this situation?
I’ve sent a report a report to our engineers about adding support for the UNIX with the CUDA Fortran modules (TPR#16932). Hopefully, we can have this added soon.
As for calling a C library from Fortran without using -Munix, you may need to use the “!$DEC” directives to specify the C function’s calling convention. See page 162 of the PGI User’s Guide. I believe the CUDA C libraries are built using the “STDCALL” convention instead of the default “CDECL”, though I’m not positive.
Note that 64-bit Windows does not have this issue(it uses a single calling convention), so if you’re able, you might try 64-bits as well.