Skip to content

Commit cb577a3

Browse files
committed
Replicate original parallel loop schedules
1 parent adbca26 commit cb577a3

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

applications/lfric_atm/optimisation/meto-ex1a/transmute/large_scale_cloud/pc2_bl_forced_cu.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
get_outer_loops,
1818
get_compiler,
1919
first_priv_red_init,
20+
OMP_PARALLEL_LOOP_DO_TRANS_DYNAMIC,
2021
OMP_PARALLEL_LOOP_DO_TRANS_STATIC
2122
)
2223

@@ -31,12 +32,16 @@ def trans(psyir):
3132
if not loop.ancestor(Loop)]
3233

3334
# Apply OpenMP parallel do directives and use workaround for
34-
# firstprivate variable issue
35+
# firstprivate variable issue; replicate dynamic and static
36+
# schedules of the original implementation
3537
try:
36-
for loop in outer_loops:
38+
for idx, loop in enumerate(outer_loops):
3739
if get_compiler() == 'cce':
3840
first_priv_red_init(loop, ["cf_base", "cf_forced", "dcfl",
3941
"dqcl", "qcl_forced", "qcl_tol"])
40-
OMP_PARALLEL_LOOP_DO_TRANS_STATIC.apply(loop.walk(Loop)[1])
42+
if idx == 0:
43+
OMP_PARALLEL_LOOP_DO_TRANS_DYNAMIC.apply(loop.walk(Loop)[1])
44+
else:
45+
OMP_PARALLEL_LOOP_DO_TRANS_STATIC.apply(loop.walk(Loop)[1])
4146
except (TransformationError, IndexError) as err:
4247
logging.warning("OMPParallelLoopTrans failed: %s", err)

0 commit comments

Comments
 (0)