about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/cuda-modules/saxpy/default.nix
blob: 68c60e2d84464a653411f9a0e1c88aa96209a659 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
{
  cmake,
  cudaPackages,
  lib,
}:
let
  inherit (cudaPackages)
    autoAddOpenGLRunpathHook
    backendStdenv
    cuda_cccl
    cuda_cudart
    cuda_nvcc
    cudatoolkit
    cudaVersion
    flags
    libcublas
    setupCudaHook
    ;
  inherit (lib) getDev getLib getOutput;
in
backendStdenv.mkDerivation {
  pname = "saxpy";
  version = "unstable-2023-07-11";

  src = ./.;

  strictDeps = true;

  nativeBuildInputs =
    [
      cmake
      autoAddOpenGLRunpathHook
    ]
    ++ lib.optionals (lib.versionOlder cudaVersion "11.4") [cudatoolkit]
    ++ lib.optionals (lib.versionAtLeast cudaVersion "11.4") [cuda_nvcc];

  buildInputs =
    lib.optionals (lib.versionOlder cudaVersion "11.4") [cudatoolkit]
    ++ lib.optionals (lib.versionAtLeast cudaVersion "11.4") [
      (getDev libcublas)
      (getLib libcublas)
      (getOutput "static" libcublas)
      cuda_cudart
    ]
    ++ lib.optionals (lib.versionAtLeast cudaVersion "12.0") [cuda_cccl];

  cmakeFlags = [
    (lib.cmakeBool "CMAKE_VERBOSE_MAKEFILE" true)
    (lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES" (
      with flags; lib.concatStringsSep ";" (lib.lists.map dropDot cudaCapabilities)
    ))
  ];

  meta = rec {
    description = "A simple (Single-precision AX Plus Y) FindCUDAToolkit.cmake example for testing cross-compilation";
    license = lib.licenses.mit;
    maintainers = lib.teams.cuda.members;
    platforms = lib.platforms.unix;
    badPlatforms = lib.optionals flags.isJetsonBuild platforms;
  };
}