Hi. I’m running Windows XP 32-bit with CUDA 2.2 and Matlab 2008a.
As per http://forums.nvidia.com/index.php?showtopic=66961 (from about 3 months ago), I downloaded the Matlab_CUDA nvmex package and updated it with the 2008a-specific replacements provided therein.
I attempt to compile the provided Szeta.cu application like so. First, I compile the cuFFT interface with no problems:
>> mex fft2_cuda.c -IC:\CUDA\include -LC:\CUDA\lib -lcudart -lcufft
>> mex fft2_cuda_sp_dp.c -IC:\CUDA\include -LC:\CUDA\lib -lcudart -lcufft
>> mex ifft2_cuda.c -IC:\CUDA\include -LC:\CUDA\lib -lcudart -lcufft
But Szeta.cu fails to build, with the following errors:
>> nvmex -f nvmexopts.bat Szeta.cu -IC:\cuda\include -LC:\cuda\lib -lcudart
Szeta.cu
tmpxft_00001484_00000000-3_Szeta.cudafe1.gpu
tmpxft_00001484_00000000-8_Szeta.cudafe2.gpu
tmpxft_00001484_00000000-3_Szeta.cudafe1.cpp
C:\PROGRA~1\MATLAB\R2008A\BIN\NVMEX.PL: Error: Link of 'Szeta.mexw32' failed.
??? Error using ==> nvmex at 206
Unable to complete successfully.
It appears that the linker fails.
In verbose mode:
>> nvmex -v -f nvmexopts.bat Szeta.cu -IC:\cuda\include -LC:\cuda\lib -lcudart
This is mex, Copyright 1984-2007 The MathWorks, Inc.
-> Options file specified on command line
----------------------------------------------------------------
-> Options file = nvmexopts.bat
MATLAB = C:\PROGRA~1\MATLAB\R2008a
-> COMPILER = nvcc
-> Compiler flags:
COMPFLAGS = -c -Xcompiler "/c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD"
OPTIMFLAGS = -Xcompiler "/O2 /Oy- /DNDEBUG"
DEBUGFLAGS = -Xcompiler "/Zi /Fd"Szeta.mexw32.pdb""
arguments = -IC:\cuda\include
Name switch =
-> Pre-linking commands =
-> LINKER = link
-> Link directives:
LINKFLAGS = /dll /export:mexFunction /MAP /LIBPATH:"C:\PROGRA~1\MATLAB\R2008a\extern\lib\win32\microsoft" libmx.lib libmex.lib libmat.lib /implib:C:\DOCUME~1\fasiha\LOCALS~1\Temp\mex_ImWOwD\templib.x /MACHINE:X86 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib
LINKDEBUGFLAGS = /DEBUG /PDB:"Szeta.mexw32.pdb"
LINKFLAGSPOST =
Name directive = /out:"Szeta.mexw32"
File link directive =
Lib. link directive =
Rsp file indicator = @
-> Resource Compiler = rc /fo "mexversion.res"
-> Resource Linker =
----------------------------------------------------------------
--> nvcc -IC:\cuda\include -c -Xcompiler "/c /Zp8 /GR /W3 /EHs /D_CRT_SECURE_NO_DEPRECATE /D_SCL_SECURE_NO_DEPRECATE /D_SECURE_SCL=0 /DMATLAB_MEX_FILE /nologo /MD" -IC:\PROGRA~1\MATLAB\R2008a\extern\include -IC:\PROGRA~1\MATLAB\R2008a\simulink\include -Xcompiler "/O2 /Oy- /DNDEBUG" -DMX_COMPAT_32 C:\home\fasiha\Matlab_CUDA-1.1a\Matlab_CUDA_1.1\Szeta.cu
Szeta.cu
tmpxft_000010e0_00000000-3_Szeta.cudafe1.gpu
tmpxft_000010e0_00000000-8_Szeta.cudafe2.gpu
tmpxft_000010e0_00000000-3_Szeta.cudafe1.cpp
tmpxft_000010e0_00000000-13_Szeta.ii
Contents of C:\DOCUME~1\fasiha\LOCALS~1\Temp\mex_ImWOwD\mex_tmp.rsp:
Szeta.obj
--> link /out:"Szeta.mexw32" /dll /export:mexFunction /MAP /LIBPATH:"C:\PROGRA~1\MATLAB\R2008a\extern\lib\win32\microsoft" libmx.lib libmex.lib libmat.lib /implib:C:\DOCUME~1\fasiha\LOCALS~1\Temp\mex_ImWOwD\templib.x /MACHINE:X86 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib @C:\DOCUME~1\fasiha\LOCALS~1\Temp\mex_ImWOwD\mex_tmp.rsp C:\cuda\lib\cudart.lib
C:\PROGRA~1\MATLAB\R2008A\BIN\NVMEX.PL: Error: Link of 'Szeta.mexw32' failed.
??? Error using ==> nvmex at 206
Unable to complete successfully.
The verbose output indicates that nvcc’s compilation is fine, the linker steps are the issue. I cannot discern any directory error with the link command, and the exact same issue happens with my custom CUDA-enabled mex file, so I turn to you for assistance. Thanks,
Ahmed