From 4a0a6937f24a22d189182c21b09213e5e48c7d32 Mon Sep 17 00:00:00 2001 From: Treece Burgess Date: Thu, 7 Nov 2024 02:51:21 +0000 Subject: [PATCH] Update PAPI GitHub CI to reduce the number of tests and to add shlib tests. --- .github/workflows/ci.sh | 49 ++++++++++------- .github/workflows/main.yml | 37 +++++++------ src/run_tests_shlib.sh | 107 +++++++++++++++++++++++++++++++++++++ 3 files changed, 156 insertions(+), 37 deletions(-) create mode 100755 src/run_tests_shlib.sh diff --git a/.github/workflows/ci.sh b/.github/workflows/ci.sh index 38652db2b..8eb67eee5 100755 --- a/.github/workflows/ci.sh +++ b/.github/workflows/ci.sh @@ -1,8 +1,9 @@ #!/bin/bash -e -COMPONENT=$1 +COMPONENTS=$1 DEBUG=$2 -COMPILER=$3 +SHLIB=$3 +COMPILER=$4 [ -z "$COMPILER" ] && COMPILER=gcc@11 @@ -16,47 +17,55 @@ module load $COMPILER cd src -if [ "$COMPONENT" = "lmsensors" ]; then +if [ "$COMPONENTS" = "cuda nvml lmsensors io net powercap appio lustre coretemp rapl sde stealtime" ]; then + # Set necessary environment variables for lmsensors wget https://github.com/groeck/lm-sensors/archive/V3-4-0.tar.gz tar -zxf V3-4-0.tar.gz cd lm-sensors-3-4-0 make install PREFIX=../lm ETCDIR=../lm/etc cd .. export PAPI_LMSENSORS_ROOT=lm - export PAPI_LMSENSORS_INC=$PAPI_LMSENSORS_ROOT/include/sensors - export PAPI_LMSENSORS_LIB=$PAPI_LMSENSORS_ROOT/lib64 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PAPI_LMSENSORS_ROOT/lib -fi -if [ "$COMPONENT" = "cuda" ] || [ "$COMPONENT" = "nvml" ]; then + # Set necessary environment variables for cuda and nvml module load cuda export PAPI_CUDA_ROOT=$ICL_CUDA_ROOT export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PAPI_CUDA_ROOT/extras/CUPTI/lib64 + fi -if [ "$COMPONENT" = "rocm" ] || [ "$COMPONENT" = "rocm_smi" ]; then +if [ "$COMPONENTS" = "rocm rocm_smi" ]; then export PAPI_ROCM_ROOT=`ls -d /opt/rocm-*` export PAPI_ROCMSMI_ROOT=$PAPI_ROCM_ROOT/rocm_smi fi -if [ "$COMPONENT" = "infiniband_umad" ]; then - export PAPI_INFINIBAND_UMAD_ROOT=/usr -fi - -if [ "$COMPONENT" = "perf_event" ]; then - ./configure --with-debug=$DEBUG --enable-warnings +if [ "$SHLIB" = "with" ]; then + ./configure --with-debug=$DEBUG --enable-warnings --with-components="$COMPONENTS" --with-shlib-tools else - ./configure --with-debug=$DEBUG --enable-warnings --with-components=$COMPONENT + ./configure --with-debug=$DEBUG --enable-warnings --with-components="$COMPONENTS" fi +#touch /tmp/component_names.txt +#for component in $COMPONENTS; do +# echo "Name: $component" >> /tmp/component_names.txt +#done + +CHECK_COMPONENTS=$(echo $COMPONENTS | sed 's/ /|/g') +echo $CHECK_COMPONENTS + make -j4 utils/papi_component_avail -# Make sure the $COMPONENT is active -utils/papi_component_avail | grep -A1000 'Active components' | grep -q "Name: $COMPONENT " +# Make sure the list of components are active +utils/papi_component_avail | grep -A1000 'Active components' | grep -E $CHECK_COMPONENTS + +#if [ "$COMPONENTS" != "cuda nvml" ]; then +# echo Testing +# ./run_tests.sh +#fi -if [ "$COMPONENT" != "cuda" ]; then - echo Testing - ./run_tests.sh +if [ "$SHLIB" = "with" ]; then + echo "Running single component test for active components" + ./run_tests_shlib.sh TESTS_QUIET fi diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0f3b01f6d..f4032561b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -13,50 +13,53 @@ jobs: papi_component: strategy: matrix: - component: [perf_event, lmsensors, io, net, powercap, appio, coretemp, stealtime] + components: [cuda nvml lmsensors io net powercap appio lustre coretemp rapl sde stealtime] debug: [yes, no] + shlib: [with, without] fail-fast: false - runs-on: cpu_intel + runs-on: [self-hosted, cpu_intel, gpu_nvidia] timeout-minutes: 60 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Test - run: .github/workflows/ci.sh ${{matrix.component}} ${{matrix.debug}} - papi_component_nvidia: + run: .github/workflows/ci.sh "${{matrix.components}}" ${{matrix.debug}} ${{matrix.shlib}} + papi_component_amd: strategy: matrix: - component: [cuda, nvml] + components: [rocm rocm_smi] debug: [yes, no] + shlib: [with, without] fail-fast: false - runs-on: gpu_nvidia + runs-on: [self-hosted, gpu_amd] timeout-minutes: 60 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Test - run: .github/workflows/ci.sh ${{matrix.component}} ${{matrix.debug}} - papi_component_amd: + run: .github/workflows/ci.sh "${{matrix.components}}" ${{matrix.debug}} ${{matrix.shlib}} + papi_component_intel_gpu: strategy: matrix: - component: [rocm, rocm_smi] - debug: [yes, no] + components: [intel_gpu] + debug: [yes, no] + shlib: [with, without] fail-fast: false - runs-on: gpu_amd + runs-on: [self-hosted, gpu_intel] timeout-minutes: 60 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Test - run: .github/workflows/ci.sh ${{matrix.component}} ${{matrix.debug}} + run: .github/workflows/ci.sh "${{matrix.components}}" ${{matrix.debug}} ${{matrix.shlib}} papi_spack: runs-on: cpu timeout-minutes: 60 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Build/Test/Install via Spack run: .github/workflows/spack.sh papi_clang_analysis: runs-on: cpu steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run static analysis run: .github/workflows/clang_analysis.sh clang-analysis-output - name: Archive analysis results diff --git a/src/run_tests_shlib.sh b/src/run_tests_shlib.sh new file mode 100755 index 000000000..4e18c73ef --- /dev/null +++ b/src/run_tests_shlib.sh @@ -0,0 +1,107 @@ +#!/bin/sh + +# File: run_tests_shlib.sh +# Author: Treece Burgess +# tburgess@icl.utk.edu + +# If the tests are not built then build them +echo $BUILD +if [ "x$BUILD" != "x" ]; then + for comp in `ls components/*/tests` ; do \ + cd components/$$comp/tests ; make; cd ../../.. ; + done +fi + +TESTS_QUIET="" +# Determine if to suppress output or send to stdout +if [ $# != 0 ]; then + if [ $1 = "TESTS_QUIET" ]; then + TESTS_QUIET=$1 + else + echo "Failed to quiet tests. Must pass TESTS_QUIET." + echo "" + fi +fi + +# Determine if VALGRIND is set +if [ "x$VALGRIND" != "x" ]; then + VALGRIND="valgrind --leak-check=full"; +fi + +# List of active components +ACTIVE_COMPONENTS=$(utils/papi_component_avail | awk '/Active components:/{flag=1; next} flag' | grep "Name:" | sed 's/Name: //' | awk '{print $1}' | paste -sd' ' -) + +# Format active components to get inactive components +ACTIVE_COMPONENTS_PATTERN=$(echo $ACTIVE_COMPONENTS | sed 's/ /|/g') + +# Find the test files, filtering for inactive components +INACTIVE_COMPONENTS=$(find components/*/tests -perm -u+x -type f ! \( -name "*.[c|h]" -o -name "*.cu" -o -name "*.so" \) | grep -vE "components/($ACTIVE_COMPONENTS_PATTERN)/") + +EXCLUDE_TXT=`grep -v -e '^#\|^$' run_tests_exclude.txt` +EXCLUDE_TESTS="$EXCLUDE_TXT $INACTIVE_COMPONENTS"; + +ACTIVE_COMPONENTS_TESTS="" +for cmp in $ACTIVE_COMPONENTS; +do + query_cmp_test=$(find components/*/tests -perm -u+x -type f ! \( -name "*.[c|h]" -o -name "*.cu" -o -name "*.so" \) | grep -E -m 1 "components/($cmp)/") + case $EXCLUDE_TESTS in + *"$query_cmp_test"*) + continue + ;; + esac + ACTIVE_COMPONENTS_TESTS="$ACTIVE_COMPONENTS_TESTS $query_cmp_test" +done + +# System information +echo "Platform:" +uname -a + +echo "Date:" +date + +echo "" +if [ -r /proc/cpuinfo ]; then + echo "Cpuinfo:" + # only print info on first processor on x86 + sed '/^$/q' /proc/cpuinfo +fi + +echo "" +if [ "x$VALGRIND" != "x" ]; then + echo "The following test cases will be run using valgrind:"; +else + echo "The following test cases will be run:"; +fi + +# This List will only show a single test for each active component +echo $ACTIVE_COMPONENTS_TESTS + +echo "" +echo "The following test cases will NOT be run:"; +echo $EXCLUDE_TESTS; + +# Set LD_LIBRARY_PATH +if [ "$LD_LIBRARY_PATH" = "" ]; then + LD_LIBRARY_PATH=.:./libpfm4/lib +else + LD_LIBRARY_PATH=.:./libpfm4/lib:"$LD_LIBRARY_PATH" +fi +export LD_LIBRARY_PATH + +echo ""; +echo "Running a Single Component Test for --with-shlib-tools"; +echo "" + +# Run a single component test +for cmp_test in $ACTIVE_COMPONENTS_TESTS; +do + if [ -x $cmp_test ]; then + printf "Running $cmp_test:\n"; + printf "%-59s" "" + if [ x$cmp == xsde ]; then + LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PWD}/components/sde/sde_lib:${PWD}/components/sde/tests/lib $VALGRIND ./$cmp_test $TESTS_QUIET + else + $VALGRIND ./$cmp_test $TESTS_QUIET + fi + fi +done