提交 b7d71322 authored 作者: Frederic's avatar Frederic

add the g++ and nvcc compiler string in the hash of the module.

上级 1b3170e9
......@@ -989,11 +989,12 @@ class CLinker(link.Linker):
compile_args=self.compile_args(),
libraries=self.libraries(),
header_dirs=self.header_dirs(),
c_compiler=self.c_compiler(),
)
@staticmethod
def cmodule_key_(env, no_recycling, compile_args=None, libraries=None,
header_dirs=None, insert_config_md5=True):
header_dirs=None, insert_config_md5=True, c_compiler=None):
"""
Do the actual computation of cmodule_key in a static method
to allow it to be reused in scalar.Composite.__eq__
......@@ -1039,6 +1040,8 @@ class CLinker(link.Linker):
# DynamicModule always add the include <numpy/arrayobject.h>
sig.append('NPY_ABI_VERSION=0x%X' %
numpy.core.multiarray._get_ndarray_c_version())
if c_compiler:
sig.append('c_compiler_str=' + c_compiler.version_str())
# IMPORTANT: The 'md5' prefix is used to isolate the compilation
# parameters from the rest of the key. If you want to add more key
......
......@@ -348,7 +348,8 @@ def get_module_hash(src_code, key):
# This is the md5 hash of the config options. We can stop
# here.
break
elif key_element.startswith('NPY_ABI_VERSION=0x'):
elif (key_element.startswith('NPY_ABI_VERSION=0x') or
key_element.startswith('c_compiler_str=')):
to_hash.append(key_element)
else:
raise AssertionError(error_msg)
......@@ -1430,6 +1431,10 @@ def gcc_version():
class GCC_compiler(object):
@staticmethod
def version_str():
return "g++ " + gcc_version_str
@staticmethod
def compile_args():
cxxflags = [flag for flag in config.gcc.cxxflags.split(' ') if flag]
......
......@@ -119,6 +119,7 @@ def cleanup():
1) keys that have an ndarray in them.
Now we use a hash in the keys of the constant data.
2) key that don't have the numpy ABI version in them
3) They do not have a compile version string
If there is no key left for a compiled module, we delete the module.
"""
......@@ -134,15 +135,18 @@ def cleanup():
keydata = cPickle.load(file)
for key in list(keydata.keys):
have_npy_abi_version = False
have_c_compiler = False
for obj in flatten(key):
if isinstance(obj, numpy.ndarray):
keydata.remove_key(key)
break
if (isinstance(obj, basestring) and
obj.startswith('NPY_ABI_VERSION=0x')):
have_npy_abi_version = True
elif isinstance(obj, basestring):
if obj.startswith('NPY_ABI_VERSION=0x'):
have_npy_abi_version = True
elif obj.startswith('c_compiler_str='):
have_c_compiler = True
if not have_npy_abi_version:
if not have_npy_abi_version or not have_c_compiler:
keydata.remove_key(key)
if len(keydata.keys) == 0:
shutil.rmtree(os.path.join(compiledir, directory))
......
......@@ -75,6 +75,10 @@ def add_standard_rpath(rpath):
class NVCC_compiler(object):
@staticmethod
def version_str():
return "nvcc " + nvcc_version
@staticmethod
def compile_args():
"""
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论