]> https://gitweb.dealii.org/ - dealii.git/commit
base/mpi.cc: remove superfluous explicit instantiations of template variable
authorMatthias Maier <tamiko@43-1.org>
Thu, 15 Feb 2024 21:54:36 +0000 (15:54 -0600)
committerMatthias Maier <tamiko@43-1.org>
Fri, 16 Feb 2024 00:40:15 +0000 (18:40 -0600)
commitaafc2c19dfd3ebc43e37ba3f13eda5f790376b1c
treef006a9473b006bb94fe5a3b8286a4c9aeb19b69b
parent6f07117be556bf929220c50820b4dead54dc31d0
base/mpi.cc: remove superfluous explicit instantiations of template variable

The `mpi.h` header already contains:
```
template <typename T>
const MPI_Datatype mpi_type_id_for_type = /* implementation detail */;
```
Meaning, the variable is known fully after including the header.
Furthermore, the `const` qualifier marks the (template) variable as
`static`. I.e., it has internal linkage.

Thus, we must not explicitly instantiate the variables (suggesting
"extern" linkage in all but the `mpi.cc` compilation unit). This
apparently not an issue with OpenMPI because `MPI_Datatype` is a
complex data structure. But it is an issue with mpich where
`MPI_Datatype` is a simple `int` - leading to a segmentation fault when
during program startup.
source/base/mpi.cc

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.