Files
TheRock/build_tools/github_actions/test_executable_scripts/test_rccl.py
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

69 lines
2.2 KiB
Python

# Copyright Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT
import logging
import os
import shlex
import subprocess
import sys
from pathlib import Path
import pytest
sys.path.insert(0, os.fspath(Path(__file__).parent.parent))
from github_actions_api import get_visible_gpu_count
THEROCK_BIN_DIR = os.getenv("THEROCK_BIN_DIR")
SCRIPT_DIR = Path(__file__).resolve().parent
THEROCK_DIR = SCRIPT_DIR.parent.parent.parent
logging.basicConfig(level=logging.INFO)
class TestRCCL:
def test_rccl_unittests(self):
# Executing rccl gtest from rccl repo
environ_vars = os.environ.copy()
# Expect at least 2 GPUs for RCCL collectives
gpu_count = get_visible_gpu_count(
env=environ_vars, therock_bin_dir=THEROCK_BIN_DIR
)
logging.info(f"Visible GPU count: {gpu_count}")
if gpu_count < 2:
pytest.skip("Skipping RCCL unit tests: <2 GPUs visible")
environ_vars["HIP_VISIBLE_DEVICES"] = "2,3"
environ_vars["UT_MIN_GPUS"] = "2"
environ_vars["UT_MAX_GPUS"] = "2"
environ_vars["UT_POW2_GPUS"] = "1"
environ_vars["UT_PROCESS_MASK"] = "1"
cmd = [f"{THEROCK_BIN_DIR}/rccl-UnitTests"]
logging.info(f"++ Exec [{THEROCK_DIR}]$ {shlex.join(cmd)}")
result = subprocess.run(cmd, cwd=THEROCK_DIR, check=False, env=environ_vars)
assert result.returncode == 0
# Executing rccl performance and correctness tests from rccl-tests repo
@pytest.mark.parametrize(
"executable",
[
"all_gather_perf",
"alltoallv_perf",
"broadcast_perf",
"alltoall_perf",
"all_reduce_perf",
"reduce_perf",
"hypercube_perf",
"gather_perf",
"scatter_perf",
"sendrecv_perf",
"reduce_scatter_perf",
],
)
def test_rccl_correctness_tests(self, executable):
cmd = [f"{THEROCK_BIN_DIR}/{executable}"]
logging.info(f"++ Exec [{THEROCK_DIR}]$ {shlex.join(cmd)}")
result = subprocess.run(
cmd,
cwd=THEROCK_DIR,
check=False,
)
assert result.returncode == 0