Open bnherrerac opened 1 month ago
Could you try with 0.8.1: https://github.com/jorgensd/dolfinx_mpc/tree/v0.8.1 and also give me the conda commands you ran to create your environment ?
Tried with 0.8.1 keeping dolfinx 0.8.0, the same error happened. I rerun these conda commands to create the env and install all the dependencies:
conda create -n fenicsx-env
conda activate fenicsx-env
conda install -c conda-forge fenics-dolfinx mpich pyvista
conda install conda-forge::dolfinx_mpc
conda install conda-forge::pytest
conda install scipy
which leaves me with dolfinx 0.8.0 and dolfinx-mpc 0.8.1. Here is a MWE that reproduces the error after this installation:
import numpy as np
from mpi4py import MPI
from dolfinx import fem, mesh
from dolfinx.common import Timer
from dolfinx_mpc import MultiPointConstraint
dolfinx_mesh = mesh.create_unit_cube(MPI.COMM_WORLD, 10, 10, 10)
V = fem.functionspace(dolfinx_mesh, ("Lagrange", 1, (dolfinx_mesh.geometry.dim, )))
def x_periodic_boundary(x):
return np.isclose(x[0], 1.0, atol=1e-8)
def x_periodic_relation(x):
out_x = np.zeros_like(x)
out_x[0] = 1 - x[0]
out_x[1] = x[1]
out_x[2] = x[2]
return out_x
with Timer("~PERIODIC: Initialize MPC"):
mpc = MultiPointConstraint(V)
mpc.create_periodic_constraint_geometrical(V, x_periodic_boundary, x_periodic_relation, bcs=[])
mpc.finalize()
Thank you for your help!
I can reproduce this. I think this is an issue with an incompatibility with nanobind versions. I will ask @minrk for guidance as he is a wizard at this!
This is almost certainly an incompatibility in nanobind (likely a compiler version mismatch) that should be pinned but apparently isn't. Can you share the output of conda env export
?
Yup, it's the same nanobind abi pinning issue that I believe I've fixed in dolfinx itself, but didn't realize it extended to mpc as well. The quickest workaround is to add gxx=12
to your list of packages, and it should pick the right compatible version of everything.
When this PR is merged, the latest builds of everything should work together again.
Thank you both for looking into this. The command conda install gxx=12
worked well as a workaround. I am having a similar issue in scifem
too, the exact same as here.
This is the output of conda env export
:
Hello, I am unable to run the periodic demos using dolfinx 0.8.0 and dolfinx_mpc 0.8.0, with Python 3.12.6. The demos I can't run are the following:
In both cases I get a similar error, here's the error for
demo_periodic_geometrical.py
:And the error for
demo_periodic3d_topological.py
:I installed dolfinx and dolfinx_mpc via conda install, and made sure that both versions are 0.8.0. I am trying to run a similar code, where I impose periodic boundary conditions in opposite faces of an unit cell, but I get stuck when calling
create_periodic_constraint_geometrical
, as in the demo. If you have any idea how I could get around this, it would be very helpful. Thanks in advance!