I completed the spack
installation following the instructions in the README file of dolfinx and have installed version 0.7.2 on a cluster. I want to install the latest dev version. I don’t know much about spack
. How to proceed?
My understanding of spack
is that it installs only released versions. If you want to install the latest dev version, you may want to follow the instructions for building from source instead.
I saw that the fenics packages offer a main
version in spack
that follows the respective main branches.
I tried installing the main versions together with the previously installed packages by running
spack add fenics-dolfinx@main+adios2 py-fenics-dolfinx@main cflags="-O3" fflags="-O3"
spack install
but I get an error at the end when trying to install py-fenics-dolfinx
. Here is the beginning of the error message:
==> py-fenics-dolfinx: Executing phase: 'install'
==> Error: ProcessError: Command exited with status 1:
'/data0/home/mslimani/bin/spack/opt/spack/linux-rhel7-haswell/gcc-10.2.0/python-3.11.7-p53pej4y4xsuegjyouvo4k7odsfcl3oc/bin/python3.11' '-m' 'pip' '-vvv' '--no-input' '--no-cache-di
r' '--disable-pip-version-check' 'install' '--no-deps' '--ignore-installed' '--no-build-isolation' '--no-warn-script-location' '--no-index' '--prefix=/data0/home/mslimani/bin/spack/opt/
spack/linux-rhel7-haswell/gcc-10.2.0/py-fenics-dolfinx-main-qc7fp77anfbum5higd63jgy7hllptirf' '.'
187 errors found in build log:
132 /data0/home/mslimani/bin/spack/opt/spack/linux-rhel7-haswell/gcc-10.2.0/fenics-dolfinx-main-uit6urv73vob4digxgk35pvlx63wqw6e/include/dolfinx/fem/assemble_vector_impl.h:
In instantiation of 'void dolfinx::fem::impl::assemble_vector(std::span<_Type, 18446744073709551615>, const dolfinx::fem::Form<T, U>&, dolfinx::fem::impl::mdspan2_t, std::
span<dolfinx::scalar_value_type_t<T> >, std::span<const T>, const std::map<std::pair<dolfinx::fem::IntegralType, int>, std::pair<std::span<const T>, int> >&) [with T = flo
at; U = float; dolfinx::fem::impl::mdspan2_t = std::mdspan<const int, std::extents<long unsigned int, 18446744073709551615, 18446744073709551615> >; dolfinx::scalar_value_
type_t<T> = float]':
133 /data0/home/mslimani/bin/spack/opt/spack/linux-rhel7-haswell/gcc-10.2.0/fenics-dolfinx-main-uit6urv73vob4digxgk35pvlx63wqw6e/include/dolfinx/fem/assemble_vector_impl.h:1
279:20: required from 'void dolfinx::fem::impl::assemble_vector(std::span<_Type, 18446744073709551615>, const dolfinx::fem::Form<T, U>&, std::span<const T>, const std::m
ap<std::pair<dolfinx::fem::IntegralType, int>, std::pair<std::span<const T>, int> >&) [with T = float; U = float]'
134 /data0/home/mslimani/bin/spack/opt/spack/linux-rhel7-haswell/gcc-10.2.0/fenics-dolfinx-main-uit6urv73vob4digxgk35pvlx63wqw6e/include/dolfinx/fem/assembler.h:113:24: re
quired from 'void dolfinx::fem::assemble_vector(std::span<_Type, 18446744073709551615>, const dolfinx::fem::Form<T, U>&, std::span<const T>, const std::map<std::pair<dolfi
nx::fem::IntegralType, int>, std::pair<std::span<const T>, int> >&) [with T = float; U = float]'
135 /tmp/mslimani/spack-stage/spack-stage-py-fenics-dolfinx-main-qc7fp77anfbum5higd63jgy7hllptirf/spack-src/python/dolfinx/wrappers/assemble.cpp:165:41: required from 'voi
d {anonymous}::declare_assembly_functions(nanobind::module_&) [with T = float; U = float]'
136 /tmp/mslimani/spack-stage/spack-stage-py-fenics-dolfinx-main-qc7fp77anfbum5higd63jgy7hllptirf/spack-src/python/dolfinx/wrappers/assemble.cpp:379:45: required from here
137 /data0/home/mslimani/bin/spack/opt/spack/linux-rhel7-haswell/gcc-10.2.0/fenics-dolfinx-main-uit6urv73vob4digxgk35pvlx63wqw6e/include/dolfinx/fem/traits.h:19:9: require
d by the constraints of 'template<class U, class T> concept dolfinx::fem::DofTransformKernel'
>> 138 /data0/home/mslimani/bin/spack/opt/spack/linux-rhel7-haswell/gcc-10.2.0/fenics-dolfinx-main-uit6urv73vob4digxgk35pvlx63wqw6e/include/dolfinx/fem/traits.h:20:12: error: the
value of 'std::is_invocable_v<std::function<void(std::span<float, 18446744073709551615>, std::span<const unsigned int>, int, int)>, std::span<_Type, 18446744073709551615>
, std::span<const unsigned int, 18446744073709551615>, int, int>' is not usable in a constant expression
139 20 | = std::is_invocable_v<U, std::span<T>, std::span<const std::uint32_t>,
140 | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
141 21 | std::int32_t, int>;
142 | ~~~~~~~~~~~~~~~~~~
143 In file included from /data0/globalfs/opt/gcc/10.2.0/include/c++/10.2.0/bits/move.h:57,
144 from /data0/globalfs/opt/gcc/10.2.0/include/c++/10.2.0/bits/stl_pair.h:59,
...
Might try again from a fresh clean environment.
Spack can install the main version by calling
as shown by ordinary-slim.
Please make sure that you update your local spack installation by calling git pull
in your local spack repository prior to concretizing and installing the main version.
Happy birthday!
I tried removing all my spack packages and updating my spack before running the installation command but I am still getting the error of the previous post.
Can you try to use a different gcc version. For example version 11 or 12. I found that this works for me. Firstly you can do
spack compiler find
To find what compiler you have in your system. Once you have that you can add it to using
spack add fenics-dolfinx@main%gcc@11.4.0+adios2 py-fenics-dolfinx@main
Thank you @adeebkor . I was able to build with gcc 11.4.0. I was even able to build multiphenicsx
by sourcing the spack-build-env.txt
of the py-fenicsx-dolfinx
package and building multiphenicsx
with the normal command and installing some dependencies it complained about (setuptools, slepc4py, maybe some others).
I have run into the same problem with gcc-10.3.0 during the installation of dolfinx 0.8.0 with spack as well as from source.
Is there an alternative solution to compiling with a newer gcc? I would like to compile against some existing libraries on my system (mpi, hdf5, etc) that are created with gcc 10.3.0 so I would like to use that.
Otherwise is there a known minimum gcc version? As far as i could tell, cmake checks for needed c++ features (which gcc10.3 passes) but not a version.
As far as I can tell, gcc 10 is the minimal requirement, ref: spack/var/spack/repos/builtin/packages/fenics-dolfinx/package.py at develop · spack/spack · GitHub
Maybe someone with more spack experience can comment (@IgorBaratta)
I had the time to dig a bit further want to document the findings here:
- gcc 10.5.0 on ubuntu 20.04 (via spack) produces the same error
- it’s only the python interface
py-fenics-dolfinx
with version >=0.8 - gcc 11 seems to work
So to me it looks like py-fenics-dolfinx
uses some c++20 feature that isn’t fully implemented in gcc10. Most likely candidate seems to be dolfinx/cpp/dolfinx/fem/traits.h at 06e90b8506d967f1836ffac7f289f49cb0fd17ec · FEniCS/dolfinx · GitHub
based on the error mesage, but I don’t have much insight into c++.
From this, atleast the py-fenics-dolfinx
spack-package would benefit from a check for gcc >=11.
Since is also applicable to the Source installation, maybe a comment on the required gcc version in the installations instructions could also be helpful.