aboutsummaryrefslogtreecommitdiff
path: root/Carpet/LoopControl
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-02-07 10:05:27 -0500
committerErik Schnetter <schnetter@gmail.com>2013-02-08 08:58:23 -0500
commit9f8ea6b95856882d782bcc126114584d33df4197 (patch)
tree3e636541cea9c0206c5f071a20219ae219c3b525 /Carpet/LoopControl
parent0b19fe1cf8736820852fd1bdd439cac0f5c8c96b (diff)
LoopControl: Improve OpenMP parallelisation
Diffstat (limited to 'Carpet/LoopControl')
-rw-r--r--Carpet/LoopControl/src/loopcontrol.cc12
1 files changed, 5 insertions, 7 deletions
diff --git a/Carpet/LoopControl/src/loopcontrol.cc b/Carpet/LoopControl/src/loopcontrol.cc
index bf5f510a1..298dc868e 100644
--- a/Carpet/LoopControl/src/loopcontrol.cc
+++ b/Carpet/LoopControl/src/loopcontrol.cc
@@ -387,12 +387,12 @@ void lc_stats_init(lc_stats_t** const stats_ptr,
char const* const file,
int const line)
{
- if (*stats_ptr) return;
+ if (CCTK_BUILTIN_EXPECT(*stats_ptr != 0, true)) return;
- lc_stats_t* stats;
-#pragma omp single copyprivate(stats)
+#pragma omp barrier
+#pragma omp master
{
- stats = new lc_stats_t;
+ lc_stats_t* const stats = new lc_stats_t;
stats->name = name;
stats->file = file;
@@ -407,11 +407,9 @@ void lc_stats_init(lc_stats_t** const stats_ptr,
stats->max = 0.0;
all_stats.push_back(stats);
- }
-#pragma omp single
- {
*stats_ptr = stats;
}
+#pragma omp barrier
}