提交 c15d29d1 authored 作者: James Bergstra's avatar James Bergstra

cmodule loads include directories from distutils and numpy

上级 f7aa190c
"""Generate and compile C modules for Python, """Generate and compile C modules for Python,
""" """
import os, tempfile, StringIO, sys, logging, subprocess, cPickle, atexit, time, shutil, stat import os, tempfile, StringIO, sys, logging, subprocess, cPickle, atexit, time, shutil, stat
import distutils.sysconfig
import numpy.distutils #TODO: TensorType should handle this
import compilelock # we will abuse the lockfile mechanism when reading and writing the registry import compilelock # we will abuse the lockfile mechanism when reading and writing the registry
_logger=logging.getLogger("theano.gof.cmodule") _logger=logging.getLogger("theano.gof.cmodule")
_logger.setLevel(logging.INFO) _logger.setLevel(logging.DEBUG)
def error(*args): def error(*args):
#sys.stderr.write('ERROR:'+ ' '.join(str(a) for a in args)+'\n') #sys.stderr.write('ERROR:'+ ' '.join(str(a) for a in args)+'\n')
...@@ -446,9 +448,10 @@ def gcc_module_compile_str(module_name, src_code, location=None, include_dirs=[] ...@@ -446,9 +448,10 @@ def gcc_module_compile_str(module_name, src_code, location=None, include_dirs=[]
preargs.append('-fPIC') preargs.append('-fPIC')
no_opt = False no_opt = False
#TODO: where to find these strings? sys? distutils? include_dirs = [distutils.sysconfig.get_python_inc()] + \
include_dirs = ['/usr/include/python2.6'] + include_dirs numpy.distutils.misc_util.get_numpy_include_dirs()\
libs = ['python2.6'] + libs + include_dirs
libs = [os.path.split(distutils.sysconfig.get_python_inc())[-1]] + libs
workdir = location workdir = location
...@@ -498,6 +501,8 @@ def nvcc_module_compile_str(module_name, src_code, location=None, include_dirs=[ ...@@ -498,6 +501,8 @@ def nvcc_module_compile_str(module_name, src_code, location=None, include_dirs=[
no_opt = False no_opt = False
raise NotImplementedError()
#TODO: -O preargs should be passed globally, not to -Xcompiler #TODO: -O preargs should be passed globally, not to -Xcompiler
#TODO: where to find these strings? sys? distutils? #TODO: where to find these strings? sys? distutils?
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论