Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create binary wheels against ABI-compatible mpi4py #3585

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 39 additions & 58 deletions .github/workflows/build-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
inputs:
dolfinx_ref:
description: "dolfinx git ref to checkout"
default: ""
default: "main"
type: string

build_fenicsx_stack:
Expand All @@ -18,24 +18,24 @@ on:

basix_ref:
description: "basix git ref to checkout"
default: ""
default: "main"
type: string

ufl_ref:
description: "ufl git ref to checkout"
default: ""
default: "main"
type: string

ffcx_ref:
description: "ffcx git ref to checkout"
default: ""
default: "main"
type: string

workflow_call:
inputs:
dolfinx_ref:
description: "dolfinx git ref to checkout"
default: ""
default: "main"
type: string

build_fenicsx_stack:
Expand All @@ -45,17 +45,17 @@ on:

basix_ref:
description: "basix git ref to checkout"
default: ""
default: "main"
type: string

ufl_ref:
description: "ufl git ref to checkout"
default: ""
default: "main"
type: string

ffcx_ref:
description: "ffcx git ref to checkout"
default: ""
default: "main"
type: string

jobs:
Expand All @@ -64,18 +64,18 @@ jobs:
runs-on: ubuntu-latest

env:
MPI4PY_VERSION: 3.1.2
PETSC4PY_VERSION: 3.16.1
CIBW_MANYLINUX_X86_64_IMAGE: docker.io/fenicsproject/wheelbuilder_x86_64:latest
CIBW_BUILD: cp37-manylinux_x86_64 cp38-manylinux_x86_64 cp39-manylinux_x86_64
CIBW_BUILD: cp39-manylinux_x86_64
CIBW_BUILD_VERBOSITY: 1
CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=file:///project/simple PETSC_DIR=/usr/local MAKEFLAGS=-j2
CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=file:///project/simple MAKEFLAGS=-j3
CIBW_MANYLINUX_X86_64_IMAGE: quay.io/pypa/manylinux_2_34_x86_64:2024-11-24-a3012f3

steps:
- uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install Python dependencies
run: python -m pip install cibuildwheel simple503 wheel
run: python -m pip install cibuildwheel simple503 build

- name: Checkout Basix
if: ${{ github.event.inputs.build_fenicsx_stack == 'true' }}
Expand All @@ -88,8 +88,8 @@ jobs:
- name: Build Basix wheel
if: ${{ github.event.inputs.build_fenicsx_stack == 'true' }}
run: |
cd basix
python -m cibuildwheel --output-dir ../wheelhouse .
cd basix/
python -m cibuildwheel --output-dir ../wheelhouse/ .

- name: Checkout UFL
if: ${{ github.event.inputs.build_fenicsx_stack == 'true' }}
Expand All @@ -101,7 +101,8 @@ jobs:

- name: Build UFL wheel
if: ${{ github.event.inputs.build_fenicsx_stack == 'true' }}
run: python -m pip wheel --no-deps -w wheelhouse ./ufl
run: |
python -m build -o wheelhouse/ ufl/

- name: Checkout FFCx
if: ${{ github.event.inputs.build_fenicsx_stack == 'true' }}
Expand All @@ -113,39 +114,15 @@ jobs:

- name: Build FFCx wheel
if: ${{ github.event.inputs.build_fenicsx_stack == 'true' }}
run: python -m pip wheel --no-deps -w wheelhouse ./ffcx

- name: Download mpi4py
run: |
curl -L -O https://github.com/mpi4py/mpi4py/releases/download/${MPI4PY_VERSION}/mpi4py-${MPI4PY_VERSION}.tar.gz
mkdir -p mpi4py
tar -xf mpi4py-${MPI4PY_VERSION}.tar.gz -C mpi4py --strip-components 1

- name: Build mpi4py wheels
run: python -m cibuildwheel --output-dir wheelhouse mpi4py
python -m build -o wheelhouse/ ffcx/

- name: Make temporary simple503 repository
run: |
mkdir -p simple
cp wheelhouse/* simple/
python -m simple503 --base-url file:///project/simple simple

- name: Download petsc4py
run: |
curl -L -O https://pypi.io/packages/source/p/petsc4py/petsc4py-${PETSC4PY_VERSION}.tar.gz
mkdir -p petsc4py
tar -xf petsc4py-${PETSC4PY_VERSION}.tar.gz -C petsc4py --strip-components 1

- name: Build petsc4py wheels
run: python -m cibuildwheel --output-dir wheelhouse petsc4py
env:
CIBW_BEFORE_BUILD: python -m pip install numpy # Not specified correctly in petsc4py

- name: Update temporary simple503 repository
run: |
cp wheelhouse/* simple/
python -m simple503 --base-url file:///project/simple simple

- name: Checkout DOLFINx
uses: actions/checkout@v4
with:
Expand All @@ -155,10 +132,27 @@ jobs:
# fenics-ffcx and fenics-basix are required by DOLFINx C++ build
# mpi4py and petsc4py are build_requirements of DOLFINx Python
- name: Build DOLFINx wheel
run: python -m cibuildwheel --output-dir wheelhouse dolfinx/python
run: |
python -m cibuildwheel --output-dir wheelhouse/ dolfinx/python
env:
CIBW_BEFORE_BUILD: python -m pip -v install --prefer-binary fenics-ffcx fenics-basix && python -m pip -v install --prefer-binary petsc4py mpi4py && cmake -S dolfinx/cpp -B build-dir -DPython3_EXECUTABLE=$(which python) && cmake --build build-dir && cmake --install build-dir
CIBW_REPAIR_WHEEL_COMMAND_LINUX: export LD_LIBRARY_PATH=$(python -c "import site; print(site.getsitepackages()[0] + '/fenics_basix.libs')") && auditwheel repair -w {dest_dir} {wheel}
CIBW_BEFORE_BUILD: |
. /etc/profile &&
dnf -y update &&
dnf install -y dnf-plugins-core &&
dnf install -y epel-release &&
/usr/bin/crb enable &&
dnf -y update &&
dnf -y install boost-devel boost-program-options cmake hdf5-devel hdf5-mpich-devel make mpich-devel openblas-devel pugixml-devel spdlog-devel &&
module load mpi/mpich-$(arch) &&
pip -v install mpi4py -i https://pypi.anaconda.org/mpi4py/simple &&
pip -v install 'fenics-basix==0.10.0.dev0' 'fenics-ffcx==0.10.0.dev0' 'fenics-ufl==2024.3.0.dev0' &&
pip -v install scikit-build-core[pyproject] nanobind &&
/usr/bin/cmake -S dolfinx/cpp -B build-dir -DPython3_EXECUTABLE=$(which python) -DHDF5_C_INCLUDE_DIR=/usr/include/mpich-$(arch) -DHDF5_C_LIBRARIES=/usr/lib64/mpich/lib &&
/usr/bin/cmake --build build-dir &&
/usr/bin/cmake --install build-dir
CIBW_REPAIR_WHEEL_COMMAND_LINUX: export LD_LIBRARY_PATH=$(python -c "import site; print(site.getsitepackages()[0] + '/fenics_basix.libs')"):${LD_LIBRARY_PATH} && auditwheel repair -w {dest_dir} {wheel}
CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=file:///project/simple MAKEFLAGS=-j3
CIBW_BUILD_FRONTEND: "pip; args: --no-build-isolation"

- name: Update temporary simple503 repository
run: |
Expand Down Expand Up @@ -189,16 +183,3 @@ jobs:
with:
name: "simple503"
path: simple/*

# Extract mpiexec from docker image
- name: Extract mpiexec.hydra from Docker image
run: |
export CONTAINER_ID=$(docker create ${CIBW_MANYLINUX_X86_64_IMAGE})
docker cp ${CONTAINER_ID}:/usr/local/bin/mpiexec.hydra mpiexec.hydra
docker rm ${CONTAINER_ID}

- name: Upload mpiexec artifact
uses: actions/upload-artifact@v4
with:
name: "mpiexec.hydra"
path: mpiexec.hydra
8 changes: 4 additions & 4 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,11 @@ endif()
find_package(pugixml REQUIRED)

# Note: When updating Boost version, also update DOLFINXConfig.cmake.in
if(DEFINED ENV{BOOST_ROOT} OR DEFINED BOOST_ROOT)
set(Boost_NO_SYSTEM_PATHS on)
endif()
#if(DEFINED ENV{BOOST_ROOT} OR DEFINED BOOST_ROOT)
# set(Boost_NO_SYSTEM_PATHS on)
#endif()

set(Boost_USE_MULTITHREADED $ENV{BOOST_USE_MULTITHREADED})
#set(Boost_USE_MULTITHREADED $ENV{BOOST_USE_MULTITHREADED})
set(Boost_VERBOSE TRUE)
find_package(Boost 1.70 REQUIRED)
set_package_properties(
Expand Down
Loading