Skip to content

Latest commit

 

History

History
131 lines (89 loc) · 4.19 KB

devcontainer.md

File metadata and controls

131 lines (89 loc) · 4.19 KB

Device Containers Getting Started Guide

This guide will walk you through using a Development Container configured with all the tools needed to build and run Triton (or Triton-CPU). The Dev Container setup is compatible with local development in Visual Studio Code and with GitHub Codespaces for cloud-based workflows.

How to use these containers?

Copy the .devcontainer folder to your triton directory.

OR

In your triton directory:

git clone -n --depth=1 --filter=tree:0 https://github.com/maryamtahhan/triton-dev-container/ .devcontainer
cd .devcontainer
git sparse-checkout set --no-cone .devcontainer/triton
git checkout
mv .devcontainer/triton ./
rm -rf .devcontainer/ .git ## The checkout creates a nested .devcontainer dir.

Prerequisites

  • VSCode
  • Docker
  • NVIDIA Container Toolkit for GPU Usage (not needed for triton-cpu)
  • VSCode Dev Containers Extension

NOTE: Details of the Dev Container prerequisites can be found here.

NOTE: If you are using an NVIDIA GPU, you also need to complete the steps to install the NVIDIA Container Toolkit.

Basic Workflow

  1. Dev Container Configuration: .devcontainer/triton/devcontainer.json file is set up with configuration details: the Docker image to use, extensions to install, environment variables...

    NOTE: The Dev Container configuration provided supports both root (not recommended) and non-root (recommended) users.

  2. Open project in Container: Open the project folder in VS Code or Github workspaces to build and attach the development environment.
  3. Development: Work as usual, with access to tools and dependencies defined in the container.

The following sections will walk through Step 2 in detail.

Running in Visual Studio Code

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 in 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 run as follows:

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

NOTE: This step can take a few minutes to complete.

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

Running in Github Codespace

Use GitHub Codespaces for cloud-based development with the same Dev Container configuration.

NOTE: GPU-powered Codespaces depends on limited beta access.

Running the Tutorials in the Dev Container

  1. Navigate to your repository and click the < >Code dropdown.

  2. In the Codespaces tab, click the ellipsis (...), then select + New with Options

  3. Edit the Branch, the Dev Container configuration (Triton), GPU and CPU settings.

  4. Click the Button to Create codespace.

    NOTE: This step can take a few minutes to complete.

When the codespace is available the Triton tutorials can be run as follows:

pip install -e './python[tutorials]'
python python/tutorials/01-vector-add.py

Building Trion with a custom LLVM in Dev Container

NOTE: This setup takes a few minutes to complete

To build Triton with a custom version of LLVM, please enable the following in the devcontainer.json

"CUSTOM_LLVM": "true"

To use different commit for LLVM than what's specified in cmake/llvm.hash set the change the following line in the Dockerfile from:

COMMIT=$(curl -s https://raw.githubusercontent.com/triton-lang/triton/refs/heads/main/cmake/llvm-hash.txt) &&\

to

COMMIT=49af6502 &&\