From a8e75fe6081b69d00f9dc4b58f620eac7a777ced Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Tue, 18 Feb 2025 13:12:32 +0530 Subject: [PATCH 01/11] Bump minimum macOS version to 10.13 --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 29ef0bf0..d742f05f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -157,7 +157,9 @@ filterwarnings = [ [tool.cibuildwheel] environment = { DISABLE_NUMCODECS_AVX2=1 } [tool.cibuildwheel.macos] -environment = { MACOSX_DEPLOYMENT_TARGET=10.9, DISABLE_NUMCODECS_AVX2=1, CFLAGS="$CFLAGS -Wno-implicit-function-declaration" } +# cibuildwheel uses 3.12 for the Python driver, which supports High Sierra and later +# https://github.com/pypa/cibuildwheel/blob/ee63bf16da6cddfb925f542f2c7b59ad50e93969/action.yml#L31 +environment = { MACOSX_DEPLOYMENT_TARGET=10.13, DISABLE_NUMCODECS_AVX2=1, CFLAGS="$CFLAGS -Wno-implicit-function-declaration" } [[tool.cibuildwheel.overrides]] select = "*-macosx_arm64" environment = { DISABLE_NUMCODECS_AVX2=1, DISABLE_NUMCODECS_SSE2=1 } From 9d983ed47430880473b89fb648dd0ae74171beeb Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Tue, 18 Feb 2025 13:13:02 +0530 Subject: [PATCH 02/11] Add `ubuntu-22.04-arm` image to CI --- .github/workflows/ci.yaml | 2 +- .github/workflows/wheel.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a2a62c44..666908cf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,7 +14,7 @@ jobs: matrix: python-version: ["3.11", "3.12", "3.13"] # macos-13 is an intel runner, macos-14 is a arm64 runner - platform: [ubuntu-latest, windows-latest, macos-13, macos-14] + platform: [ubuntu-latest, ubuntu-22.04-arm, windows-latest, macos-13, macos-14] defaults: run: diff --git a/.github/workflows/wheel.yaml b/.github/workflows/wheel.yaml index 6746ffb8..6a99f04d 100644 --- a/.github/workflows/wheel.yaml +++ b/.github/workflows/wheel.yaml @@ -14,7 +14,7 @@ jobs: fail-fast: false matrix: # macos-13 is an intel runner, macos-14 is a arm64 runner - os: [ubuntu-latest, windows-latest, macos-13, macos-14] + os: [ubuntu-latest, ubuntu-22.04-arm, windows-latest, macos-13, macos-14] env: CIBW_TEST_COMMAND: python -c "import numcodecs" CIBW_BUILD: "cp311-* cp312-* cp313-*" From 0afe5fc6cde7d654b3770052d144cf68699f6ade Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Tue, 18 Feb 2025 13:13:13 +0530 Subject: [PATCH 03/11] Fix a typo --- .github/workflows/ci.yaml | 2 +- .github/workflows/wheel.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 666908cf..d3e75836 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -13,7 +13,7 @@ jobs: fail-fast: false matrix: python-version: ["3.11", "3.12", "3.13"] - # macos-13 is an intel runner, macos-14 is a arm64 runner + # macos-13 is an intel runner, macos-14 is an arm64 runner platform: [ubuntu-latest, ubuntu-22.04-arm, windows-latest, macos-13, macos-14] defaults: diff --git a/.github/workflows/wheel.yaml b/.github/workflows/wheel.yaml index 6a99f04d..709a4444 100644 --- a/.github/workflows/wheel.yaml +++ b/.github/workflows/wheel.yaml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - # macos-13 is an intel runner, macos-14 is a arm64 runner + # macos-13 is an intel runner, macos-14 is an arm64 runner os: [ubuntu-latest, ubuntu-22.04-arm, windows-latest, macos-13, macos-14] env: CIBW_TEST_COMMAND: python -c "import numcodecs" From 19ed8102b47e9b59903180b27684af9db43ec408 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Tue, 18 Feb 2025 13:13:26 +0530 Subject: [PATCH 04/11] Install Zarr 3, now that it is available --- .github/workflows/ci.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index d3e75836..bd6b0887 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -56,8 +56,7 @@ jobs: # Since zarr v3 requires numpy >= 1.25, on Python 3.11 leave it out # so we can have some tests of our minimum version of numpy (1.24) if: matrix.python-version != '3.11' - # TODO: remove --pre option when zarr v3 is out - run: python -m pip install --pre zarr>=3.0.0b2 + run: python -m pip install zarr>=3 - name: List installed packages run: python -m pip list From 3a645362b3754aac96d9b2579ad2756e60432a22 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Tue, 18 Feb 2025 13:20:24 +0530 Subject: [PATCH 05/11] Allow compilation on Linux AArch64 --- setup.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 6cbddf4a..76c61a00 100644 --- a/setup.py +++ b/setup.py @@ -302,13 +302,24 @@ class BuildFailed(Exception): pass +def get_arch_specific_objects(): + machine = cpuinfo.platform.machine() + if machine == 'x86_64': + return [S[:-1] + 'o' for S in glob("c-blosc/internal-complibs/zstd*/decompress/*amd64.S")] + elif machine == 'aarch64': + return [S[:-1] + 'o' for S in glob("c-blosc/internal-complibs/zstd*/decompress/*aarch64.S")] + return [] + + class ve_build_ext(build_ext): # This class allows C extension building to fail. def run(self): try: - if cpuinfo.platform.machine() == 'x86_64': - S_files = glob('c-blosc/internal-complibs/zstd*/decompress/*amd64.S') + machine = cpuinfo.platform.machine() + if machine in ('x86_64', 'aarch64'): + pattern = '*amd64.S' if machine == 'x86_64' else '*aarch64.S' + S_files = glob(f'c-blosc/internal-complibs/zstd*/decompress/{pattern}') compiler = ccompiler.new_compiler() customize_compiler(compiler) compiler.src_extensions.append('.S') From af294ef4df5d26cad2e4e4ea5bfbe11e49aaa436 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Tue, 18 Feb 2025 13:50:56 +0530 Subject: [PATCH 06/11] Don't check for SSE2/AVX2 for AArch64 --- setup.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 76c61a00..5af2786c 100644 --- a/setup.py +++ b/setup.py @@ -13,8 +13,15 @@ # determine CPU support for SSE2 and AVX2 cpu_info = cpuinfo.get_cpu_info() flags = cpu_info.get('flags', []) -have_sse2 = 'sse2' in flags -have_avx2 = 'avx2' in flags +machine = cpuinfo.platform.machine() + +# only check for x86 features on x86_64 arch +have_sse2 = False +have_avx2 = False +if machine == 'x86_64': + have_sse2 = 'sse2' in flags + have_avx2 = 'avx2' in flags + disable_sse2 = 'DISABLE_NUMCODECS_SSE2' in os.environ disable_avx2 = 'DISABLE_NUMCODECS_AVX2' in os.environ @@ -24,7 +31,7 @@ if have_cflags: # respect compiler options set by user pass -elif os.name == 'posix': +elif os.name == 'posix' and machine == 'x86_64': if disable_sse2: base_compile_args.append('-mno-sse2') elif have_sse2: From 6b05be5d4c9cf8d76a2f47749bcfd9b19c17b3cc Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Tue, 18 Feb 2025 16:53:38 +0530 Subject: [PATCH 07/11] Bump to `setup-miniconda@3.1.1` Suggested-by: --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index bd6b0887..b1a1a7d9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,7 +28,7 @@ jobs: fetch-depth: 0 # required for version resolution - name: Set up Conda - uses: conda-incubator/setup-miniconda@v3.1.0 + uses: conda-incubator/setup-miniconda@v3.1.1 with: channels: conda-forge miniforge-version: latest From 82a4565ef9f49f47567a6c7a21f768027252d5f0 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 19 Feb 2025 09:22:42 +0530 Subject: [PATCH 08/11] Add a CHANGELOG entry --- docs/release.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/release.rst b/docs/release.rst index c5ba3919..4c7a4c29 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -17,6 +17,12 @@ Release notes Unreleased ---------- +Enhancements +~~~~~~~~~~~~ + +* Add support for the Linux AArch64 architecture. + By :user:`Agriya Khetarpal `, :issue:`288`. + Improvements ~~~~~~~~~~~~ * Raise a custom `UnknownCodecError` when trying to retrieve an unavailable codec. @@ -40,7 +46,7 @@ Breaking changes Deprecations ~~~~~~~~~~~~ -The following ``blosc`` funcitons are deprecated, with no replacement. +The following ``blosc`` functions are deprecated, with no replacement. This is because they are not intended to be public API. - ``numcodecs.blosc.init`` From 912c207eebd7f86a6850b6a2752fd30bfbd81fe3 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Wed, 19 Feb 2025 16:25:41 +0530 Subject: [PATCH 09/11] Add `extra_link_args` for pthreads --- setup.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/setup.py b/setup.py index 5af2786c..4defd23b 100644 --- a/setup.py +++ b/setup.py @@ -60,8 +60,14 @@ def blosc_extension(): info('setting up Blosc extension') extra_compile_args = base_compile_args.copy() + extra_link_args = [] define_macros = [] + # ensure pthread is properly linked on POSIX systems + if os.name == 'posix': + extra_compile_args.append('-pthread') + extra_link_args.append('-pthread') + # setup blosc sources blosc_sources = [f for f in glob('c-blosc/blosc/*.c') if 'avx2' not in f and 'sse2' not in f] include_dirs = [os.path.join('c-blosc', 'blosc')] @@ -125,6 +131,7 @@ def blosc_extension(): include_dirs=include_dirs, define_macros=define_macros, extra_compile_args=extra_compile_args, + extra_link_args=extra_link_args, extra_objects=extra_objects, ), ] From a86d4c20066c5b20bdc24df4146be0f02bb89a88 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 1 Mar 2025 18:49:47 +0530 Subject: [PATCH 10/11] Drop redundant `get_arch_specific_objects` Co-Authored-By: David Stansby --- setup.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/setup.py b/setup.py index 4defd23b..c27fad35 100644 --- a/setup.py +++ b/setup.py @@ -316,15 +316,6 @@ class BuildFailed(Exception): pass -def get_arch_specific_objects(): - machine = cpuinfo.platform.machine() - if machine == 'x86_64': - return [S[:-1] + 'o' for S in glob("c-blosc/internal-complibs/zstd*/decompress/*amd64.S")] - elif machine == 'aarch64': - return [S[:-1] + 'o' for S in glob("c-blosc/internal-complibs/zstd*/decompress/*aarch64.S")] - return [] - - class ve_build_ext(build_ext): # This class allows C extension building to fail. From d00be4b1fe55c636a558866063fcf927c87fdf78 Mon Sep 17 00:00:00 2001 From: Agriya Khetarpal <74401230+agriyakhetarpal@users.noreply.github.com> Date: Sat, 1 Mar 2025 18:53:02 +0530 Subject: [PATCH 11/11] Add note for macOS compatibility --- docs/release.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/release.rst b/docs/release.rst index 4c7a4c29..14fc9423 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -20,7 +20,8 @@ Unreleased Enhancements ~~~~~~~~~~~~ -* Add support for the Linux AArch64 architecture. +* Add support for the Linux AArch64 architecture, and bump the minimum +macOS deployment target for x86_64 to 10.13. By :user:`Agriya Khetarpal `, :issue:`288`. Improvements