Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .cursor/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

FROM ubuntu:24.04

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
ca-certificates \
curl \
git \
git-lfs \
python3.12 \
python3.12-dev \
python3.12-venv \
libopenmpi-dev \
libzmq3-dev \
cmake \
ninja-build \
ccache \
clang-format \
build-essential \
pkg-config \
sudo \
docker.io \
fuse-overlayfs \
iptables \
libnvidia-compute-550 \
&& rm -rf /var/lib/apt/lists/* \
&& ln -sf /usr/bin/python3.12 /usr/local/bin/python3 \
&& git lfs install --system

USER ubuntu
43 changes: 43 additions & 0 deletions .cursor/cloud-agent-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set -euo pipefail

REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "${REPO_ROOT}"

if command -v git-lfs >/dev/null 2>&1; then
git lfs install --local 2>/dev/null || git lfs install
git lfs pull
fi

if [[ ! -d .venv ]]; then
python3 -m venv .venv
fi
# shellcheck source=/dev/null
source .venv/bin/activate

python -m pip install -U pip wheel setuptools
pip install -r requirements-dev.txt
git config --local --unset-all core.hooksPath 2>/dev/null || true
pre-commit install --install-hooks

# Optional: compile and editable-install when a GPU driver is present.
if command -v nvidia-smi >/dev/null 2>&1 && nvidia-smi >/dev/null 2>&1; then
ARCH="${TRTLLM_CUDA_ARCH:-}"
if [[ -z "${ARCH}" ]]; then
case "$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader 2>/dev/null | head -1 | tr -d '.')" in
100) ARCH="100-real" ;;
90) ARCH="90-real" ;;
89) ARCH="89-real" ;;
80) ARCH="80-real" ;;
*) ARCH="90-real" ;;
esac
fi
python3 scripts/build_wheel.py \
--use_ccache \
-a "${ARCH}" \
--skip_building_wheel \
--linking_install_binary
pip install -e .
fi
31 changes: 31 additions & 0 deletions .cursor/cloud-agent-start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set -euo pipefail

if ! command -v dockerd >/dev/null 2>&1; then
exit 0
fi

if sudo docker info >/dev/null 2>&1; then
exit 0
fi

sudo mkdir -p /etc/docker
if [[ ! -f /etc/docker/daemon.json ]]; then
echo '{"storage-driver":"fuse-overlayfs"}' | sudo tee /etc/docker/daemon.json >/dev/null
fi
sudo update-alternatives --set iptables /usr/sbin/iptables-legacy 2>/dev/null || true

if ! pgrep -x dockerd >/dev/null 2>&1; then
sudo dockerd >/tmp/dockerd.log 2>&1 &
fi

for _ in $(seq 1 60); do
if sudo docker info >/dev/null 2>&1; then
break
fi
sleep 1
done

sudo usermod -aG docker "${USER:-ubuntu}" 2>/dev/null || true
10 changes: 10 additions & 0 deletions .cursor/environment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "TensorRT-LLM",
"user": "ubuntu",
"build": {
"dockerfile": "Dockerfile",
"context": "."
},
"install": "bash .cursor/cloud-agent-install.sh",
"start": "bash .cursor/cloud-agent-start.sh"
}
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ __pycache__/
.mypy_cache/
.vscode
.zed
.cursor
.cursor/*
!.cursor/environment.json
!.cursor/Dockerfile
!.cursor/cloud-agent-install.sh
!.cursor/cloud-agent-start.sh
*.engine
*.engine.config
*.cache
Expand Down
11 changes: 11 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,17 @@ Key files:
2. Make changes following `CODING_GUIDELINES.md`
3. Test locally with `pytest`

## Cursor Cloud Agent

Repository-managed environment: `.cursor/environment.json` (install + start scripts under `.cursor/`).

- Activate the project venv: `source .venv/bin/activate` (created by install).
- Install refreshes `git lfs`, `pip install -r requirements-dev.txt`, and `pre-commit` hooks.
- When `nvidia-smi` works, install also runs `scripts/build_wheel.py` (editable) and `pip install -e .`. Override GPU arch with `TRTLLM_CUDA_ARCH` (e.g. `90-real`).
- `import tensorrt_llm`, most of `pytest tests/unittest/`, and `trtllm-serve` need a built package and an NVIDIA GPU. Use a GPU-enabled machine (self-hosted Cloud Agent worker or the NGC `devel` container workflow in `docs/source/installation/build-from-source.md`) for inference and GPU tests.
- CPU-only checks without a build: `ruff check <file>`, `pre-commit run --files <file>`.
- Set `LLM_MODELS_ROOT` for tests that need model weights.

## Branching policy and PRs

- The main repository (`upstream`) is located at https://github.com/NVIDIA/TensorRT-LLM/
Expand Down
Loading