diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-08-15 14:08:20 -0600 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-08-15 14:08:20 -0600 |
commit | 1d493b9a1e1792eee4697d6d4985770cdb0522f8 (patch) | |
tree | 9d09518645d6ab1000af95a7526ef880e13a8339 | |
parent | 27461a762da51d0c3151e7a55f13719e393ebded (diff) |
LoopControl: Initialize fine thread communicators ahead of time
-rw-r--r-- | Carpet/LoopControl/src/loopcontrol.cc | 25 |
1 files changed, 6 insertions, 19 deletions
diff --git a/Carpet/LoopControl/src/loopcontrol.cc b/Carpet/LoopControl/src/loopcontrol.cc index c4a2f6be1..a9b53d948 100644 --- a/Carpet/LoopControl/src/loopcontrol.cc +++ b/Carpet/LoopControl/src/loopcontrol.cc @@ -588,6 +588,7 @@ void lc_descr_init(lc_descr_t **const descr_ptr, all_descrs.push_back(descr); *descr_ptr = descr; + // Determine number of SMT threads if (CCTK_BUILTIN_EXPECT(num_smt_threads==0, false)) { if (CCTK_IsFunctionAliased("GetNumSMTThreads")) { num_smt_threads = GetNumSMTThreads(); @@ -595,6 +596,11 @@ void lc_descr_init(lc_descr_t **const descr_ptr, num_smt_threads = 1; } } + + // Allocate fine thread communicators + if (CCTK_BUILTIN_EXPECT(lc_fine_thread_comm.empty(), false)) { + lc_fine_thread_comm.resize(omp_get_max_threads()); + } } #pragma omp barrier } @@ -822,25 +828,6 @@ void lc_control_init(lc_control_t *restrict const control, } } - // Allocate fine thread communicators - int ftcs, gnct; - if ((ftcs=int(lc_fine_thread_comm.size())) < (gnct=get_num_coarse_threads())) { -#pragma omp barrier - if (not ((int(lc_fine_thread_comm.size()) < get_num_coarse_threads()))) { -#pragma omp critical - cout << "thread: " << omp_get_thread_num() << " " - << "ftcs1=" << ftcs << " " - << "gnct1=" << gnct << " " - << "ftcs2=" << lc_fine_thread_comm.size() << " " - << "gnct2=" << get_num_coarse_threads() << "\n" << flush; - } - assert(int(lc_fine_thread_comm.size()) < get_num_coarse_threads()); -#pragma omp master - lc_fine_thread_comm.resize(get_num_coarse_threads()); -#pragma omp barrier - assert(int(lc_fine_thread_comm.size()) == get_num_coarse_threads()); - } - // Initialize everything with a large, bogus value |