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..ea77f7f20 --- /dev/null +++ b/scripts/article/run_cuda.sh @@ -0,0 +1,69 @@ +#!/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" +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..9f54bcf8a --- /dev/null +++ b/scripts/article/run_hpu.sh @@ -0,0 +1,83 @@ +#!/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" +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..0cba2aa95 --- /dev/null +++ b/scripts/article/run_rocm.sh @@ -0,0 +1,69 @@ +#!/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" +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..502901d3b --- /dev/null +++ b/scripts/article/run_xpu.sh @@ -0,0 +1,75 @@ +#!/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" +fi + +cd $MILABENCH_WORDIR + +# +# Run the benchmakrs +milabench run + +# +# Display report +milabench report --runs $MILABENCH_WORDIR/results/runs