From 4c4fc2bebe59859230d5f4b7598901a27fdc11e1 Mon Sep 17 00:00:00 2001 From: ajanicijamd Date: Wed, 4 Jun 2025 09:25:52 -0400 Subject: [PATCH] Fixed NIC performance monitoring test (#189) --------- Co-authored-by: David Galiffi [ROCm/rocprofiler-systems commit: b98c3c8b863004ac4b6b834d23611fa4906168d7] --- .../docker/Dockerfile.opensuse | 2 +- .../docker/Dockerfile.opensuse.ci | 2 +- .../docker/Dockerfile.rhel | 2 +- .../docker/Dockerfile.rhel.ci | 2 +- .../docker/Dockerfile.ubuntu | 2 +- .../docker/Dockerfile.ubuntu.ci | 2 +- .../tests/get_default_nic.sh | 27 +++++++++++++++++++ .../tests/rocprof-sys-nic-perf.cmake | 19 +++++++++---- 8 files changed, 47 insertions(+), 11 deletions(-) create mode 100755 projects/rocprofiler-systems/tests/get_default_nic.sh diff --git a/projects/rocprofiler-systems/docker/Dockerfile.opensuse b/projects/rocprofiler-systems/docker/Dockerfile.opensuse index d59f9bcb08..d48c13c290 100644 --- a/projects/rocprofiler-systems/docker/Dockerfile.opensuse +++ b/projects/rocprofiler-systems/docker/Dockerfile.opensuse @@ -25,7 +25,7 @@ RUN zypper --non-interactive update -y && \ zypper --non-interactive install -y -t pattern devel_basis && \ zypper --non-interactive install -y binutils-gold chrpath cmake curl dpkg-devel \ gcc-c++ git libdrm-devel libnuma-devel openmpi3-devel python3-pip rpm-build \ - wget && \ + wget iproute2 && \ python3 -m pip install 'cmake==3.21' ARG ROCM_VERSION=0.0 diff --git a/projects/rocprofiler-systems/docker/Dockerfile.opensuse.ci b/projects/rocprofiler-systems/docker/Dockerfile.opensuse.ci index 88637abcfb..80a51db8d3 100644 --- a/projects/rocprofiler-systems/docker/Dockerfile.opensuse.ci +++ b/projects/rocprofiler-systems/docker/Dockerfile.opensuse.ci @@ -29,7 +29,7 @@ RUN zypper --non-interactive update -y && \ zypper --non-interactive install -y -t pattern devel_basis && \ zypper --non-interactive install -y binutils-gold chrpath cmake curl dpkg-devel \ gcc-c++ git libnuma-devel openmpi3-devel papi-devel python3-pip \ - rpm-build vim wget && \ + rpm-build vim wget iproute2 && \ zypper --non-interactive clean --all && \ python3 -m pip install 'cmake==3.21' perfetto diff --git a/projects/rocprofiler-systems/docker/Dockerfile.rhel b/projects/rocprofiler-systems/docker/Dockerfile.rhel index a5ee8b3f0b..4a727c583a 100644 --- a/projects/rocprofiler-systems/docker/Dockerfile.rhel +++ b/projects/rocprofiler-systems/docker/Dockerfile.rhel @@ -16,7 +16,7 @@ ENV LIBRARY_PATH ${LIBRARY_PATH}:/opt/amdgpu/lib64 RUN yum groupinstall -y "Development Tools" && \ yum install -y epel-release && crb enable && \ yum install -y --allowerasing chrpath cmake curl dpkg-devel libdrm-devel numactl-devel \ - openmpi-devel papi-devel python3-pip texinfo wget which zlib-devel && \ + openmpi-devel papi-devel python3-pip texinfo wget which zlib-devel iproute && \ yum clean all && \ python3 -m pip install 'cmake==3.21' && \ python3 -m pip install 'perfetto' diff --git a/projects/rocprofiler-systems/docker/Dockerfile.rhel.ci b/projects/rocprofiler-systems/docker/Dockerfile.rhel.ci index 1fba6c2b94..fd85e3d8a6 100644 --- a/projects/rocprofiler-systems/docker/Dockerfile.rhel.ci +++ b/projects/rocprofiler-systems/docker/Dockerfile.rhel.ci @@ -20,7 +20,7 @@ ARG NJOBS="8" RUN yum groupinstall -y "Development Tools" && \ yum install -y epel-release && crb enable && \ yum install -y --allowerasing chrpath cmake curl dpkg-devel numactl-devel \ - openmpi-devel papi-devel python3-pip texinfo wget which vim zlib-devel && \ + openmpi-devel papi-devel python3-pip texinfo wget which vim zlib-devel iproute && \ yum clean all && \ python3 -m pip install 'cmake==3.21' perfetto diff --git a/projects/rocprofiler-systems/docker/Dockerfile.ubuntu b/projects/rocprofiler-systems/docker/Dockerfile.ubuntu index 4fc1c4cbb9..d3640e6e0c 100644 --- a/projects/rocprofiler-systems/docker/Dockerfile.ubuntu +++ b/projects/rocprofiler-systems/docker/Dockerfile.ubuntu @@ -23,7 +23,7 @@ RUN apt-get update && \ apt-get install -y apt-utils autoconf autotools-dev bash-completion bison \ build-essential chrpath cmake curl flex gettext git-core gnupg2 libnuma1 libopenmpi-dev \ libpapi-dev libpfm4-dev librpm-dev libtool libudev1 lsb-release m4 \ - python3-pip rpm texinfo wget && \ + python3-pip rpm texinfo wget iproute2 && \ OS_VERSION=$(cat /etc/os-release | grep VERSION_ID | sed 's/=/ /'1 | awk '{print $NF}' | sed 's/"//g') && \ if [ "${OS_VERSION}" == "24.04" ]; then \ python3 -m pip install --break-system-packages 'cmake==3.21'; \ diff --git a/projects/rocprofiler-systems/docker/Dockerfile.ubuntu.ci b/projects/rocprofiler-systems/docker/Dockerfile.ubuntu.ci index e36ba9b64d..5cf52c31d7 100644 --- a/projects/rocprofiler-systems/docker/Dockerfile.ubuntu.ci +++ b/projects/rocprofiler-systems/docker/Dockerfile.ubuntu.ci @@ -28,7 +28,7 @@ RUN apt-get update && \ apt-get install -y autoconf autotools-dev bash-completion bison build-essential \ bzip2 chrpath cmake curl environment-modules flex gettext git-core gnupg2 gzip \ libiberty-dev libpapi-dev libpfm4-dev libtool locales lsb-release m4 \ - python3-pip texinfo unzip wget vim zip zlib1g-dev && \ + python3-pip texinfo unzip wget vim zip zlib1g-dev iproute2 && \ apt-get autoclean && \ if [ "${OS_VERSION}" == "24.04" ]; then \ python3 -m pip install --break-system-packages 'cmake==3.21' perfetto \ diff --git a/projects/rocprofiler-systems/tests/get_default_nic.sh b/projects/rocprofiler-systems/tests/get_default_nic.sh new file mode 100755 index 0000000000..8c7d0af2dc --- /dev/null +++ b/projects/rocprofiler-systems/tests/get_default_nic.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +# MIT License +# +# Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + + +# This script gets the name of the default NIC and writes it to standard output. + +ip r | awk '/default/{print $5}' diff --git a/projects/rocprofiler-systems/tests/rocprof-sys-nic-perf.cmake b/projects/rocprofiler-systems/tests/rocprof-sys-nic-perf.cmake index ca1453bdbf..1c1bcd1639 100644 --- a/projects/rocprofiler-systems/tests/rocprof-sys-nic-perf.cmake +++ b/projects/rocprofiler-systems/tests/rocprof-sys-nic-perf.cmake @@ -26,7 +26,14 @@ # # -------------------------------------------------------------------------------------- # -set(_network_interface "lo") +# Get the name of the default NIC and write it to _network_interface. +execute_process( + COMMAND "${CMAKE_SOURCE_DIR}/tests/get_default_nic.sh" + OUTPUT_STRIP_TRAILING_WHITESPACE + OUTPUT_VARIABLE _network_interface) + +message(STATUS "Default network interface is ${_network_interface}") + set(_nic_perf_environment "${_base_environment}" "ROCPROFSYS_OUTPUT_PATH=${PROJECT_BINARY_DIR}/rocprof-sys-tests-output/nic-performance" @@ -38,18 +45,20 @@ set(_nic_perf_environment "ROCPROFSYS_USE_ROCM=OFF" "ROCPROFSYS_TIMEMORY_COMPONENTS=wall_clock,papi_array,network_stats" "ROCPROFSYS_NETWORK_INTERFACE=${_network_interface}" - "ROCPROFSYS_PAPI_EVENTS=net:::${_network_interface}:tx:byte,net:::${_network_interface}:rx:byte,net:::${_network_interface}:rx:packet,net:::${_network_interface}:tx:packet" - ) + "ROCPROFSYS_PAPI_EVENTS=net:::${_network_interface}:tx:byte net:::${_network_interface}:rx:byte net:::${_network_interface}:rx:packet net:::${_network_interface}:tx:packet" + "ROCPROFSYS_SAMPLING_DELAY=0.05") +# Set _download_url to a large file that will give rocprof-sys-sample time to collect NIC +# performance data. set(_download_url - "https://github.com/ROCm/rocprofiler-systems/releases/download/rocm-6.3.1/rocprofiler-systems-0.1.0-ubuntu-20.04-ROCm-60200-PAPI-OMPT-Python3.sh" + "https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.0/clang+llvm-20.1.0-armv7a-linux-gnueabihf.tar.gz" ) # Run the NIC performance test add_test( NAME nic-performance COMMAND $ -- wget --no-check-certificate - --quiet ${_download_url} -O /tmp/rocprofiler-systems-install.sh + ${_download_url} -O /tmp/rocprofiler-systems.test.bin WORKING_DIRECTORY ${PROJECT_BINARY_DIR}) set_tests_properties(nic-performance PROPERTIES ENVIRONMENT "${_nic_perf_environment}"