-
Notifications
You must be signed in to change notification settings - Fork 558
/
build_tarballs.jl
74 lines (60 loc) · 2.97 KB
/
build_tarballs.jl
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
# CUDA forward compatibility driver
#
# - https://docs.nvidia.com/deploy/cuda-compatibility/index.html#forward-compatibility-title
# - https://docs.nvidia.com/datacenter/tesla/index.html
# - https://www.nvidia.com/Download/index.aspx
using BinaryBuilder, Pkg
include("../../../fancy_toys.jl")
name = "CUDA_Driver"
version = v"0.11.0"
cuda_version = v"12.7"
cuda_version_str = "$(cuda_version.major)-$(cuda_version.minor)"
driver_version_str = "565.57.01"
build = 1
sources_linux_x86 = [
FileSource("https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-compat-$(cuda_version_str)-$(driver_version_str)-$(build).el8.x86_64.rpm",
"8df61c9a521494f4892082177fde778219be892a93e59a6fc1bceb4331f66225", "compat.rpm")
]
sources_linux_aarch64 = [
FileSource("https://developer.download.nvidia.com/compute/cuda/repos/rhel8/sbsa/cuda-compat-$(cuda_version_str)-$(driver_version_str)-$(build).el8.aarch64.rpm",
"68430934bc3de03cc00240b78da39099981fcedb81b48e69cbe4505dc36fffd7", "compat.rpm")
]
dependencies = []
script = raw"""
apk update
apk add rpm2cpio
rpm2cpio compat.rpm | cpio -idmv
mkdir -p ${libdir}
mv usr/local/cuda-*/compat/* ${libdir}
"""
# CUDA_Driver_jll provides libcuda_compat, but we can't always use that driver: It requires
# specific hardware, and a compatible operating system. So we don't just dlopen the library,
# but instead check during __init__ if we can, and dlopen either the system driver or the
# compatible one from this JLL.
#
# Ordinarily, we'd put this logic in a package that depends on CUDA_Driver_jll (e.g.
# CUDA_Driver.jl), but that complicates depending on it from other JLLs (like
# CUDA_Runtime_jll). This will also simplify moving the logic into CUDA_Runtime_jll, which
# we will have to at some point (because its pkg hooks shouldn't depend on CUDA_Driver_jll).
init_block = read(joinpath(@__DIR__, "init.jl"), String)
init_block = map(eachline(IOBuffer(init_block))) do line
# indent non-empty lines
(isempty(line) ? "" : " ") * line * "\n"
end |> join
products = [
LibraryProduct("libcuda", :libcuda_compat; dont_dlopen=true),
LibraryProduct("libcudadebugger", :libcuda_debugger; dont_dlopen=true),
LibraryProduct("libnvidia-nvvm", :libnvidia_nvvm; dont_dlopen=true),
LibraryProduct("libnvidia-ptxjitcompiler", :libnvidia_ptxjitcompiler; dont_dlopen=true),
]
non_reg_ARGS = filter(arg -> arg != "--register", ARGS)
if should_build_platform("x86_64-linux-gnu")
build_tarballs(non_reg_ARGS, name, version, sources_linux_x86, script,
[Platform("x86_64", "linux")], products, dependencies;
skip_audit=true, init_block)
end
if should_build_platform("aarch64-linux-gnu")
build_tarballs(ARGS, name, version, sources_linux_aarch64, script,
[Platform("aarch64", "linux")], products, dependencies;
skip_audit=true, init_block)
end