From f674d68bb602cb92b43942ec263b55ebc38341b7 Mon Sep 17 00:00:00 2001 From: Thomas VINCENT Date: Thu, 27 May 2021 09:09:56 +0200 Subject: [PATCH 1/6] Disable SSE2 and AVX2 on ARM64 --- setup.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index a18aa86e..8c061b6b 100644 --- a/setup.py +++ b/setup.py @@ -76,6 +76,8 @@ def get_cpu_sse2_avx2(): :returns: (is SSE2 available, is AVX2 available) :rtype: List(bool) """ + if platform.machine() == "arm64": + return False, False if platform.machine() == "ppc64le": return True, False try: @@ -162,7 +164,9 @@ def finalize_options(self): logger.warning("C++11 disabled: not available") if self.sse2: - if (compiler.compiler_type == 'msvc' or + if platform.machine() == 'arm64': + self.sse2 = False + elif (compiler.compiler_type == 'msvc' or platform.machine() == 'ppc64le'): self.sse2 = True else: @@ -171,7 +175,9 @@ def finalize_options(self): logger.warning("SSE2 disabled: not available") if self.avx2: - if compiler.compiler_type == 'msvc': + if platform.machine() == 'arm64': + self.avx2 = False + elif compiler.compiler_type == 'msvc': self.avx2 = sys.version_info[:2] >= (3, 5) elif platform.machine() == 'ppc64le': self.avx2 = False From 5691c7eaf9f6180e58dfbfbfbc4ac24c94e19667 Mon Sep 17 00:00:00 2001 From: Thomas VINCENT Date: Thu, 27 May 2021 09:55:52 +0200 Subject: [PATCH 2/6] try macos-arm64 build with cibuildwheel --- .github/workflows/ci.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f706e3f..6da54c58 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -104,3 +104,15 @@ jobs: pip install --upgrade h5py==${{ matrix.H5PY_OLDER_VERSION }} pip list python test/test.py + + build_wheels_macos: + name: Build wheels on macos-10.15 + runs-on: macos-10.15 + steps: + - uses: actions/checkout@v2 + + - name: Build wheels + uses: joerick/cibuildwheel@v1.11.0 + env: + CIBW_BUILD: cp39-macosx_* + CIBW_ARCHS_MACOS: x86_64 arm64 universal2 From 20ef138c9c6e1a90abf4ff5f3cfe1089d0158f96 Mon Sep 17 00:00:00 2001 From: Thomas VINCENT Date: Thu, 27 May 2021 10:25:05 +0200 Subject: [PATCH 3/6] add debug machine print --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6da54c58..ffede80b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -116,3 +116,4 @@ jobs: env: CIBW_BUILD: cp39-macosx_* CIBW_ARCHS_MACOS: x86_64 arm64 universal2 + CIBW_BEFORE_BUILD: python -c "import platform;print('Machine:', platform.machine())" From 06fb0255c630782ffa1b5ca293bdff64ecb29ec0 Mon Sep 17 00:00:00 2001 From: Thomas VINCENT Date: Thu, 27 May 2021 10:47:20 +0200 Subject: [PATCH 4/6] add setting build options through env var --- setup.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index 8c061b6b..38d54fa2 100644 --- a/setup.py +++ b/setup.py @@ -140,12 +140,15 @@ class Build(build): def initialize_options(self): build.initialize_options(self) - self.hdf5 = None - self.openmp = not sys.platform.startswith('darwin') - self.native = True - self.sse2 = True - self.avx2 = True - self.cpp11 = True + self.hdf5 = os.environ.get("HDF5PLUGIN_HDF5_DIR", None) + self.openmp = os.environ.get( + "HDF5PLUGIN_OPENMP", + "False" if sys.platform.startswith('darwin') else "True" + ) == "True" + self.native = os.environ.get("HDF5PLUGIN_NATIVE", "True") == "True" + self.sse2 = os.environ.get("HDF5PLUGIN_SSE2", "True") == "True" + self.avx2 = os.environ.get("HDF5PLUGIN_AVX2", "True") == "True" + self.cpp11 = os.environ.get("HDF5PLUGIN_CPP11", "True") == "True" def finalize_options(self): build.finalize_options(self) From cfa010312b8cdb764407e24ef7de7b9c830e5b73 Mon Sep 17 00:00:00 2001 From: Thomas VINCENT Date: Thu, 27 May 2021 10:49:45 +0200 Subject: [PATCH 5/6] disable sse2, avx2 and native options --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ffede80b..988ffcdd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -117,3 +117,6 @@ jobs: CIBW_BUILD: cp39-macosx_* CIBW_ARCHS_MACOS: x86_64 arm64 universal2 CIBW_BEFORE_BUILD: python -c "import platform;print('Machine:', platform.machine())" + HDF5PLUGIN_SSE2: False + HDF5PLUGIN_AVX2: False + HDF5PLUGIN_NATIVE: False From f6c45dcc835f90f1930222d9f2c14e9b4f288477 Mon Sep 17 00:00:00 2001 From: Thomas VINCENT Date: Thu, 27 May 2021 11:04:45 +0200 Subject: [PATCH 6/6] clean-up ci config --- .github/workflows/ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 988ffcdd..5079307c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,7 +106,7 @@ jobs: python test/test.py build_wheels_macos: - name: Build wheels on macos-10.15 + name: Build ARM64 wheels on macos-10.15 runs-on: macos-10.15 steps: - uses: actions/checkout@v2 @@ -115,8 +115,7 @@ jobs: uses: joerick/cibuildwheel@v1.11.0 env: CIBW_BUILD: cp39-macosx_* - CIBW_ARCHS_MACOS: x86_64 arm64 universal2 - CIBW_BEFORE_BUILD: python -c "import platform;print('Machine:', platform.machine())" + CIBW_ARCHS_MACOS: arm64 HDF5PLUGIN_SSE2: False HDF5PLUGIN_AVX2: False HDF5PLUGIN_NATIVE: False