From a1f23083fc510c28c7899718418c94f15c899237 Mon Sep 17 00:00:00 2001 From: Jose Santos Date: Tue, 18 Nov 2025 10:53:37 -0600 Subject: [PATCH 1/6] Add rocm-cmake --- apptainer/intelliperf.def | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apptainer/intelliperf.def b/apptainer/intelliperf.def index da1fa972..010de978 100644 --- a/apptainer/intelliperf.def +++ b/apptainer/intelliperf.def @@ -22,7 +22,7 @@ From: rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0 # Install additional system dependencies apt-get -y update - apt-get install -y software-properties-common git wget clang lld libzstd-dev libomp-dev vim libdwarf-dev gdb tmux + apt-get install -y software-properties-common git wget clang lld libzstd-dev libomp-dev vim libdwarf-dev gdb tmux cmake # Upgrade pip pip install --upgrade pip @@ -59,6 +59,14 @@ From: rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0 litellm[proxy] " + git clone https://github.com/ROCm/rocm-cmake.git + cd rocm-cmake + mkdir build + cd build + cmake .. + cmake --build . + cmake --build . --target install + %runscript echo "Welcome to IntelliPerf with ROCm 7.0!" source /opt/conda/bin/activate py_3.10 From 1b0aed8561d716b1397052648aa52bd2091ad33b Mon Sep 17 00:00:00 2001 From: Jose Santos Date: Fri, 9 Jan 2026 13:11:44 -0600 Subject: [PATCH 2/6] add change base of image - remove invaalid command from runscript - add unzip --- apptainer/build_multi_base.sh | 168 ++++++++++++++++++++++++++++++++++ apptainer/intelliperf.def | 5 +- 2 files changed, 170 insertions(+), 3 deletions(-) create mode 100755 apptainer/build_multi_base.sh diff --git a/apptainer/build_multi_base.sh b/apptainer/build_multi_base.sh new file mode 100755 index 00000000..0dd1887f --- /dev/null +++ b/apptainer/build_multi_base.sh @@ -0,0 +1,168 @@ +#!/bin/bash +# SPDX-License-Identifier: MIT +# Generate IntelliPerf definition files from different base images + +set -e + +# Default values +BASE_IMAGE="" +OUTPUT_NAME="" +DEF_TEMPLATE="intelliperf.def" +SCRIPT_DIR=$(dirname $(realpath $0)) + +# Preset base images +declare -A PRESETS=( + ["composable_kernel"]="rocm/composable_kernel:ck_ub24.04_rocm7.1.1_amd-staging" + ["gemm"]="rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0" + ["matrix_transpose1"]="rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0" + ["vllm"]="rocm/vllm:rocm7.0.0_vllm_0.11.2_20251210" + ["counting_sketch"]="rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0" + ["global_reduction"]="rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0" + ["silu"]="rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0" + ["Dataset_hip"]="rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0" + ["gpu-kernel-agent"]="rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0" + ["point_to_voxel"]="rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0" + ["diff_gaussian_rasterization"]="rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0" + ["gsplat"]="rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0" + ["histogram"]="rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0" + ["reduction"]="rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0" + ["causal_conv1d_fwd"]="rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0" + ["element_multiply"]="rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0" + ["matrix_transpose"]="rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0" + ["rocm7.0-pytorch"]="rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0" + ["rocm7.1-pytorch"]="rocm/pytorch:rocm7.1_ubuntu22.04_py3.10_pytorch_release_2.8.0" + ["composable-kernel"]="rocm/composable_kernel:ck_pytorch" + ["rocm6.2-pytorch"]="rocm/pytorch:rocm6.2_ubuntu22.04_py3.10_pytorch_release_2.4.0" + ["rocm7.0-ubuntu22"]="rocm/rocm-terminal:rocm7.0-ubuntu22.04" + ["rocm7.1-ubuntu22"]="rocm/rocm-terminal:rocm7.1-ubuntu22.04" + ["rocm7.0-vllm"]="rocm/vllm:rocm7.0.0_vllm_0.11.2_20251210" + +) + +# Help message +show_help() { + cat << EOF +Usage: $0 [OPTIONS] + +Generate IntelliPerf Apptainer definition files from different base images. + +OPTIONS: + -b, --base IMAGE Base Docker image (required) + -o, --output NAME Output .def filename (default: intelliperf-.def) + -t, --template FILE Template .def file (default: intelliperf.def) + -p, --preset NAME Use preset base image (see list below) + -l, --list List available presets + -h, --help Show this help message + +PRESETS: +EOF + for preset in "${!PRESETS[@]}"; do + echo " $preset: ${PRESETS[$preset]}" + done | sort + echo "" + echo "EXAMPLES:" + echo " # Generate def file from rocm7.1-pytorch preset" + echo " $0 --preset rocm7.1-pytorch" + echo "" + echo " # Generate def file from custom base image" + echo " $0 --base rocm/pytorch:rocm7.2_ubuntu22.04_py3.10_pytorch_release_2.9.0 --output intelliperf-rocm72.def" + echo "" + echo " # Generate using intelliperf_ck.def template with different base" + echo " $0 --preset rocm7.1-pytorch --template intelliperf_ck.def --output intelliperf-ck-rocm71.def" +} + +# Parse arguments +while [[ $# -gt 0 ]]; do + case $1 in + -b|--base) + BASE_IMAGE="$2" + shift 2 + ;; + -o|--output) + OUTPUT_NAME="$2" + shift 2 + ;; + -t|--template) + DEF_TEMPLATE="$2" + shift 2 + ;; + -p|--preset) + PRESET_NAME="$2" + if [[ -z "${PRESETS[$PRESET_NAME]}" ]]; then + echo "Error: Unknown preset '$PRESET_NAME'" + echo "Use --list to see available presets" + exit 1 + fi + BASE_IMAGE="${PRESETS[$PRESET_NAME]}" + # Set default output name based on preset if not specified + if [[ -z "$OUTPUT_NAME" ]]; then + OUTPUT_NAME="intelliperf-${PRESET_NAME}.def" + fi + shift 2 + ;; + -l|--list) + echo "Available presets:" + for preset in "${!PRESETS[@]}"; do + echo " $preset: ${PRESETS[$preset]}" + done | sort + exit 0 + ;; + -h|--help) + show_help + exit 0 + ;; + *) + echo "Unknown option: $1" + show_help + exit 1 + ;; + esac +done + +# Validate required arguments +if [[ -z "$BASE_IMAGE" ]]; then + echo "Error: Base image is required (use --base or --preset)" + show_help + exit 1 +fi + +# Set default output name if not specified +if [[ -z "$OUTPUT_NAME" ]]; then + # Extract a sanitized name from the base image + SANITIZED=$(echo "$BASE_IMAGE" | sed 's/[\/:]/-/g') + OUTPUT_NAME="intelliperf-${SANITIZED}.def" +fi + +# Check if template exists +if [[ ! -f "$SCRIPT_DIR/$DEF_TEMPLATE" ]]; then + echo "Error: Template file '$DEF_TEMPLATE' not found in $SCRIPT_DIR" + exit 1 +fi + +echo "==========================================" +echo "IntelliPerf Definition File Generator" +echo "==========================================" +echo "Base Image: $BASE_IMAGE" +echo "Template: $DEF_TEMPLATE" +echo "Output: $OUTPUT_NAME" +echo "==========================================" + +# Replace the 'From:' line in the template and save to output +sed "s|^From:.*|From: ${BASE_IMAGE}|" "$SCRIPT_DIR/$DEF_TEMPLATE" > "$SCRIPT_DIR/$OUTPUT_NAME" + +if [[ $? -eq 0 ]]; then + echo "" + echo "==========================================" + echo "Definition file generated successfully!" + echo "Saved to: $SCRIPT_DIR/$OUTPUT_NAME" + echo "==========================================" + echo "" + echo "To build the container:" + echo " apptainer build ${OUTPUT_NAME%.def}.sif $SCRIPT_DIR/$OUTPUT_NAME" +else + echo "" + echo "==========================================" + echo "Generation failed!" + echo "==========================================" + exit 1 +fi diff --git a/apptainer/intelliperf.def b/apptainer/intelliperf.def index 010de978..eefaae8c 100644 --- a/apptainer/intelliperf.def +++ b/apptainer/intelliperf.def @@ -22,13 +22,13 @@ From: rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0 # Install additional system dependencies apt-get -y update - apt-get install -y software-properties-common git wget clang lld libzstd-dev libomp-dev vim libdwarf-dev gdb tmux cmake + apt-get install -y software-properties-common git wget clang lld libzstd-dev libomp-dev vim libdwarf-dev gdb tmux cmake unzip # Upgrade pip pip install --upgrade pip # Install additional Python packages for intelliperf - pip install --no-cache-dir \ + pip install --upgrade --ignore-installed --no-cache-dir \ astunparse==1.6.2 \ colorlover \ dash-bootstrap-components \ @@ -69,5 +69,4 @@ From: rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0 %runscript echo "Welcome to IntelliPerf with ROCm 7.0!" - source /opt/conda/bin/activate py_3.10 exec "$@" From 8eab9fe85896f72c19dd9760bbd8d92c2470533d Mon Sep 17 00:00:00 2001 From: Jose Santos Date: Mon, 12 Jan 2026 13:08:28 -0600 Subject: [PATCH 3/6] pin nexus --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b7339b98..7ea86c2b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -26,7 +26,7 @@ dependencies = [ "pytest", "litellm[proxy]", "rpds-py", - "nexus @ git+https://github.com/AMDResearch/nexus.git@main", + "nexus @ git+https://github.com/AMDResearch/nexus.git@b2d68ab35be613bcf71e32ffa0fbc2fc4edc3fc1", ] [tool.setuptools] From 8a65dd96eec624088d9211823c021d3a8d6bced1 Mon Sep 17 00:00:00 2001 From: Jose Santos Date: Tue, 13 Jan 2026 13:32:10 -0600 Subject: [PATCH 4/6] Add virtual env --- apptainer/intelliperf.def | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/apptainer/intelliperf.def b/apptainer/intelliperf.def index eefaae8c..0edbe0bf 100644 --- a/apptainer/intelliperf.def +++ b/apptainer/intelliperf.def @@ -11,6 +11,10 @@ From: rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0 export ROCM_PATH=/opt/rocm export OMPI_MCA_mtl="^ofi" export OMPI_MCA_pml="ob1" + + # Activate virtual environment + export VIRTUAL_ENV=/opt/intelliperf_venv + export PATH=/opt/intelliperf_venv/bin:$PATH %post /bin/bash -c " @@ -22,12 +26,18 @@ From: rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0 # Install additional system dependencies apt-get -y update - apt-get install -y software-properties-common git wget clang lld libzstd-dev libomp-dev vim libdwarf-dev gdb tmux cmake unzip + apt-get install -y software-properties-common git wget clang lld libzstd-dev libomp-dev vim libdwarf-dev gdb tmux cmake unzip python3-venv - # Upgrade pip + # Create virtual environment + python3 -m venv /opt/intelliperf_venv + + # Activate virtual environment + . /opt/intelliperf_venv/bin/activate + + # Upgrade pip in virtual environment pip install --upgrade pip - # Install additional Python packages for intelliperf + # Install additional Python packages for intelliperf in virtual environment pip install --upgrade --ignore-installed --no-cache-dir \ astunparse==1.6.2 \ colorlover \ @@ -68,5 +78,10 @@ From: rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0 cmake --build . --target install %runscript + # Activate virtual environment + if [ -f /opt/intelliperf_venv/bin/activate ]; then + . /opt/intelliperf_venv/bin/activate + fi + echo "Welcome to IntelliPerf with ROCm 7.0!" exec "$@" From a9b5343942c72228cbba404d36695bc0c1f89c87 Mon Sep 17 00:00:00 2001 From: Jose Santos Date: Tue, 13 Jan 2026 14:41:34 -0600 Subject: [PATCH 5/6] install rocm-cmake if its not there --- apptainer/intelliperf.def | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/apptainer/intelliperf.def b/apptainer/intelliperf.def index 0edbe0bf..e0a9eae9 100644 --- a/apptainer/intelliperf.def +++ b/apptainer/intelliperf.def @@ -69,14 +69,16 @@ From: rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0 litellm[proxy] " - git clone https://github.com/ROCm/rocm-cmake.git - cd rocm-cmake - mkdir build - cd build - cmake .. - cmake --build . - cmake --build . --target install - + # Only install rocm-cmake if it doesn't exist + if [ ! -d "rocm-cmake" ]; then + git clone https://github.com/ROCm/rocm-cmake.git + cd rocm-cmake + mkdir build + cd build + cmake .. + cmake --build . + cmake --build . --target install + fi %runscript # Activate virtual environment if [ -f /opt/intelliperf_venv/bin/activate ]; then From 85b378da0d8fb409837ce6a6bada0325edfaea3f Mon Sep 17 00:00:00 2001 From: Jose Santos Date: Wed, 14 Jan 2026 13:06:14 -0600 Subject: [PATCH 6/6] adding shebang to for runscript to work in github actions --- apptainer/intelliperf.def | 1 + 1 file changed, 1 insertion(+) diff --git a/apptainer/intelliperf.def b/apptainer/intelliperf.def index e0a9eae9..39138b6c 100644 --- a/apptainer/intelliperf.def +++ b/apptainer/intelliperf.def @@ -80,6 +80,7 @@ From: rocm/pytorch:rocm7.0_ubuntu22.04_py3.10_pytorch_release_2.8.0 cmake --build . --target install fi %runscript + #!/bin/bash # Activate virtual environment if [ -f /opt/intelliperf_venv/bin/activate ]; then . /opt/intelliperf_venv/bin/activate