返回 Skill 列表
extension
分类: 开发与工程无需 API Key

pixi-install-nvidia

当用户说“使用pixi安装<某些NVIDIA工具>”(或类似表述)并希望通过Pixi安装NVIDIA/CUDA/GPU软件包(不使用sudo/apt),例如CUDA工具包组件、cuDNN/NCCL、PyTorch CUDA构建版本、RAPIDS时,请使用此规则。

person作者: jakexiaohubgithub

Pixi Install NVIDIA

Trigger

Use this skill when the user asks to install NVIDIA tooling via Pixi, especially in the form:

  • "use pixi to install <some nvidia tool>"

Examples:

  • "use pixi to install cuda"
  • "use pixi to install nvcc"
  • "use pixi to install cudnn/nccl"
  • "use pixi to install pytorch cuda 12.1"

Overview

This skill provides workflows for setting up No-Sudo, User-Space GPU environments. By installing CUDA toolkits and libraries via Pixi, you avoid modifying the host system (apt install) and ensure perfect reproducibility across different machines.

Key Benefits

  • No Root Needed: Install compilers (NVCC) and libraries (cuDNN, NCCL) without sudo.
  • Isolation: Project CUDA version is independent of the host's /usr/local/cuda.
  • Reproducibility: pixi.lock guarantees the exact same driver-compatible libraries everywhere.

Workflow

1. Channel Configuration

Ensure the correct channels are present in pyproject.toml. The order determines priority.

  • Command: pixi project channel add nvidia (and pytorch if needed).
  • Priority: nvidia MUST be prioritized over conda-forge for all NVIDIA tools and libraries (CUDA, cuDNN, NCCL, etc.), unless the user explicitly requests otherwise.

2. Adding GPU Packages

Use specific versions to ensure compatibility between CUDA and the framework. Always prefer the nvidia channel for these packages.

PyTorch (Recommended)

pixi add pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia

CUDA Toolkit Components

Instead of the massive cuda-toolkit, consider adding only what's needed:

pixi add cuda-compiler cuda-libraries-dev

3. Verification

After installation, verify GPU visibility:

pixi run python -c "import torch; print(torch.cuda.is_available())"

Troubleshooting & References

  • CUDA Version Mismatch: Check nvidia-smi on the host to ensure the installed pytorch-cuda version is supported by the host driver.
  • Library Loading Issues: If libcuda.so or libcudart.so are not found, ensure the environment is activated (pixi shell).
  • Detailed Package List: See nvidia-packages.md for a comprehensive list of available NVIDIA and GPU libraries.
  • Compiling Code: See compiling-cuda.md for instructions on using nvcc and cmake with the Pixi-managed toolkit.

Resources

references/

  • nvidia-packages.md: Comprehensive guide on channels, packages, and versioning for NVIDIA ecosystems.
  • compiling-cuda.md: Guide for compiling CUDA C++ code using the Pixi-managed toolchain.