Skip to content

Let -cudalib=nvtx3 pick the NVTX wrapper so NVHPC 26.9 links - #2111

Open
platelett wants to merge 1 commit into
MFlowCode:masterfrom
platelett:codex/fix-nvhpc-nvtx-link
Open

platelett wants to merge 1 commit into
MFlowCode:masterfrom
platelett:codex/fix-nvhpc-nvtx-link

Conversation

@platelett

Copy link
Copy Markdown

GPU builds (--gpu acc or --gpu mp) with NVHPC 26.9 fail at their first link:

/usr/bin/ld: cannot find -lnvhpcwrapnvtx: No such file or directory
gmake[3]: *** [CMakeFiles/syscheck.dir/build.make:100: syscheck] Error 2
  • Cause. NVHPC 26.9 renamed its NVTX wrapper library to libnvhpcnvtx, and MFCTargets.cmake names the old one.
  • Fix. This PR stops naming it. The -cudalib=nvtx3 flag already on that line links the wrapper under each release's own name.
  • CI. The CI lanes (NVHPC up to 26.3) link the same library as before.
  • CI filter. A one-line change makes CI run the build matrix for cmake/ changes; it is the same line as Fix compiler configuration, build-cache identity, and CMake CI coverage #2019.

Change

cmake/MFCTargets.cmake. For CUDA ≥ 12.9 (no CUDA::nvToolsExt), the targets linked the wrapper twice:

target_link_libraries(${a_target} PRIVATE nvhpcwrapnvtx)
target_link_options(${a_target} PRIVATE "-cudalib=nvtx3")

The first line is removed. The driver adds the wrapper itself:

nvfortran -cudalib=nvtx3 -dryrun link line
25.9, 26.3 ... -lnvhpcwrapnvtx ...
26.9 ... -lnvhpcnvtx ...

A comment records this next to the flag. The CUDA ≤ 12.8 branch (CUDA::nvToolsExt) is unchanged.

.github/file-filter.yml. It adds 'cmake/**' to the cmakelist filter. The filter lists CMakeLists.txt and toolchain/cmake/**, but not the cmake/ directory added in #1552. As a result, a PR that changes only cmake/*.cmake, like this one, skips the build and test matrix. This is the same line as #2019, so whichever lands second merges cleanly. I can drop this line if you prefer.

Side effects

  • NVHPC ≤ 26.3: the link line is unchanged in effect. It was checked with -dryrun on 25.9 and 26.3, and a clean 26.3 --gpu acc build shows libnvhpcwrapnvtx.so in ldd, as before.
  • CUDA ≤ 12.8: unchanged.
  • CI: it now runs the build matrix for cmake/ changes, which costs more CI time for such PRs.
Verification

On 2× H100 NVL:

master this PR
NVHPC 26.9, --gpu acc link fails (above) all targets build
NVHPC 25.9, --gpu acc builds builds
NVTX ranges in nsys (./mfc.sh run ... --nsys, 2D_riemann_test, 50 steps) — present on 25.9 and 26.9: TIMESTEP ×50, COMPUTE-RHS ×150, RHS-RIEMANN-SOLVER ×300, RHS-RECONSTRUCTION ×300
Full --gpu acc suite, NVHPC 26.9 cannot build 675 passed, 47 failed. All 47 are hypoelasticity tests (below)

On an RTX 4060 Ti (sm_89):

master this PR
NVHPC 26.9, --gpu acc ld: cannot find -lnvhpcwrapnvtx pre/sim/post build
NVHPC 26.3 (newest CI lane), --gpu acc, clean build directory builds syscheck and pre_process build, and ldd shows libnvhpcwrapnvtx.so
nsys NVTX summary, 64² 2D case, 20 steps, NVHPC 26.9 — TIMESTEP ×20, COMPUTE-RHS ×60, RHS-RIEMANN-SOLVER ×120, RHS-RECONSTRUCTION ×120

The 47 hypoelasticity failures on 26.9 are unrelated to this PR:

  • Unpatched master, built on 26.9 with a compat symlink so it links, fails the same way. For example, 34F3999B gives abs: 1.56E-02, rel: 1.56E-05 in both.
  • A CPU-only 26.9 build, which has no NVTX at all, fails 41 of the first 51 hypoelasticity tests.
  • --reldebug and --debug builds pass, with no bounds errors.
  • They pass on NVHPC 25.9. We will report them separately.

./mfc.sh precheck passes.

Contribution Policy

All contributions are expected to demonstrate:

  • A clear understanding of the codebase
  • Alignment with product direction
  • Thoughtful reasoning behind changes
  • Evidence of real-world usage or hands-on experience with the problem

If these expectations are not met, we would prefer to implement the changes ourselves rather than spend time reviewing low-effort submissions.

Acknowledgement

  • I confirm this PR meets the above expectations and reflects my own understanding and real-world context.

This PR is from Diablo (Tsinghua University) participating in the SC26 Student Cluster Competition.

Motivation
Naming an NVHPC NVTX wrapper explicitly breaks GPU linking when its library name changes.

Expectation
Let the compiler driver select its NVTX wrapper and include cmake changes in the CI build filter.

Change
For CUDA >= 12.9 the targets linked nvhpcwrapnvtx by name in addition
to -cudalib=nvtx3. NVHPC 26.9 renamed that library to libnvhpcnvtx, so
a GPU build stops at its first link (syscheck):

    /usr/bin/ld: cannot find -lnvhpcwrapnvtx

-cudalib=nvtx3 already links the wrapper under each release's name
(-lnvhpcwrapnvtx on 25.9 and 26.3, -lnvhpcnvtx on 26.9, per
nvfortran -dryrun), so the explicit name is dropped and a comment
records why.

Also add cmake/** to the cmakelist filter in file-filter.yml. It lists
CMakeLists.txt and toolchain/cmake/** but not the cmake/ directory
added in MFlowCode#1552, so a PR that only changes cmake/*.cmake skipped every
build. Same line as in MFlowCode#2019.

Result
The release-dependent hardcoded wrapper name is removed. The precheck passes. The older CUDA::nvToolsExt path is unchanged.

Co-authored-by: ruru25254649 <ruru.2525.4649@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WPhkY8p1EHhGY7jScizJmC
@platelett
platelett requested a review from a team as a code owner October 25, 2026 09:56
@platelett
platelett requested review from danieljvickers and removed request for a team October 25, 2026 09:56
@github-actions

Copy link
Copy Markdown

Claude Code Review

Head SHA: 4870e05

Files changed:

  • 2
  • .github/file-filter.yml
  • cmake/MFCTargets.cmake

Findings:
No issues found. Checked cmake/MFCTargets.cmake (NVTX link branch for CUDA >= 12.9 now relies on -cudalib=nvtx3 alone) and .github/file-filter.yml (cmake/** added to the cmakelist filter).

@codecov

codecov Bot commented Oct 25, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.95%. Comparing base (ee99151) to head (4870e05).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2111   +/-   ##
=======================================
  Coverage   61.95%   61.95%           
=======================================
  Files          86       86           
  Lines       22906    22906           
  Branches     3378     3378           
=======================================
  Hits        14192    14192           
  Misses       6206     6206           
  Partials     2508     2508           

☔ View full report in Codecov by Harness.
📢 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.

This branch has not been deployed

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

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant