From 898f276715e506191e389cae3613a7efd2a6f7b6 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Fri, 9 Oct 2026 15:19:32 +0000 Subject: [PATCH] [None][chore] Add Cursor Cloud Agent environment configuration Add repository-managed environment.json with Ubuntu base Dockerfile, idempotent install/start scripts for dev dependencies and Docker, and document Cloud Agent workflow in AGENTS.md. Signed-off-by: Cursor Agent --- .cursor/Dockerfile | 34 +++++++++++++++++++++++++++ .cursor/cloud-agent-install.sh | 43 ++++++++++++++++++++++++++++++++++ .cursor/cloud-agent-start.sh | 31 ++++++++++++++++++++++++ .cursor/environment.json | 10 ++++++++ .gitignore | 6 ++++- AGENTS.md | 11 +++++++++ 6 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 .cursor/Dockerfile create mode 100755 .cursor/cloud-agent-install.sh create mode 100755 .cursor/cloud-agent-start.sh create mode 100644 .cursor/environment.json diff --git a/.cursor/Dockerfile b/.cursor/Dockerfile new file mode 100644 index 000000000000..f92b4f3dfb4d --- /dev/null +++ b/.cursor/Dockerfile @@ -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 diff --git a/.cursor/cloud-agent-install.sh b/.cursor/cloud-agent-install.sh new file mode 100755 index 000000000000..897444357d1e --- /dev/null +++ b/.cursor/cloud-agent-install.sh @@ -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 diff --git a/.cursor/cloud-agent-start.sh b/.cursor/cloud-agent-start.sh new file mode 100755 index 000000000000..c126fc4a1bb7 --- /dev/null +++ b/.cursor/cloud-agent-start.sh @@ -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 diff --git a/.cursor/environment.json b/.cursor/environment.json new file mode 100644 index 000000000000..46f12b1574c5 --- /dev/null +++ b/.cursor/environment.json @@ -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" +} diff --git a/.gitignore b/.gitignore index b693ef923ccc..b9a6dd2359e9 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/AGENTS.md b/AGENTS.md index 7d729ff65553..350f11649c90 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -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 `, `pre-commit run --files `. +- 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/