Installation and setup#

This guide covers supported platforms, prerequisites, and how to set up the training environment: container (recommended) and bare metal, plus multi-node distributed training (Slurm recommended).


Supported platforms#

Requirement

Notes

OS

Linux (ROCm-supported distributions per AMD documentation).

ROCm

≥ 7.0 recommended.

GPUs

AMD Instinct™ MI300X, MI325X, MI355X (or other ROCm-supported Instinct SKUs your site supports).


Prerequisites#

Prerequisite

Purpose

AMD Instinct GPUs

Training and benchmarks execute on GPU.

ROCm drivers and user-space stack

Required for HIP, RCCL, and ML frameworks.

Docker ≥ 24.0 (or Podman with compatible GPU passthrough)

Container mode and reproducible environments.

git

Clone the repository and submodules.

Quick environment checks#

rocm-smi
docker --version

rocm-smi should list your GPUs; docker --version should report 24.0 or newer.



Bare-metal (host) setup#

The container setup above is strongly recommended. The AMD-published training Docker image is the tested, reproducible, and best-supported path. Build the full stack on a bare-metal host only when containers are not an option (for example, due to policy or operational constraints).

What to expect#

Reproducing the training environment on the host means building the same stack the Docker image ships, mostly from source. This is a long, build-heavy process that requires:

  • Several source-built kernel libraries (Flash Attention, TransformerEngine, AITER, Primus-Turbo, Grouped GEMM, causal-conv1d, Mamba) compiled against ROCm.

  • A machine with many CPU cores, ample RAM, and tens of GB of free disk.

  • A long time (expect a multi-hour first build).

What a complete host environment needs#

Layer

What it provides

How it is installed

Kernel/hardware

AMD GPU driver (amdgpu KMD) and device access (/dev/kfd, /dev/dri)

OS/administrator (root, one-time)

OS libraries

Build toolchain and runtime libraries (g++, git, RDMA, hwloc, etc.)

apt (root, one-time)

ROCm user-space

rocm-sdk-devel + device wheels—no system-wide ROCm install required

pip (TheRock wheels, in venv)

Deep learning framework

ROCm-enabled PyTorch (torch, torchvision, torchaudio, apex)

pip (TheRock wheels, in venv)

Accelerated kernels

Flash Attention, TransformerEngine, AITER, Primus-Turbo, Grouped GEMM, Mamba

build from source (in venv)

Multi-node communications

UCX, OpenMPI, rocSHMEM, AMD AINIC—only for distributed (multi-node) training

build from source or apt

Primus + Python dependencies

Primus, submodules, and training libraries (datasets, transformers, wandb, etc.)

git + pip (in venv)

General approach#

  1. System packages (root, one-time): install the build toolchain and, for multi-node, the RDMA/networking libraries via apt. The GPU kernel driver must already be loaded.

  2. Python virtual environment (no root): create a venv, then install ROCm and PyTorch from AMD’s TheRock multi-arch wheels—this replaces a system ROCm install and keeps everything unprivileged.

  3. Build the accelerated kernels from source against the ROCm in venv and your GPU architecture (gfx942 for MI300X/MI325X, gfx950 for MI350X/MI355X).

  4. Install Primus and its Python dependencies, then persist the required environment variables (ROCm paths, NVTE_* flags) in your venv activation script.

  5. (Optional) Build the multi-node communication stack (UCX, OpenMPI, rocSHMEM) only if you require RDMA-based distributed training.

Detailed instructions#

Follow the full, step-by-step guide here, which includes the exact pinned versions, environment variables, and automated install scripts:

Verify#

After the build, validate the environment and run a benchmark directly on the host (no container):

./primus-cli direct -- benchmark gemm --M 4096 --N 4096 --K 4096


Post-installation verification checklist (for all setup approaches)#

Step

Check

ROCm

rocm-smi shows expected GPUs and no driver errors.

Container engine

docker run --rm ... rocm/primus:v26.4 (or your site’s GPU test) succeeds.

GEMM benchmark

./primus-cli container or direct benchmark completes (see sections above).

Preflight

Run preflight diagnostics: ./primus-cli direct -- preflight (single node) or ./primus-cli slurm srun -N <N> -- preflight (cluster).

If your training pulls models or tokenizers from Hugging Face Hub, configure tokens (for example HF_TOKEN) in the environment or container flags as required by your configuration.