I have a simple example program that demonstrates how to call CUDA-C code from a Fortran module. This compiles, links, and runs properly on my Linux system. However, when I attempt to port it to Windows 7, I get a strange link error (see below).
Here are the commands I am calling (with output). My CUDA code is in my_func.cu and the Fortran code is in test.f90.
nvcc -o my_func.o -c my_func.cu my_func.cu tmpxft_000015e0_00000000-3_my_func.cudafe1.gpu tmpxft_000015e0_00000000-8_my_func.cudafe2.gpu my_func.cu tmpxft_000015e0_00000000-3_my_func.cudafe1.cpp tmpxft_000015e0_00000000-14_my_func.ii gfortran -c test.f90 gfortran -o test my_func.o test.o "-LC:\Program Files (x86)\NVIDIA GPU Computing Toolkit\CUDA\v3.2\lib\Win32" -lcudart Warning: .drectve `/DEFAULTLIB:"libcpmt" /DEFAULTLIB:"LIBCMT" /DEFAULTLIB:"OLDNAMES" ' unrecognized my_func.o:(.text+0xa): undefined reference to `__security_cookie' my_func.o:(.text+0x1b7): undefined reference to `@__security_check_cookie@4' collect2: ld returned 1 exit status mingw32-make: *** [all] Error 1
My research suggests that the problem is due to the fact that GFortran is running under MinGW, but nvcc is using Microsoft Visual Studio (cl.exe) as the C compiler. I have also read that it is impossible to use MinGW’s gcc as the nvcc C compiler.
So that leaves me at a dead end. Any assistance would be greatly appreciated.
Also, if you do not have a solution, but could help me restate or elaborate on my problem in a way that would help me research this issue, that would be appreciated as well.