Dolfinx in spack

Dear FEniCS community,
I’m trying to install dolfinx on a HPC resource via spack using the GitHub instructions.
I’m facing two problems:

  1. some packages like gmsh and matplotlib were not installed and I added them manually through pip, not sure it is the right way to add packages on spack, but I couldn’t find a better solution.
  2. through spack find I can see that py-petsc4py@3.18.3 is installed but seems that mumps (and umfpack) is not working and I obtain this error:
[0] Could not locate solver type mumps for factorization type LU and matrix type seqaij. Perhaps you must ./configure with --download-mumps

If someone could point some tips out, it would be very helpful.
Thank you very much.

As PETSc has mumps as a variant, you need to use the variants command in spack:

https://spack.readthedocs.io/en/latest/packaging_guide.html#variants
For instance, you can see: dolfinx/spack.yml at main · FEniCS/dolfinx · GitHub
adds adios2 which is a variant in: spack/package.py at develop · spack/spack · GitHub

You can also see: Basic Usage — Spack 0.20.0.dev0 documentation

You can also add gmsh through spack: Package List — Spack 0.20.0.dev0 documentation

I solved it in the following way, not sure it is the best one though:

  1. Installed dolfinx via spack as in GitHub - FEniCS/dolfinx: Next generation FEniCS problem solving environment
  2. Added packages by modifying the file spack/var/spack/environments/fenicsx-env/spack.yaml
    2a. specs:[py-fenics-dolfinx, other-packages]
    2b. unify: when_possible
    the list of packages is available here: Package List — Spack 0.20.0.dev0 documentation
  1. I added gmsh to the specs but still I couldn’t manage to import dolfinx.io.gmshio so I installed py-gmsh through pip: Installation - pip documentation v23.3.1
  2. To switch on the variant mumps in PETSc I modified the file spack/var/spack/repos/builtin/packages/fenics-dolfinx/package.py at the line:
    depends_on("petsc+mpi+shared+mumps")

It is actually working now, but I imagine there is a simpler way to get it done.
Thank you again!
ar

Hi, androd,

About the variant mumps in PETSc, I modified the depends_on("petsc+mpi+shared+mumps"). It seemed not to work. Is there other operation?

Thanks

Dear xiaolaner,
I’m not an expert at all, but just for completeness, which error do you get?
Thanks

Dear androd,
I modified the file as your method. It also has the same error Could not locate solver type mumps for factorization type LU and matrix type seqaij. Perhaps you must ./configure with --download-mumps. So I wonder if I need other operation.
The steps are as:

  1. modified the file spack/var/spack/repos/builtin/packages/fenics-dolfinx/package.py at the line:
depends_on("petsc+mpi+shared+mumps")
  1. spack load py-fenics-doflinx again