-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add utility to help launch milabench with docker
- Loading branch information
pierre.delaunay
committed
Jan 17, 2025
1 parent
df7d8a1
commit cf751f7
Showing
8 changed files
with
183 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
FROM nvcr.io/nvidia/pytorch:24.02-py3 | ||
|
||
# Arguments | ||
# --------- | ||
|
||
# Use ofed_info -s to get your local version | ||
ARG MOFED_VERSION=5.4-3.4.0.0 | ||
ARG CONFIG=standard.yaml | ||
ARG ARCH=cuda | ||
|
||
ENV MILABENCH_GPU_ARCH=$ARCH | ||
ENV MILABENCH_CONFIG_NAME=$CONFIG | ||
ENV MILABENCH_DOCKER=1 | ||
|
||
# Paths | ||
# ----- | ||
|
||
ENV MILABENCH_CONFIG=/milabench/milabench/config/$MILABENCH_CONFIG_NAME | ||
ENV MILABENCH_BASE=/milabench/envs | ||
ENV MILABENCH_OUTPUT=/milabench/results/ | ||
ENV MILABENCH_ARGS="" | ||
|
||
# Copy milabench | ||
# -------------- | ||
|
||
WORKDIR /milabench | ||
COPY . /milabench/milabench/ | ||
|
||
# Install Dependencies | ||
# -------------------- | ||
|
||
# curl: used to download anaconda and rust | ||
# git: used by milabench | ||
# libibverbs: used for infiniband | ||
# rustc: used by BERT models inside https://pypi.org/project/tokenizers/ | ||
# build-essential: for rust | ||
|
||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN cd $HOME && | ||
rm -rf /milabench/env && | ||
pip install virtualenv && | ||
virtualenv --system-site-packages /milabench/env && | ||
/milabench/env/bin/pip install -e milabench && | ||
/milabench/env/bin/milabench install --use-current-env && | ||
/milabench/env/bin/pip uninstall torch torchvision torchaudio -y && | ||
/milabench/env/bin/pip cache purge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from __future__ import annotations | ||
|
||
from coleo import Option, tooled | ||
|
||
|
||
from ..commands import DockerRunCommand, CmdCommand | ||
from ..pack import Package | ||
from ..common import get_multipack | ||
from ..system import DockerConfig | ||
|
||
|
||
def dummy_pack(packs) -> Package: | ||
pack = list(packs.values())[0] | ||
name = "setup" | ||
|
||
return Package( | ||
{ | ||
"name": name, | ||
"tag": [name], | ||
"definition": ".", | ||
"run_name": pack.config["run_name"], | ||
"dirs": pack.config["dirs"], | ||
"config_base": pack.config["config_base"], | ||
"config_file": pack.config["config_file"], | ||
"system": pack.config["system"], | ||
} | ||
) | ||
|
||
|
||
@tooled | ||
def cli_docker(args=None): | ||
"""Builds the docker command to execute from the system configuration""" | ||
from .run import arguments | ||
|
||
if args is None: | ||
args = arguments() | ||
|
||
mp = get_multipack(run_name=args.run_name) | ||
|
||
pack = dummy_pack(mp.packs) | ||
|
||
system = pack.config["system"] | ||
config = DockerConfig(**system.get("docker")) | ||
|
||
# milabench prepare | ||
plan = DockerRunCommand(CmdCommand(pack, "milabench", "prepare"), config) | ||
|
||
for pack, argv, _ in plan.commands(): | ||
print(" ".join(argv)) | ||
|
||
# milabench run | ||
plan = DockerRunCommand(CmdCommand(pack, "milabench", "run"), config) | ||
|
||
for pack, argv, _ in plan.commands(): | ||
print(" ".join(argv)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters