blob: 85a78c4c1326b86f1a2dead9c0fda4f39de06417 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
From aafc2c19dfd3ebc43e37ba3f13eda5f790376b1c Mon Sep 17 00:00:00 2001
From: Matthias Maier <tamiko@43-1.org>
Date: Thu, 15 Feb 2024 15:54:36 -0600
Subject: [PATCH 1/2] 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 | 20 --------------------
1 file changed, 20 deletions(-)
diff --git a/source/base/mpi.cc b/source/base/mpi.cc
index dab88e2b97..f845845764 100644
--- a/source/base/mpi.cc
+++ b/source/base/mpi.cc
@@ -100,26 +100,6 @@ namespace Utilities
namespace MPI
{
-#ifdef DEAL_II_WITH_MPI
- // Provide definitions of template variables for all valid instantiations.
- template const MPI_Datatype mpi_type_id_for_type<bool>;
- template const MPI_Datatype mpi_type_id_for_type<char>;
- template const MPI_Datatype mpi_type_id_for_type<signed char>;
- template const MPI_Datatype mpi_type_id_for_type<short>;
- template const MPI_Datatype mpi_type_id_for_type<int>;
- template const MPI_Datatype mpi_type_id_for_type<long int>;
- template const MPI_Datatype mpi_type_id_for_type<unsigned char>;
- template const MPI_Datatype mpi_type_id_for_type<unsigned short>;
- template const MPI_Datatype mpi_type_id_for_type<unsigned long int>;
- template const MPI_Datatype mpi_type_id_for_type<unsigned long long int>;
- template const MPI_Datatype mpi_type_id_for_type<float>;
- template const MPI_Datatype mpi_type_id_for_type<double>;
- template const MPI_Datatype mpi_type_id_for_type<long double>;
- template const MPI_Datatype mpi_type_id_for_type<std::complex<float>>;
- template const MPI_Datatype mpi_type_id_for_type<std::complex<double>>;
-#endif
-
-
MinMaxAvg
min_max_avg(const double my_value, const MPI_Comm mpi_communicator)
{
--
2.43.0
|