-
Notifications
You must be signed in to change notification settings - Fork 1
124 lines (111 loc) · 5.43 KB
/
python-wheels.yml
File metadata and controls
124 lines (111 loc) · 5.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Python Wheels
on:
pull_request:
types: [opened, synchronize, reopened, labeled]
paths:
- 'include/**'
- 'src/**'
- 'cmake/**'
- 'interfaces/python/**'
- '.github/workflows/python-wheels.yml'
workflow_dispatch:
permissions:
contents: read
actions: write
jobs:
wheels:
if: >-
${{
github.event_name == 'workflow_dispatch' ||
(
github.event.action == 'labeled' &&
github.event.label.name == 'Run Python Wheels'
) ||
(
github.event.action != 'labeled' &&
contains(github.event.pull_request.labels.*.name, 'Run Python Wheels')
)
}}
name: ${{ matrix.os }} | ${{ matrix.mpi_flavor }}
runs-on: ${{ matrix.os }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
mpi_flavor: [mpich, openmpi]
env:
CIBW_BUILD: cp310-* cp311-* cp312-* cp313-* cp314-*
CIBW_SKIP: "*-musllinux_*"
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
CIBW_BUILD_VERBOSITY: "2"
CIBW_TEST_REQUIRES: pytest scipy
CIBW_BEFORE_TEST: MPICC=mpicc python -m pip install --no-binary=mpi4py mpi4py
CIBW_TEST_COMMAND: >-
python -c "import hypredrive as hd; print(hd.configure(solver='pcg'))" &&
python -m pytest -q --tb=short
{project}/interfaces/python/tests/test_options.py
{project}/interfaces/python/tests/test_solve_serial.py &&
mpiexec -n 2 python -m pytest -q --tb=short
{project}/interfaces/python/tests/test_solve_mpi.py
{project}/interfaces/python/tests/test_laplacian_example_mpi.py
CIBW_CONFIG_SETTINGS: >-
cmake.define.HYPREDRV_PYTHON_BUNDLE_CORE=ON
cmake.define.BUILD_SHARED_LIBS=ON
cmake.define.HYPRE_ENABLE_MPI=ON
cmake.define.HYPRE_ENABLE_FORTRAN=OFF
cmake.define.HYPRE_ENABLE_CUDA=OFF
cmake.define.HYPRE_ENABLE_HIP=OFF
cmake.define.HYPRE_ENABLE_SYCL=OFF
build.verbose=true
steps:
- uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==3.1.4
- name: Prepare flavor-specific source tree
run: >-
python interfaces/python/tools/prepare_flavor_build.py
--flavor ${{ matrix.mpi_flavor }}
--output build/python-wheel-src-${{ matrix.mpi_flavor }}
- name: Configure Linux MPI environment
if: startsWith(runner.os, 'Linux')
run: |
set -euxo pipefail
if [ "${{ matrix.mpi_flavor }}" = "mpich" ]; then
echo "CIBW_BEFORE_ALL_LINUX=dnf install -y git gcc-c++ mpich-devel" >> "$GITHUB_ENV"
echo "CIBW_ENVIRONMENT_LINUX=PATH=/usr/lib64/mpich/bin:\$PATH LD_LIBRARY_PATH=/usr/lib64/mpich/lib:\${LD_LIBRARY_PATH:-} CC=mpicc CXX=mpicxx MPICH_CC=/usr/bin/gcc MPICH_CXX=/usr/bin/g++ ANNOBIN_DISABLE=1 CMAKE_BUILD_PARALLEL_LEVEL=2 HYPREDRV_WHEEL_MPI_FLAVOR=mpich OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 OMPI_MCA_rmaps_base_oversubscribe=1" >> "$GITHUB_ENV"
echo "CIBW_REPAIR_WHEEL_COMMAND_LINUX=auditwheel repair --exclude libmpi.so.12 --exclude libmpich.so.12 -w {dest_dir} {wheel}" >> "$GITHUB_ENV"
else
echo "CIBW_BEFORE_ALL_LINUX=dnf install -y git gcc-c++ openmpi-devel" >> "$GITHUB_ENV"
echo "CIBW_ENVIRONMENT_LINUX=PATH=/usr/lib64/openmpi/bin:\$PATH LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:\${LD_LIBRARY_PATH:-} CC=mpicc CXX=mpicxx OMPI_CC=/usr/bin/gcc OMPI_CXX=/usr/bin/g++ ANNOBIN_DISABLE=1 CMAKE_BUILD_PARALLEL_LEVEL=2 HYPREDRV_WHEEL_MPI_FLAVOR=openmpi OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 OMPI_MCA_rmaps_base_oversubscribe=1" >> "$GITHUB_ENV"
echo "CIBW_REPAIR_WHEEL_COMMAND_LINUX=auditwheel repair --exclude libmpi.so.40 --exclude libopen-rte.so.40 --exclude libopen-pal.so.40 -w {dest_dir} {wheel}" >> "$GITHUB_ENV"
fi
- name: Configure macOS MPI environment
if: startsWith(runner.os, 'macOS')
run: |
set -euxo pipefail
echo "CIBW_REPAIR_WHEEL_COMMAND_MACOS=cp {wheel} {dest_dir}" >> "$GITHUB_ENV"
if [ "${{ matrix.mpi_flavor }}" = "mpich" ]; then
echo "CIBW_BEFORE_ALL_MACOS=brew install mpich" >> "$GITHUB_ENV"
echo "CIBW_ENVIRONMENT_MACOS=CC=mpicc CXX=mpicxx CMAKE_BUILD_PARALLEL_LEVEL=2 HYPREDRV_WHEEL_MPI_FLAVOR=mpich OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 OMPI_MCA_rmaps_base_oversubscribe=1" >> "$GITHUB_ENV"
else
echo "CIBW_BEFORE_ALL_MACOS=brew install open-mpi" >> "$GITHUB_ENV"
echo "CIBW_ENVIRONMENT_MACOS=CC=mpicc CXX=mpicxx CMAKE_BUILD_PARALLEL_LEVEL=2 HYPREDRV_WHEEL_MPI_FLAVOR=openmpi OMPI_ALLOW_RUN_AS_ROOT=1 OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 OMPI_MCA_rmaps_base_oversubscribe=1" >> "$GITHUB_ENV"
fi
- name: Build wheels
run: >-
python -m cibuildwheel
build/python-wheel-src-${{ matrix.mpi_flavor }}/interfaces/python
--output-dir wheelhouse
- name: Inspect built wheels
run: python -m pip install twine && python -m twine check wheelhouse/*.whl
- name: Upload wheel artifacts
uses: actions/upload-artifact@v6
with:
name: hypredrive-wheels-${{ matrix.os }}-${{ matrix.mpi_flavor }}
path: wheelhouse/*.whl
if-no-files-found: error