Skip to content

Repository files navigation

FEniCSx for Windows

Native 64-bit Windows conda packages for FEniCSx, including DOLFINx, PETSc, petsc4py, HDF5, and MPI support.

These packages are built primarily for use with FEATool Multiphysics, providing its native Windows FEniCSx/PETSc backend, but they can also be installed and used directly from Python without WSL, Docker, or a Linux virtual machine.

Packages are published on the precise-simulation Anaconda channel.

Installation

Requirements

  • Windows 10 or Windows 11, 64-bit
  • Miniforge, Miniconda, or Anaconda
  • CPython 3.12, 3.13, 3.14, or 3.15

Create a dedicated conda environment and install DOLFINx:

conda create -n fenics-windows python=3.12
conda activate fenics-windows
conda install -c precise-simulation -c conda-forge "libblas=*=*openblas" fenics-dolfinx

Python 3.12, 3.13, 3.14, and 3.15 are supported. The packages use Python's stable ABI, so the same DOLFINx binary can serve all supported interpreter versions.

The install pulls in the required Windows builds of PETSc, petsc4py, HDF5, Intel MPI, mpi4py, Basix, FFCx, UFL, PT-Scotch, MUMPS, OpenBLAS, and their dependencies.

Verify the installation

Check that DOLFINx and PETSc can be imported:

python -c "import dolfinx, petsc4py; print('DOLFINx', dolfinx.__version__); print('petsc4py', petsc4py.__version__)"

Then create a small mesh:

python -c "from mpi4py import MPI; from dolfinx import mesh; mesh.create_unit_square(MPI.COMM_SELF, 8, 8); print('DOLFINx installation OK')"

If both commands complete successfully, the environment is ready for normal serial FEniCSx use.

Running FEniCSx

A minimal example:

from mpi4py import MPI
from dolfinx import mesh

domain = mesh.create_unit_square(MPI.COMM_WORLD, 16, 16)

print(
    f"Rank {MPI.COMM_WORLD.rank}: "
    f"{domain.topology.index_map(domain.topology.dim).size_local} cells"
)

Save this as test.py and run it serially:

python test.py

A more complete Poisson example is included in this repository as scripts/test-poisson.py:

python scripts\test-poisson.py

Parallel execution with MPI

The packages include Intel MPI and support multi-process DOLFINx runs.

Run the example above with two local MPI ranks:

mpiexec -localonly -n 2 python test.py

or run the bundled Poisson example:

mpiexec -localonly -n 2 python scripts\test-poisson.py

-localonly restricts process launching to the current computer.

Windows Firewall

Serial DOLFINx use does not start mpiexec and normally requires no Windows Firewall changes.

Multi-process runs use Intel MPI's Hydra launcher and may trigger a Windows Firewall prompt for mpiexec.exe or one of the Hydra proxy executables. On managed systems, an administrator or IT deployment may need to allow these executables through the firewall.

Users who only need serial FEniCSx can use the packages without configuring MPI launcher firewall rules.

Intel MPI fabric setting

Do not set:

I_MPI_FABRICS=shm

Current Intel MPI versions select local shared-memory transport automatically. If an older configuration has this variable set, clear it with:

set I_MPI_FABRICS=

Included functionality

The Windows stack includes:

  • DOLFINx
  • PETSc and petsc4py
  • Intel MPI and mpi4py
  • parallel HDF5 with local HDF5/XDMF support
  • Basix
  • FFCx
  • UFL
  • PT-Scotch mesh partitioning
  • MUMPS sparse direct solver
  • OpenBLAS

Parallel HDF5/XDMF files and distributed DOLFINx computations are supported.

PETSc's MUMPS direct solver is available, for example:

ksp.setType("preonly")
pc = ksp.getPC()
pc.setType("lu")
pc.setFactorSolverType("mumps")

Windows-specific notes

PT-Scotch

The packages use the 32-bit-integer PT-Scotch build, which has been validated for DOLFINx mesh partitioning on Windows.

Distributed mesh creation

When constructing distributed meshes manually, do not provide an identical complete copy of the global cell array independently on every MPI rank. Supply the mesh data on the root rank or distribute the input appropriately.

OpenBLAS threads with MPI

For a strict rank-per-core MPI execution model, set:

set OPENBLAS_NUM_THREADS=1

This is optional for normal serial use.

MATLAB/Octave embedded-runtime overlay

The repository also contains a bridge-oriented packaging path for embedding the qualified Windows FEniCS stack into a separate CPython 3.12 host runtime.

.\scripts\package-embedded-runtime.ps1 -Prefix <fenics-conda-prefix> -Output .\dist
.\scripts\test-embedded-runtime.ps1 -Zip .\dist\fenics-embed-runtime-v0.1.0-win-x64-cp312.zip -Python <python-3.12.10.exe>

The resulting ZIP is an overlay, not a Python installation. It preserves the package-owned Lib/site-packages, native Library/bin closure, Library/fenics-jit runtime/backend, CPython headers, runtime data and provenance needed by DOLFINx/PETSc/FFCx. The fenics_embed_runtime.activate() bootstrap relocates DLL, PETSc and JIT roots against the embedding runtime's sys.prefix.

Hosted qualification merges the exact overlay into a clean non-conda CPython 3.12.10 runtime, removes ambient compiler/SDK state, then performs a fresh micro-Clang FFCx Poisson JIT and PETSc solve. This payload is intended for the optional FEniCS runtime profile of the Python MATLAB/Octave bridge; normal conda installation remains the primary direct-Python distribution path.

macOS embedded-runtime producer prototype

The historical embedded-runtime-macos-prototype workflow is retained as a manual diagnostic for the first qualification stage of macOS arm64 and Rosetta x86_64 overlays. It creates a FEniCS 0.11 / NumPy 2.5.2 source environment for each architecture and retains the solver's exact package transaction for subsequent pinning. It downloads the exact official Zig 0.15.2 toolchain for that architecture, poisons ambient compiler/SDK discovery, and requires a fresh FFCx JIT plus serial PETSc Poisson solve through a zig cc wrapper targeting macOS 14.0.

The successful #27 transaction is frozen in the retained package locks and Zig checksums. Fresh conda solves can drift as the channel changes, so this historical workflow is not a pull-request acceptance gate. The embedded-runtime-macos-overlay workflow below replays the immutable transactions without solving and owns current producer acceptance.

The embedded-runtime-macos-overlay workflow replays those checked-in locks as solver-free @EXPLICIT transactions using the exact URL ordering retained by the qualified prototype and micromamba 2.10.0. Each exact URL is SHA-256 anchored by the checked-in lock, and the installed package records are then compared field-for-field with that lock. It packages the FEniCS/PETSc/MPI closure in a private fenics-runtime/ namespace, bundles the exact Zig toolchain, and excludes producer CPython and NumPy. It performs complete Mach-O closure and ad-hoc-signature audits, records package ownership and license inventory, then builds the overlay twice and requires byte-identical ZIP/summary/checksum outputs. The resulting artifact hashes are retained as qualification evidence rather than treated as public release assets.

The same public workflow now performs a self-contained consumer qualification after deleting the producer conda prefix/package cache and extracted Zig source tree. It constructs a clean, hash-pinned official CPython 3.12.10 Python.framework plus NumPy 2.5.2 runtime under a path containing spaces, rejects overlay overwrites, poisons ambient compiler/native discovery, activates the overlay twice, verifies provider ownership, runs the full import stack and a fresh Zig/FFCx + PETSc Poisson solve, audits generated Mach-O modules, and rechecks all inherited consumer bytes. No private repository or cross-repository credential participates in producer acceptance.

Updating

Update the environment with conda:

conda activate fenics-windows
conda update -c precise-simulation -c conda-forge fenics-dolfinx

Package channel

Packages are published at:

https://anaconda.org/precise-simulation

This repository contains the recipes and CI infrastructure used to build and publish the native Windows packages.

Maintainer policy

The current supported Python/JIT backend matrix is defined in config/support-policy.json. The maintenance and release procedure for new Python minors and JIT backend revisions is documented in docs/jit-backend-maintenance.md.

Reporting problems

For problems specific to these Windows packages, please open a GitHub issue and include:

  • Windows version
  • Python version
  • output of conda list
  • the command used to install the packages
  • the complete error message

For general DOLFINx/FEniCSx usage questions that are not Windows-package specific, refer to the upstream FEniCSx documentation.