Skip to content

Commit

Permalink
Add HPU run script
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed May 22, 2024
1 parent 49a6458 commit e2dd9c8
Show file tree
Hide file tree
Showing 5 changed files with 300 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ workspace/
slurm-*
scripts/inventory.yaml
out.txt

scripts/article/hpu/
scripts/article/cuda/
scripts/article/xpu/
69 changes: 69 additions & 0 deletions scripts/article/run_cuda.sh
Original file line number Diff line number Diff line change
@@ -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
83 changes: 83 additions & 0 deletions scripts/article/run_hpu.sh
Original file line number Diff line number Diff line change
@@ -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
69 changes: 69 additions & 0 deletions scripts/article/run_rocm.sh
Original file line number Diff line number Diff line change
@@ -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
75 changes: 75 additions & 0 deletions scripts/article/run_xpu.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit e2dd9c8

Please sign in to comment.