Skip to content

Commit

Permalink
Add correct compiler flags for Apple M2 and M3
Browse files Browse the repository at this point in the history
  • Loading branch information
yguclu committed Aug 26, 2024
1 parent 1f338bc commit 951bd7f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions psydac/api/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@
# Apple silicon requires architecture-specific flags (see https://github.com/pyccel/psydac/pull/411)
import subprocess # nosec B404
cpu_brand = subprocess.check_output(['sysctl','-n','machdep.cpu.brand_string']).decode('utf-8') # nosec B603, B607
if "Apple M1" in cpu_brand:
PSYDAC_BACKEND_GPYCCEL['flags'] += ' -mcpu=apple-m1'
if "Apple M1" in cpu_brand: PSYDAC_BACKEND_GPYCCEL['flags'] += ' -mcpu=apple-m1'
elif "Apple M2" in cpu_brand: PSYDAC_BACKEND_GPYCCEL['flags'] += ' -mcpu=apple-m2'
elif "Apple M3" in cpu_brand: PSYDAC_BACKEND_GPYCCEL['flags'] += ' -mcpu=apple-m3'
else:
# TODO: Support later Apple CPU models. Perhaps the CPU naming scheme could be easily guessed
# based on the output of 'sysctl -n machdep.cpu.brand_string', but I wouldn't rely on this
Expand Down

0 comments on commit 951bd7f

Please sign in to comment.