Skip to content

Latest commit

 

History

History
129 lines (95 loc) · 4.9 KB

File metadata and controls

129 lines (95 loc) · 4.9 KB

Device Containers Getting Started Guide

This guide walks you through using a Development Container configured with all the tools needed to build and run Triton (or Triton-CPU). The setup is optimized for local development using Visual Studio Code. Full VSCode Dev Container setup details can be found official Visual Studio Code documentation.

Prerequisites

GPU users must install the NVIDIA Container Toolkit/ROCm for GPU support.

Podman users: The VSCode Dev Container extension needs the additional settings shown below when using podman. docker-compose or podman-compose can be used with podman. settings


Basic Workflow

Below is the basic workflow for developing Triton using VSCode in a Dev Container:

  1. Clone Triton Repository: Clone one of the Triton repository and cd into the top-level of the cloned repository.
  2. Bootstrap triton-dev-containers: Run the bootstrap command or clone and build the Dev Container.
  3. Launch VSCode Dev Container: Launch Dev Container from the VSCode command palette.
  4. Development: Work as usual, with access to tools and dependencies defined in the container.

Clone Triton Repository

VS Code Device Containers allow development using VS Code, but within a container. This provide consistent and reproducible development environments for developing with Triton. The pre-configured development containers are designed to work with one of:

Clone the repository that is being developed and cd into the top-level of the cloned repository.

Bootstrap triton-dev-containers

This repository is intended to be be cloned under the repository being developed. It is recommended to only checkout what is needed for a given development environment (Sparse Checkout), but it is possible to do a full checkout of this repository.

The Dev Container Configuration file, .devcontainer/triton/devcontainer.json, is setup with configuration details, like the Docker image to use, extensions to install, environment variables, etc. The Dev Container configuration provided supports both root (not recommended) and non-root (recommended) users.

Option 1: Sparse Checkout Script - RECOMMENDED

This option clones only what is needed for a given variant. Once the script completes, there should be a .devcontainer/ directory in the top-level of the repository being developed.

wget -qO- https://raw.githubusercontent.com/redhat-et/triton-dev-containers/main/.devcontainer/scripts/bootstrap-devcontainer.sh | bash -s triton-cpu

Replace triton-cpu (above) with one of the supported variants:

  • triton
  • triton-cpu
  • triton-amd

Option 2: Clone Everything

This option clones the entire triton-dev-containers repository.

git clone https://github.com/redhat-et/triton-dev-containers.git
cd triton-dev-containers
make devcontainers

Launch VSCode Dev Container

Follow these steps to launch and work with the Dev Container in Visual Studio Code.

Open the project in Visual Studio Code. A pop up will appear asking to reopen the project in a Dev Container.

reopen-in-container

If the pop up doesn't appear, the container can be launched by accessing the Visual Studio Code Command Palette and looking for the: Dev Containers: Reopen in Container option as shown below.

reopen-in-container

Visual Studio Code will relaunch inside the Dev Container.

When the container is ready the Triton tutorials can be installed as follows (This step can take a few minutes to complete):

pip install -e './python[tutorials]'

Once the Triton tutorials are installed, they can be run to verify everything is installed correctly. If developing with triton-cpu, some of the tutorials may not succeed as is. Run tutorials with -cpu in the name, like 02-fused-softmax-cpu.py and 03-matrix-multiplication-cpu.py.

python python/tutorials/01-vector-add.py