如何配置mex以将编译器标志传递给nvcc [英] How can one configure mex to pass compiler flags to nvcc
问题描述
使用nvcc
编译mex
文件时,由于mex
无法识别它们,因此我一直难以将CUDA特有的编译器选项传递给nvcc
编译器.
While compiling mex
files with nvcc
I have struggled to pass compiler options specific to CUDA to the nvcc
compiler, as mex
doesn't recognize them.
我找到了一些一些较新的版本,
但是问题是非常特定于用户的,并且mex
编译器多年来已经发生了变化,所以我不知道该怎么做.
I found some old posts about passing compiler flags and some newer ones,
but the questions are quite user-specific, and the mex
compiler has changed over the years, so I cant figure out what to do.
所以,我的具体问题是:我应该怎么做才能使mex
将编译器标志传递给nvcc
?
So, my specific question: What should I do to make mex
pass compiler flags to nvcc
?
更通用一些:如何使mex
将编译器标志传递给另一个编译器?
A bit more generic: What should one do to make mex
pass compiler flags to another compiler?
推荐答案
如果使用最新的编译方式(其中选项位于xml文件中),则可以在其中硬编码默认的编译标志.例如我的样子:
If working with the newest compiling way where the options are in an xml file, one can hardcode the default compile flags in there. For example mine looks like:
COMPILER="nvcc"
COMPFLAGS="-gencode=arch=compute_20,code=sm_20 -gencode=arch=compute_30,code=sm_30 -gencode=arch=compute_35,code=sm_35 -gencode=arch=compute_50,code=\"sm_50,compute_50\" --compiler-options=/c,/GR,/W3,/EHs,/nologo,/MD"
COMPDEFINES="--compiler-options=/D_CRT_SECURE_NO_DEPRECATE,/D_SCL_SECURE_NO_DEPRECATE,/D_SECURE_SCL=0,$MATLABMEX"
MATLABMEX="/DMATLAB_MEX_FILE"
OPTIMFLAGS="--compiler-options=/O2,/Oy-,/DNDEBUG"
INCLUDE="-I"$MATLABROOT\extern\include" -I"$MATLABROOT\simulink\include""
DEBUGFLAGS="--compiler-options=/Z7"
一个人可以更改修改COMPFLAGS
这篇关于如何配置mex以将编译器标志传递给nvcc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!