|
4 | 4 |
|
5 | 5 | [FEniCS](https://fenicsproject.org/) is a popular open-source computing platform for solving partial differential equations (PDEs) using the finite element method ([FEM](https://en.wikipedia.org/wiki/Finite_element_method)). Originally developed in 2003, the earlier version is now known as legacy FEniCS. In 2020, the next-generation framework [FEniCSx](https://docs.fenicsproject.org/) was introduced, with the latest stable [release v0.9.0](https://fenicsproject.org/blog/v0.9.0/) in October 2024. Though it builds on the legacy FEniCS but introduces significant improvements over the legacy libraries. FEniCSx is composed of the following libraries that support typical workflows: [UFL](https://github.com/FEniCS/ufl) → [FFCx](https://github.com/FEniCS/ffcx) → [Basix](https://github.com/FEniCS/basix) → [DOLFINx](https://github.com/FEniCS/dolfinx), which are the build blocks of it. And new users are encouraged to adopt [FEniCSx](https://fenicsproject.org/documentation/) for its modern features and active development support. |
6 | 6 |
|
7 | | - |
8 | | -(Maybe add a short intro into the stack the software depends on, and further more the internal dependencies UFL->FFCx ...) |
9 | | - |
10 | | - |
11 | | - |
12 | | - |
13 | 7 | FEniCSx can be installed on [ULHPC](https://www.uni.lu/research-en/core-facilities/hpc/) systems using [Easybuild](https://docs.easybuild.io) or [Spack](https://spack.io/), Below are detailed instructions for each method, |
14 | 8 |
|
15 | 9 | <!-- Intro end --> |
16 | 10 |
|
17 | 11 | ### Building FEniCS With Spack |
18 | 12 |
|
19 | | - |
20 | 13 | Building FEniCSx with Spack on the [ULHPC](https://www.uni.lu/research-en/core-facilities/hpc/) system requires that Users already installed Spack and sourced its enviroment on the cluster. If Spack is not yet configured, follow the [spack documentation](../../environment/spack.md) for installation and configuration. |
21 | 14 |
|
22 | | - |
23 | 15 | !!! note |
24 | 16 |
|
25 | 17 | Spack would be a good choice for building FEniCSx because it automatically manages complex dependencies, allows to isolates all installations in a dedicated environment, leverages system-provided packages in ~/.`spack/packages.yaml` for optimal performance, and simplifies reproducibility and maintenance across different systems. |
26 | 18 |
|
27 | 19 | Create and Activate a Spack Environment: |
28 | 20 |
|
29 | 21 | To maintain an isolated installation, create a dedicated Spack environment in a chosen directory. |
30 | | -The following example builds FEniCSx in the `home` directory: |
| 22 | +The following example sets up a stable release of FEniCSx `v0.9.0` in the `fenicsx-test` directory inside the `home` directory: |
31 | 23 |
|
32 | 24 | cd ~ |
33 | | - spack env create -d fenicsx-0.9.0/ |
34 | | - spack env activate fenicsx-0.9.0/ |
35 | | - |
36 | | - |
| 25 | + spack env create -d fenicsx-test/ |
| 26 | + spack env activate fenicsx-test/ |
| 27 | + |
37 | 28 | Add the core FEniCSx components and common dependencies: |
38 | 29 |
|
39 | 30 | spack add py-fenics-dolfinx@0.9.0+petsc4py fenics-dolfinx+adios2+petsc adios2+python petsc+mumps |
40 | 31 |
|
41 | | - # Change @0.9.0 to any version in the above if you want a another version. |
42 | | - spack concretize |
43 | | - spack install -j16 |
44 | | - |
45 | | - |
46 | | -!!! question " why concretize and -j16 ? " |
47 | | - |
48 | | - `spack concretize` resolves all dependencies and selects compatible versions for the specified packages. `-j16` sets the number cores to use for building. Using a higher number can speed up the build but should be chosen based on available CPU cores and cluster policies. |
49 | | - |
| 32 | +!!! Additional |
50 | 33 |
|
| 34 | + The spack `add command` add abstract specs of packages to the currently active environment and registers them as root `specs` in the environment’s `spack.yaml` file. Alternatively, packages can be predefined directly in the `spack.yaml` file located in`$SPACK_ENV`. |
51 | 35 |
|
52 | | -or its also possible to define build packages in `$SPACK_ENV` in a `spack.yaml` file. |
| 36 | + spack: |
| 37 | + # add package specs to the `specs` list |
| 38 | + specs: |
| 39 | + - py-fenics-dolfinx@0.9.0+petsc4py |
| 40 | + - fenics-dolfinx+adios2+petsc |
| 41 | + - petsc+mumps |
| 42 | + - adios2+python |
53 | 43 |
|
54 | | - spack: |
55 | | - # add package specs to the `specs` list |
56 | | - specs: |
57 | | - - py-fenics-dolfinx@0.9.0+petsc4py |
58 | | - - fenics-dolfinx+adios2+petsc |
59 | | - - petsc+mumps |
60 | | - - adios2+python |
61 | | - |
62 | | - view: true |
63 | | - concretizer: |
64 | | - unify: true |
| 44 | + view: true |
| 45 | + concretizer: |
| 46 | + unify: true |
| 47 | + !!! note |
| 48 | + Replace `@0.9.0` with a different version if you prefer to install others release. |
65 | 49 |
|
66 | | -!!! question " why unify : true ? " |
| 50 | +??? question " why unify : true ? " |
67 | 51 |
|
68 | 52 | `unify: true` ensures all packages share the same dependency versions, preventing multiple builds of the same library. Without it, each `spec` could resolve dependencies independently, leading to potential conflicts and redundant installations. |
69 | 53 |
|
| 54 | +Once Packages `specs` have been added to the current environment, they need to be concretized. |
| 55 | + |
| 56 | + spack concretize |
| 57 | + spack install -j16 |
| 58 | + |
| 59 | +!!! note |
70 | 60 |
|
| 61 | + Here, [`spack concretize`](https://spack.readthedocs.io/en/latest/environments.html#spec-concretization) resolves all dependencies and selects compatible versions for the specified packages. In addition to adding individual specs to an environment, the `spack install` command installs the entire environment at once and `-j16` option sets the number of CPU cores used for building, which can speed up the installation. |
| 62 | + Once installed, the FEniCSx environment is ready to use on the cluster. |
71 | 63 |
|
72 | 64 | The following are also common dependencies used in FEniCS scripts: |
73 | 65 |
|
|
0 commit comments