From 79fbd5bb5748dc423676e13d61fd9e90d35dede4 Mon Sep 17 00:00:00 2001 From: schottenhamml <helen.schottenhamml@fau.de> Date: Mon, 27 Mar 2023 09:48:19 +0200 Subject: [PATCH] Allow usage of ARM architectures for Linux systems (not just Darwin). --- pystencils/backends/simd_instruction_sets.py | 3 ++- pystencils/cpu/cpujit.py | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pystencils/backends/simd_instruction_sets.py b/pystencils/backends/simd_instruction_sets.py index 6af548048..cdb2ee5cf 100644 --- a/pystencils/backends/simd_instruction_sets.py +++ b/pystencils/backends/simd_instruction_sets.py @@ -43,7 +43,8 @@ def get_supported_instruction_sets(): return _cache.copy() if 'PYSTENCILS_SIMD' in os.environ: return os.environ['PYSTENCILS_SIMD'].split(',') - if platform.system() == 'Darwin' and platform.machine() == 'arm64': # not supported by cpuinfo + if (platform.system() == 'Darwin' or platform.system() == 'Linux') and platform.machine() == 'arm64': + # not supported by cpuinfo return ['neon'] elif platform.system() == 'Linux' and platform.machine().startswith('riscv'): # not supported by cpuinfo libc = CDLL('libc.so.6') diff --git a/pystencils/cpu/cpujit.py b/pystencils/cpu/cpujit.py index ca4f26794..19c09c47a 100644 --- a/pystencils/cpu/cpujit.py +++ b/pystencils/cpu/cpujit.py @@ -146,7 +146,9 @@ def read_config(): ('flags', '-Ofast -DNDEBUG -fPIC -march=native -fopenmp -std=c++11'), ('restrict_qualifier', '__restrict__') ]) - if platform.machine().startswith('ppc64'): + if platform.machine() == 'arm64': + default_compiler_config['flags'] = default_compiler_config['flags'].replace('-march=native', '') + elif platform.machine().startswith('ppc64'): default_compiler_config['flags'] = default_compiler_config['flags'].replace('-march=native', '-mcpu=native') elif platform.system().lower() == 'windows': -- GitLab