forked from PrincetonUniversity/athena
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path15.mpi_tag_ub.patch
42 lines (41 loc) · 1.25 KB
/
15.mpi_tag_ub.patch
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
diff --git a/src/globals.cpp b/src/globals.cpp
index 5d12815a..1f2271fb 100644
--- a/src/globals.cpp
+++ b/src/globals.cpp
@@ -22,6 +22,7 @@ namespace Globals {
// all of these global variables are set at the start of main():
int my_rank; // MPI rank of this process
int nranks; // total number of MPI ranks
+int mpi_tag_ub; // upper bound on MPI tags
int next_task_id = 69; // next available task id (last item of task_list)
int next_scalar_index = 0; // next available scalar index
}
diff --git a/src/globals.hpp b/src/globals.hpp
index 885ef30b..1687063b 100644
--- a/src/globals.hpp
+++ b/src/globals.hpp
@@ -12,6 +12,7 @@ namespace Globals {
extern int my_rank, nranks;
extern int next_task_id;
extern int next_scalar_index;
+extern int mpi_tag_ub;
}
#endif // GLOBALS_HPP_
diff --git a/src/main.cpp b/src/main.cpp
index 04d74465..b0381d00 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -109,6 +109,13 @@ int main(int argc, char *argv[]) {
MPI_Finalize();
return(0);
}
+
+ // Get maximum value of MPI tag
+ MPI_Aint* tag_ub_ptr;
+ int att_flag;
+ MPI_Comm_get_attr(MPI_COMM_WORLD, MPI_TAG_UB, &tag_ub_ptr, &att_flag);
+ Globals::mpi_tag_ub = *tag_ub_ptr;
+
#else // no MPI
Globals::my_rank = 0;
Globals::nranks = 1;