How prompt are new fenicsx packages pushed to spack?

I have been using version 0.4.X.X of dolfinx built from source. Only version 0.3.X.X is available via spack. I successfully installed this spack version on a hpc cluster. My only modification to the installation procedure at dolfinx/README.md at main · FEniCS/dolfinx · GitHub is to pre-install gcc@10.3.0 (since only 8.3.0 is available in the compiler list).

git clone https://github.com/spack/spack.git
. ./spack/share/spack/setup-env.sh
spack env create fenicsx-env
spack env activate fenicsx-env
spack add gcc@10.3.0
spack install
spack load gcc@10.3.0
spack location -i gcc@10.3.0 | xargs spack compiler add
spack add py-fenics-dolfinx%gcc@10.3.0 cflags="-O3" fflags="-O3"
spack install

This version throws some errors that I’m not sure if they’re caused by any platform dependent installs or just bugs in the old version of code. For example (version 0.3.0) of dolfinx:

import dolfinx
import numpy as np
import ufl
from dolfinx.fem import (Constant, dirichletbc as DirichletBC, Function, FunctionSpace, locate_dofs_topological)
from dolfinx.fem import LinearProblem
# from dolfinx.fem.petsc import LinearProblem
from dolfinx.io import XDMFFile
from dolfinx.mesh import locate_entities_boundary
from mpi4py import MPI
from petsc4py import PETSc
from petsc4py.PETSc import ScalarType
from ufl import ds, dx, grad, inner
# many other lines of code
x0bc = DirichletBC.DirichletBC(u0, locate_dofs_topological(V, 0, x0facet))
x1bc = DirichletBC.DirichletBC(u1, locate_dofs_topological(V, 0, x1facet))

# Define variational problem
u = ufl.TrialFunction(V)
v = ufl.TestFunction(V)
x = ufl.SpatialCoordinate(mesh)
f = Constant(mesh, ScalarType(0))
g = Constant(mesh, ScalarType(0))

a = inner(grad(u), grad(v)) * dx
L = inner(f, v) * dx + inner(g, v) * ds

problem = LinearProblem(a, L, bcs=[x0bc, x1bc], petsc_options={"ksp_type": "preonly", "pc_type": "lu"})

calling LinearProblem raises the following error:

Traceback (most recent call last):
  File "/storage/coda1/p-tf74/0/hpcuser/ssb/transport.py", line 75, in <module>
    problem = LinearProblem(a, L, bcs=[x0bc, x1bc], petsc_options={"ksp_type": "preonly", "pc_type": "lu"})
  File "/storage/coda1/p-tf74/0/hpcuser/spack/opt/spack/linux-rhel7-cascadelake/gcc-10.3.0/py-fenics-dolfinx-0.3.0-gknuzu6dvtixtdpicjmxc576yy6dgbi5/lib/python3.9/site-packages/dolfinx/fem/problem.py", line 58, in __init__
    self._A = fem.create_matrix(self._a)
  File "/storage/coda1/p-tf74/0/hpcuser/spack/opt/spack/linux-rhel7-cascadelake/gcc-10.3.0/py-fenics-dolfinx-0.3.0-gknuzu6dvtixtdpicjmxc576yy6dgbi5/lib/python3.9/site-packages/dolfinx/fem/assemble.py", line 60, in create_matrix
    return cpp.fem.create_matrix(_create_cpp_form(a))
ValueError: vector::reserve

In version 0.4.2, LinearProblem is imported from dolfinx.fem.petsc.

While building a cpp version of dolfinx code using a CMakeLists.txt, I get the error:

[ 25%] Compile conduction.py using FFCx
ERROR:ffcx:Expecting a UFL form file (.ufl).
make[2]: *** [conduction.c] Error 1
make[1]: *** [CMakeFiles/conduction.dir/all] Error 2
make: *** [all] Error 2

I can run a python version of the code and build/run a cpp translation of the same code on a separate machine where I built out dolfinx from source.

Q: Am I to treat the errors as issues that were addressed in v0.4.2 or is there something silently faulty with my spack installation of py-fenics-dolfinx?

Consider the following change if you want to install the latest developments

spack add py-fenics-dolfinx@main%gcc@10.3.0 cflags="-O3" fflags="-O3"
1 Like

The v0.4 Spack PR is at fenicsx: update to v0.4 by ma595 · Pull Request #30661 · spack/spack · GitHub. We made a number of changes in v0.4 to improve packaging support (Spack, conda), so it’s taking a bit longer than usual to revise the Spack configure to get it just right.

1 Like

This helped resolve the errors. For anyone who installs py-fenics-dolfinx@main after installing default latest spack version, you may need to manually remove the spack installs related to the old version 0.3.0 otherwise cmake/make struggles to find ufcx.h headers.

1 Like