diff --git a/docs/documentation/testing.md b/docs/documentation/testing.md index 57cdc16232..856a778904 100644 --- a/docs/documentation/testing.md +++ b/docs/documentation/testing.md @@ -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 `. 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. diff --git a/toolchain/mfc/test/test.py b/toolchain/mfc/test/test.py index 6bc578beae..f7fe464e08 100644 --- a/toolchain/mfc/test/test.py +++ b/toolchain/mfc/test/test.py @@ -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, @@ -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 = [] @@ -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 diff --git a/toolchain/mfc/test/test_nvhpc_known_difference.py b/toolchain/mfc/test/test_nvhpc_known_difference.py new file mode 100644 index 0000000000..8e843b1a7d --- /dev/null +++ b/toolchain/mfc/test/test_nvhpc_known_difference.py @@ -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