skills/tools/pixi/pixi-make-cu-build-env/SKILL.md
Guides the agent to setup a new or existing Pixi environment for compiling C++ and CUDA code. It ensures the correct compilers, toolkits, and CMake configurations are in place for a robust user-space build.
npx skillsauth add igamenovoer/magic-context pixi-make-cu-build-envInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Use this skill when the user asks to:
Mandatory: You MUST identify:
Project Context: The existing Pixi project path. (Default to current working directory if valid).
Manifest File: Identify if the project uses pixi.toml or pyproject.toml.
Target Environment Name: "Which Pixi environment should this be set up in?"
default environment.cuda-12), use that feature.CUDA Version: "Which CUDA version do you need?" (e.g., 11.8, 12.1).
Host Tools: Check if cmake, ninja, and a C++ compiler are available and suitable.
cmake --version, ninja --version, and check for gcc/clang (Linux) or cl (Windows).Tools: "Do you need profiling/debugging tools like nsight-compute?"
Before modifying the project, verify the current state of <MANIFEST_FILE>.
cuda-toolkit, cudnn)? Is the nvidia channel prioritized? Are versions conflicting?conda-forge prioritized, incompatible pins):
cu<VERSION>-build) with its own solve-group to isolate dependencies.Execute the workflow corresponding to the user's choice.
Create a new feature and environment with a dedicated solve-group.
# 1. Add Feature with Dependencies (Pin channel to nvidia)
pixi add --manifest-path <MANIFEST_FILE> --feature <NEW_ENV_NAME> --channel nvidia \
cmake ninja cxx-compiler make pkg-config \
cuda-toolkit=<VERSION> cuda-nvcc=<VERSION> \
[cudnn nccl nsight-compute]
# 2. Create Environment with Dedicated Solve-Group
# (Use 'pixi workspace environment add' or edit manifest manually if CLI lacks support)
# TOML equivalent:
# [tool.pixi.environments]
# <NEW_ENV_NAME> = { features = ["<NEW_ENV_NAME>"], solve-group = "<NEW_ENV_NAME>" }
Best Practice: Always add the nvidia channel to the project configuration before installing packages.
Command Logic:
--feature.--feature <ENV_NAME>.# 1. Setup Channels (Prioritize NVIDIA)
pixi project channel add nvidia --prepend --manifest-path <PROJECT_PATH>/<MANIFEST_FILE>
# 2. Core Build Tools
pixi add --manifest-path <PROJECT_PATH>/<MANIFEST_FILE> [--feature <ENV_NAME>] cmake ninja cxx-compiler make pkg-config
# 3. CUDA Toolchain
pixi add --manifest-path <PROJECT_PATH>/<MANIFEST_FILE> [--feature <ENV_NAME>] cuda-toolkit=<VERSION> cuda-nvcc=<VERSION>
Optional Extras/Tools (Only if requested):
pixi add --manifest-path <PROJECT_PATH>/<MANIFEST_FILE> [--feature <ENV_NAME>] cudnn=<VERSION> nccl=<VERSION> nsight-compute
Add a standard CMake build task to <MANIFEST_FILE>.
CMAKE_CUDA_COMPILER points to the Pixi-managed nvcc ($CONDA_PREFIX/bin/nvcc).Task Definition:
[tool.pixi.tasks]
configure = { cmd = "cmake -G Ninja -S . -B build -DCMAKE_CUDA_COMPILER=$CONDA_PREFIX/bin/nvcc -DCUDAToolkit_ROOT=$CONDA_PREFIX", env = { CUDACXX = "$CONDA_PREFIX/bin/nvcc" } }
build = "cmake --build build"
test = "ctest --test-dir build"
To verify the setup, deploy the self-contained test suite from the skill's resource directory.
1. Deploy Test Suite:
Check if the project has a tmp/ directory. If so, place the verification project there to keep the root clean.
# Determine verification path
TARGET_DIR="build-check"
if [ -d "tmp" ]; then TARGET_DIR="tmp/build-check"; fi
# Deploy
mkdir -p "$TARGET_DIR"
cp -r magic-context/skills/tools/pixi/pixi-make-cu-build-env/demo-code/* "$TARGET_DIR"/
chmod +x "$TARGET_DIR/build-and-run.sh"
2. Execute: Run the script using the configured environment. The script automatically handles source path detection.
pixi run --manifest-path <MANIFEST_FILE> [--feature <ENV_NAME>] "$TARGET_DIR/build-and-run.sh"
$TARGET_DIR/build/check_app exists to confirm the compilation setup.build-and-run.sh handles directory context automatically. If you see errors about missing CMakeLists.txt, ensure you haven't moved the script out of the verification directory.Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed is often normal; CMake usually finds pthread in the next step.nvcc warning : Support for offline compilation... indicates the default architecture might be older. You can safely ignore this warning for verification purposes.nvidia-smi. The host driver must support the installed CUDA Toolkit version.nvidia for cuda-* packages.-DCMAKE_CUDA_COMPILER over relying on implicit path resolution, as CMake might pick up /usr/bin/nvcc.sudo and works on any Linux machine with a driver.data-ai
Create readable Mermaid diagrams inside Markdown files. Use for flowcharts and sequence diagrams that must render cleanly in common Markdown renderers (e.g., GitHub) without horizontal scrolling. Covers fenced mermaid blocks, init/theme styling, label wrapping with <br/>, and sequenceDiagram layout rules (short IDs, wrapped labels, don’t break identifiers).
development
Manual invocation only; use only when the user explicitly requests `make-program-tutorial` by exact name, OR when the user asks to use a skill to create an SDK/API/library tutorial. Create a clear, reproducible, step-by-step tutorial for a specific API/SDK/library (or a set of functions/classes), with runnable examples, expected outputs, and basic troubleshooting.
testing
Use when the user wants to create a self-hosted, offline-installable Conda channel (mirror) containing a specific subset of packages using Pixi.
tools
Use when the user says "use pixi to install <some nvidia tool>" (or similar) and wants NVIDIA/CUDA/GPU packages installed via Pixi (no sudo/apt), e.g., CUDA toolkit pieces, cuDNN/NCCL, PyTorch CUDA builds, RAPIDS.