Install

KempnerForge uses uv for dependency management. There is no pip install kempnerforge — you work from a clone.

Prerequisites

  • Python 3.12+ — pinned via .python-version (>=3.12) and pyproject.toml’s requires-python. uv reads .python-version and will use any Python ≥ 3.12 already on your machine, or fetch a managed CPython for you. No manual Python install needed.

  • PyTorch 2.12 or newer: uv sync installs the version locked in uv.lock, and pyproject.toml allows 2.12 and later (see Dependency floors).

  • NVIDIA driver 580 or newer: PyTorch wheels are pulled from the CUDA 13.0 index and bundle the CUDA runtime, so no separate CUDA toolkit is needed.

  • A C++20 compiler (GCC 10 or newer) for torch.compile on CPU, including the unit tests that compile a model on CPU: Inductor builds CPU kernels with g++ -std=c++20. Where the system compiler is older, put a newer g++ first on PATH.

  • NVIDIA GPU for any training or distributed test (H100, H200, or A100). Unit tests run on CPU.

  • uv — install once per machine:

    curl -LsSf https://astral.sh/uv/install.sh | sh
    

Clone and sync

git clone git@github.com:KempnerInstitute/KempnerForge.git
cd KempnerForge

# Creates .venv, installs runtime + dev dependencies, resolves torch from the
# CUDA 13.0 index pinned in pyproject.toml.
uv sync

The .venv is project-local. Every command in the docs runs through uv run so the venv is activated automatically — you do not need to source .venv/bin/activate.

Verify

Run the same checks CI runs on every PR:

uv run ruff check .
uv run ruff format --check .
uv run pyright kempnerforge/
uv run pytest tests/unit/ -v --timeout=60

If all four pass, your environment is ready.

Dependency floors

uv sync installs the exact versions in uv.lock. For an install that does not go through the lock, pyproject.toml gives every runtime dependency a lower bound, the oldest release KempnerForge supports. CI tests those bounds: its unit-tests (dependency floors) job installs every runtime dependency at its lower bound on Python 3.12 and runs the unit tests. The commands are in .github/workflows/ci.yml. The floors are tested on Python 3.12 only: some of the oldest releases, such as Pillow 10.0.0 and PyYAML 6.0.1, publish no wheels for Python 3.13 or newer.

Optional: docs dependencies

If you plan to preview docs locally, add the docs dependency group:

uv sync --group docs
uv run make -C docs live  # live-reload server on http://127.0.0.1:8000

See the “Writing Docs” section of CONTRIBUTING.md for the full editor loop.

SLURM clusters (Kempner and similar)

Unit tests run on CPU login nodes. Anything that needs a GPU (integration, distributed, end-to-end tests, and actual training) has to run inside a SLURM allocation.

Interactive allocation for development

# 1 node, 4 GPUs — enough for integration + distributed tests
salloc --partition=<partition-name> --account=<account-name> \
  --nodes=1 --gpus-per-node=4 --cpus-per-task=16 --mem=256G --time=2:00:00

Replace <partition-name> and <account-name> with values your PI gave you. Once the prompt returns, you are on a compute node and can run uv run torchrun ... directly.

Modules and environment

On Kempner clusters, the provided scripts/slurm/*.sh wrappers detect the InfiniBand interface and export NCCL_SOCKET_IFNAME / GLOO_SOCKET_IFNAME before invoking torchrun or srun. They do not module load anything — uv sync brings in the CUDA-enabled PyTorch wheel, and the CUDA driver is already present on compute nodes.

If you launch bare torchrun from an interactive shell, the venv from uv sync is all you need.

Next steps