Skip to content

Commit d8b8486

Browse files
committed
Use Barriers in profiling
1 parent e9010e7 commit d8b8486

File tree

4 files changed

+42
-0
lines changed

4 files changed

+42
-0
lines changed

src/t8_forest/t8_forest.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3032,6 +3032,9 @@ t8_forest_commit (t8_forest_t forest)
30323032
T8_ASSERT (!forest->committed);
30333033
if (forest->profile != NULL) {
30343034
/* If profiling is enabled, we measure the runtime of commit */
3035+
#if T8_ENABLE_PROFILE_BARRIER
3036+
sc_MPI_Barrier(forest->mpicomm);
3037+
#endif
30353038
forest->profile->commit_runtime = sc_MPI_Wtime ();
30363039
}
30373040

@@ -3247,6 +3250,9 @@ t8_forest_commit (t8_forest_t forest)
32473250

32483251
if (forest->profile != NULL) {
32493252
/* If profiling is enabled, we measure the runtime of commit */
3253+
#if T8_ENABLE_PROFILE_BARRIER
3254+
sc_MPI_Barrier(forest->mpicomm);
3255+
#endif
32503256
forest->profile->commit_runtime = sc_MPI_Wtime () - forest->profile->commit_runtime;
32513257
}
32523258

src/t8_forest/t8_forest_balance.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ t8_forest_balance (t8_forest_t forest, int repartition)
164164
adap_stats = ghost_stats = partition_stats = NULL;
165165

166166
if (forest->profile != NULL) {
167+
#if T8_ENABLE_PROFILE_BARRIER
168+
sc_MPI_Barrier(forest->mpicomm);
169+
#endif
167170
/* Profiling is enable, so we measure the runtime of balance */
168171
forest->profile->balance_runtime = -sc_MPI_Wtime ();
169172
/* We store the individual adapt, ghost, and partition runtimes */
@@ -285,6 +288,9 @@ t8_forest_balance (t8_forest_t forest, int repartition)
285288

286289
if (forest->profile != NULL) {
287290
/* Profiling is enabled, so we measure the runtime of balance. */
291+
#if T8_ENABLE_PROFILE_BARRIER
292+
sc_MPI_Barrier(forest->mpicomm);
293+
#endif
288294
forest->profile->balance_runtime += sc_MPI_Wtime ();
289295
forest->profile->balance_rounds = count_rounds;
290296
/* Print the runtime of adapt/ghost/partition */

src/t8_forest/t8_forest_ghost.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,6 +1551,9 @@ t8_forest_ghost_create_ext (t8_forest_t forest, int unbalanced_version)
15511551

15521552
if (forest->profile != NULL) {
15531553
/* If profiling is enabled, we measure the runtime of ghost_create */
1554+
#if T8_ENABLE_PROFILE_BARRIER
1555+
sc_MPI_Barrier(forest->mpicomm);
1556+
#endif
15541557
forest->profile->ghost_runtime = -sc_MPI_Wtime ();
15551558
/* DO NOT DELETE THE FOLLOWING line.
15561559
* even if you do not want this output. It fixes a bug that occurred on JUQUEEN, where the
@@ -1608,6 +1611,9 @@ t8_forest_ghost_create_ext (t8_forest_t forest, int unbalanced_version)
16081611

16091612
if (forest->profile != NULL) {
16101613
/* If profiling is enabled, we measure the runtime of ghost_create */
1614+
#if T8_ENABLE_PROFILE_BARRIER
1615+
sc_MPI_Barrier(forest->mpicomm);
1616+
#endif
16111617
forest->profile->ghost_runtime += sc_MPI_Wtime ();
16121618
/* We also store the number of ghosts and remotes */
16131619
if (ghost != NULL) {

src/t8_forest/t8_forest_partition.cxx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ t8_forest_partition_create_offsets (t8_forest_t forest)
9292
{
9393
if (forest->profile != NULL) {
9494
/* If profiling is enabled, we measure the runtime of partition */
95+
#if T8_ENABLE_PROFILE_BARRIER
96+
sc_MPI_Barrier(forest->mpicomm);
97+
#endif
9598
forest->profile->forest_offsets_runtime = -sc_MPI_Wtime ();
9699
}
97100

@@ -120,6 +123,9 @@ t8_forest_partition_create_offsets (t8_forest_t forest)
120123
t8_shmem_array_end_writing (forest->element_offsets);
121124
if (forest->profile != NULL) {
122125
/* If profiling is enabled, we measure the runtime of partition */
126+
#if T8_ENABLE_PROFILE_BARRIER
127+
sc_MPI_Barrier(forest->mpicomm);
128+
#endif
123129
forest->profile->forest_offsets_runtime += sc_MPI_Wtime ();
124130
}
125131
}
@@ -266,6 +272,9 @@ t8_forest_partition_create_first_desc (t8_forest_t forest)
266272
{
267273
if (forest->profile != NULL) {
268274
/* If profiling is enabled, we measure the runtime of partition */
275+
#if T8_ENABLE_PROFILE_BARRIER
276+
sc_MPI_Barrier(forest->mpicomm);
277+
#endif
269278
forest->profile->first_descendant_runtime = -sc_MPI_Wtime ();
270279
}
271280
sc_MPI_Comm comm;
@@ -348,6 +357,9 @@ t8_forest_partition_create_first_desc (t8_forest_t forest)
348357
#endif
349358
if (forest->profile != NULL) {
350359
/* If profiling is enabled, we measure the runtime of partition */
360+
#if T8_ENABLE_PROFILE_BARRIER
361+
sc_MPI_Barrier(forest->mpicomm);
362+
#endif
351363
forest->profile->first_descendant_runtime += sc_MPI_Wtime ();
352364
}
353365
}
@@ -358,6 +370,9 @@ t8_forest_partition_create_tree_offsets (t8_forest_t forest)
358370

359371
if (forest->profile != NULL) {
360372
/* If profiling is enabled, we measure the runtime of partition */
373+
#if T8_ENABLE_PROFILE_BARRIER
374+
sc_MPI_Barrier(forest->mpicomm);
375+
#endif
361376
forest->profile->cmesh_offsets_runtime = -sc_MPI_Wtime ();
362377
}
363378

@@ -426,6 +441,9 @@ t8_forest_partition_create_tree_offsets (t8_forest_t forest)
426441
}
427442
if (forest->profile != NULL) {
428443
/* If profiling is enabled, we measure the runtime of partition */
444+
#if T8_ENABLE_PROFILE_BARRIER
445+
sc_MPI_Barrier(forest->mpicomm);
446+
#endif
429447
forest->profile->cmesh_offsets_runtime += sc_MPI_Wtime ();
430448
}
431449
}
@@ -1209,6 +1227,9 @@ t8_forest_partition (t8_forest_t forest)
12091227

12101228
if (forest->profile != NULL) {
12111229
/* If profiling is enabled, we measure the runtime of partition */
1230+
#if T8_ENABLE_PROFILE_BARRIER
1231+
sc_MPI_Barrier(forest->mpicomm);
1232+
#endif
12121233
forest->profile->partition_runtime = sc_MPI_Wtime ();
12131234

12141235
/* DO NOT DELETE THE FOLLOWING line.
@@ -1239,6 +1260,9 @@ t8_forest_partition (t8_forest_t forest)
12391260

12401261
if (forest->profile != NULL) {
12411262
/* If profiling is enabled, we measure the runtime of partition */
1263+
#if T8_ENABLE_PROFILE_BARRIER
1264+
sc_MPI_Barrier(forest->mpicomm);
1265+
#endif
12421266
forest->profile->partition_runtime = sc_MPI_Wtime () - forest->profile->partition_runtime;
12431267

12441268
/* DO NOT DELETE THE FOLLOWING line.

0 commit comments

Comments
 (0)