Skip to content

Commit 2235b29

Browse files
Wheels: Deactivate AVX512 in Blosc2 for non-OSX targets (#1763)
* Deactivate AVX512 in Blosc2 for non-OSX targets * Upgrade Zlib to 1.3.1 Zlib 1.2 is incompatible with CMake 4 * Upgrade zfp to 1.0.1 * Remove ADIOS1 and Blosc1 * Deactivate AVX512 in Blosc2 for non-OSX targets (now actually) * Same on Windows * Apply library upgrades to Windows, too * Upgrade outdated runners * Apply patch to fix 32-bit builds * Try some tricks to use git-am * Use Python's patch module * Revert "Use Python's patch module" This reverts commit 4705753. * setup.py: 0.16.1.post1 * Use git tag for ADIOS2 patch
1 parent ce0dd62 commit 2235b29

File tree

3 files changed

+57
-106
lines changed

3 files changed

+57
-106
lines changed

.github/workflows/build.yml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
include:
13-
- os: ubuntu-20.04
13+
- os: ubuntu-22.04
1414
arch: "x86_64"
1515

16-
- os: ubuntu-20.04
16+
- os: ubuntu-22.04
1717
arch: "i686"
1818

1919
# builds faster on Travis-CI:
@@ -30,14 +30,14 @@ jobs:
3030
# arch: "s390x"
3131

3232
# x86-64 (64bit)
33-
- os: windows-2019
33+
- os: windows-2022
3434
arch: "AMD64"
3535

3636
# x86 (32bit)
37-
- os: windows-2019
37+
- os: windows-2022
3838
arch: "x86"
3939
env:
40-
CMAKE_GENERATOR: "Visual Studio 16 2019"
40+
CMAKE_GENERATOR: "Visual Studio 17 2022"
4141
CMAKE_GENERATOR_PLATFORM: "Win32"
4242

4343
- os: macos-13
@@ -86,6 +86,14 @@ jobs:
8686
python -m pip install --upgrade pip setuptools wheel
8787
python -m pip install cibuildwheel==2.21.2
8888
89+
# 0.16.1.post1 bump
90+
- name: Download Patch 1/1
91+
uses: suisei-cn/actions-download-file@818d6b7dc8fe73f2f924b6241f2b1134ca1377d9 # 1.6.0
92+
id: setupversion
93+
with:
94+
url: "https://github.com/openPMD/openPMD-api/commit/f94a1d48eefbc81784a9c25f61c913cf30fe2ece.patch"
95+
target: src/.patch/
96+
8997
# # Patch: Fix versioning
9098
# - name: Download Patch 1/2
9199
# uses: suisei-cn/actions-download-file@818d6b7dc8fe73f2f924b6241f2b1134ca1377d9 # 1.6.0
@@ -102,13 +110,10 @@ jobs:
102110
# url: "https://github.com/openPMD/openPMD-api/pull/1684.patch"
103111
# target: src/.patch/
104112

105-
# - name: Apply Patches
106-
# run: |
107-
# cd src
108-
# git apply --exclude=.github/workflows/windows.yml .patch/1680.patch
109-
# git apply --exclude=cmake/dependencies/pybind11.cmake .patch/1684.patch
110-
# git fetch
111-
# git apply --exclude=setup.py -3 .patch/1684.patch
113+
- name: Apply Patches
114+
run: |
115+
cd src
116+
git apply .patch/f94a1d48eefbc81784a9c25f61c913cf30fe2ece.patch
112117
113118
- name: Build wheel
114119
env:

library_builders.bat

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,22 @@ exit /b 0
2121
https://github.com/ornladios/ADIOS2/archive/v2.10.2.zip
2222
powershell Expand-Archive adios2-2.10.2.zip -DestinationPath dep-adios2
2323

24+
curl -sLo dep-adios2/ADIOS2-2.10.2/patch.diff https://github.com/franzpoeschel/ADIOS2/commit/patches-fix-32-bit-builds.patch
25+
26+
:: Use git-am for applying the patch,
27+
:: for some reason, python -m patch just silently does nothing.
28+
:: git-am requires a Git repository to apply a patch, but the release zip
29+
:: strips away any Git info, so we just quickly initialize a repository.
30+
cd dep-adios2/ADIOS2-2.10.2
31+
git init
32+
git config user.email "[email protected]"
33+
git config user.name "Tooling"
34+
git add .
35+
git commit --message="Initial commit so we can use git-am"
36+
git am patch.diff
37+
cd ..
38+
cd ..
39+
2440
cmake --version
2541

2642
cmake -S dep-adios2/ADIOS2-2.10.2 -B build-adios2 ^
@@ -87,7 +103,8 @@ exit /b 0
87103
-DBUILD_TESTS=OFF ^
88104
-DPIGZ_ENABLE_TESTS=OFF ^
89105
-DZLIB_ENABLE_TESTS=OFF ^
90-
-DZLIBNG_ENABLE_TESTS=OFF
106+
-DZLIBNG_ENABLE_TESTS=OFF ^
107+
-DDEACTIVATE_AVX512=ON
91108
:: -DPREFER_EXTERNAL_ZLIB=ON ^
92109
:: -DZLIB_USE_STATIC_LIBS=ON
93110
if errorlevel 1 exit 1
@@ -146,10 +163,10 @@ exit /b 0
146163
:build_zfp
147164
if exist zfp-stamp exit /b 0
148165

149-
curl -sLo zfp-0.5.5.tar.gz ^
150-
https://github.com/LLNL/zfp/releases/download/0.5.5/zfp-0.5.5.tar.gz
151-
tar -xvzf zfp-0.5.5.tar.gz
152-
mv zfp-0.5.5 dep-zfp
166+
curl -sLo zfp-1.0.1.tar.gz ^
167+
https://github.com/LLNL/zfp/releases/download/1.0.1/zfp-1.0.1.tar.gz
168+
tar -xvzf zfp-1.0.1.tar.gz
169+
mv zfp-1.0.1 dep-zfp
153170

154171
cmake -S dep-zfp -B build-zfp ^
155172
-DCMAKE_BUILD_TYPE=Release ^
@@ -176,11 +193,11 @@ exit /b 0
176193
:build_zlib
177194
if exist zlib-stamp exit /b 0
178195

179-
curl -sLo zlib-1.2.13.zip ^
180-
https://github.com/madler/zlib/archive/v1.2.13.zip
181-
powershell Expand-Archive zlib-1.2.13.zip -DestinationPath dep-zlib
196+
curl -sLo zlib-1.3.1.zip ^
197+
https://github.com/madler/zlib/archive/v1.3.1.zip
198+
powershell Expand-Archive zlib-1.3.1.zip -DestinationPath dep-zlib
182199

183-
cmake -S dep-zlib/zlib-1.2.13 -B build-zlib ^
200+
cmake -S dep-zlib/zlib-1.3.1 -B build-zlib ^
184201
-DBUILD_SHARED_LIBS=ON ^
185202
-DCMAKE_BUILD_TYPE=Release
186203
if errorlevel 1 exit 1

library_builders.sh

Lines changed: 14 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -72,34 +72,6 @@ function install_buildessentials {
7272
touch buildessentials-stamp
7373
}
7474

75-
function build_adios1 {
76-
if [ -e adios1-stamp ]; then return; fi
77-
78-
curl -k -sLo adios-1.13.1.tar.gz \
79-
https://users.nccs.gov/~pnorbert/adios-1.13.1.tar.gz
80-
file adios*.tar.gz
81-
tar -xzf adios*.tar.gz
82-
rm adios*.tar.gz
83-
cd adios-*
84-
85-
# Cross-Compile hints for autotools based builds
86-
HOST_ARG=""
87-
if [[ "${CMAKE_OSX_ARCHITECTURES-}" == "arm64" ]]; then
88-
HOST_ARG="--host=aarch64-apple-darwin"
89-
fi
90-
91-
./configure --enable-static --disable-shared --disable-fortran --without-mpi ${HOST_ARG} --prefix=${BUILD_PREFIX} --with-blosc=/usr
92-
make -j${CPU_COUNT}
93-
make install
94-
cd -
95-
96-
# note: for universal binaries on macOS
97-
# https://developer.apple.com/documentation/apple-silicon/building-a-universal-macos-binary
98-
#lipo -create -output universal_app x86_app arm_app
99-
100-
touch adios1-stamp
101-
}
102-
10375
function build_adios2 {
10476
if [ -e adios2-stamp ]; then return; fi
10577

@@ -153,51 +125,6 @@ function build_adios2 {
153125
touch adios2-stamp
154126
}
155127

156-
function build_blosc {
157-
if [ -e blosc-stamp ]; then return; fi
158-
159-
curl -sLo c-blosc-1.21.0.tar.gz \
160-
https://github.com/Blosc/c-blosc/archive/v1.21.0.tar.gz
161-
file c-blosc*.tar.gz
162-
tar -xzf c-blosc*.tar.gz
163-
rm c-blosc*.tar.gz
164-
165-
# Patch PThread Propagation
166-
curl -sLo blosc-pthread.patch \
167-
https://patch-diff.githubusercontent.com/raw/Blosc/c-blosc/pull/318.patch
168-
python3 -m patch -p 1 -d c-blosc-1.21.0 blosc-pthread.patch
169-
170-
# SSE2 support
171-
# https://github.com/Blosc/c-blosc/issues/334
172-
DEACTIVATE_SSE2=OFF
173-
if [[ "${CMAKE_OSX_ARCHITECTURES-}" == *"arm64"* ]]; then
174-
# error: SSE2 is not supported by the target architecture/platform and/or this compiler.
175-
DEACTIVATE_SSE2=ON
176-
fi
177-
178-
mkdir build-blosc
179-
cd build-blosc
180-
PY_BIN=$(which python3)
181-
CMAKE_BIN="$(${PY_BIN} -m pip show cmake 2>/dev/null | grep Location | cut -d' ' -f2)/cmake/data/bin/"
182-
PATH=${CMAKE_BIN}:${PATH} cmake \
183-
-DDEACTIVATE_SNAPPY=ON \
184-
-DDEACTIVATE_SSE2=${DEACTIVATE_SSE2} \
185-
-DBUILD_SHARED=OFF \
186-
-DBUILD_TESTS=OFF \
187-
-DBUILD_BENCHMARKS=OFF \
188-
-DCMAKE_VERBOSE_MAKEFILE=ON \
189-
-DCMAKE_INSTALL_PREFIX=${BUILD_PREFIX} \
190-
-DZLIB_USE_STATIC_LIBS=ON \
191-
../c-blosc-*
192-
make -j${CPU_COUNT}
193-
make install
194-
cd -
195-
196-
rm -rf build-blosc
197-
198-
touch blosc-stamp
199-
}
200-
201128
function build_blosc2 {
202129
if [ -e blosc-stamp2 ]; then return; fi
203130

@@ -209,6 +136,15 @@ function build_blosc2 {
209136

210137
mkdir build-blosc2
211138
cd build-blosc2
139+
if [[ "${CMAKE_OSX_ARCHITECTURES-}" == *"arm64"* ]]; then
140+
# SSE2 support
141+
# https://github.com/Blosc/c-blosc/issues/334
142+
# error: SSE2 is not supported by the target architecture/platform and/or this compiler.
143+
local architecture_specific_flags=("-DDEACTIVATE_SSE2=ON")
144+
else
145+
# AVX512 not supported on AMD CPUs
146+
local architecture_specific_flags=("-DDEACTIVATE_SSE2=OFF" "-DDEACTIVATE_AVX512=ON")
147+
fi
212148
PY_BIN=$(which python3)
213149
CMAKE_BIN="$(${PY_BIN} -m pip show cmake 2>/dev/null | grep Location | cut -d' ' -f2)/cmake/data/bin/"
214150
PATH=${CMAKE_BIN}:${PATH} cmake \
@@ -224,6 +160,7 @@ function build_blosc2 {
224160
-DCMAKE_INSTALL_PREFIX=${BUILD_PREFIX} \
225161
-DPREFER_EXTERNAL_ZLIB=ON \
226162
-DZLIB_USE_STATIC_LIBS=ON \
163+
"${architecture_specific_flags[@]}" \
227164
../c-blosc2-*
228165
make -j${CPU_COUNT}
229166
make install
@@ -237,8 +174,9 @@ function build_blosc2 {
237174
function build_zfp {
238175
if [ -e zfp-stamp ]; then return; fi
239176

240-
curl -sLo zfp-0.5.5.tar.gz \
241-
https://github.com/LLNL/zfp/releases/download/0.5.5/zfp-0.5.5.tar.gz
177+
local version="1.0.1"
178+
curl -sLo zfp-$version.tar.gz \
179+
https://github.com/LLNL/zfp/releases/download/$version/zfp-$version.tar.gz
242180
file zfp*.tar.gz
243181
tar -xzf zfp*.tar.gz
244182
rm zfp*.tar.gz
@@ -265,7 +203,7 @@ function build_zfp {
265203
function build_zlib {
266204
if [ -e zlib-stamp ]; then return; fi
267205

268-
ZLIB_VERSION="1.2.13"
206+
ZLIB_VERSION="1.3.1"
269207

270208
curl -sLO https://zlib.net/fossils/zlib-$ZLIB_VERSION.tar.gz
271209
file zlib*.tar.gz
@@ -377,15 +315,6 @@ fi
377315
install_buildessentials
378316
build_zlib
379317
build_zfp
380-
if [[ "$(uname -m)" != "ppc64le" ]]; then
381-
# builds too long for Travis-CI
382-
build_blosc
383-
fi
384318
build_blosc2
385319
build_hdf5
386-
if [[ "${CMAKE_OSX_ARCHITECTURES-}" != "arm64" && "$(uname -m)" != "ppc64le" ]]; then
387-
# macOS: skip ADIOS1 build for M1
388-
# Linux: with ADIOS2 also enabled, this builds too long for Travis-CI
389-
build_adios1
390-
fi
391320
build_adios2

0 commit comments

Comments
 (0)