Skip to content

Allow external MPI initialisation and finalisation

Issue/feature addressed

MPI can only be initialised once per program, hence for testing frameworks that combine multiple tests into a single program MPI has to be initialised once before any tests and finalised afterwards. Currently Nektar++ errors if MPI is initialised before Nektar++ is used.

Proposed solution

Check to see if MPI is already initialised, if so Nektar++ assumes it is not responsible for initialising/finalising MPI and continues as before. If MPI is not already initialised then Nektar++ initialises/finalises as before.


Changed the initialisation check to set a bool to indicate if nektar++ is controlling MPI and initialise/finalise as before.


No new tests added.


  • Functions and classes, or changes to them, are documented.
  • User guide/documentation is updated.
  • Changelog is updated.
  • Suitable tests added for new functionality.
  • Contributed code is correctly formatted. (See the contributing guidelines).
  • License added to any new files.
  • No extraneous files have been added (e.g. compiler output or test data files).


On the 19.07 the code formatting (code style) was standardised using clang-format, over the whole Nektar++ code. This means changes in your branch will conflict with formatting changes on the master branch. To resolve these conflicts , see #295 (closed)

Edited by Dave Moxey

Merge request reports