blob: 0e14ce709a6423fd0ae78023d5c90b435ef536fb (
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
final: _: {
# Helper hook used in both autoAddCudaCompatRunpath and
# autoAddDriverRunpath that applies a generic patching action to all elf
# files with a dynamic linking section.
autoFixElfFiles =
final.callPackage
(
{makeSetupHook}:
makeSetupHook
{
name = "auto-fix-elf-files";
}
./auto-fix-elf-files.sh
)
{};
# Internal hook, used by cudatoolkit and cuda redist packages
# to accommodate automatic CUDAToolkit_ROOT construction
markForCudatoolkitRootHook =
final.callPackage
(
{makeSetupHook}:
makeSetupHook {name = "mark-for-cudatoolkit-root-hook";} ./mark-for-cudatoolkit-root-hook.sh
)
{};
# Currently propagated by cuda_nvcc or cudatoolkit, rather than used directly
setupCudaHook =
(final.callPackage
(
{makeSetupHook, backendStdenv}:
makeSetupHook
{
name = "setup-cuda-hook";
substitutions.setupCudaHook = placeholder "out";
# Point NVCC at a compatible compiler
substitutions.ccRoot = "${backendStdenv.cc}";
# Required in addition to ccRoot as otherwise bin/gcc is looked up
# when building CMakeCUDACompilerId.cu
substitutions.ccFullPath = "${backendStdenv.cc}/bin/${backendStdenv.cc.targetPrefix}c++";
}
./setup-cuda-hook.sh
)
{}
);
autoAddDriverRunpath =
final.callPackage
(
{addDriverRunpath, autoFixElfFiles, makeSetupHook}:
makeSetupHook
{
name = "auto-add-opengl-runpath-hook";
propagatedBuildInputs = [addDriverRunpath autoFixElfFiles];
}
./auto-add-driver-runpath-hook.sh
)
{};
# autoAddCudaCompatRunpath hook must be added AFTER `setupCudaHook`. Both
# hooks prepend a path with `libcuda.so` to the `DT_RUNPATH` section of
# patched elf files, but `cuda_compat` path must take precedence (otherwise,
# it doesn't have any effect) and thus appear first. Meaning this hook must be
# executed last.
autoAddCudaCompatRunpath =
final.callPackage
(
{makeSetupHook, autoFixElfFiles, cuda_compat ? null }:
makeSetupHook
{
name = "auto-add-cuda-compat-runpath-hook";
propagatedBuildInputs = [autoFixElfFiles];
substitutions = {
# Hotfix Ofborg evaluation
libcudaPath = if final.flags.isJetsonBuild then "${cuda_compat}/compat" else null;
};
meta.broken = !final.flags.isJetsonBuild;
# Pre-cuda_compat CUDA release:
meta.badPlatforms = final.lib.optionals (cuda_compat == null) final.lib.platforms.all;
meta.platforms = cuda_compat.meta.platforms or [ ];
}
./auto-add-cuda-compat-runpath.sh
)
{};
}
|