Ich möchte C++ und CUDA-Code mit Cython umhüllen. Ich schaute npcuda-Beispiel (https://github.com/rmcgibbo/npcuda-example) und ich ändere setup.py wie folgt.Wrapping C++ und CUDA-Code mit Cython
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"])
Und ich setup.py für meinen Code ausführen, aber, ich habe einen Fehler nvcc "fatal error: 'mutex' file not found"
I "-std = C++ 11" Option erraten kann nicht nvcc Compiler übergeben. Wie kann ich C++ - und CUDA-Code einbinden include C++ 11-Code?
Nur aus Neugier: Warum willst du das? Wofür benötigen Sie Cython, wenn Sie Ihren leistungsfähigen Code bereits in C++ und CUDA haben? – Chiel
Ja, ich habe C++ und CUDA-Code. Ich möchte Python-Schnittstelle meines Codes machen. – nyatsui
Ich löse dieses Problem. Ich benutze Mac OS X und Anaconda mit Pyenv. distutils.util.get_platform() return mac os x 10.5. Dann ändere ich Python Anakonda zum Systemstandard Python, ich kann meinen Code kompilieren. – nyatsui