Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/documentation/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ A test is considered passing when our error tolerances are met in order to maint
- `--max-attempts` (`-m`) the maximum number of attempts to make on a test before considering it failed
- `--no-examples` skips the testing of cases in the examples folder
- `--no-chemistry` skips every case that uses chemistry (``chemistry = 'T'``), including reacting example cases
- Cases with a known GPU-only difference on NVHPC < 25.11 (`NVHPC_GPU_KNOWN_DIFFERENCE_UUIDS` in `toolchain/mfc/test/test.py`, tracked in #2181) are skipped on GPU builds with an old `nvfortran`, with a visible reason line; tolerances are not widened. CPU builds and other compilers run them.
- `--no-build` runs against existing binaries without rebuilding. Some cases (chemistry, analytic initial conditions) need their own build, which `./mfc.sh build` does not produce; build everything the suite needs with `./mfc.sh test --dry-run <options>`. If any required binary is missing, `--no-build` stops before running any case and lists what is missing.
- `--rdma-mpi` runs additional tests where RDMA MPI is enabled.

Expand Down
26 changes: 25 additions & 1 deletion toolchain/mfc/test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from rich.panel import Panel

from .. import common, sched
from ..build import HDF5, POST_PROCESS, PRE_PROCESS, SIMULATION, build
from ..build import HDF5, POST_PROCESS, PRE_PROCESS, SIMULATION, _compiler_version, build
from ..common import MFCException, console_safe, does_command_exist, format_list_to_string, get_program_output, log_tail
from ..gpu_diagnostics import (
GPU_FAULT_MARKER,
Expand Down Expand Up @@ -271,6 +271,22 @@ def is_uuid(term):
return cases, skipped_cases


# Cases with a known GPU-only result difference on NVHPC < 25.11 (CPU builds and 25.11+ pass): the pinned Phoenix compiler
# is 25.5. The cause is not identified, so the skip is reported per case and tolerances stay untouched. See
# https://github.com/MFlowCode/MFC/issues/2181
NVHPC_GPU_KNOWN_DIFFERENCE_UUIDS = {"124D7972"}
NVHPC_GPU_FIXED_VERSION = (25, 11)


def nvhpc_gpu_known_difference(uuid: str, gpu: str, fc_version: str) -> bool:
"""True if `uuid` is a known difference for a GPU build with `fc_version` (first line of `FC --version`).

An unparsable or non-nvfortran version never matches, so the case runs.
"""
match = re.match(r"nvfortran\s+(\d+)\.(\d+)", fc_version)
return uuid in NVHPC_GPU_KNOWN_DIFFERENCE_UUIDS and gpu != "no" and bool(match) and (int(match[1]), int(match[2])) < NVHPC_GPU_FIXED_VERSION


def __filter(cases_) -> typing.Tuple[typing.List[TestCase], typing.List[TestCase]]:
cases = cases_[:]
selected_cases = []
Expand Down Expand Up @@ -363,6 +379,14 @@ def is_uuid(term):
if any(label in case.trace for label in skip):
cases.remove(case)

fc = os.environ.get("FC", "").split(maxsplit=1)
fc_version = _compiler_version(fc[0]) if fc and ARG("gpu") != "no" else ""
for case in cases[:]:
if nvhpc_gpu_known_difference(case.get_uuid(), ARG("gpu"), fc_version):
cons.print(f"[yellow]skipped {case.get_uuid()} ({case.trace}): known difference on NVHPC < 25.11 GPU, see #2181[/yellow]")
cases.remove(case)
skipped_cases.append(case)

# Skip tests that fail under nvfortran in Docker (pass natively/Apptainer):
# - 3D_rayleigh_taylor_muscl: segfaults with nvfortran+MPI (seccomp/mprotect)
# - the six UUIDs: intermittent post-detected NaN on Lagrangian-bubble goldens with the NVHPC 24.1/24.3 compat
Expand Down
27 changes: 27 additions & 0 deletions toolchain/mfc/test/test_nvhpc_known_difference.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""The NVHPC < 25.11 GPU skip (#2181) must hit only GPU builds with an old nvfortran."""

import pytest

from mfc.test.test import nvhpc_gpu_known_difference

OLD = "nvfortran 25.5-0 64-bit target on x86-64 Linux -tp haswell"


@pytest.mark.parametrize(
"uuid, gpu, version, skipped",
[
("124D7972", "acc", OLD, True),
("124D7972", "mp", OLD, True),
("124D7972", "acc", "nvfortran 24.5-0 64-bit target", True),
("124D7972", "acc", "nvfortran 25.11-0 64-bit target", False),
("124D7972", "acc", "nvfortran 26.1-0 64-bit target", False),
("124D7972", "acc", "nvfortran garbage", False),
("124D7972", "acc", "", False),
("124D7972", "no", OLD, False),
("124D7972", "acc", "GNU Fortran (GCC) 13.2.0", False),
("124D7972", "acc", "ftn 25.5", False),
("DEADBEEF", "acc", OLD, False),
],
)
def test_skip_decision(uuid, gpu, version, skipped):
assert nvhpc_gpu_known_difference(uuid, gpu, version) is skipped
Loading