From aa2ef365900f6a2b816fa4e975df2c886d63ab6c Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 22 May 2024 13:25:46 +0000 Subject: [PATCH] Add HPU run script --- .gitignore | 4 ++ scripts/article/run_cuda.sh | 71 +++++++++++++++++++++++++++++++ scripts/article/run_hpu.sh | 85 +++++++++++++++++++++++++++++++++++++ scripts/article/run_rocm.sh | 70 ++++++++++++++++++++++++++++++ scripts/article/run_xpu.sh | 76 +++++++++++++++++++++++++++++++++ 5 files changed, 306 insertions(+) create mode 100644 scripts/article/run_cuda.sh create mode 100644 scripts/article/run_hpu.sh create mode 100644 scripts/article/run_rocm.sh create mode 100644 scripts/article/run_xpu.sh diff --git a/.gitignore b/.gitignore index a07a34657..ccc7bbfac 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,7 @@ workspace/ slurm-* scripts/inventory.yaml out.txt + +scripts/article/hpu/ +scripts/article/cuda/ +scripts/article/xpu/ diff --git a/scripts/article/run_cuda.sh b/scripts/article/run_cuda.sh new file mode 100644 index 000000000..080dc759f --- /dev/null +++ b/scripts/article/run_cuda.sh @@ -0,0 +1,71 @@ +#!/bin/bash + +set -ex + +export MILABENCH_GPU_ARCH=cuda +export MILABENCH_WORDIR="$(pwd)/$MILABENCH_GPU_ARCH" + +export MILABENCH_BASE="$MILABENCH_WORDIR/results" +export MILABENCH_CONFIG="$MILABENCH_WORDIR/milabench/config/standard.yaml" +export MILABENCH_VENV="$MILABENCH_WORDIR/env" +export BENCHMARK_VENV="$MILABENCH_WORDIR/results/venv/torch" + + +install_prepare() { + mkdir -p $MILABENCH_WORDIR + cd $MILABENCH_WORDIR + + virtualenv $MILABENCH_WORDIR/env + + git clone https://github.com/mila-iqia/milabench.git -b intel + git clone https://github.com/Delaunay/voir.git -b async_timer + git clone https://github.com/Delaunay/torchcompat.git + + . $MILABENCH_WORDIR/env/bin/activate + pip install -e $MILABENCH_WORDIR/milabench + + # + # Install milabench's benchmarks in their venv + # + milabench install + + which pip + pip install -e $MILABENCH_WORDIR/voir + pip install -e $MILABENCH_WORDIR/torchcompat + + ( + . $BENCHMARK_VENV/bin/activate + which pip + pip install -e $MILABENCH_WORDIR/voir + pip install -e $MILABENCH_WORDIR/torchcompat + pip install torch torchvision torchaudio + + ( + cd $MILABENCH_WORDIR/milabench/benchmarks/timm/pytorch-image-models; + git fetch origin; + git checkout cb0e439 + ) + ) + + # + # Generate/download datasets, download models etc... + milabench prepare +} + +if [ ! -d "$MILABENCH_WORDIR" ]; then + install_prepare +else + echo "Reusing previous install" + . $MILABENCH_WORDIR/env/bin/activate +fi + +cd $MILABENCH_WORDIR + + +# +# Run the benchmakrs +milabench run + +# +# Display report +milabench report --runs $MILABENCH_WORDIR/results/runs diff --git a/scripts/article/run_hpu.sh b/scripts/article/run_hpu.sh new file mode 100644 index 000000000..bec792224 --- /dev/null +++ b/scripts/article/run_hpu.sh @@ -0,0 +1,85 @@ +#!/bin/bash + +set -ex + +export MILABENCH_GPU_ARCH=hpu +export MILABENCH_WORDIR="$(pwd)/$MILABENCH_GPU_ARCH" +export MILABENCH_BASE="$MILABENCH_WORDIR/results" +export MILABENCH_CONFIG="$MILABENCH_WORDIR/milabench/config/standard.yaml" +export MILABENCH_VENV="$MILABENCH_WORDIR/env" +export BENCHMARK_VENV="$MILABENCH_WORDIR/results/venv/torch" + +install_prepare() { + mkdir -p $MILABENCH_WORDIR + cd $MILABENCH_WORDIR + + virtualenv $MILABENCH_WORDIR/env + + git clone https://github.com/mila-iqia/milabench.git -b intel + git clone https://github.com/Delaunay/voir.git -b async_timer + git clone https://github.com/Delaunay/torchcompat.git + + wget -nv https://vault.habana.ai/artifactory/gaudi-installer/1.15.1/habanalabs-installer.sh + chmod +x habanalabs-installer.sh + + . $MILABENCH_WORDIR/env/bin/activate + pip install -e $MILABENCH_WORDIR/milabench + + + # + # Install milabench's benchmarks in their venv + # + milabench install + + which pip + pip install -e $MILABENCH_WORDIR/voir + pip install -e $MILABENCH_WORDIR/torchcompat + + # Override dependencies for HPU + # milabench needs pyhlml + export HABANALABS_VIRTUAL_DIR=$MILABENCH_VENV + ./habanalabs-installer.sh install -t dependencies --venv -y + ./habanalabs-installer.sh install -t pytorch --venv -y + + + ( + . $BENCHMARK_VENV/bin/activate + which pip + pip install -e $MILABENCH_WORDIR/voir + pip install -e $MILABENCH_WORDIR/torchcompat + + ( + cd $MILABENCH_WORDIR/milabench/benchmarks/timm/pytorch-image-models; + git fetch origin; + git checkout cb0e439 + ) + + # Override dependencies for HPU + # benchmarks need pytorch + export HABANALABS_VIRTUAL_DIR=$BENCHMARK_VENV + ./habanalabs-installer.sh install -t dependencies --venv -y + ./habanalabs-installer.sh install -t pytorch --venv -y + ) + + # + # Generate/download datasets, download models etc... + milabench prepare +} + +if [ ! -d "$MILABENCH_WORDIR" ]; then + install_prepare +else + echo "Reusing previous install" + . $MILABENCH_WORDIR/env/bin/activate +fi + +cd $MILABENCH_WORDIR + + +# +# Run the benchmakrs +milabench run "$@" + +# +# Display report +milabench report --runs $MILABENCH_WORDIR/results/runs diff --git a/scripts/article/run_rocm.sh b/scripts/article/run_rocm.sh new file mode 100644 index 000000000..c7186880c --- /dev/null +++ b/scripts/article/run_rocm.sh @@ -0,0 +1,70 @@ +#!/bin/bash + +set -ex + +export MILABENCH_GPU_ARCH=rocm +export MILABENCH_WORDIR="$(pwd)/$MILABENCH_GPU_ARCH" + +export MILABENCH_BASE="$MILABENCH_WORDIR/results" +export MILABENCH_CONFIG="$MILABENCH_WORDIR/milabench/config/standard.yaml" +export MILABENCH_VENV="$MILABENCH_WORDIR/env" +export BENCHMARK_VENV="$MILABENCH_WORDIR/results/venv/torch" + + +install_prepare() { + mkdir -p $MILABENCH_WORDIR + cd $MILABENCH_WORDIR + + virtualenv $MILABENCH_WORDIR/env + + git clone https://github.com/mila-iqia/milabench.git -b intel + git clone https://github.com/Delaunay/voir.git -b async_timer + git clone https://github.com/Delaunay/torchcompat.git + + . $MILABENCH_WORDIR/env/bin/activate + pip install -e $MILABENCH_WORDIR/milabench + + # + # Install milabench's benchmarks in their venv + # + milabench install + + which pip + pip install -e $MILABENCH_WORDIR/voir + pip install -e $MILABENCH_WORDIR/torchcompat + + ( + . $BENCHMARK_VENV/bin/activate + which pip + pip install -e $MILABENCH_WORDIR/voir + pip install -e $MILABENCH_WORDIR/torchcompat + pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.0 + + ( + cd $MILABENCH_WORDIR/milabench/benchmarks/timm/pytorch-image-models; + git fetch origin; + git checkout cb0e439 + ) + ) + + # + # Generate/download datasets, download models etc... + milabench prepare +} + +if [ ! -d "$MILABENCH_WORDIR" ]; then + install_prepare +else + echo "Reusing previous install" + . $MILABENCH_WORDIR/env/bin/activate +fi + +cd $MILABENCH_WORDIR + +# +# Run the benchmakrs +milabench run + +# +# Display report +milabench report --runs $MILABENCH_WORDIR/results/runs diff --git a/scripts/article/run_xpu.sh b/scripts/article/run_xpu.sh new file mode 100644 index 000000000..1e51b18c3 --- /dev/null +++ b/scripts/article/run_xpu.sh @@ -0,0 +1,76 @@ +#!/bin/bash + +set -ex + +export MILABENCH_GPU_ARCH=xpu +export MILABENCH_WORDIR="$(pwd)/$MILABENCH_GPU_ARCH" + +export MILABENCH_BASE="$MILABENCH_WORDIR/results" +export MILABENCH_CONFIG="$MILABENCH_WORDIR/milabench/config/standard.yaml" +export MILABENCH_VENV="$MILABENCH_WORDIR/env" +export BENCHMARK_VENV="$MILABENCH_WORDIR/results/venv/torch" + + +install_prepare() { + mkdir -p $MILABENCH_WORDIR + cd $MILABENCH_WORDIR + + virtualenv $MILABENCH_WORDIR/env + + git clone https://github.com/mila-iqia/milabench.git -b intel + git clone https://github.com/Delaunay/voir.git -b async_timer + git clone https://github.com/Delaunay/torchcompat.git + + # XPU manager is necessary + wget -nv https://github.com/intel/xpumanager/releases/download/V1.2.36/xpumanager_1.2.36_20240428.081009.377f9162.u22.04_amd64.deb + sudo dpkg -i xpumanager_1.2.36_20240428.081009.377f9162.u22.04_amd64.deb + + . $MILABENCH_WORDIR/env/bin/activate + pip install -e $MILABENCH_WORDIR/milabench + + # + # Install milabench's benchmarks in their venv + # + milabench install + + which pip + pip install -e $MILABENCH_WORDIR/voir + pip install -e $MILABENCH_WORDIR/torchcompat + + ( + . $BENCHMARK_VENV/bin/activate + which pip + pip install -e $MILABENCH_WORDIR/voir + pip install -e $MILABENCH_WORDIR/torchcompat + + # Override dependencies for XPU + pip install torch, torchvision torchaudio intel-extension-for-pytorch --extra-index-url https://pytorch-extension.intel.com/release-whl/stable/xpu/us/ + + ( + cd $MILABENCH_WORDIR/milabench/benchmarks/timm/pytorch-image-models; + git fetch origin; + git checkout cb0e439 + ) + ) + + # + # Generate/download datasets, download models etc... + milabench prepare +} + +if [ ! -d "$MILABENCH_WORDIR" ]; then + install_prepare +else + echo "Reusing previous install" + . $MILABENCH_WORDIR/env/bin/activate +fi + +cd $MILABENCH_WORDIR + +# +# Run the benchmakrs +milabench run + +# +# Display report +milabench report --runs $MILABENCH_WORDIR/results/runs