diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000000..bba0b1a102 --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,9 @@ +FROM nvcr.io/nvidia/pytorch:25.12-py3 + +RUN --mount=type=cache,target=/var/lib/apt/lists,sharing=locked \ + --mount=type=cache,target=/var/cache/apt,sharing=locked \ + apt-get update \ + && apt-get install -y sccache \ + && rm -rf /var/lib/apt/lists/* + +RUN pip uninstall -y transformer-engine diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..c412a8fbd8 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,31 @@ +// For format details, see https://aka.ms/devcontainer.json. For config options, see the +// README at: https://github.com/devcontainers/templates/tree/main/src/docker-existing-dockerfile +{ + "name": "Transformer Engine Dev Container", + "build": { + "dockerfile": "Dockerfile" + }, + "mounts": [ + "source=${localEnv:HOME}/.bash_history_devcontainer,target=/home/ubuntu/.bash_history,type=bind,consistency=cached", + "source=${localEnv:HOME}/.cache,target=/home/ubuntu/.cache,type=bind,consistency=cached" + ], + "initializeCommand": ".devcontainer/initializeCommand.sh", + "postCreateCommand": ".devcontainer/postCreateCommand.sh", + "remoteUser": "ubuntu", + "runArgs": [ + "--gpus=all", + "--shm-size=4g" + ], + "containerEnv": {}, + "customizations": { + "vscode": { + "extensions": [ + "charliermarsh.ruff", + "eamodio.gitlens", + "ms-python.python", + "streetsidesoftware.code-spell-checker", + "tamasfe.even-better-toml" + ] + } + } +} diff --git a/.devcontainer/initializeCommand.sh b/.devcontainer/initializeCommand.sh new file mode 100755 index 0000000000..410c01da90 --- /dev/null +++ b/.devcontainer/initializeCommand.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +set -euo pipefail + +mkdir -p ~/.cache/sccache diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh new file mode 100755 index 0000000000..a648f762ac --- /dev/null +++ b/.devcontainer/postCreateCommand.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -euo pipefail + +# pip install ninja +NVTE_USE_CCACHE=1 NVTE_CCACHE_BIN=sccache NVTE_FRAMEWORK=pytorch NVTE_BUILD_DEBUG=1 pip install -v --no-build-isolation -e . diff --git a/.gitignore b/.gitignore index 7a86041a1e..2c9c337556 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,4 @@ compile_commands.json tensor_dumps/ artifacts/ *.DS_Store +logs/