Skip to content

Commit

Permalink
arch: max apple mcpu
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Jan 16, 2024
1 parent 553f3ef commit e621833
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
4 changes: 3 additions & 1 deletion devito/arch/archinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
25 changes: 10 additions & 15 deletions devito/arch/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@


@memoized_func
def sniff_compiler_version(cc):
def sniff_compiler_version(cc, allow_fail=False):
"""
Detect the compiler version.
Expand All @@ -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"
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion examples/seismic/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit e621833

Please sign in to comment.