# Agent Instructions This document provides guidelines for building, testing, and contributing to the CCCL repository. It is primarily written for agentic AIs, but the information is also useful for CCCL developers. --- ## Overview CCCL is a collection of CUDA C++ libraries and Python packages: * **libcudacxx** — CUDA C++ Standard Library * **CUB** — Block-level primitives * **Thrust** — High-level parallel algorithms * **cudax** — Experimental features * **C Parallel Library** — C bindings for CCCL algorithms * **Python CCCL packages** (`cuda-cccl`) — Python APIs for parallel primitives and programmatic access to CCCL headers The repository uses **CMake** with the **Ninja** generator and provides standardized presets for consistent builds. --- ## Iteration Cycles For a given task, you should: 1. Research. Search the web, read existing code, look up system/dependency headers / implementations of related functionality. Figure out best practices and common pitfalls. Look for existing tests of the functionality; if none exist, plan a new test that integrates with the relevant existing testing frameworks. 2. Plan. Create a high-level plan to implement the requested feature. 3. Review and Refine plan. Look for pitfalls, find ways to smooth out rough edges. Verify any assumptions, edgecases, or identified pitfalls. Repeat until the plan is solid. 4. Gather consistency context. Look at similar code (sibling classes if possible, otherwise just related source files) to learn the style and patterns used in the project. Consistency is important -- similar features should be organized and implemented similarly. Naming conventions should be followed. 5. If requested: Present the plan. Only do this if the user asks for a plan to do something -- if they just ask you implement something without requesting a plan, skip this step. 6. Draft. Implement the requested task to the best of your ability. 7. Review and Refine. Read through your changes. Verify that API calls are correct. Assess clarity, performance, and readability. Iterate as needed. 8. Style check. Ensure that your changes follow style and naming conventions. 9. Build and test. Once you're confident that your changes are functionally and stylistically correct start build, test, and iterate cycles. If you don't have permissions to do these, ask the user to run specific build/test commands for you. --- ## Known Agent Limitations ### OpenAI Codex Codex cloud instances cannot: * Run Docker containers with devcontainer scripts * Access GPUs or run GPU-dependent tests --- ## Build and Test Tools All CCCL subprojects are computationally expensive to build and test. Use the provided helper scripts to minimize work and target only what you need. ### CMake Presets Presets are defined in `CMakePresets.json`. Names follow a `project` or `-cpp` format, such as `cub-cpp20`, `thrust-cpp17`, or `libcudacxx`. Use `cmake --list-presets` to view available options. Build trees are placed under `build/${CCCL_BUILD_INFIX}/${PRESET}`. ### `.devcontainer/launch.sh` Launches a container configured with a CUDA Toolkit and host compiler. First startup may take time, but cached environments are faster. In agent environments, container launches may not be supported. To check if you are already inside a container, verify if `CCCL_BUILD_INFIX` is set. Common options: * `-d, --docker` — Run without VSCode (required for agents) * `--cuda ` — Select CUDA Toolkit (optional) * `--cuda-ext` — Use a docker image with extended CTK libraries * `--host ` — Select host compiler (optional) * `--gpus ` — GPU devices to add to the container (use `all` to pass all GPUs) * `-e/--env`, `-v/--volume` — Environment variables / volume mounts * `--