提交 d316bae4 authored 作者: Frédéric Bastien's avatar Frédéric Bastien

Merge pull request #4107 from nouiz/matt-graham-cudnn_paths_fix

Remove empty string in the include and lib dir.
...@@ -2118,8 +2118,10 @@ class GCC_compiler(Compiler): ...@@ -2118,8 +2118,10 @@ class GCC_compiler(Compiler):
libs = [] libs = []
if preargs is None: if preargs is None:
preargs = [] preargs = []
else:
preargs = list(preargs) # Remove empty string directory
include_dirs = [d for d in include_dirs if d]
lib_dirs = [d for d in lib_dirs if d]
include_dirs = include_dirs + std_include_dirs() include_dirs = include_dirs + std_include_dirs()
libs = libs + std_libs() libs = libs + std_libs()
......
...@@ -188,6 +188,10 @@ class NVCC_compiler(Compiler): ...@@ -188,6 +188,10 @@ class NVCC_compiler(Compiler):
Otherwise nvcc never finish. Otherwise nvcc never finish.
""" """
# Remove empty string directory
include_dirs = [d for d in include_dirs if d]
lib_dirs = [d for d in lib_dirs if d]
rpaths = list(rpaths) rpaths = list(rpaths)
if sys.platform == "win32": if sys.platform == "win32":
...@@ -219,18 +223,20 @@ class NVCC_compiler(Compiler): ...@@ -219,18 +223,20 @@ class NVCC_compiler(Compiler):
libs.append('cudart') libs.append('cudart')
lib_dirs = lib_dirs + std_lib_dirs() lib_dirs = lib_dirs + std_lib_dirs()
if any(ld == os.path.join(cuda_root, 'lib') or
ld == os.path.join(cuda_root, 'lib64') for ld in lib_dirs): # config.dnn.include_path add this by default for cudnn in the
warnings.warn("You have the cuda library directory in your " # new back-end. This should not be used in this back-end. So
"lib_dirs. This has been known to cause problems " # just remove them.
"and should not be done.") lib_dirs = [ld for ld in lib_dirs if
not(ld == os.path.join(cuda_root, 'lib') or
ld == os.path.join(cuda_root, 'lib64'))]
if sys.platform != 'darwin': if sys.platform != 'darwin':
# sometimes, the linker cannot find -lpython so we need to tell it # sometimes, the linker cannot find -lpython so we need to tell it
# explicitly where it is located # explicitly where it is located
# this returns somepath/lib/python2.x # this returns somepath/lib/python2.x
python_lib = distutils.sysconfig.get_python_lib(plat_specific=1, \ python_lib = distutils.sysconfig.get_python_lib(plat_specific=1,
standard_lib=1) standard_lib=1)
python_lib = os.path.dirname(python_lib) python_lib = os.path.dirname(python_lib)
if python_lib not in lib_dirs: if python_lib not in lib_dirs:
lib_dirs.append(python_lib) lib_dirs.append(python_lib)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论