提交 aa8d0246 authored 作者: Frederic Bastien's avatar Frederic Bastien

some small fix to make it work when the end don't have CUDA_ROOT, but that the…

some small fix to make it work when the end don't have CUDA_ROOT, but that the other env variables are set correctly.
上级 48a980a0
......@@ -34,10 +34,12 @@ def nvcc_module_compile_str(module_name, src_code, location=None, include_dirs=[
preargs= [] if preargs is None else list(preargs)
preargs.append('-fPIC')
no_opt = False
cuda_root = os.getenv('CUDA_ROOT')
include_dirs = std_include_dirs() + include_dirs
libs = std_libs() + ['cudart'] + libs
lib_dirs = std_lib_dirs() + [os.path.join(os.getenv('CUDA_ROOT'), 'lib')] + lib_dirs
lib_dirs = std_lib_dirs() + lib_dirs
if cuda_root:
lib_dirs.append(os.path.join(cuda_root, 'lib'))
cppfilename = os.path.join(location, 'mod.cu')
cppfile = file(cppfilename, 'w')
......
......@@ -235,12 +235,18 @@ class CudaNdarrayType(Type):
def c_header_dirs(self):
"""Override `CLinkerOp.c_headers` """
return [os.path.dirname(cuda_ndarray.__file__),
os.path.join(os.getenv("CUDA_ROOT"),'include')]
ret = [os.path.dirname(cuda_ndarray.__file__)]
cuda_root = os.getenv("CUDA_ROOT")
if cuda_root:
ret.append(os.path.join(cuda_root,'include'))
return ret
def c_lib_dirs(self):
return [os.path.dirname(cuda_ndarray.__file__),
os.path.join(os.getenv("CUDA_ROOT"),'lib')]
ret = [os.path.dirname(cuda_ndarray.__file__)]
cuda_root = os.getenv("CUDA_ROOT")
if cuda_root:
ret.append(os.path.join(cuda_root,'lib'))
return ret
def c_libraries(self):
return ['cuda_ndarray', 'cudart']
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论