diff --git a/.agents/setup b/.agents/setup new file mode 100755 index 0000000..afc23e2 --- /dev/null +++ b/.agents/setup @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +# Amp orb setup for blackwell-kernel-lab. +# +# Amp runs this from the repository root when it builds a project orb snapshot +# (Debian 12, CPU only: orbs have no GPU). It must finish within 20 minutes and +# be safe to run more than once. See https://ampcode.com/docs/orbs/customizing +# +# Installs only what this repo's CI and manifests need: +# - apt: build-essential, cmake (Debian 12: 3.25), shellcheck +# - CPU-only configure: cmake -S kernels -B build/kernels-cpu -DBKL_ENABLE_CUDA=OFF +# +# It ends with a dependency fetch/prebuild, not a test run. +set -euo pipefail + +cd "$(dirname "${BASH_SOURCE[0]}")/.." + +SUDO="" +if [ "$(id -u)" -ne 0 ]; then + SUDO="sudo" +fi + +# Install Debian packages that are not already present. +apt_install() { + local missing=() pkg + for pkg in "$@"; do + if ! dpkg-query -W -f='${Status}' "$pkg" 2>/dev/null | grep -q "install ok installed"; then + missing+=("$pkg") + fi + done + if [ "${#missing[@]}" -gt 0 ]; then + $SUDO apt-get -o Acquire::Retries=5 update -qq + $SUDO env DEBIAN_FRONTEND=noninteractive apt-get -o Acquire::Retries=5 install -y --no-install-recommends "${missing[@]}" + fi +} + +# --- System packages (cmake + C++ compiler for the CPU configure path; shellcheck for ci-lint.yml) --- +apt_install build-essential cmake shellcheck + +# --- Prebuild: CPU-only CMake configure (ci-cpu.yml) --- +# BKL_ENABLE_CUDA=OFF skips every kernel target, so no nvcc is needed. +cmake -S kernels -B build/kernels-cpu -DBKL_ENABLE_CUDA=OFF + +echo "Amp orb setup for blackwell-kernel-lab finished."