Skip to content

Conversation

@sergisiso
Copy link
Collaborator

@sergisiso sergisiso commented Dec 2, 2025

  • Unifies omp_gpu_trans.py omp_cpu_trans.py and acc_loops_trans.py
  • Adds a new README (https://github.com/stfc/PSyclone/tree/single_nemo_script/examples/nemo/scripts)
  • Switch one of the NEMOv5 ORCA test from OpenMP to OpenACC loops to have coverage of both
  • Improve performance of NEMOv5 (NEMOv4 got a regression needed to get full reproducibility)
  • Require full reproducibility of remaining nemo (loop) tests

sergisiso and others added 26 commits October 15, 2025 10:10
@codecov
Copy link

codecov bot commented Dec 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.91%. Comparing base (97dd02d) to head (bc5d55f).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3244   +/-   ##
=======================================
  Coverage   99.91%   99.91%           
=======================================
  Files         376      376           
  Lines       53529    53543   +14     
=======================================
+ Hits        53484    53498   +14     
  Misses         45       45           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sergisiso
Copy link
Collaborator Author

@arporter This is ready for a first review. See top PR description for the things that this PR attempts.

Copy link
Collaborator

@LonelyCat124 LonelyCat124 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @sergisiso
Overall looks fine, few typos in the examples which I think means they won't have been tested with the new changes. Can you fix that up and then rerun the integration to check they all run correctly with the GPU enabled.

${PSYCLONE} -s ./openmp_gpu_levels_trans.py ../code/tra_adv.F90
${PSYCLONE} -s ../scripts/omp_cpu_trans.py ../code/tra_adv.F90
${PSYCLONE} -s ../scripts/omp_gpu_trans.py ../code/tra_adv.F90
PARALLEL_DIRECTICVES="omp_threading" ${PSYCLONE} -s ../scripts/insert_loop_parallelism.py ../code/tra_adv.F90
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be PARLLEL_DIRECTIVES I think.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ups, fixed

${PSYCLONE} -s ./omp_levels_trans.py ../code/traldf_iso.F90
${PSYCLONE} -s ../scripts/omp_cpu_trans.py ../code/traldf_iso.F90
${PSYCLONE} -s ../scripts/omp_gpu_trans.py ../code/traldf_iso.F90
PARALLEL_DIRECTICVES="omp_threading" ${PSYCLONE} -s ../scripts/insert_loop_parallelism.py ../code/traldf_iso.F90
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also should be DIRECTIVES

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

> but these are pinned to a particular release of PSyclone and have constraints
> defined in `mk/sct_psyclone.sh` script. By contrast, the process presented in
> this README uses the experimental `psyclonefc` compiler wrapper command which
> bypases the `makenemo -p` and instead intercepts any compilation command and
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bypasses

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

compile, but the results will diverge. This gets more complicated with parallel
programming because certain operations like reductions or atomics are not
always reproducible. Therefore, to understand what causes the results divergence
it is usefulk to apply the transformations step-by-step while checking if the
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/usefulk/useful/

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

and see if the results still match.
- Finally, run it with `REPRODUCIBLE=1 PARALLEL_DIRECTIVES="omp_offloading" PSYCLONE_OPTS="-s insert_loop_parallelism.py"`

Orthogonally to finding which step is causing the divergence we may want to find
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think "Alongside finding which step is causing the divergence" might be more appropriate? These feel like related steps not opposed to me.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, updated

In addition to the source, you can also modify the recipe that psyclone uses to
transform the code. In this example you can do so by changing any detail of the
`insert_loop_parallelism.py` transformation script, but the `FILES_TO_SKIP`
global variable is particularly relevant as it allows psyclone skip processing
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/psyclone/PSyclone/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly below.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated several instances of this in this file

except TransformationError:
pass
if filename == "fldread.f90":
# TODO #2951: This file has issues converting SturctureRefs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Sturcture/Structure

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

if filename == "fldread.f90":
# TODO #2951: This file has issues converting SturctureRefs
pass
elif nemo_v4 and filename == "dynspg_ts.f90":
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on skipping this file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created the relevant issue and added a TODO here

@sergisiso
Copy link
Collaborator Author

@LonelyCat124 This is ready for another review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants