How can I avoid this error when creating a MEX file? "Error: Link of 'mexGPUexample.mex64' failed."
이전 댓글 표시
Hi all,
I am trying to compile the "mexGPUexample.cu" code according to the directions here: http://www.mathworks.com/help/distcomp/run-mex-functions-containing-cuda-code.html
I've followed the steps (changed environment variables, etc.) but when try to compile, I get the following:
>> mex mexGPUexample.cu
C:\PROGRA~1\MATLAB\R2013B\BIN\MEX.PL: Error: Link of 'mexGPUexample.mexw64' failed.
Unable to complete successfully.
Is there a problem with space characters in a path name somewhere? I'm running 64-bit Windows 7 with MATLAB R2013b and CUDA 5.5 with the MS Visual Studio 2012 Pro C compiler.
Any help is appreciated! Here is the verbose output:
>> mex -v mexGPUexample.cu
***************************************************************************
Warning: Neither -compatibleArrayDims nor -largeArrayDims is selected.
Using -compatibleArrayDims. In the future, MATLAB will require
the use of -largeArrayDims and remove the -compatibleArrayDims
option. For more information, see:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html
****************************************************************************
-> Default options filename found in C:\Users\e293911\Documents\MATLAB\Misc
----------------------------------------------------------------
-> Options file = C:\Users\e293911\Documents\MATLAB\Misc\mexopts.bat
MATLAB = C:\Program Files\MATLAB\R2013b
-> COMPILER = nvcc
-> Compiler flags:
COMPFLAGS = -gencode=arch=compute_13,code=sm_13 -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=\"sm_30,compute_30\" -c --compiler-options=/GR,/W3,/EHs,/D_CRT_SECURE_NO_DEPRECATE,/D_SCL_SECURE_NO_DEPRECATE,/D_SECURE_SCL=0,/DMATLAB_MEX_FILE,/nologo,/MD
OPTIMFLAGS = --compiler-options=/O2,/Oy-,/DNDEBUG
DEBUGFLAGS = --compiler-options=/Z7
arguments =
Name switch =
-> Pre-linking commands =
-> LINKER = link
-> Link directives:
LINKFLAGS = /dll /export:mexFunction /LIBPATH:"C:\Program Files\MATLAB\R2013b\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib gpu.lib cudart.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /manifest /incremental:NO /implib:"C:\Users\ASP_2_~1\AppData\Local\Temp\mex_KtFoIb\templib.x" /MAP:"mexGPUexample.mexw64.map"
LINKDEBUGFLAGS = /debug /PDB:"mexGPUexample.mexw64.pdb"
LINKFLAGSPOST =
Name directive = /out:"mexGPUexample.mexw64"
File link directive =
Lib. link directive =
Rsp file indicator = @
-> Resource Compiler = rc /fo "mexversion.res"
-> Resource Linker =
----------------------------------------------------------------
--> nvcc -gencode=arch=compute_13,code=sm_13 -gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=\"sm_30,compute_30\" -c --compiler-options=/GR,/W3,/EHs,/D_CRT_SECURE_NO_DEPRECATE,/D_SCL_SECURE_NO_DEPRECATE,/D_SECURE_SCL=0,/DMATLAB_MEX_FILE,/nologo,/MD -I"C:\Program Files\MATLAB\R2013b\extern\include" -I"C:\Program Files\MATLAB\R2013b\simulink\include" --compiler-options=/O2,/Oy-,/DNDEBUG -DMX_COMPAT_32 mexGPUexample.cu
Contents of C:\Users\ASP_2_~1\AppData\Local\Temp\mex_KtFoIb\mex_tmp.rsp:
mexGPUexample.obj
--> link /out:"mexGPUexample.mexw64" /dll /export:mexFunction /LIBPATH:"C:\Program Files\MATLAB\R2013b\extern\lib\win64\microsoft" libmx.lib libmex.lib libmat.lib gpu.lib cudart.lib /MACHINE:X64 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /manifest /incremental:NO /implib:"C:\Users\ASP_2_~1\AppData\Local\Temp\mex_KtFoIb\templib.x" /MAP:"mexGPUexample.mexw64.map" @C:\Users\ASP_2_~1\AppData\Local\Temp\mex_KtFoIb\mex_tmp.rsp
C:\PROGRA~1\MATLAB\R2013B\BIN\MEX.PL: Error: Link of 'mexGPUexample.mexw64' failed.
Unable to complete successfully.
댓글 수: 7
Walter Roberson
2013년 12월 30일
Odd, normally it would give a reason for the failure. I have to wonder whether it was able to find "link" at all?
Edward
2013년 12월 30일
Walter Roberson
2013년 12월 30일
Try
!link
and see whether MS Windows complains about it link being found or if instead link starts up
Edward
2013년 12월 30일
Walter Roberson
2013년 12월 30일
Try editing the indicated mexopts.bat file, and add -v to the beginning of LINKFLAGS . Save and run again. Perhaps the output will indicate the problem.
Edward
2013년 12월 30일
Walter Roberson
2013년 12월 30일
It appears that it should have been /VERBOSE
My guess is that it is not going to help.
I wonder if maybe the wrong LINK program is being used, but I do not really know how to check that in MS Windows.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 GPU Computing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!