From e621833aedf33b7a3040bfab40f884bbfcc08067 Mon Sep 17 00:00:00 2001 From: mloubout Date: Tue, 16 Jan 2024 10:01:08 -0500 Subject: [PATCH] arch: max apple mcpu --- devito/arch/archinfo.py | 4 +++- devito/arch/compiler.py | 25 ++++++++++--------------- examples/seismic/model.py | 2 +- 3 files changed, 14 insertions(+), 17 deletions(-) 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 f960c8160e..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" @@ -236,11 +239,10 @@ def version(self): except (TypeError, ValueError): version = Version(self.suffix) else: - try: - # Knowing the version may still be useful to pick supported flags - version = sniff_compiler_version(self.CC) - except (FileNotFoundError, OSError): - version = Version("0") + # 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): @@ -951,13 +953,6 @@ def __lookup_cmds__(self): self.MPICC = environ.get('MPICC', self.MPICC) self.MPICXX = environ.get('MPICXX', self.MPICXX) - @property - def version(self): - """ - Custom compiler are assumed to be self-contained, hence no version. - """ - return Version("0") - def __new_with__(self, **kwargs): return super().__new_with__(base=self._base, **kwargs) 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):