我希望用Cython包装C++和CUDA代码。我看了npcuda-example(https://github.com/rmcgibbo/npcuda-example),并将setup.py更改如下:
ext = Extension('MyWrap',
sources=['src/my_code.cu', 'python/my_wrap.pyx'],
library_dirs=[CUDA['lib']],
libraries=['cudart'],
language='c++',
runtime_library_dirs=[CUDA['lib']],
# this syntax is specific to this build system
# we're only going to use certain compiler args with nvcc and not with gcc
# the implementation of this trick is in customize_compiler() below
extra_compile_args={'clang++': ['-std=c++11','-O3'],
'nvcc': ['-std=c++11','-gencode','arch=compute_30,code=sm_30']},
include_dirs = [numpy_include, CUDA['include'], 'src'],
extra_link_args=["-std=c++11"])
我运行我的代码的setup.py文件,但是出现了一个nvcc错误"致命错误:未找到'mutex'文件"
。我猜测"-std=c++11"选项无法通过nvcc编译器。那么我该如何包含c++11代码来包装c++和CUDA代码呢?