Skip to content

Commit

Permalink
Fixes for CI failures (#421)
Browse files Browse the repository at this point in the history
- Modify Pyccel compilation flags to support both Intel and Apple
Silicon processors on macOS
- Do not use new version 4 of mpi4py -- see issue #420
- Do not use new version 1.14 of SciPy -- see issue #419

---------

Co-authored-by: kvrigor <[email protected]>
  • Loading branch information
yguclu and kvrigor authored Aug 1, 2024
1 parent 904b7d7 commit 6850cb0
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
20 changes: 17 additions & 3 deletions psydac/api/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

PSYDAC_BACKEND_GPYCCEL = {'name': 'pyccel',
'compiler': 'GNU',
'flags' : '-O3 -march=native -mtune=native -ffast-math',
'flags' : '-O3 -ffast-math',
'folder' : '__gpyccel__',
'tag' : 'gpyccel',
'openmp' : False}
Expand Down Expand Up @@ -41,8 +41,22 @@
# ...

# Platform-dependent flags
if platform.machine() == 'x86_64':
PSYDAC_BACKEND_GPYCCEL['flags'] += ' -mavx'
if platform.system() == "Darwin" and platform.machine() == 'arm64':
# 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'
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
# guess unless it has been manually verified. Loud errors are better than silent failures!
raise SystemError(f"Unsupported Apple CPU '{cpu_brand}'.")
else:
# Default architecture flags
PSYDAC_BACKEND_GPYCCEL['flags'] += ' -march=native -mtune=native'
if platform.machine() == 'x86_64':
PSYDAC_BACKEND_GPYCCEL['flags'] += ' -mavx'

#==============================================================================

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies = [

# Third-party packages from PyPi
'numpy >= 1.16',
'scipy >= 0.18',
'scipy >= 0.18, < 1.14',
'sympy >= 1.5',
'matplotlib',
'pytest >= 4.5',
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ wheel
setuptools >= 61, != 67.2.0
numpy >= 1.16
Cython >= 0.25, < 3.0
mpi4py >= 3.0.0
mpi4py >= 3.0.0, < 4

# Required to build h5py from source
pkgconfig

0 comments on commit 6850cb0

Please sign in to comment.