Skip to content

ConnorBaker/cuda-packages

Repository files navigation

cuda-packages

Out of tree (Nixpkgs) experiments with packaging CUDA in an extensible way.

Important

I am in the process of upstreaming this into Nixpkgs. This repository will be archived once that is complete.

Most code lives in Nixpkgs and is copied/modified here for ease of development.

Top-level:

TODO: hostRedistSystem was moved from cudaConfig to cudaPackagesConfig because it is a function of the capabilities specified, and so can vary by package set.

TODO: cudaCapabilities was introduced to cudaPackagesConfig to enable per-package-set configuration -- cudaConfig.cudaCapabilities provides defaults for all package sets.

  • cudaConfig: evaluated configuration for CUDA package sets
    • includes hostNixSystem, hostRedistSystem, and cudaCapabilities (among others), which are helpful when writing modules for cudaModules with the goal of conditionally changing the build based on what's being targeted through mkMerge and mkIf.
  • cudaLib: types, data, and utility functions used in creation of the CUDA package sets
  • cudaPackagesExtensions: extensions (overlays) applied to each CUDA package set
    • an easy way to add packages to all CUDA package sets
  • cudaModules: modules which change the creation of CUDA package sets
    • an easy way to add new CUDA package sets, change the defaults, or add packages to a specific CUDA package set

Notes

  • Python wrappers which invoke CMake do not always pass their environment to the CMake process. That means a number of the environment variables we set so CMake's auto-detection functionality just works is broken.
  • autoAddDriverRunpath for CMake projects is a crutch -- the correct fix is to have the CMake project link against CUDA::cudart.
  • cudaPackages.callPackage sets strictDeps=true and __structuredAttrs=true by default. Packages must have a good reason to opt out (e.g., Python packaging has not been updated yet to support structured attributes: NixOS/nixpkgs#347194).
  • cudaPackages.callPackage uses a name prefix for more descriptive store path names.
    • Prefix is available as cudaPackages.cudaNamePrefix.
  • Manifests and overrides are versioned
    • This prevents conflicts when downstream consumers add their own manifests and overrides.
  • 12.2.2 is kept around because it is the last version of CUDA 12 supported by Xavier through cuda_compat
    • DO NOT rely on it being around forever -- try to upgrade to newer hardware!
  • cuda_compat can be disabled by setting the package to null. This is useful in cases where the host OS has a recent enough CUDA driver that the compatibility library isn't needed.

Todo

About

A playground for Nix and CUDA

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published