|
3 | 3 | # LICENSE file or go to https://github.com/pyccel/psydac/blob/devel/LICENSE # |
4 | 4 | # for full license details. # |
5 | 5 | #---------------------------------------------------------------------------# |
6 | | -import subprocess # nosec B404 |
| 6 | +# import subprocess # nosec B404 |
7 | 7 | import platform |
8 | | -import re |
9 | | -from packaging.version import Version |
| 8 | +# import re |
| 9 | +# from packaging.version import Version |
10 | 10 |
|
11 | 11 |
|
12 | 12 | __all__ = ('PSYDAC_DEFAULT_FOLDER', 'PSYDAC_BACKENDS') |
|
20 | 20 |
|
21 | 21 | PSYDAC_BACKEND_GPYCCEL = {'name': 'pyccel', |
22 | 22 | 'compiler_family': 'GNU', |
23 | | - 'flags' : '-O3 -ffast-math', |
| 23 | + 'flags' : '-O3 -ffast-math -march=native', |
24 | 24 | 'folder' : '__gpyccel__', |
25 | 25 | 'tag' : 'gpyccel', |
26 | 26 | 'openmp' : False} |
27 | 27 |
|
| 28 | +if platform.machine() == 'x86_64': |
| 29 | + PSYDAC_BACKEND_GPYCCEL['flags'] += ' -mavx' |
| 30 | + |
28 | 31 | PSYDAC_BACKEND_IPYCCEL = {'name': 'pyccel', |
29 | 32 | 'compiler_family': 'intel', |
30 | 33 | 'flags' : '-O3', |
|
47 | 50 | 'openmp' : False} |
48 | 51 | # ... |
49 | 52 |
|
50 | | -# Get gfortran version |
51 | | -gfortran_version_output = subprocess.check_output(['gfortran', '--version']).decode('utf-8') # nosec B603, B607 |
52 | | -gfortran_version_string = re.search(r"(\d+\.\d+\.\d+)", gfortran_version_output).group() |
53 | | -gfortran_version = Version(gfortran_version_string) |
54 | | - |
55 | | -# Platform-dependent flags |
56 | | -if platform.system() == "Darwin" and platform.machine() == 'arm64' and gfortran_version >= Version("14"): |
| 53 | +# Get gfortran version [MCP 19.02.2026: commented since currently not needed] |
| 54 | +# gfortran_version_output = subprocess.check_output(['gfortran', '--version']).decode('utf-8') # nosec B603, B607 |
| 55 | +# gfortran_version_string = re.search(r"(\d+\.\d+\.\d+)", gfortran_version_output).group() |
| 56 | +# gfortran_version = Version(gfortran_version_string) |
57 | 57 |
|
58 | | - # Apple silicon requires architecture-specific flags (see https://github.com/pyccel/psydac/pull/411) |
59 | | - # which are only available on GCC version >= 14 |
60 | | - cpu_brand = subprocess.check_output(['sysctl','-n','machdep.cpu.brand_string']).decode('utf-8').strip() # nosec B603, B607 |
61 | | - if cpu_brand.startswith("Apple M"): |
62 | | - # Example: "Apple M3 Pro (virtual)" --> " -mcpu=apple-m3" |
63 | | - cpu_flag = '-'.join(cpu_brand.lower().split()[:2]) |
64 | | - PSYDAC_BACKEND_GPYCCEL['flags'] += f' -mcpu={cpu_flag}' |
65 | | - else: |
66 | | - # TODO: Support later Apple CPU models. Perhaps the CPU naming scheme could be easily guessed |
67 | | - # based on the output of 'sysctl -n machdep.cpu.brand_string', but I wouldn't rely on this |
68 | | - # guess unless it has been manually verified. Loud errors are better than silent failures! |
69 | | - raise SystemError(f"Unsupported Apple CPU '{cpu_brand}'.") |
| 58 | +# if platform.system() == "Darwin" and platform.machine() == 'arm64' and gfortran_version >= Version("14"): |
| 59 | +# |
| 60 | +# # Apple silicon requires architecture-specific flags (see https://github.com/pyccel/psydac/pull/411) |
| 61 | +# # which are only available on GCC version >= 14 |
| 62 | +# cpu_brand = subprocess.check_output(['sysctl','-n','machdep.cpu.brand_string']).decode('utf-8').strip() # nosec B603, B607 |
| 63 | +# if cpu_brand.startswith("Apple M"): |
| 64 | +# # Example: "Apple M3 Pro (virtual)" --> " -mcpu=apple-m3" |
| 65 | +# cpu_flag = '-'.join(cpu_brand.lower().split()[:2]) |
| 66 | +# PSYDAC_BACKEND_GPYCCEL['flags'] += f' -mcpu={cpu_flag}' |
| 67 | +# else: |
| 68 | +# # TODO: Support later Apple CPU models. Perhaps the CPU naming scheme could be easily guessed |
| 69 | +# # based on the output of 'sysctl -n machdep.cpu.brand_string', but I wouldn't rely on this |
| 70 | +# # guess unless it has been manually verified. Loud errors are better than silent failures! |
| 71 | +# raise SystemError(f"Unsupported Apple CPU '{cpu_brand}'.") |
70 | 72 |
|
71 | | -else: |
72 | | - # Default architecture flags |
73 | | - PSYDAC_BACKEND_GPYCCEL['flags'] += ' -march=native -mtune=native' |
74 | | - if platform.machine() == 'x86_64': |
75 | | - PSYDAC_BACKEND_GPYCCEL['flags'] += ' -mavx' |
| 73 | +# else: |
| 74 | +# # Default architecture flags |
| 75 | +# PSYDAC_BACKEND_GPYCCEL['flags'] += ' -march=native -mtune=native' |
| 76 | +# if platform.machine() == 'x86_64': |
| 77 | +# PSYDAC_BACKEND_GPYCCEL['flags'] += ' -mavx' |
76 | 78 |
|
77 | 79 | #============================================================================== |
78 | 80 |
|
|
0 commit comments