提交 0681cf5a authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Stop removing amdlibm when compiling with NVCC and make sure to not add it in the first place.

上级 649d40c6
...@@ -1456,19 +1456,6 @@ class CLinker(link.Linker): ...@@ -1456,19 +1456,6 @@ class CLinker(link.Linker):
libs = self.libraries() libs = self.libraries()
preargs = self.compile_args() preargs = self.compile_args()
compiler_name = c_compiler.__name__ compiler_name = c_compiler.__name__
if compiler_name == 'NVCC_compiler' and config.lib.amdlibm:
# This lib does not work correctly with nvcc in device code.
# and newer version of g++ as 4.5.1.
# example of errors: "/usr/lib/gcc/x86_64-redhat-linux/4.5.1/
# include/mmintrin.h(49): error: identifier
# "__builtin_ia32_emms" is undefined"
if '<amdlibm.h>' in mod.includes:
mod.includes.remove('<amdlibm.h>')
if '-DREPLACE_WITH_AMDLIBM' in preargs:
preargs.remove('-DREPLACE_WITH_AMDLIBM')
if 'amdlibm' in libs:
libs.remove('amdlibm')
# We want to compute the code without the lock # We want to compute the code without the lock
src_code = mod.code() src_code = mod.code()
get_lock() get_lock()
......
...@@ -201,24 +201,24 @@ class Scalar(Type): ...@@ -201,24 +201,24 @@ class Scalar(Type):
def values_eq_approx(self, a, b, tolerance=1e-4): def values_eq_approx(self, a, b, tolerance=1e-4):
return abs(a - b) <= ((abs(a) + abs(b)) * tolerance) return abs(a - b) <= ((abs(a) + abs(b)) * tolerance)
def c_headers(self): def c_headers(self, c_compiler):
l = ['<math.h>'] l = ['<math.h>']
# These includes are needed by Scalar and TensorType, # These includes are needed by Scalar and TensorType,
# we declare them here and they will be re-used by TensorType # we declare them here and they will be re-used by TensorType
l.append('<numpy/arrayobject.h>') l.append('<numpy/arrayobject.h>')
l.append('<numpy/arrayscalars.h>') l.append('<numpy/arrayscalars.h>')
if config.lib.amdlibm: if config.lib.amdlibm and c_compiler.supports_amdlibm:
l += ['<amdlibm.h>'] l += ['<amdlibm.h>']
return l return l
def c_libraries(self): def c_libraries(self, c_compiler):
l = [] l = []
if config.lib.amdlibm: if config.lib.amdlibm and c_compiler.supports_amdlibm:
l += ['amdlibm'] l += ['amdlibm']
return l return l
def c_compile_args(self): def c_compile_args(self, c_compiler):
if config.lib.amdlibm: if config.lib.amdlibm and c_compiler.supports_amdlibm:
return ['-DREPLACE_WITH_AMDLIBM'] return ['-DREPLACE_WITH_AMDLIBM']
else: else:
return [] return []
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论