From 80c4dbe4deffe9dd59745d2aef420e66216ac56c Mon Sep 17 00:00:00 2001 From: coleramos425 Date: Mon, 3 Feb 2025 11:22:51 -0600 Subject: [PATCH 1/3] Update def file for rocm install Signed-off-by: coleramos425 --- maestro.def | 35 +++++++++++++++++++++++++++++++++++ run.sh | 12 ++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 maestro.def create mode 100755 run.sh diff --git a/maestro.def b/maestro.def new file mode 100644 index 00000000..3a8c303d --- /dev/null +++ b/maestro.def @@ -0,0 +1,35 @@ +Bootstrap: docker +From: ubuntu:22.04 + +%post + + # Install dependencies + apt-get -y update + apt-get install -y software-properties-common + apt-get upgrade -y + apt-get install -y build-essential python3 python3-pip git wget clang lld libzstd-dev libomp-dev + python3 -m pip install --upgrade pip + python3 -m pip install 'cmake==3.22' + + # Install ROCm + mkdir --parents --mode=0755 /etc/apt/keyrings + wget --no-check-certificate https://repo.radeon.com/rocm/rocm.gpg.key -O - | \ + gpg --dearmor | tee /etc/apt/keyrings/rocm.gpg > /dev/null + + echo "deb [arch=amd64 signed-by=/etc/apt/keyrings/rocm.gpg] https://repo.radeon.com/rocm/apt/6.3.2 jammy main" \ + | tee --append /etc/apt/sources.list.d/rocm.list + + printf "Package: *\nPin: release o=repo.radeon.com\nPin-Priority: 600\n" | tee /etc/apt/preferences.d/rocm-pin-600 + + apt-get -y update + ROCM_VERSION=$(apt-cache search rocm-dev[0-9] | awk '{print $1}' | sed 's/rocm-dev//g') + apt-get install -y rocm-dev6.3.2 rocm-llvm-dev6.3.2 rocm-hip-runtime-dev6.3.2 rocm-smi-lib6.3.2 rocminfo6.3.2 + + # Install logduration + export SSH_AUTH_SOCK={{ SSH_AUTH_SOCK }} + cd /root + git clone -v git@github.com:AARInternal/logduration.git + cd logduration + mkdir -p build && + cmake -DCMAKE_PREFIX_PATH=${ROCM_PATH} -DLLVM_INSTALL_DIR=/opt/rocm/llvm -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=ON -S . -B build && + cmake --build build --target install diff --git a/run.sh b/run.sh new file mode 100755 index 00000000..6080e861 --- /dev/null +++ b/run.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +timestamp=$(date +"%Y%m%d_%H%M%S") + +ssh_auth_sock_path=$(readlink -f "$SSH_AUTH_SOCK") +# Build the Singularity container +# --build-arg SSH_AUTH_SOCK=$SSH_AUTH_SOCK is used to pass the SSH agent socket to the container +# (advantage of this method is that the key is at no point copied to the container image.) +# If your SSH_AUTH_SOCK will not already bound to the container, and is available at /run/..., add `--bind /run` to the build command +apptainer build \ + --build-arg SSH_AUTH_SOCK=${ssh_auth_sock_path} \ + "maestro_${timestamp}.sif" maestro.def \ No newline at end of file From ef157a1cfc514e667d48352ea6813e5d5eee563e Mon Sep 17 00:00:00 2001 From: coleramos425 Date: Mon, 3 Feb 2025 12:46:50 -0600 Subject: [PATCH 2/3] Add guided tuning repo to apptainer Signed-off-by: coleramos425 --- maestro.def | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/maestro.def b/maestro.def index 3a8c303d..fcd54a84 100644 --- a/maestro.def +++ b/maestro.def @@ -11,6 +11,13 @@ From: ubuntu:22.04 python3 -m pip install --upgrade pip python3 -m pip install 'cmake==3.22' + # Add GitHub trusted host + mkdir -p ~/.ssh + touch ~/.ssh/known_hosts + ssh-keyscan github.com >> ~/.ssh/known_hosts + chmod 700 ~/.ssh + chmod 644 ~/.ssh/known_hosts + # Install ROCm mkdir --parents --mode=0755 /etc/apt/keyrings wget --no-check-certificate https://repo.radeon.com/rocm/rocm.gpg.key -O - | \ @@ -24,12 +31,35 @@ From: ubuntu:22.04 apt-get -y update ROCM_VERSION=$(apt-cache search rocm-dev[0-9] | awk '{print $1}' | sed 's/rocm-dev//g') apt-get install -y rocm-dev6.3.2 rocm-llvm-dev6.3.2 rocm-hip-runtime-dev6.3.2 rocm-smi-lib6.3.2 rocminfo6.3.2 + export PATH=/opt/rocm/bin:$PATH + export LD_LIBRARY_PATH=/opt/rocm/lib:$LD_LIBRARY_PATH + export ROCM_PATH=/opt/rocm # Install logduration export SSH_AUTH_SOCK={{ SSH_AUTH_SOCK }} cd /root git clone -v git@github.com:AARInternal/logduration.git cd logduration - mkdir -p build && - cmake -DCMAKE_PREFIX_PATH=${ROCM_PATH} -DLLVM_INSTALL_DIR=/opt/rocm/llvm -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=ON -S . -B build && + git submodule update --init --recursive + mkdir -p build + cmake -DCMAKE_INSTALL_PREFIX=/opt/logduration -DCMAKE_PREFIX_PATH=${ROCM_PATH} -DLLVM_INSTALL_DIR=/opt/rocm/llvm -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=ON -S . -B build cmake --build build --target install + + # Install rocprof-compute + cd /root + git clone -v git@github.com:ROCm/rocprofiler-compute.git + cd rocprofiler-compute + export INSTALL_DIR=/opt/rocprofiler-compute + python3 -m pip install -t ${INSTALL_DIR}/python-libs -r requirements.txt + mkdir build + cd build + cmake -DCMAKE_INSTALL_PREFIX=${INSTALL_DIR}/3.0.0 \ + -DPYTHON_DEPS=${INSTALL_DIR}/python-libs \ + -DMOD_INSTALL_PATH=${INSTALL_DIR}/modulefiles/rocprofiler-compute .. + make install + export PATH=${INSTALL_DIR}/3.0.0/bin:$PATH + + # Install guided-tuning (JBs tool) + cd /root + git clone -v git@github.com:AARInternal/guided-tuning.git + python3 -m pip install pandas duckdb From f74f6412af6ebd2fcab23b6dae1a805496eb2b7c Mon Sep 17 00:00:00 2001 From: coleramos425 Date: Tue, 4 Feb 2025 12:36:22 -0600 Subject: [PATCH 3/3] Add ssh configuration into apptainer runner While not comprehensive, this adds basic SSH keys to the agent Signed-off-by: coleramos425 --- run.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/run.sh b/run.sh index 6080e861..decf6aa6 100755 --- a/run.sh +++ b/run.sh @@ -2,6 +2,15 @@ timestamp=$(date +"%Y%m%d_%H%M%S") +# Auto config SSH agent +if [ ! -S ~/.ssh/ssh_auth_sock ]; then + eval `ssh-agent` > /dev/null + ln -sf "$SSH_AUTH_SOCK" ~/.ssh/ssh_auth_sock +fi +export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock +[ -f ~/.ssh/id_rsa ] && ssh-add ~/.ssh/id_rsa +[ -f ~/.ssh/id_ed25519 ] && ssh-add ~/.ssh/id_ed25519 + ssh_auth_sock_path=$(readlink -f "$SSH_AUTH_SOCK") # Build the Singularity container # --build-arg SSH_AUTH_SOCK=$SSH_AUTH_SOCK is used to pass the SSH agent socket to the container