about summary refs log tree commit diff
path: root/pkgs/development/compilers/cudatoolkit/saxpy/default.nix
blob: 2da6da29004dc0e85eb3fa2f717ad79d2cd0ba8d (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
{ autoAddOpenGLRunpathHook
, backendStdenv
, cmake
, cuda_cccl ? null
, cuda_cudart ? null
, cudaFlags
, cuda_nvcc ? null
, cudatoolkit ? null
, lib
, libcublas ? null
, setupCudaHook
, stdenv
}:

backendStdenv.mkDerivation {
  pname = "saxpy";
  version = "unstable-2023-07-11";

  src = ./.;

  buildInputs = lib.optionals (cuda_cudart != null) [
    libcublas
    cuda_cudart
    cuda_cccl
  ] ++ lib.optionals (cuda_cudart == null) [
    cudatoolkit
  ];
  nativeBuildInputs = [
    cmake

    # Alternatively, we could remove the propagated hook from cuda_nvcc and add
    # directly:
    # setupCudaHook
    autoAddOpenGLRunpathHook
  ] ++ lib.optionals (cuda_nvcc != null) [
    cuda_nvcc
  ] ++ lib.optionals (cuda_nvcc == null) [
    cudatoolkit
  ];

  cmakeFlags = [
    "-DCMAKE_VERBOSE_MAKEFILE=ON"
    "-DCMAKE_CUDA_ARCHITECTURES=${with cudaFlags; builtins.concatStringsSep ";" (map dropDot cudaCapabilities)}"
  ];

  meta = {
    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;
  };
}