Skip to content

Add CI for tracking porting progress using gcov and custom parsing + report generation - #80

Merged
marshallward merged 10 commits into
MOM6-GPU:dev/gpufrom
edoyango:dev/gpu
Jul 28, 2026
Merged

Add CI for tracking porting progress using gcov and custom parsing + report generation#80
marshallward merged 10 commits into
MOM6-GPU:dev/gpufrom
edoyango:dev/gpu

Conversation

@edoyango

@edoyango edoyango commented Jul 16, 2026

Copy link
Copy Markdown

This creates a new CI that generates a report for both the repo's default branch and any pr that comes in

  • the report is html and pushed to the gh-pages (will be created if it doesn't exist)
  • This means that gh-pages history may need pruning at some point.
  • Reuse binaries from the testing CI
  • Generates the report using the benchmark_ALE case (cloned from https://github.com/MOM6-GPU/MOM6-examples, but does some git tricks to only pull the benchmark_ALE folder).

The report uses gcov, which means code only hit by benchmark_ALE is shown in the report.

An example of what the report will look like is here: https://edoyango.github.io/MOM6/
Latest on dev/gpu is the report for dev/gpu, and pr-2 is a PR example (the PR is small, it just updates the script and adds some annotations to MOM_barotropic.F90).

NB: Only once this PR is merged, will the CI start to trigger.

This PR was coded entirely with claude sonnet 5

@edoyango

Copy link
Copy Markdown
Author

noting this pr, once merged, will just get the site generation working. I'll put in another follow-up PR that adds:

  • Stricter, simpler noport/toport marking rules, applied to MOM_barotropic.F90.
  • CI now tracks GPU-port coverage across double_gyre, benchmark, and benchmark_ALE, with per-case pages plus a combined report, and a working case-picker landing page on gh-pages.
  • A new interactive TUI for browsing port/coverage status locally.

@marshallward

Copy link
Copy Markdown
Member

Looks really nice, good job Claude!

I'm guessing there are false positives, and maybe there's some overhead on the CI, but we can play with it for a while to work out those issues.

The plan is to remove the code changes before merging right?

edoyango added 10 commits July 28, 2026 06:52
track_gpu_port.py cross-references gcov execution coverage against
GPU-ported source regions (do concurrent, omp target directives, manual
@gpu-ported/@start noport/toport markers) to report which executed,
GPU-portable lines still need porting. gpu-port-report.yml runs it in CI
against a short benchmark_ALE run built with --coverage instrumentation.
…parate build

.testing's build/cov/MOM6 is already compiled with --coverage from the same
PR source, the same FMS fork (edoyango/FMS) that MOM6-examples/src/FMS2_gpu
points to, and the default dynamic_symmetric/solo_driver config that
ocean_only uses — so it can run benchmark_ALE directly with no recompile.

Moves the report job into verify-linux.yml (needs: build-coverage) since
`needs` can only reference jobs in the same workflow file; the standalone
gpu-port-report.yml is removed. Cloning MOM6-gpu/MOM6-examples is now only
for the benchmark_ALE input files and the f90nml submodule (for
get_nprocs.py) — no FMS/MOM6 build there at all.
CI failed: get_nprocs.py computed 64 ranks from MOM6-gpu/MOM6-examples's
checked-in MOM_parameter_doc.layout for benchmark_ALE, exceeding the
runner's available slots. This is a coverage smoke run, not a scaling
test, so hardcode -np 1 and force "#override LAYOUT = 1,1" so the
runtime domain decomposition matches. Drops the now-unnecessary
get_nprocs.py call and its f90nml submodule dependency.
CI failed with FileNotFoundError on src/equation_of_state/TEOS10/*.f90:
those are git symlinks into the pkg/GSW-Fortran submodule, and
gpu-port-report's checkout doesn't initialize submodules (the coverage
build itself never compiles them — it links an externally-built libgsw.a
instead via --with-gsw). rglob() still walks the dangling symlinks, so
skip any path that isn't a real file, with a warning, instead of
crashing the whole report.
track_gpu_port.py gains --baseline-json (diff current ported totals
against a prior --out-json snapshot) and --changed-files + --out-comment
(a short summary scoped to the PR's own files, for posting as a comment
rather than the full per-file/per-routine report).

verify-linux.yml's gpu-port-report job now uploads its JSON snapshot as
a "gpu-port-json" artifact on every run (the next PR's baseline), and on
pull_request events also computes the PR's changed .F90/.f90 files and
looks up the base branch's latest snapshot to diff against.

Actually posting the comment is split into a new gpu-port-comment.yml,
triggered by workflow_run: gpu-port-report checks out and runs PR code
(possibly from a fork) so it must stay read-only, while commenting
needs write access that workflow_run grants safely since it runs with
the base repo's permissions and never checks out the triggering code.
The comment is updated in place across pushes via a hidden HTML marker.
…port

Without it, the "top porting opportunities" section in --out-md caps at
25 routines by portable-remaining lines, which is fine for a quick scan
but drops routines once the codebase has more than 25 with remaining
work. --verbose lists all of them, with their exact line ranges. Wired
into the CI job's full report (job summary), not the PR comment, which
stays short by design.
Adds --out-html to track_gpu_port.py, generating a self-contained
line-by-line coverage/port-status page per source file (ported /
portable-remaining / executed-not-portable / not-hit, plus an index).
The read-only gpu-port-report job builds it as an artifact; the
write-capable gpu-port-comment.yml workflow (via workflow_run) pushes
it to gh-pages under pr-<number>/ and links it from the sticky PR
comment. A pull_request_target cleanup workflow removes the preview
when the PR closes.
Green stays "done", but "portable, not yet ported" (the actual action
item) is now red, "executed, not portable" (benign — no porting
target) is blue instead of yellow to avoid reading as a warning, and
"executable, not hit" is grey.
Previously the GPU port HTML report was only ever published per-PR
(pr-<number>/) and got deleted again once the PR closed, so merging
lost the report instead of updating a durable one. gpu-port-report now
also runs on pushes to dev/gpu, and gpu-port-comment.yml publishes
those to a fixed porting_progress/ path on gh-pages instead of a
PR-numbered one.
The "publish-pages" job downloaded the report artifact into "report/"
(inside the checked-out repo), then later ran "git add -A" when committing
to gh-pages. That staged the whole working tree, not just the intended
publish path and index.html, so the first successful run accidentally
committed "report/" itself into gh-pages. Every subsequent run then failed:
the fresh, untracked "report/" download collided with the tracked copy
already on gh-pages, and "git checkout -B gh-pages FETCH_HEAD" aborted
rather than overwrite it.

Downloading to $RUNNER_TEMP instead means the artifact can never again
collide with whatever's checked out, and scoping "git add" to exactly the
publish path plus index.html means a stray leftover elsewhere in the
workdir can't get swept into a gh-pages commit either.

Does not by itself unblock the branch: gh-pages already has "report/"
committed to it from the earlier bad run, so a one-time cleanup commit
removing it from gh-pages is still needed before publishing will succeed
again.
@edoyango

Copy link
Copy Markdown
Author

The plan is to remove the code changes before merging right?

yes sorry I've removed the code changes just now

@marshallward marshallward left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The @noport @toport stuff may need to be dropped as we look to syncing with dev/gfdl, but we can start thinking about that later on.

@marshallward

marshallward commented Jul 28, 2026

Copy link
Copy Markdown
Member

The commits are well-structured so I'll do a rebase.

@marshallward
marshallward merged commit 3eb40f0 into MOM6-GPU:dev/gpu Jul 28, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants