Files
TheRock/rocm-systems/projects/rocprofiler-systems/tests/shmem_validation_check.sh
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

97 lines
3.2 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
#
# Copyright (c) Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT
#
# Runs "oshrun -n <NP> <EXE>", validates output. Use with CTest SKIP_RETURN_CODE 77.
# Exit 0 → SHMEM OK (fixture shmem_available is set; dependent tests run).
# Exit 77 → SHMEM unavailable / runtime failure / output mismatch (test skipped in CI).
# Other → real test logic failure (rare).
#
# Expected output (e.g. oshrun -np 2 ./shmem-hello):
# Hello from PE 0 of 2
# PE 0 received value 1 from PE 1
# Hello from PE 1 of 2
# PE 1 received value 0 from PE 0
#
# Usage: shmem_validation_check.sh <oshrun_exe> <num_pes> <hello_exe> [marker_file] [pingpong_exe]
# If marker_file is given, it is created (touched) on success so CTest can gate other tests.
# If pingpong_exe is given, ldd output is printed for diagnostics.
OSHRUN="$1"
NP="$2"
EXE="$3"
MARKER="$4"
PINGPONG="$5"
if [[ -z "$OSHRUN" || -z "$NP" || -z "$EXE" ]]; then
echo "Usage: $0 <oshrun_exe> <num_pes> <hello_exe>"
exit 77
fi
# Remove stale marker from previous runs so validation-passed cannot pass on remnants
if [[ -n "$MARKER" ]]; then
rm -f "$MARKER"
fi
# Always print ldd output at the beginning for diagnostics (pass or fail)
if [[ -n "$PINGPONG" ]]; then
echo "--- ldd shmem-pingpong ---"
ldd "$PINGPONG" 2>&1 || true
echo "--- end ldd ---"
fi
echo "--- oshrun version ---"
"$OSHRUN" --version 2>&1 || "$OSHRUN" -V 2>&1 || true
echo "--- end oshrun version ---"
OUTPUT=$("$OSHRUN" -n "$NP" "$EXE" 2>&1)
STATUS=$?
if [[ $STATUS -ne 0 ]]; then
echo "SHMEM runtime failed (oshrun exit=$STATUS) – skipping SHMEM tests"
echo "--- oshrun output ---"
echo "$OUTPUT"
echo "--- end output ---"
exit 77
fi
# Require both greeting lines and "received value" lines (order may vary by PE)
if ! echo "$OUTPUT" | grep -qE "Hello from PE [0-9]+ of ${NP}"; then
echo "SHMEM validation: missing 'Hello from PE X of ${NP}' – skipping"
echo "--- oshrun output ---"
echo "$OUTPUT"
echo "--- end output ---"
exit 77
fi
if ! echo "$OUTPUT" | grep -qE "PE [0-9]+ received value [0-9]+ from PE [0-9]+"; then
echo "SHMEM validation: missing 'PE X received value Y from PE Z' – skipping"
echo "--- oshrun output ---"
echo "$OUTPUT"
echo "--- end output ---"
exit 77
fi
# For np=2 we expect both PEs to have said hello and both to have received a value
if [[ "$NP" -eq 2 ]]; then
if ! echo "$OUTPUT" | grep -q "Hello from PE 0 of 2" || ! echo "$OUTPUT" | grep -q "Hello from PE 1 of 2"; then
echo "SHMEM validation: expected both PE 0 and PE 1 greetings – skipping"
echo "--- oshrun output ---"
echo "$OUTPUT"
echo "--- end output ---"
exit 77
fi
if ! echo "$OUTPUT" | grep -q "PE 0 received value 1 from PE 1" || ! echo "$OUTPUT" | grep -q "PE 1 received value 0 from PE 0"; then
echo "SHMEM validation: expected PE 0 received from PE 1 and PE 1 from PE 0 – skipping"
echo "--- oshrun output ---"
echo "$OUTPUT"
echo "--- end output ---"
exit 77
fi
fi
# Signal success so a follow-up test can set the fixture (CTest only sets fixture on pass)
if [[ -n "$MARKER" ]]; then
touch "$MARKER"
fi
exit 0