nixpkgs/pkgs/development/cuda-modules/cuda/overrides.nix
Connor Baker 8e800cedaf cudaPackages: move derivations to cuda-modules & support aarch64
cudaPackages.cuda_compat: ignore missing libs provided at runtime

cudaPackages.gpus: Jetson should never build by default

cudaPackages.flags: don't build Jetson capabilities by default

cudaPackages: re-introduce filter for pre-existing CUDA redist packages in overrides

cudaPackages: only recurseIntoAttrs for the latest of each major version

cudaPackages.nvccCompatabilities: use GCC 10 through CUDA 11.5 to avoid a GLIBC incompatability

cudaPackages.cutensor: acquire libcublas through cudatoolkit prior to 11.4

cudaPackages.cuda_compat: mark as broken on aarch64-linux if not targeting Jetson

cudaPackages.cutensor_1_4: fix build

cudaPackages: adjust use of autoPatchelfIgnoreMissingDeps

cudaPackages.cuda_nvprof: remove unecessary override to add addOpenGLRunpath

cudaPackages: use getExe' to avoid patchelf warning about missing meta.mainProgram

cudaPackages: fix evaluation with Nix 2.3

cudaPackages: fix platform detection for Jetson/non-Jetson aarch64-linux

python3Packages.tensorrt: mark as broken if required packages are missing

Note: evaluating the name of the derivation will fail if tensorrt is not present,
which is why we wrap the value in `lib.optionalString`.

cudaPackages.flags.getNixSystem: add guard based on jetsonTargets

cudaPackages.cudnn: use explicit path to patchelf

cudaPackages.tensorrt: use explicit path to patchelf
2023-12-07 16:45:54 +00:00

130 lines
4.0 KiB
Nix

{cudaVersion, lib}:
let
inherit (lib) attrsets lists strings;
# cudaVersionOlder : Version -> Boolean
cudaVersionOlder = strings.versionOlder cudaVersion;
# cudaVersionAtLeast : Version -> Boolean
cudaVersionAtLeast = strings.versionAtLeast cudaVersion;
addBuildInputs =
drv: buildInputs:
drv.overrideAttrs (prevAttrs: {buildInputs = prevAttrs.buildInputs ++ buildInputs;});
in
# NOTE: Filter out attributes that are not present in the previous version of
# the package set. This is necessary to prevent the appearance of attributes
# like `cuda_nvcc` in `cudaPackages_10_0, which predates redistributables.
final: prev:
attrsets.filterAttrs (attr: _: (builtins.hasAttr attr prev)) {
libcufile = prev.libcufile.overrideAttrs (
prevAttrs: {
buildInputs = prevAttrs.buildInputs ++ [
final.libcublas.lib
final.pkgs.numactl
final.pkgs.rdma-core
];
# Before 11.7 libcufile depends on itself for some reason.
env.autoPatchelfIgnoreMissingDeps =
prevAttrs.env.autoPatchelfIgnoreMissingDeps
+ strings.optionalString (cudaVersionOlder "11.7") " libcufile.so.0";
}
);
libcusolver = addBuildInputs prev.libcusolver (
# Always depends on this
[final.libcublas.lib]
# Dependency from 12.0 and on
++ lists.optionals (cudaVersionAtLeast "12.0") [final.libnvjitlink.lib]
# Dependency from 12.1 and on
++ lists.optionals (cudaVersionAtLeast "12.1") [final.libcusparse.lib]
);
libcusparse = addBuildInputs prev.libcusparse (
lists.optionals (cudaVersionAtLeast "12.0") [final.libnvjitlink.lib]
);
cuda_compat = prev.cuda_compat.overrideAttrs (
prevAttrs: {
env.autoPatchelfIgnoreMissingDeps =
prevAttrs.env.autoPatchelfIgnoreMissingDeps + " libnvrm_gpu.so libnvrm_mem.so";
# `cuda_compat` only works on aarch64-linux, and only when building for Jetson devices.
brokenConditions = prevAttrs.brokenConditions // {
"Trying to use cuda_compat on aarch64-linux targeting non-Jetson devices" =
!final.flags.isJetsonBuild;
};
}
);
cuda_gdb = addBuildInputs prev.cuda_gdb (
# x86_64 only needs gmp from 12.0 and on
lists.optionals (cudaVersionAtLeast "12.0") [final.pkgs.gmp]
);
cuda_nvcc = prev.cuda_nvcc.overrideAttrs (
oldAttrs: {
propagatedBuildInputs = [final.setupCudaHook];
meta = (oldAttrs.meta or {}) // {
mainProgram = "nvcc";
};
}
);
cuda_nvprof = prev.cuda_nvprof.overrideAttrs (
prevAttrs: {buildInputs = prevAttrs.buildInputs ++ [final.cuda_cupti.lib];}
);
cuda_demo_suite = addBuildInputs prev.cuda_demo_suite [
final.pkgs.freeglut
final.pkgs.libGLU
final.pkgs.libglvnd
final.pkgs.mesa
final.libcufft.lib
final.libcurand.lib
];
nsight_compute = prev.nsight_compute.overrideAttrs (
prevAttrs: {
nativeBuildInputs =
prevAttrs.nativeBuildInputs
++ (
if (strings.versionOlder prev.nsight_compute.version "2022.2.0") then
[final.pkgs.qt5.wrapQtAppsHook]
else
[final.pkgs.qt6.wrapQtAppsHook]
);
buildInputs =
prevAttrs.buildInputs
++ (
if (strings.versionOlder prev.nsight_compute.version "2022.2.0") then
[final.pkgs.qt5.qtwebview]
else
[final.pkgs.qt6.qtwebview]
);
}
);
nsight_systems = prev.nsight_systems.overrideAttrs (
prevAttrs: {
nativeBuildInputs = prevAttrs.nativeBuildInputs ++ [final.pkgs.qt5.wrapQtAppsHook];
buildInputs = prevAttrs.buildInputs ++ [
final.pkgs.alsa-lib
final.pkgs.e2fsprogs
final.pkgs.nss
final.pkgs.numactl
final.pkgs.pulseaudio
final.pkgs.wayland
final.pkgs.xorg.libXcursor
final.pkgs.xorg.libXdamage
final.pkgs.xorg.libXrandr
final.pkgs.xorg.libXtst
];
}
);
nvidia_driver = prev.nvidia_driver.overrideAttrs {
# No need to support this package as we have drivers already
# in linuxPackages.
meta.broken = true;
};
}