diff --git a/build_tools/github_actions/fetch_test_configurations.py b/build_tools/github_actions/fetch_test_configurations.py index 413251f2799..a1163093b12 100644 --- a/build_tools/github_actions/fetch_test_configurations.py +++ b/build_tools/github_actions/fetch_test_configurations.py @@ -486,6 +486,20 @@ def _build_container_options(job_config: dict, platform: str) -> dict: # Architectures that we have multi GPU setup for testing "multi_gpu": {"linux": ["gfx94X-dcgpu", "gfx950-dcgpu"]}, }, + # rocSHMEM tests + "rocshmem": { + "job_name": "rocshmem", + "fetch_artifact_args": "--rocshmem --tests", + "timeout_minutes": 30, + "test_script": f"python {_get_script_path('test_runner.py')}", + "platform": ["linux"], + "total_shards_dict": { + "linux": 1, + }, + # rocSHMEM functional/unit tests launch via mpirun with RANKS 2..64, so + # they need a multi-GPU runner (same setup as rccl). + "multi_gpu": {"linux": ["gfx94X-dcgpu", "gfx950-dcgpu"]}, + }, # rocprofiler-sdk tests "rocprofiler-sdk": { "job_name": "rocprofiler-sdk", diff --git a/build_tools/github_actions/test_executable_scripts/test_runner.py b/build_tools/github_actions/test_executable_scripts/test_runner.py index ff0cac8510e..d765ae1a877 100644 --- a/build_tools/github_actions/test_executable_scripts/test_runner.py +++ b/build_tools/github_actions/test_executable_scripts/test_runner.py @@ -262,6 +262,22 @@ ], }, }, + # rocshmem's functional/unit test wrappers run rocshmem_info to auto-detect + # the backend. rocshmem_info is installed via install(PROGRAMS ...) (not as a + # target), so it keeps its build-tree RPATH and can't find its shared libs + # (libamdhip64.so.7, librocm_sysdeps_numa.so.1, ...) in the relocated test + # artifact. Prepend the install lib dir and the bundled sysdeps lib dir to + # LD_LIBRARY_PATH so the probe resolves the ROCm runtime + sysdeps libs. + # (The test binaries themselves install to bin/ as targets and resolve libs + # via their relocatable RPATH, so this only fixes the backend-detection probe.) + "rocshmem": { + "additional_env_paths": { + "LD_LIBRARY_PATH": [ + ["lib"], + ["lib", "rocm_sysdeps", "lib"], + ], + }, + }, } diff --git a/build_tools/github_actions/tests/fetch_test_configurations_test.py b/build_tools/github_actions/tests/fetch_test_configurations_test.py index f637269dc09..ae0859ea6ee 100644 --- a/build_tools/github_actions/tests/fetch_test_configurations_test.py +++ b/build_tools/github_actions/tests/fetch_test_configurations_test.py @@ -307,10 +307,13 @@ def fake_select_weighted_label(labels_config, context_name): rccl = next(j for j in components if j["job_name"] == "rccl") self.assertEqual(rccl["multi_gpu_runner"], "linux-mi300-mgpu-a") - # Verify select_weighted_label was called for rccl multi-gpu + # Verify select_weighted_label was called for the multi-gpu jobs. + # With rocshmem added there is more than one multi-GPU job (rccl and + # rocshmem), each using a "-multi-gpu" context. multi_gpu_calls = [c for c in selected_labels if "multi-gpu" in c[1]] - self.assertEqual(len(multi_gpu_calls), 1) - self.assertEqual(multi_gpu_calls[0][1], "rccl-multi-gpu") + multi_gpu_contexts = {c[1] for c in multi_gpu_calls} + self.assertIn("rccl-multi-gpu", multi_gpu_contexts) + self.assertIn("rocshmem-multi-gpu", multi_gpu_contexts) finally: fetch_test_configurations.select_weighted_label = ( original_select_weighted_label diff --git a/build_tools/install_rocm_from_artifacts.py b/build_tools/install_rocm_from_artifacts.py index 8942414c277..68cc322c5d0 100644 --- a/build_tools/install_rocm_from_artifacts.py +++ b/build_tools/install_rocm_from_artifacts.py @@ -34,6 +34,7 @@ [--prim | --no-prim] [--rand | --no-rand] [--rccl | --no-rccl] + [--rocshmem | --no-rocshmem] [--rocdecode | --no-rocdecode] [--rocjpeg | --no-rocjpeg] [--rocjitsu | --no-rocjitsu] @@ -387,6 +388,7 @@ def retrieve_artifacts_by_run_id(args): args.mpi, args.rand, args.rccl, + args.rocshmem, args.rocdecode, args.rocjpeg, args.rocjitsu, @@ -488,6 +490,16 @@ def retrieve_artifacts_by_run_id(args): extra_artifacts.append("rand") if args.rccl: extra_artifacts.append("rccl") + if args.rocshmem: + extra_artifacts.append("rocshmem") + # The functional test binary (bin/rocshmem_functional_tests) and + # bin/rocshmem_info live in the _run component; the install-tree + # CTestTestfile.cmake references them via relative paths. + argv.append("rocshmem_run") + # rocSHMEM tests launch via mpirun and link against TheRock's + # vendored OpenMPI, so pull it (with its run component for mpiexec). + extra_artifacts.append("openmpi") + argv.append("openmpi_run") if args.rocprofiler_sdk: extra_artifacts.append("rocprofiler-sdk") extra_artifacts.append("aqlprofile") @@ -853,6 +865,13 @@ def main(argv): action=argparse.BooleanOptionalAction, ) + artifacts_group.add_argument( + "--rocshmem", + default=False, + help="Include 'rocshmem' artifacts", + action=argparse.BooleanOptionalAction, + ) + artifacts_group.add_argument( "--mpi", default=False, diff --git a/build_tools/tests/install_rocm_from_artifacts_test.py b/build_tools/tests/install_rocm_from_artifacts_test.py index 301fc5a06d8..de2d4ffea45 100644 --- a/build_tools/tests/install_rocm_from_artifacts_test.py +++ b/build_tools/tests/install_rocm_from_artifacts_test.py @@ -157,6 +157,7 @@ def _make_run_id_args(**overrides) -> argparse.Namespace: prim=False, rand=False, rccl=False, + rocshmem=False, mpi=False, rocdecode=False, rocjpeg=False, diff --git a/comm-libs/CMakeLists.txt b/comm-libs/CMakeLists.txt index 7fa08de6643..8e8a0f9a0b9 100644 --- a/comm-libs/CMakeLists.txt +++ b/comm-libs/CMakeLists.txt @@ -160,6 +160,10 @@ if(THEROCK_ENABLE_ROCSHMEM) "-DEXPLICIT_ROCM_VERSION=${ROCM_MAJOR_VERSION}.${ROCM_MINOR_VERSION}.${ROCM_PATCH_VERSION}" -DBUILD_FUNCTIONAL_TESTS=${THEROCK_BUILD_TESTING} -DBUILD_UNIT_TESTS=${THEROCK_BUILD_TESTING} + # Register functional/unit tests with CTest and install the relocatable + # bin/rocshmem/**/CTestTestfile.cmake files (with quick/standard/ + # comprehensive/full tier labels) that test_runner.py drives via ctest. + -DBUILD_CTESTS=${THEROCK_BUILD_TESTING} -DSOURCE_DIR=${_source_dir} -DPATCHELF=${PATCHELF} -DPython3_EXECUTABLE=${Python3_EXECUTABLE} diff --git a/comm-libs/artifact-rocshmem.toml b/comm-libs/artifact-rocshmem.toml index e3a65f9e715..22e20a755db 100644 --- a/comm-libs/artifact-rocshmem.toml +++ b/comm-libs/artifact-rocshmem.toml @@ -6,7 +6,6 @@ include = [ [components.run."comm-libs/rocshmem/stage"] include = [ "bin/rocshmem_info", - "bin/rocshmem_functional_tests", "share/rocshmem/rocshmem_functional_driver.sh", ] [components.dbg."comm-libs/rocshmem/stage"] @@ -21,4 +20,21 @@ include = [ ] # Tests [components.test."comm-libs/rocshmem/stage"] +include = [ + # Install-tree CTest files: test_runner.py runs `ctest --test-dir bin/rocshmem`, + # whose root CTestTestfile.cmake subdirs into tests/functional and tests/unit. + "bin/rocshmem/**", + # Test binaries. Both the functional and unit test executables install to + # bin/ (CMAKE_INSTALL_BINDIR) so their RPATH ($ORIGIN/../lib) resolves the + # ROCm runtime libs (e.g. libhiprtc.so.7). + "bin/rocshmem_functional_tests", + "bin/rocshmem_unit_tests", + # CTest wrapper scripts referenced (by relative path) from the install-tree + # CTestTestfile.cmake, plus the retry helper. + "share/rocshmem/test_wrapper.sh", + "share/rocshmem/unit_test_wrapper.sh", + "share/rocshmem/ctest_with_retry.sh", + # HSACOs used by the device_bitcode functional tests (quick tier). + "share/rocshmem/*.hsaco", +] optional = true