Skip to content

Commit

Permalink
Merge branch 'jhale/try-cffi-backport' of github.com:FEniCS/dolfinx i…
Browse files Browse the repository at this point in the history
…nto jhale/try-cffi-backport
  • Loading branch information
jhale committed Oct 18, 2024
2 parents 8a55d2b + 4dbf26b commit 4f0f202
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 65 deletions.
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ updates:
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
- package-ecosystem: "pip" # See documentation for possible values
directory: "python/"
schedule:
interval: "weekly"
86 changes: 43 additions & 43 deletions .github/workflows/conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Conda install

on:
# Uncomment the below 'push' to trigger on push
# push:
# branches:
#push:
# branches:
# - "**"
schedule:
# '*' is a special character in YAML, so string must be quoted
Expand All @@ -15,52 +15,52 @@ jobs:
name: Install and test
strategy:
matrix:
os: [ubuntu-latest, macos-13, macos-14]
os: [ubuntu-latest, macos-13, macos-14, windows-2022]
python-version: ["3.9", "3.10", "3.11", "3.12"]
petsc-scalar-type: ["real"]
include:
- os: ubuntu-latest
python-version: "3.12"
petsc-scalar-type: "complex"
runs-on: ${{ matrix.os }}
timeout-minutes: 30
# This is necessary to ensure conda environment is activated in every step.
defaults:
run:
shell: bash -el {0}

steps:
- name: Install conda (macOS)
if: runner.os == 'macOS'
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: ${{ matrix.python-version }}

# TODO: These could probably be merged into one cross-platform step.
- name: Install DOLFINx with MPICH (Unix-like)
if: ${{ runner.os == 'macOS' || runner.os == 'Linux' }}
run: |
brew install anaconda
echo "/opt/homebrew/anaconda3/bin:/usr/local/anaconda3/bin" >> $GITHUB_PATH
- name: Update conda
conda install -c conda-forge fenics-dolfinx mpich petsc=*=${{ matrix.petsc-scalar-type }}*
- name: Install DOLFINx (Windows)
if: ${{ runner.os == 'Windows' }}
run: |
conda update conda
- name: Install DOLFINx (py3-10)
run: |
conda create -n env3-10 -c conda-forge python=3.10 fenics-dolfinx mpich
conda env export -n env3-10
- name: Test (py3-10)
run: |
conda run -n env3-10 python -c "from mpi4py import MPI; import dolfinx; dolfinx.mesh.create_rectangle(comm=MPI.COMM_WORLD, points=((0, 0), (2, 1)), n=(32, 16))"
conda run -n env3-10 mpirun -np 2 python -c "from mpi4py import MPI; import dolfinx; dolfinx.mesh.create_rectangle(comm=MPI.COMM_WORLD, points=((0, 0), (2, 1)), n=(32, 16))"
- name: Install DOLFINx (py3-11)
run: |
conda create -n env3-11 -c conda-forge python=3.11 fenics-dolfinx mpich
conda env export -n env3-11
- name: Test (py3-11)
run: |
conda run -n env3-11 python -c "from mpi4py import MPI; import dolfinx; dolfinx.mesh.create_rectangle(comm=MPI.COMM_WORLD, points=((0, 0), (2, 1)), n=(32, 16))"
conda run -n env3-11 mpirun -np 2 python -c "from mpi4py import MPI; import dolfinx; dolfinx.mesh.create_rectangle(comm=MPI.COMM_WORLD, points=((0, 0), (2, 1)), n=(32, 16))"
- name: Install DOLFINx (py3-12)
run: |
conda create -n env3-12 -c conda-forge python=3.12 fenics-dolfinx mpich
conda env export -n env3-12
- name: Test (py3-12)
run: |
conda run -n env3-12 python -c "from mpi4py import MPI; import dolfinx; dolfinx.mesh.create_rectangle(comm=MPI.COMM_WORLD, points=((0, 0), (2, 1)), n=(32, 16))"
conda run -n env3-12 mpirun -np 2 python -c "from mpi4py import MPI; import dolfinx; dolfinx.mesh.create_rectangle(comm=MPI.COMM_WORLD, points=((0, 0), (2, 1)), n=(32, 16))"
- name: Install DOLFINx (py3-12, petsc-complex)
conda install -c conda-forge fenics-dolfinx
- name: Test (Unix-like)
if: ${{ runner.os == 'macOS' || runner.os == 'Linux' }}
run: |
conda create -n env3-12-complex -c conda-forge python=3.12 fenics-dolfinx petsc=*=complex* mpich
conda env export -n env3-12-complex
- name: Test (py3-12-complex)
conda info
conda list
mpiexec --version
mpiexec -v -np 1 python -c "from mpi4py import MPI; import dolfinx; dolfinx.mesh.create_rectangle(comm=MPI.COMM_WORLD, points=((0, 0), (2, 1)), n=(32, 16))"
mpiexec -v -np 2 python -c "from mpi4py import MPI; import dolfinx; dolfinx.mesh.create_rectangle(comm=MPI.COMM_WORLD, points=((0, 0), (2, 1)), n=(32, 16))"
# NOTE: Late 2024, Intel MPI is only correctly setup using cmd.exe.
- name: Test (Windows)
if: ${{ runner.os == 'Windows' }}
shell: cmd /C CALL {0}
run: |
conda run -n env3-12-complex python -c "from mpi4py import MPI; import dolfinx; dolfinx.mesh.create_rectangle(comm=MPI.COMM_WORLD, points=((0, 0), (2, 1)), n=(32, 16))"
conda run -n env3-12-complex mpirun -np 2 python -c "from mpi4py import MPI; import dolfinx; dolfinx.mesh.create_rectangle(comm=MPI.COMM_WORLD, points=((0, 0), (2, 1)), n=(32, 16))"
conda info
conda list
mpiexec --version
mpiexec -v -np 1 python -c "from mpi4py import MPI; import dolfinx; dolfinx.mesh.create_rectangle(comm=MPI.COMM_WORLD, points=((0, 0), (2, 1)), n=(32, 16))"
mpiexec -v -np 2 python -c "from mpi4py import MPI; import dolfinx; dolfinx.mesh.create_rectangle(comm=MPI.COMM_WORLD, points=((0, 0), (2, 1)), n=(32, 16))"
5 changes: 2 additions & 3 deletions .github/workflows/spack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
type: string
dolfinx_version:
description: "DOLFINx release branch/tag to test"
default: "0.8.0"
default: "0.9.0"
type: string

jobs:
Expand All @@ -34,7 +34,7 @@ jobs:
PRTE_MCA_rmaps_default_mapping_policy: :oversubscribe # Newer OpenMPI
OMPI_MCA_rmaps_base_oversubscribe: true # Older OpenMPI

DOLFINX_RELEASE_VERSION: "${{ github.event_name != 'workflow_dispatch' && '0.8.0' || github.event.inputs.dolfinx_version }}"
DOLFINX_RELEASE_VERSION: "${{ github.event_name != 'workflow_dispatch' && '0.9.0' || github.event.inputs.dolfinx_version }}"

steps:
- name: Get Spack
Expand Down Expand Up @@ -100,7 +100,6 @@ jobs:
spack env create cpp-release-test
spack env activate cpp-release-test
spack add fenics-dolfinx@${DOLFINX_RELEASE_VERSION}+adios2 cmake py-fenics-ffcx
spack add [email protected]
spack install
cd dolfinx-release/cpp/
cd demo/poisson
Expand Down
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,21 @@ comprehensive instructions.

#### conda

To install the latest release of the Python interface, with pyvista
support for visualisation, using [conda](https://conda.io):
To install the latest release of the Python interface, including pyvista for
visualisation, using [conda](https://conda.io):

```shell
conda create -n fenicsx-env
conda activate fenicsx-env
conda install -c conda-forge fenics-dolfinx mpich pyvista
conda install -c conda-forge fenics-dolfinx mpich pyvista # Linux and macOS
conda install -c conda-forge fenics-dolfinx pyvista pyamg # Windows
```

Windows conda packages are currently in beta testing and can be installed using:
```shell
conda create -n fenicsx-env
conda activate fenicsx-env
conda install -c minrk/label/fenics-windows -c conda-forge fenics-dolfinx=0.9.0.dev
```
Because FEniCS uses just-in-time compilation it also necessary to install
[Microsoft Visual Studio](https://visualstudio.microsoft.com/downloads/).
*Windows only*: Windows conda packages are currently in beta testing. PETSc and
petsc4py are not available on Windows; as an alternative we recommend using
`pyamg` following `python/demo/demo_pyamg.py`. Because FEniCS uses just-in-time
compilation it necessary to install [Microsoft Visual
Studio](https://visualstudio.microsoft.com/downloads/).

conda is distributed with [Anaconda](https://www.anaconda.com/) and
[Miniconda](https://docs.conda.io/en/latest/miniconda.html). The recipe
Expand Down
10 changes: 5 additions & 5 deletions cpp/cmake/templates/dolfinx.conf.in
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Helper file for setting non-default DOLFINx environment variables

# Common Unix variables
export @OS_LIBRARY_PATH_NAME@=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@:$@OS_LIBRARY_PATH_NAME@
export PATH=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@:$PATH
export PKG_CONFIG_PATH=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/pkgconfig:$PKG_CONFIG_PATH
export CMAKE_PREFIX_PATH=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/cmake:$CMAKE_PREFIX_PATH
export @OS_LIBRARY_PATH_NAME@=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@:${@OS_LIBRARY_PATH_NAME@:-}
export PATH=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@:${PATH:-}
export PKG_CONFIG_PATH=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/pkgconfig:${PKG_CONFIG_PATH:-}
export CMAKE_PREFIX_PATH=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@/cmake:${CMAKE_PREFIX_PATH:-}

# Special macOS variables
export DYLD_FRAMEWORK_PATH=/opt/local/Library/Frameworks:$DYLD_FRAMEWORK_PATH
export DYLD_FRAMEWORK_PATH=/opt/local/Library/Frameworks:${DYLD_FRAMEWORK_PATH:-}
6 changes: 3 additions & 3 deletions docker/Dockerfile.test-env
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ARG OPENMPI_PATCH=3

########################################

FROM ubuntu:24.04 as dev-env
FROM ubuntu:24.04 AS dev-env
LABEL maintainer="FEniCS Steering Council <[email protected]>"
LABEL description="FEniCS testing and development environment with PETSc real, complex, 32-bit and 64-bit modes"

Expand Down Expand Up @@ -143,8 +143,8 @@ RUN if [ "$MPI" = "mpich" ]; then \
ldconfig && \
rm -rf /tmp/*

ENV VIRTUAL_ENV /dolfinx-env
ENV PATH /dolfinx-env/bin:$PATH
ENV VIRTUAL_ENV=/dolfinx-env
ENV PATH=/dolfinx-env/bin:$PATH
RUN python3 -m venv ${VIRTUAL_ENV}

# Install Python packages (via pip)
Expand Down

0 comments on commit 4f0f202

Please sign in to comment.