[Distutils] Compiling CUDA code

Luís Bruno me at lbruno.org
Sat Jun 16 12:41:46 CEST 2007


Hello,

Cristian S. Rocha wrote:
> I would like to use distutils to compile CUDA code. CUDA is an
> extension of C and C++ to use GPUs capabilities. It need replace
> the gcc compiler by nvcc command line in unix, and append/modify
> some others parameters.

I haven't tried this, but see psycopg2's setup.py:


class psycopg_build_ext(distutils.command.build_ext.build_ext):
   ...
   def get_compiler(self):
       return self.compiler or get_default_compiler()


Maybe you can use distutils.ccompiler.new_compiler() or subclass
distutils.unixccompiler.UnixCCompiler.

Then, return that instance from psycopg_build_ext.get_compiler() and
use this in setup.py:


setup(
    ...
    cmdclass=dict(build_ext=psycopg_build_ext),
    ...
)


Again, I haven't tried this; just some pointers I stumbled upon.
Please tell me if it served your purposes!

http://docs.python.org/dist/dist.html
http://docs.python.org/dist/module-distutils.ccompiler.html

G'luck,
-- 
Luis Bruno
Python charmer, trapped inside a Windows sysadmin body. Help!


More information about the Distutils-SIG mailing list