| 11 |
10 |
| 12 Sorry, although the core of program is written in Rust with a modern dependency management and build process, we also have legacy C++ and Python dependencies, i.e., the Fenicsx PDE library. Therefore, the build process is difficult. |
11 Sorry, although the core of program is written in Rust with a modern dependency management and build process, we also have legacy C++ and Python dependencies, i.e., the Fenicsx PDE library. Therefore, the build process is difficult. |
| 13 |
12 |
| 14 (We admit it, we made a mistake by going with the crowd and using Fenicsx. In the end it would have been less effort to write low-level PDE code in Rust.) |
13 (We admit it, we made a mistake by going with the crowd and using Fenicsx. In the end it would have been less effort to write low-level PDE code in Rust.) |
| 15 |
14 |
| 16 ### Phase 1: Python and Fenics |
15 ### Phase 1: Python and Fenics |
| 17 |
16 |
| 18 #### Option 1.A that avoids Conda hell, but is more work (macOS and Linux) |
17 #### Option 1.A that avoids Conda hell, but is more work (macOS and Linux) |
| 19 |
18 |
| 20 ##### Phase 1.A.1: C++ dependencies of Fenics |
19 ##### Phase 1.A.1: C++ dependencies of Fenics |
| 21 |
20 |
| 109 If you didn't already do these steps with `direnv` above, you should: |
108 If you didn't already do these steps with `direnv` above, you should: |
| 110 |
109 |
| 111 export PYTHONPATH=$(echo .venv/lib/python*/site-packages) |
110 export PYTHONPATH=$(echo .venv/lib/python*/site-packages) |
| 112 export PYO3_PYTHON="$(which python)" |
111 export PYO3_PYTHON="$(which python)" |
| 113 |
112 |
| 114 |
|
| 115 #### Option 1.B: Conda |
113 #### Option 1.B: Conda |
| 116 |
114 |
| 117 You can *try to* install Fenicsx in Conda according to instructions on the Fenics website. Additionally you need to install `scipy`: |
115 You can _try to_ install Fenicsx in Conda according to instructions on the Fenics website. Additionally you need to install `scipy`: |
| 118 |
116 |
| 119 conda create -n fenicsx-env |
117 conda create -n fenicsx-env |
| 120 conda activate fenicsx-env |
118 conda activate fenicsx-env |
| 121 conda install -c conda-forge fenics-dolfinx=0.10.0 scipy=1.17.1 mpich |
119 conda install -c conda-forge fenics-dolfinx=0.10.0 scipy=1.17.1 mpich |
| 122 |
120 |
| 123 This is, however, unlikely to not work, as Conda, despite its sandboxing separation attempts, conflicts with system packages, or Conda packages have weird ideas. You're likely to run into runtime problems with the FFCX form compiler (*bad* *bad* *bad* idea, running a C compiler runtime) failing due to something, somewhere, in the extremely fragile Conda setup, trying to load system libraries wrongly, etc. |
121 This is, however, unlikely to not work, as Conda, despite its sandboxing separation attempts, conflicts with system packages, or Conda packages have weird ideas. You're likely to run into runtime problems with the FFCX form compiler (_bad_ _bad_ _bad_ idea, running a C compiler runtime) failing due to something, somewhere, in the extremely fragile Conda setup, trying to load system libraries wrongly, etc. |
| 124 |
122 |
| 125 #### Option 1.C: Debian/Ubuntu |
123 #### Option 1.C: Debian/Ubuntu |
| 126 |
124 |
| 127 You may be able to use the system package manager, but beware of obsolete and modified versions. As of 2026-03-23, the packages available in Debian/Ubuntu cause massive memory leaks and eventual system crash. |
125 You may be able to use the system package manager, but beware of obsolete and modified versions. As of 2026-03-23, the packages available in Debian/Ubuntu cause massive memory leaks and eventual system crash. |
| 128 |
126 |
| 133 [alg_tools] also needs to be downloaded separately. |
131 [alg_tools] also needs to be downloaded separately. |
| 134 |
132 |
| 135 1. Install the [Rust] infrastructure (including Cargo) with [rustup]. |
133 1. Install the [Rust] infrastructure (including Cargo) with [rustup]. |
| 136 2. Install a “nightly” release of the Rust compiler. With rustup, installed in |
134 2. Install a “nightly” release of the Rust compiler. With rustup, installed in |
| 137 the previous step, this can be done with |
135 the previous step, this can be done with |
| 138 |
136 |
| 139 rustup toolchain install nightly |
137 rustup toolchain install nightly |
| 140 |
138 |
| 141 3. Download [alg_tools], [pointsource_algs], and [measures] and unpack them under |
139 3. Download [alg_tools], [pointsource_algs], and [measures] and unpack them under |
| 142 the same directory as this package. |
140 the same directory as this package. |
| 143 |
141 |
| 144 [rustup]: https://rustup.rs |
142 [rustup]: https://rustup.rs |
| 145 [alg_tools]: https://tuomov.iki.fi/software/alg_tools/ |
143 [alg_tools]: https://tuomov.iki.fi/software/alg_tools/ |
| 146 [pointsource_algs]: https://tuomov.iki.fi/software/pointsource_algs/ |
144 [pointsource_algs]: https://tuomov.iki.fi/software/pointsource_algs/ |
| 147 [measures]: https://tuomov.iki.fi/repos/measures/ |
145 [measures]: https://tuomov.iki.fi/repos/measures/ |
| 148 [Rust]: https://www.rust-lang.org/ |
146 [Rust]: https://www.rust-lang.org/ |
| 149 [GNU Scientific Library]: https://www.gnu.org/software/gsl/ |
147 [GNU Scientific Library]: https://www.gnu.org/software/gsl/ |
| 150 [rust-GSL]: https://docs.rs/GSL/6.0.0/rgsl/ |
148 [rust-GSL]: https://docs.rs/GSL/6.0.0/rgsl/ |
| 151 [Homebrew]: https://brew.sh |
149 [Homebrew]: https://brew.sh |
| 152 [arXiv:2212.02991]: https://arxiv.org/abs/2212.02991 |
150 [arXiv:2212.02991]: https://arxiv.org/abs/2212.02991 |
| 153 [arXiv:2502.12417]: https://arxiv.org/abs/2502.12417 |
151 [arXiv:2502.12417]: https://arxiv.org/abs/2502.12417 |
| 154 [doi:10.46298/jnsao-2023-10433]: http://doi.org/10.46298/jnsao-2023-10433 |
152 [doi:10.46298/jnsao-2023-10433]: http://doi.org/10.46298/jnsao-2023-10433 |
| 155 |
153 |
| 156 ### Linux / further patching |
154 ### Linux / further patching |
| 157 |
155 |
| 158 Due to both Fenics and typical Linux system being completely broken, you may need to do further patching to get things to compile: |
156 Due to both Fenics and typical Linux system being completely broken, you may need to do further patching to get things to compile: |
| 159 |
157 |
| 160 1. I had to set (in my [direnv](https://direnv.net) `.envrc`) |
158 1. I had to set (in my [direnv](https://direnv.net) `.envrc`) |
| 161 |
159 |
| 162 export PKG_CONFIG_PATH=/home/linuxbrew/.linuxbrew/lib/pkgconfig:/usr/local/lib/pkgconfig/:/usr/lib/aarch64-linux-gnu/pkgconfig/ |
160 export PKG_CONFIG_PATH=/home/linuxbrew/.linuxbrew/lib/pkgconfig:/usr/local/lib/pkgconfig/:/usr/lib/aarch64-linux-gnu/pkgconfig/ |
| 163 export LD_LIBRARY_PATH=/home/linuxbrew/.linuxbrew/lib |
161 export LD_LIBRARY_PATH=/home/linuxbrew/.linuxbrew/lib |
| 164 |
162 |
| 165 2. Some libraries, in particular `libfmt` and `libspdlog` installed in Homebrew, may conflict with system versions, that must be removed. |
163 2. Some libraries, in particular `libfmt` and `libspdlog` installed in Homebrew, may conflict with system versions, that must be removed. |
| 166 Lack of proper sandboxing in legacy Linux distributions, effectively prohibits multiple versions of the same library. |
164 Lack of proper sandboxing in legacy Linux distributions, effectively prohibits multiple versions of the same library. |
| 167 2. I had to add `Libs` in `/usr/local/lib/pkgconfig/dolfinx.pc` the bit `-L/home/linuxbrew/.linuxbrew/lib/ -lopenblas`. Nothing in the fenics stack seems to explicitly require it. Basix, that depends on openblas, is entirely missing a `pkg-config` file. |
165 3. I had to add `Libs` in `/usr/local/lib/pkgconfig/dolfinx.pc` the bit `-L/home/linuxbrew/.linuxbrew/lib/ -lopenblas`. Nothing in the fenics stack seems to explicitly require it. Basix, that depends on openblas, is entirely missing a `pkg-config` file. |
| 168 3. Also `export export OMP_NUM_THREADS=1` (in `.envrc`). We don't do MPI. We cannot do MPI in Fenics' lame “it's all just parallel solution of PDEs, with no other computation, ever” aka “single-program multiple-data, with no controller at all” way. If you don't do this, you may have multiple threads wasting CPU just being there. We try to control the thread count in our code, but OpenMPI on Linux doesn't seem to respect it. |
166 4. Also `export export OMP_NUM_THREADS=1` (in `.envrc`). We don't do MPI. We cannot do MPI in Fenics' lame “it's all just parallel solution of PDEs, with no other computation, ever” aka “single-program multiple-data, with no controller at all” way. If you don't do this, you may have multiple threads wasting CPU just being there. We try to control the thread count in our code, but OpenMPI on Linux doesn't seem to respect it. |
| 169 |
167 |
| 170 ## Building and running the experiments |
168 ## Building and running the experiments |
| 171 |
169 |
| 172 To compile the program, run |
170 To compile the program, run |
| 173 |
171 |