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

184 lines
5.3 KiB
Python

# Copyright (c) Advanced Micro Devices, Inc.
# SPDX-License-Identifier: MIT
"""
Lulesh tests.
"""
from __future__ import annotations
import pytest
from conftest import RocprofsysTest
# These binaries link against libgomp
pytestmark = [pytest.mark.lulesh, pytest.mark.openmp]
# =============================================================================
# Lulesh fixtures
# =============================================================================
@pytest.fixture
def lulesh_base_env() -> dict[str, str]:
env = {
"ROCPROFSYS_USE_KOKKOSP": "ON",
"ROCPROFSYS_COUT_OUTPUT": "ON",
"ROCPROFSYS_SAMPLING_FREQ": "50",
"ROCPROFSYS_KOKKOSP_PREFIX": "[kokkos]",
}
return env
# =============================================================================
# Lulesh tests
# =============================================================================
# TODO: LULESH_USE_HIP does not currently work properly out of the box, tofix
# TODO: LULESH_USE_MPI does not currently work, tofix
class TestLulesh(RocprofsysTest):
@pytest.mark.parametrize(
"mode",
["baseline", "sampling", "binary_rewrite", "runtime_instrument", "sys_run"],
)
def test(self, mode, lulesh_base_env):
env = lulesh_base_env.copy()
env["KOKKOS_TOOLS_LIBS"] = "librocprof-sys-dl.so"
result = self.run_test(
mode,
"lulesh",
env=env,
run_args=["-i", "5", "-s", "20", "-p"],
binary_rewrite_args=[
"-e",
"-v",
"2",
"--label",
"file",
"line",
"return",
"args",
],
runtime_instrument_args=[
"-e",
"-v",
"1",
"--label",
"file",
"line",
"return",
"args",
"-ME",
"lib(gomp|m-)",
],
)
self.assert_regex(
result,
mode,
binary_rewrite_pass_regex=[r"\|_\[kokkos\] [a-zA-Z]"],
runtime_instrument_pass_regex=[r"\|_\[kokkos\] [a-zA-Z]"],
)
@pytest.mark.baseline
@pytest.mark.parametrize("lib", ["librocprof-sys", "librocprof-sys-dl"])
def test_baseline_kokkosp(self, lib, lulesh_base_env):
env = lulesh_base_env.copy()
env["KOKKOS_TOOLS_LIBS"] = f"{lib}.so"
result = self.run_test(
"baseline",
"lulesh",
env=env,
run_args=["-i", "10", "-s", "20", "-p"],
)
self.assert_regex(result, pass_regex=[r"\|_\[kokkos\] [a-zA-Z]"])
@pytest.mark.parametrize(
"mode", ["sampling", "binary_rewrite", "runtime_instrument", "sys_run"]
)
def test_kokkosp(self, mode):
env = {"ROCPROFSYS_USE_KOKKOSP": "ON"}
result = self.run_test(
mode,
"lulesh",
env=env,
run_args=["-i", "10", "-s", "20", "-p"],
binary_rewrite_args=["-e", "-v", "2"],
runtime_instrument_args=[
"-e",
"-v",
"1",
"--label",
"file",
"line",
"return",
"args",
"-ME",
"lib(gomp|m-)",
],
)
self.assert_regex(result)
@pytest.mark.parametrize(
"mode", ["sampling", "binary_rewrite", "runtime_instrument", "sys_run"]
)
def test_perfetto(self, mode, perfetto_env):
env = perfetto_env.copy()
env["ROCPROFSYS_USE_KOKKOSP"] = "OFF"
result = self.run_test(
mode,
"lulesh",
env=env,
run_args=["-i", "10", "-s", "20", "-p"],
binary_rewrite_args=["-e", "-v", "2"],
runtime_instrument_args=[
"-e",
"-v",
"1",
"-l",
"--dynamic-callsites",
"--traps",
"--allow-overlapping",
"-ME",
"libgomp",
],
)
self.assert_regex(result)
@pytest.mark.parametrize(
"mode",
["baseline", "sampling", "binary_rewrite", "runtime_instrument", "sys_run"],
)
def test_timemory(self, mode, timemory_env):
env = timemory_env.copy()
env["ROCPROFSYS_USE_KOKKOSP"] = "OFF"
result = self.run_test(
mode,
"lulesh",
env=env,
run_args=["-i", "2", "-s", "20", "-p"],
binary_rewrite_args=[
"-e",
"-v",
"2",
"-l",
"--dynamic-callsites",
"--traps",
"--allow-overlapping",
],
runtime_instrument_args=[
"-e",
"-v",
"1",
"-l",
"--dynamic-callsites",
"-ME",
"libgomp",
"--env",
"ROCPROFSYS_TIMEMORY_COMPONENTS=wall_clock peak_rss",
],
)
self.assert_regex(
result,
mode,
binary_rewrite_fail_regex=["0 instrumented loops in procedure"],
)