Skip to content

Commit

Permalink
Adding a worfklow for each component and the counter analysis toolkit.
Browse files Browse the repository at this point in the history
  • Loading branch information
Treece Burgess committed Nov 14, 2024
1 parent f4a8b19 commit 8f7fd17
Show file tree
Hide file tree
Showing 21 changed files with 538 additions and 74 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
As of now, the GitHub CI is designed to run in three instances:
1. A per component basis, meaning if a component's codebase is updated then we only will run CI tests for that component. As an example, if we update `cupti_profiler.c` in `src/components/cuda` then we will only run CI tests for that component.
2. A change in the PAPI framework i.e. in the `src/` directory. If this occurs then we will run a full test suite.
3. A weekly test which builds PAPI with multiple components. This is currently programmed to run weekly on Sundays at 5:00PM eastern time. This is being done to simulate users' behavior of compiling in multiple components for a PAPI build.


# Per Component Basis
All per component basis tests have a `.yml` that is structured with `componentName_component.yml`. As
an example for the `cuda` component we would have a `.yml` of `cuda_component.yml`. Therefore,
if a new component is added to PAPI, you will need to create a `.yml` based on the aforementioned structure.

Along with creating the `.yml` file, you will need to add an associated workflow. Below is a skeleton that can
be used as a starting point. As a reminder, make sure to change the necessary fields out for your component.

```
name: cuda # replace cuda with your component name
on:
pull_request:
paths:
- 'src/components/cuda/**' # replace the cuda path with your component
jobs:
component_tests:
strategy:
matrix:
component: [cuda] # replace cuda with your component name
debug: [yes, no]
shlib: [with, without]
fail-fast: false
runs-on: [self-hosted, nvidia_gpu]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: cuda component tests # replace cuda with your component name
run: .github/workflows/ci_per_component.sh ${{matrix.component}} ${{matrix.debug}} ${{matrix.shlib}}
````
# PAPI Framework
# Weekly Test
For the weekly test, we utilize the files `weekly_papi_build.yml` and the script `ci_weekly_papi_build.sh`. Any changes for the weekly test need to be done to these two files.
As a reminder this weekly test is ran on Sunday's at 5:00PM eastern time.
24 changes: 24 additions & 0 deletions .github/workflows/appio_component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: appio

on:
pull_request:
# run CI only if appio directory or appio sub-directories receive updates
# run CI if framework receives an update
paths:
- 'src/components/appio/**'
- 'src/*'

jobs:
component_tests:
strategy:
matrix:
component: [appio]
debug: [yes, no]
shlib: [with, without]
fail-fast: false
runs-on: [self-hosted, cpu_intel]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: appio component tests
run: .github/workflows/ci_per_component.sh ${{matrix.component}} ${{matrix.debug}} ${{matrix.shlib}}
20 changes: 20 additions & 0 deletions .github/workflows/cat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: counter analysis toolkit

on:
pull_request:
# run CI for updates to counter analysis toolkit
paths:
- 'src/counter_analysis_toolkit/**'
jobs:
component_tests:
strategy:
matrix:
debug: [yes, no]
shlib: [with, without]
fail-fast: false
runs-on: [self-hosted, cpu_intel]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: counter analysis toolkit tests
run: .github/workflows/ci_cat.sh ${{matrix.debug}} ${{matrix.shlib}}
48 changes: 48 additions & 0 deletions .github/workflows/ci_cat.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash -e

DEBUG=$1
SHLIB=$2
COMPILER=$3

[ -z "$COMPILER" ] && COMPILER=gcc@11

source /etc/profile
set +x
set -e
trap 'echo "# $BASH_COMMAND"' DEBUG
shopt -s expand_aliases

module load $COMPILER

# configuring and install PAPI
if [ "$SHLIB" = "with" ]; then
./configure --prefix=$PWD/cat-ci --with-debug=$DEBUG --enable-warnings --with-shlib-tools
else
./configure --prefix=$PWD/cat-ci --with-debug=$DEBUG --enable-warnings
fi
make -j4 && make install

# set PAPI_DIR for CAT
export PAPI_DIR=$PWD/cat-ci

cd counter_analysis_toolkit

# check detected architecture was correct
DETECTED_ARCH=$(make | head -n 1 | grep -o 'ARCH.*')
if [ "$DETECTED_ARCH" != "ARCH=X86" ]; then
echo "Failed to detect appropriate architecture."
exit 1
fi

make -j4

rm -rf OUT_DIR; mkdir OUT_DIR
echo "BR_INST_RETIRED 0" > event_list.txt
./cat_collect -in event_list.txt -out OUT_DIR -branch

# check cat ran successfully
FILENAME=$(cd OUT_DIR && ls)
if [ "$FILENAME" != "BR_INST_RETIRED.branch" ]; then
echo "Expected output file is not matched."
exit 1
fi
35 changes: 28 additions & 7 deletions .github/workflows/ci_per_component.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,19 @@ shopt -s expand_aliases

module load $COMPILER

CPU_COMPONENTS="perf_event perf_event_uncore sysdetect"

cd src

# cuda and nvml environment variables
if [ "$COMPONENT" = "cuda" || "$COMPONENT" = "nvml" ]; then
module load cuda
export PAPI_CUDA_ROOT=$ICL_CUDA_ROOT
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PAPI_CUDA_ROOT/extras/CUPTI/lib64
# lmsensors environment variables
if [ "$COMPONENT" = "lmsensors"]; then
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 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PAPI_LMSENSORS_ROOT/lib
fi

# rocm and rocm_smi environment variables
Expand All @@ -30,17 +36,32 @@ if [ "$COMPONENT" = "rocm" || "$COMPONENT" = "rocm_smi" ]; then
export PAPI_ROCMSMI_ROOT=$PAPI_ROCM_ROOT/rocm_smi
fi

# set necessary environemnt variables for cuda and nvml
if [ "$COMPONENT" = "cuda" || "$COMPONENT" = "nvml" ]; then
module load cuda
export PAPI_CUDA_ROOT=$ICL_CUDA_ROOT
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PAPI_CUDA_ROOT/extras/CUPTI/lib64
fi

# test linking with or without --with-shlib-tools
if [ "$SHLIB" = "with" ]; then
./configure --with-debug=$DEBUG --enable-warnings --with-components="$COMPONENTS" --with-shlib-tools
./configure --with-debug=$DEBUG --enable-warnings --with-components="$COMPONENT" --with-shlib-tools
else
./configure --with-debug=$DEBUG --enable-warnings --with-components="$COMPONENTS"
./configure --with-debug=$DEBUG --enable-warnings --with-components="$COMPONENT"
fi

make -j4

# run PAPI utilities
utils/papi_component_avail
ACTIVE_COMPONENTS=$(utils/papi_component_avail | grep -A1000 'Active components' | grep "Name:" | sed 's/Name: //' | awk '{print $1}' | paste -sd ' ' -)

if [ "$ACTIVE_COMPONENTS" != "$CPU_COMPONENTS $COMPONENT" ]; then
DISABLED_COMPONENTS=$(diff --side-by-side --suppress-common-lines <(echo "$EXPECTED_ACTIVE_COMPONENTS" | sed 's/ /\n/g') <(echo "$ACTIVE_COMPONENTS" | sed 's/ /\n/g') | awk '{print $2}')
echo -e "Components are disabled that should be active, these are:\n$DISABLED_COMPONENTS"
exit 1
fi


# without '--with-shlib-tools' in ./configure
if [ "$SHLIB" = "without" ]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,24 @@ module load $COMPILER

cd src

MATCH_COMPONENTS="cuda nvml rocm rocm_smi powercap powercap_ppc rapl sensors_ppc infiniband net appio io lustre stealtime coretemp lmsensors mx sde"
# load necessary environment variables for the above set of MATCH_COMPONENTS
if [ "$COMPONENTS" = "$MATCH_COMPONENTS" ]; then
# 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 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PAPI_LMSENSORS_ROOT/lib
# 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 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PAPI_LMSENSORS_ROOT/lib

# rocm and rocm_smi
export PAPI_ROCM_ROOT=`ls -d /opt/rocm-*`
export PAPI_ROCMSMI_ROOT=$PAPI_ROCM_ROOT/rocm_smi
# set necessary environment variables for rocm and rocm_smi
export PAPI_ROCM_ROOT=`ls -d /opt/rocm-*`
export PAPI_ROCMSMI_ROOT=$PAPI_ROCM_ROOT/rocm_smi

# 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
# set necessary environemnt 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

#MATCH_COMPONENTS="rocm rocm_smi"
# load necessary environment variables for testing of the rocm and rocm_smi components
#if [ "$COMPONENTS" = "$MATCH_COMPONENTS" ]; then
# export PAPI_ROCM_ROOT=`ls -d /opt/rocm-*`
# export PAPI_ROCMSMI_ROOT=$PAPI_ROCM_ROOT/rocm_smi
#fi

# test linking with or without --with-shlib-tools
if [ "$SHLIB" = "with" ]; then
Expand All @@ -57,7 +46,6 @@ fi
make -j4

# run PAPI utilities
echo "Running papi_component_avail: "
utils/papi_component_avail

# check list of active components
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/coretemp_component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: coretemp

on:
pull_request:
# run CI only if coretemp directory or coretemp sub-directories receive updates
# run CI if framework receives an update
paths:
- 'src/components/coretemp/**'
- 'src/*'

jobs:
component_tests:
strategy:
matrix:
component: [coretemp]
debug: [yes, no]
shlib: [with, without]
fail-fast: false
runs-on: [self-hosted, cpu_intel]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: coretemp component tests
run: .github/workflows/ci_per_component.sh ${{matrix.component}} ${{matrix.debug}} ${{matrix.shlib}}
24 changes: 24 additions & 0 deletions .github/workflows/cuda_component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: cuda

on:
pull_request:
# run CI only if cuda directory or cuda sub-directories receive updates
# run CI if framework receives an update
paths:
- 'src/components/cuda/**'
- 'src/*'

jobs:
component_tests:
strategy:
matrix:
component: [cuda]
debug: [yes, no]
shlib: [with, without]
fail-fast: false
runs-on: [self-hosted, gpu_nvidia]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: cuda component tests
run: .github/workflows/ci_per_component.sh ${{matrix.component}} ${{matrix.debug}} ${{matrix.shlib}}
24 changes: 24 additions & 0 deletions .github/workflows/example_component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: example

on:
pull_request:
# run CI only if example directory or example sub-directories receive updates
# run CI if framework receives an update
paths:
- 'src/components/example/**'
- 'src/*'

jobs:
component_tests:
strategy:
matrix:
component: [example]
debug: [yes, no]
shlib: [with, without]
fail-fast: false
runs-on: [self-hosted, cpu_intel]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: example component tests
run: .github/workflows/ci_per_component.sh ${{matrix.component}} ${{matrix.debug}} ${{matrix.shlib}}
24 changes: 24 additions & 0 deletions .github/workflows/intel_gpu_component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: intel_gpu

on:
pull_request:
# run CI only if intel_gpu directory or intel_gpu sub-directories receive updates
# run CI if framework receives an update
paths:
- 'src/components/intel_gpu/**'
- 'src/*'

jobs:
component_tests:
strategy:
matrix:
component: [intel_gpu]
debug: [yes, no]
shlib: [with, without]
fail-fast: false
runs-on: [self-hosted, gpu_intel]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: intel_gpu component tests
run: .github/workflows/ci_per_component.sh ${{matrix.component}} ${{matrix.debug}} ${{matrix.shlib}}
24 changes: 24 additions & 0 deletions .github/workflows/io_component.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: io

on:
pull_request:
# run CI only if io directory or io sub-directories receive updates
# run CI if framework receives an update
paths:
- 'src/components/io/**'
- 'src/*'

jobs:
component_tests:
strategy:
matrix:
component: [io]
debug: [yes, no]
shlib: [with, without]
fail-fast: false
runs-on: [self-hosted, cpu_intel]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- name: io component tests
run: .github/workflows/ci_per_component.sh ${{matrix.component}} ${{matrix.debug}} ${{matrix.shlib}}
Loading

0 comments on commit 8f7fd17

Please sign in to comment.