In the solution explorer, add matmul.CUF to the source files.
Right-mouse click on the project properties, select “Fortran->Language”, and then change the “CUDA Fortran” drop-down to “yes”.
Select the menu option “Build->Build Solution” to build the executable.
Finally, select the menu option “Debug->Start Without Debugging” to run the executable.
It compiles well, but encounters the “unresolved external symbol cudafor and iso_c_binding” errors when linking.
Is there anything to do with the project properties?? (pgi visual fortran 2008 (with vs shell) )
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.