Skip to content

Commit e055365

Browse files
committed
Fix RAW (read after write) race hazard in theta-l_kokkos limiter
Also remove (slow) profiling calls
1 parent 10a423d commit e055365

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

components/homme/src/theta-l_kokkos/cxx/CaarFunctorImpl.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,6 @@ struct CaarFunctorImpl {
343343

344344
set_rk_stage_data(data);
345345

346-
profiling_resume();
347-
348346
GPTLstart("caar compute");
349347
int nerr;
350348
Kokkos::parallel_reduce("caar loop pre-boundary exchange", m_policy_pre, *this, nerr);
@@ -367,7 +365,6 @@ struct CaarFunctorImpl {
367365

368366
limiter.run(data.np1);
369367

370-
profiling_pause();
371368
}
372369

373370
KOKKOS_INLINE_FUNCTION

components/homme/src/theta-l_kokkos/cxx/LimiterFunctor.hpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,11 @@ struct LimiterFunctor {
9999

100100
void run (const int& tl)
101101
{
102-
profiling_resume();
103-
104102
GPTLstart("caar limiter");
105103
m_np1 = tl;
106104
Kokkos::parallel_for("caar loop dp3d limiter", m_policy_dp3d_lim, *this);
107105
Kokkos::fence();
108106
GPTLstop("caar limiter");
109-
110-
profiling_pause();
111107
}
112108

113109
KOKKOS_INLINE_FUNCTION
@@ -147,6 +143,7 @@ struct LimiterFunctor {
147143
#endif
148144
result = result<=diff_as_real(k) ? result : diff_as_real(k);
149145
}, reducer);
146+
kv.team_barrier();
150147

151148
auto vtheta_dp = Homme::subview(m_state.m_vtheta_dp,kv.ie,m_np1,igp,jgp);
152149

@@ -168,8 +165,6 @@ struct LimiterFunctor {
168165
});
169166
}
170167

171-
kv.team_barrier();
172-
173168
// This loop must be done over physical levels, unless we implement
174169
// masks, like it has been done in the E3SM/scream project
175170
Real mass_new = 0.0;
@@ -194,6 +189,7 @@ struct LimiterFunctor {
194189
vtheta_dp(ilev) *= dp(ilev);
195190
});
196191
} //end of min_diff < 0
192+
kv.team_barrier();
197193

198194
Kokkos::parallel_for(Kokkos::ThreadVectorRange(kv.team,NUM_LEV),
199195
[&](const int ilev) {

0 commit comments

Comments
 (0)