2.1. Installing the precompiled wheels
The easiest method to get pyoomph installed on your system is using pip, i.e. just enter the following in a terminal (works for CPython):
python -m pip install pyoomph
This will install pyoomph on your system. However, please also read the system-specific steps below.
If you get errors, let us know (c.diddens@utwente.nl), and we will see whether we can provide a suitable wheel for your system.
Warning
If you are using a recent Mac with the Apple silicon (arm64 architecture) processor, and you want to use the fast MKL Pardiso solver, you must execute this command in a Rosetta terminal. At https://www.courier.com/blog/tips-and-tricks-to-setup-your-apple-m1-for-development/ you can find instructions on how to create such a Rosetta terminal (note: recent systems must be handled differently, see e.g. here: https://developer.apple.com/forums/thread/718666). Also, please see below regarding the mkl module.
Since Intel’s mkl package is not available for arm64 at all and Apple’s Rosetta 2 support degrades with every system update, it is usually the better choice to stay native and use MUMPS as solver instead: either the standalone pyoomph_mumps package (Section 2.7), which does not require PETSc, or PETSc/MUMPS as described in Section 2.6.
Depending on your system, you have to do additional steps to obtain the full performance:
2.1.1. Windows
pyoomph can use a minimal C compiler, namely the TinyC compiler (TCC), wrapped by the tccbox package. This compiler generates machine code very quickly, but the generated code is usually not well optimized so that the execution is slow compared to more sophisticated compilers. On Windows, Microsoft offers the MS Build Tools, a free compiler suite, which can be utilized by pyoomph to generate faster machine code. It is best to download the Build Tools for Visual Studio 2019, since this is the version Python is usually referring to. The installer can be found at https://aka.ms/vs/16/release/vs_buildtools.exe. It is important to install at least the following components:
Fig. 2.1 Required packages to install from MS Build Tools
If you do not want to install MS Build Tools for any reason, you always can use the internal TinyC compiler. To do so, call the method set_c_compiler("tcc") of the Problem class to select the internal compiler. This has to be done for each problem and before any calls of the methods initialise(), output(), solve() or run(). Alternatively, you can add the command line arguments –tcc, e.g. run your simulation script my_simulation.py as follows:
python my_simulation.py --tcc
Note
If you encounter segmentation faults during solving, you likely have a bugged version of the MKL package installed. In that case, please downgrade to an older version, e.g. via python -m pip install mkl==2024.1.0.
2.1.2. Mac
On Mac, clang will be used as high performance compiler. To get clang, install the developer tools via
xcode-select --install
Warning
If you are using a recent Mac with an Apple silicon processor (arm64 architecture) and you run in Rosetta 2, make sure to not upgrade the package mkl. Also on Macs with an Intel processor, more recent versions can cause a crash. If you by accident upgrade your mkl package, reset it by entering (in a Rosetta 2 terminal for arm64 chips):
python -m pip install mkl==2021.4.0
On arm64 Macs, mkl is not available at all, so the MKL Pardiso solver requires the Rosetta 2 route in the first place. Natively, use MUMPS instead, either via the standalone pyoomph_mumps package (Section 2.7) or via PETSc (Section 2.6); the Accelerate framework pyoomph falls back to otherwise is too slow for larger problems.
2.1.3. Linux
On Linux, make sure that you have the gcc compiler installed to get optimal performance, e.g. on Ubuntu by
sudo apt install gcc
Other Linux distributions, you might have to use yum, pacman, etc., instead.
Note
If you encounter segmentation faults during solving, you likely have a bugged version of the MKL package installed. In that case, please downgrade to an older version, e.g. via python -m pip install mkl==2024.1.0.
2.1.4. Trying whether pyoomph works
To check whether pyoomph has been installed and the compilers and solvers can be detected, try it with
python -m pyoomph check all
2.1.5. Updating pyoomph
Pyoomph is under continuous development and the wheels are regularly updated. To update pyoomph to the recent version, just do a
python -m pip install --upgrade pyoomph