dimanche 27 mars 2016

Wrapping c++ and CUDA code with cython

I want to wrap c++ and CUDA code with cython. I looked npcuda-example (http://ift.tt/1RDuCyD) and I change setup.py as follows.

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"])

And, I run setup.py for my code, but, I have a nvcc error "fatal error: 'mutex' file not found" I guess "-std=c++11" option can not pass mvcc compiler. How can I wrap c++ and CUDA code include c++11 code?

Aucun commentaire:

Enregistrer un commentaire