diff --git a/devito/arch/archinfo.py b/devito/arch/archinfo.py index afaa49d86f..3b5e647c50 100644 --- a/devito/arch/archinfo.py +++ b/devito/arch/archinfo.py @@ -715,7 +715,9 @@ class AppleArm(Arm): def march(self): sysinfo = run(["sysctl", "-n", "machdep.cpu.brand_string"], stdout=PIPE, stderr=DEVNULL).stdout.decode("utf-8") - return sysinfo.split(' ')[1].lower() + mx = sysinfo.split(' ')[1].lower() + # Currently clang only supports up to m2 + return min(mx, 'm2') class Amd(Cpu64): diff --git a/devito/arch/compiler.py b/devito/arch/compiler.py index 35f522a0b8..03f49a84ba 100644 --- a/devito/arch/compiler.py +++ b/devito/arch/compiler.py @@ -27,7 +27,7 @@ @memoized_func -def sniff_compiler_version(cc): +def sniff_compiler_version(cc, allow_fail=False): """ Detect the compiler version. @@ -43,8 +43,11 @@ def sniff_compiler_version(cc): except UnicodeDecodeError: return Version("0") except FileNotFoundError: - error("The `%s` compiler isn't available on this system" % cc) - sys.exit(1) + if allow_fail: + return Version("0") + else: + error("The `%s` compiler isn't available on this system" % cc) + sys.exit(1) if ver.startswith("gcc"): compiler = "gcc" @@ -210,15 +213,6 @@ def __init__(self, **kwargs): else: raise NotImplementedError("Unsupported platform %s" % platform) - if self.suffix is not None: - try: - self.version = Version(str(float(self.suffix))) - except (TypeError, ValueError): - self.version = Version(self.suffix) - else: - # Knowing the version may still be useful to pick supported flags - self.version = sniff_compiler_version(self.CC) - self.__init_finalize__(**kwargs) def __init_finalize__(self, **kwargs): @@ -237,6 +231,20 @@ def __new_with__(self, **kwargs): def name(self): return self.__class__.__name__ + @property + def version(self): + if self.suffix is not None: + try: + version = Version(str(float(self.suffix))) + except (TypeError, ValueError): + version = Version(self.suffix) + else: + # Knowing the version may still be useful to pick supported flags + allow_fail = isinstance(self, CustomCompiler) + version = sniff_compiler_version(self.CC, allow_fail=allow_fail) + + return version + def get_version(self): result, stdout, stderr = call_capture_output((self.cc, "--version")) if result != 0: diff --git a/examples/seismic/model.py b/examples/seismic/model.py index eb78d97ed3..d0ca897d03 100644 --- a/examples/seismic/model.py +++ b/examples/seismic/model.py @@ -167,7 +167,7 @@ def physical_params(self, **kwargs): return {i.name: kwargs.get(i.name, i) or i for i in known} def _gen_phys_param(self, field, name, space_order, is_param=True, - default_value=0): + default_value=0, **kwargs): if field is None: return default_value if isinstance(field, np.ndarray):