Compiling CUDA files with mex -v mexGPUExample.cu

Im trying to compile CUDA files into mex.
Matlab ships with an example CUDA file located in matlabfolder\toolbox\distcomp\gpu\extern\src\mex, but when I try to compile it by typing:
mex -v mexGPUExample.cu
I get:
Error using mex
Creating library mexGPUExample.lib and object mexGPUExample.exp
MSVCRT.lib(atonexit.obj) : error LNK2019: unresolved external
symbol __imp_EncodePointer referenced in function __atonexitinit
MSVCRT.lib(crtdll.obj) : error LNK2001: unresolved external symbol
__imp_EncodePointer
MSVCRT.lib(atonexit.obj) : error LNK2019: unresolved external
symbol __imp_DecodePointer referenced in function _onexit
MSVCRT.lib(crtdll.obj) : error LNK2001: unresolved external symbol
__imp_DecodePointer
MSVCRT.lib(gs_support.obj) : error LNK2019: unresolved external
symbol __imp_QueryPerformanceCounter referenced in function
__security_init_cookie
MSVCRT.lib(gs_support.obj) : error LNK2019: unresolved external
symbol __imp_GetCurrentProcessId referenced in function
__security_init_cookie
MSVCRT.lib(gs_support.obj) : error LNK2019: unresolved external
symbol __imp_GetCurrentThreadId referenced in function
__security_init_cookie
MSVCRT.lib(gs_support.obj) : error LNK2019: unresolved external
symbol __imp_GetSystemTimeAsFileTime referenced in function
__security_init_cookie
MSVCRT.lib(dllmain.obj) : error LNK2019: unresolved external symbol
__imp_DisableThreadLi
braryCalls referenced in function DllMain
mexGPUExample.mexw64 : fatal error LNK1120: 7 unresolved externals
Im using the VS2013 cuda7.5 and Windows SDK 8.1A ,why have this problem?

Antworten (1)

Joss Knight
Joss Knight am 6 Sep. 2017

0 Stimmen

You can't compile this file with mex, it must be compiled with mexcuda.

2 Kommentare

I compile the file with mexcuda, it also has error:
Error using mex
No supported compiler or SDK was found. You can install the freely
available MinGW-w64 C/C++ compiler; see Install MinGW-w64 Compiler.
For more options, see
http://www.mathworks.com/support/compilers/R2015b/win64.html.
should I install the MinGW-w64 C/C++ compiler ?
Joss Knight
Joss Knight am 8 Sep. 2017
No, because that compiler isn't supported by the CUDA compiler. Can you give me the verbose output from mexcuda? I need to see why it's not picking up your Visual Studio installation.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu 颜色图 finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 30 Aug. 2017

Kommentiert:

am 8 Sep. 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!