Skip to content

Commit 86e6536

Browse files
committed
CUDA_Compiler_jll build 0.3.0+0
1 parent 87b0ef3 commit 86e6536

File tree

4 files changed

+32
-160
lines changed

4 files changed

+32
-160
lines changed

.pkg/platform_augmentation.jl

Lines changed: 18 additions & 146 deletions
Original file line numberDiff line numberDiff line change
@@ -1,158 +1,30 @@
11
using Base.BinaryPlatforms
22

3-
using Libdl
4-
5-
# re-use the CUDA_Runtime_jll preference to select the appropriate compiler
6-
const CUDA_Runtime_jll_uuid = Base.UUID("76a88914-d11a-5bdc-97e0-2f5a05c973a2")
7-
const preferences = Base.get_preferences(CUDA_Runtime_jll_uuid)
8-
function parse_version_preference(key)
9-
if haskey(preferences, key)
10-
if isa(preferences[key], String)
11-
version = tryparse(VersionNumber, preferences[key])
12-
if version === nothing
13-
@error "CUDA $key preference is not valid; expected a version number, but got '$(preferences[key])'"
14-
missing
15-
else
16-
version
17-
end
18-
else
19-
@error "CUDA $key preference is not valid; expected a version number, but got '$(preferences[key])'"
20-
missing
21-
end
22-
else
23-
missing
24-
end
25-
end
26-
const version_preference = parse_version_preference("version")
27-
28-
if ismissing(version_preference)
29-
# before loading CUDA_Driver_jll, try to find out where the system driver is located.
30-
let
31-
name = if Sys.iswindows()
32-
Libdl.find_library("nvcuda")
33-
else
34-
Libdl.find_library(["libcuda.so.1", "libcuda.so"])
35-
end
36-
37-
# if we've found a system driver, put a dependency on it,
38-
# so that we get recompiled if the driver changes.
39-
if name != ""
40-
handle = Libdl.dlopen(name)
41-
path = Libdl.dlpath(handle)
42-
Libdl.dlclose(handle)
43-
44-
@debug "Adding include dependency on $path"
45-
Base.include_dependency(path)
46-
end
47-
end
48-
end
49-
50-
# platform augmentation hooks run in an ill-defined environment, where:
51-
# - CUDA_Driver_jll may not be available
52-
# - the wrong version of CUDA_Driver_jll may be available
53-
#
54-
# because of that, we need to be very careful about using that dependency.
55-
# currently, we support all existing versions of CUDA_Driver_jll, but if we
56-
# ever need to introduce a breaking change, we'll need some way to identify
57-
# the version of CUDA_Driver_jll from its module (e.g. a global constant).
58-
#
59-
# ref: https://github.com/JuliaLang/Pkg.jl/issues/3225
60-
# can't use Preferences for the same reason
613
try
62-
using CUDA_Driver_jll
63-
catch err
64-
# we'll handle this below
4+
using CUDA_Runtime_jll
5+
catch
6+
# during initial package installation, CUDA_Runtime_jll may not be available.
7+
# in that case, we just won't select an artifact.
658
end
669

67-
# get the version of the available CUDA driver by querying either CUDA_Driver_jll's
68-
# driver, or the system driver if CUDA_Driver_jll is not available
69-
function get_driver_version()
70-
if !@isdefined(CUDA_Driver_jll)
71-
# driver JLL not available because we're in the middle of installing packages
72-
@debug "CUDA_Driver_jll not available; not selecting an artifact"
73-
return nothing
74-
end
75-
76-
cuda_driver = if CUDA_Driver_jll.is_available()
77-
@debug "Using CUDA_Driver_jll for driver discovery"
78-
79-
if !isdefined(CUDA_Driver_jll, :libcuda) || # [email protected]
80-
isnothing(CUDA_Driver_jll.libcuda) # https://github.com/JuliaLang/julia/issues/48999
81-
# no driver found
82-
@debug "CUDA_Driver_jll reports no driver found"
83-
return nothing
84-
end
85-
CUDA_Driver_jll.libcuda
86-
else
87-
# CUDA_Driver_jll only kicks in for supported platforms, so fall back to
88-
# a system search if the artifact isn't available (JLLWrappers.jl#50)
89-
@debug "CUDA_Driver_jll unavailable, falling back to system search"
10+
# can't use Preferences for the same reason
11+
const CUDA_Runtime_jll_uuid = Base.UUID("76a88914-d11a-5bdc-97e0-2f5a05c973a2")
12+
const preferences = Base.get_preferences(CUDA_Runtime_jll_uuid)
13+
Base.record_compiletime_preference(CUDA_Runtime_jll_uuid, "version")
14+
Base.record_compiletime_preference(CUDA_Runtime_jll_uuid, "local")
9015

91-
driver_name = if Sys.iswindows()
92-
Libdl.find_library("nvcuda")
16+
function augment_platform!(platform::Platform)
17+
platform["cuda"] = if @isdefined(CUDA_Runtime_jll)
18+
cuda = cuda_toolkit_tag()
19+
if cuda === nothing
20+
"none"
9321
else
94-
Libdl.find_library(["libcuda.so.1", "libcuda.so"])
95-
end
96-
if driver_name == ""
97-
# no driver found
98-
@debug "CUDA_Driver_jll unavailable, and no system CUDA driver found"
99-
return nothing
22+
# extract major version
23+
cuda_version = parse(VersionNumber, cuda)
24+
"$(cuda_version.major)"
10025
end
101-
102-
driver_name
103-
end
104-
@debug "Found CUDA driver at '$cuda_driver'"
105-
106-
# minimal API call wrappers we need
107-
function cuDriverGetVersion(library_handle)
108-
function_handle = Libdl.dlsym(library_handle, "cuDriverGetVersion"; throw_error=false)
109-
if function_handle === nothing
110-
@debug "Driver library seems invalid (does not contain 'cuDriverGetVersion')"
111-
return nothing
112-
end
113-
version_ref = Ref{Cint}()
114-
status = ccall(function_handle, Cint, (Ptr{Cint},), version_ref)
115-
if status != 0
116-
@debug "Call to 'cuDriverGetVersion' failed with status $status"
117-
return nothing
118-
end
119-
major, ver = divrem(version_ref[], 1000)
120-
minor, patch = divrem(ver, 10)
121-
return VersionNumber(major, minor, patch)
122-
end
123-
124-
driver_handle = Libdl.dlopen(cuda_driver; throw_error=false)
125-
if driver_handle === nothing
126-
@debug "Failed to load CUDA driver"
127-
return nothing
128-
end
129-
130-
cuDriverGetVersion(driver_handle)
131-
end
132-
133-
# returns the value for the "cuda" tag we should use in the platform ("$MAJOR")
134-
# or nothing if no CUDA driver was found.
135-
function cuda_driver_tag()
136-
if version_preference !== missing
137-
@debug "CUDA version override: $version_preference"
138-
"$(version_preference.major)"
13926
else
140-
cuda_driver = get_driver_version()
141-
if cuda_driver === nothing
142-
@debug "Failed to query CUDA driver version"
143-
return nothing
144-
end
145-
@debug "CUDA driver version: $cuda_driver"
146-
147-
"$(cuda_driver.major)"
148-
end
149-
end
150-
151-
function augment_platform!(platform::Platform)
152-
if !haskey(platform, "cuda")
153-
platform["cuda"] = something(cuda_driver_tag(), "none")
154-
# XXX: use "none" when we couldn't find a compatible toolkit.
155-
# we can't just leave off the platform tag or Pkg would select *any* artifact.
27+
"none"
15628
end
15729

15830
return platform

Artifacts.toml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ os = "linux"
88

99
[[CUDA_Compiler.download]]
1010
sha256 = "a249766eebae37d103e45c90c331784a3d26633194b2facb259c6fcb29f8ae03"
11-
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.2.2+0/CUDA_Compiler.v0.2.2.x86_64-linux-gnu-cuda+11.tar.gz"
11+
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.3.0+0/CUDA_Compiler.v0.3.0.x86_64-linux-gnu-cuda+11.tar.gz"
1212
[[CUDA_Compiler]]
1313
arch = "aarch64"
1414
cuda = "11"
@@ -20,7 +20,7 @@ os = "linux"
2020

2121
[[CUDA_Compiler.download]]
2222
sha256 = "4b89ab924dae5e44204fdeedb814fb603f3f8f26fe962d92f212774787744841"
23-
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.2.2+0/CUDA_Compiler.v0.2.2.aarch64-linux-gnu-cuda_platform+jetson-cuda+11.tar.gz"
23+
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.3.0+0/CUDA_Compiler.v0.3.0.aarch64-linux-gnu-cuda_platform+jetson-cuda+11.tar.gz"
2424
[[CUDA_Compiler]]
2525
arch = "aarch64"
2626
cuda = "11"
@@ -32,7 +32,7 @@ os = "linux"
3232

3333
[[CUDA_Compiler.download]]
3434
sha256 = "fc9c1cd6a93c700f827b1dd484bff0ca2b5ea54e9b1f0bad70bea8517ae1b275"
35-
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.2.2+0/CUDA_Compiler.v0.2.2.aarch64-linux-gnu-cuda_platform+sbsa-cuda+11.tar.gz"
35+
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.3.0+0/CUDA_Compiler.v0.3.0.aarch64-linux-gnu-cuda_platform+sbsa-cuda+11.tar.gz"
3636
[[CUDA_Compiler]]
3737
arch = "x86_64"
3838
cuda = "11"
@@ -42,7 +42,7 @@ os = "windows"
4242

4343
[[CUDA_Compiler.download]]
4444
sha256 = "4da6c51fab2e0b5a31a5d13fcad2d635691d6f107875914b6d6510879472b2fb"
45-
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.2.2+0/CUDA_Compiler.v0.2.2.x86_64-w64-mingw32-cuda+11.tar.gz"
45+
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.3.0+0/CUDA_Compiler.v0.3.0.x86_64-w64-mingw32-cuda+11.tar.gz"
4646
[[CUDA_Compiler]]
4747
arch = "x86_64"
4848
cuda = "12"
@@ -53,7 +53,7 @@ os = "linux"
5353

5454
[[CUDA_Compiler.download]]
5555
sha256 = "bdc82d97b73b7e0e5369f40ca4d9813b314578292a750ce09977280d11eb8da3"
56-
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.2.2+0/CUDA_Compiler.v0.2.2.x86_64-linux-gnu-cuda+12.tar.gz"
56+
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.3.0+0/CUDA_Compiler.v0.3.0.x86_64-linux-gnu-cuda+12.tar.gz"
5757
[[CUDA_Compiler]]
5858
arch = "aarch64"
5959
cuda = "12"
@@ -65,7 +65,7 @@ os = "linux"
6565

6666
[[CUDA_Compiler.download]]
6767
sha256 = "61a5418b016dd9965eba530186fe68f4b041ef059d2fbb3c24e0ddb235abcdca"
68-
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.2.2+0/CUDA_Compiler.v0.2.2.aarch64-linux-gnu-cuda_platform+jetson-cuda+12.tar.gz"
68+
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.3.0+0/CUDA_Compiler.v0.3.0.aarch64-linux-gnu-cuda_platform+jetson-cuda+12.tar.gz"
6969
[[CUDA_Compiler]]
7070
arch = "aarch64"
7171
cuda = "12"
@@ -77,7 +77,7 @@ os = "linux"
7777

7878
[[CUDA_Compiler.download]]
7979
sha256 = "07d88f979ce98f74210a90a690b1bb07d7de22455f3ff42cb93597f145ec812d"
80-
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.2.2+0/CUDA_Compiler.v0.2.2.aarch64-linux-gnu-cuda_platform+sbsa-cuda+12.tar.gz"
80+
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.3.0+0/CUDA_Compiler.v0.3.0.aarch64-linux-gnu-cuda_platform+sbsa-cuda+12.tar.gz"
8181
[[CUDA_Compiler]]
8282
arch = "x86_64"
8383
cuda = "12"
@@ -87,7 +87,7 @@ os = "windows"
8787

8888
[[CUDA_Compiler.download]]
8989
sha256 = "528c37bc3d53b69446e172381c7978c791731037ed15d4bb7a8a345fac005a54"
90-
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.2.2+0/CUDA_Compiler.v0.2.2.x86_64-w64-mingw32-cuda+12.tar.gz"
90+
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.3.0+0/CUDA_Compiler.v0.3.0.x86_64-w64-mingw32-cuda+12.tar.gz"
9191
[[CUDA_Compiler]]
9292
arch = "x86_64"
9393
cuda = "13"
@@ -98,7 +98,7 @@ os = "linux"
9898

9999
[[CUDA_Compiler.download]]
100100
sha256 = "e8385e68ebdcf44b736222fc71c05c3d7eab0fc86002300c41066be5da98b03d"
101-
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.2.2+0/CUDA_Compiler.v0.2.2.x86_64-linux-gnu-cuda+13.tar.gz"
101+
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.3.0+0/CUDA_Compiler.v0.3.0.x86_64-linux-gnu-cuda+13.tar.gz"
102102
[[CUDA_Compiler]]
103103
arch = "aarch64"
104104
cuda = "13"
@@ -109,7 +109,7 @@ os = "linux"
109109

110110
[[CUDA_Compiler.download]]
111111
sha256 = "31038643db6407f2fd061aa9d5a5bb45b78a54b4bb48f7bec104d5ce2cd787f4"
112-
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.2.2+0/CUDA_Compiler.v0.2.2.aarch64-linux-gnu-cuda+13.tar.gz"
112+
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.3.0+0/CUDA_Compiler.v0.3.0.aarch64-linux-gnu-cuda+13.tar.gz"
113113
[[CUDA_Compiler]]
114114
arch = "x86_64"
115115
cuda = "13"
@@ -119,4 +119,4 @@ os = "windows"
119119

120120
[[CUDA_Compiler.download]]
121121
sha256 = "f42a23c40e568b85e384b2e1c888d2431db686ac20dd58ac1cfd6fa4fbf46de1"
122-
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.2.2+0/CUDA_Compiler.v0.2.2.x86_64-w64-mingw32-cuda+13.tar.gz"
122+
url = "https://github.com/JuliaBinaryWrappers/CUDA_Compiler_jll.jl/releases/download/CUDA_Compiler-v0.3.0+0/CUDA_Compiler.v0.3.0.x86_64-w64-mingw32-cuda+13.tar.gz"

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "CUDA_Compiler_jll"
22
uuid = "d1e2174e-dfdc-576e-b43e-73b79eb1aca8"
3-
version = "0.2.2+0"
3+
version = "0.3.0+0"
44

55
[deps]
66
JLLWrappers = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# `CUDA_Compiler_jll.jl` (v0.2.2+0)
1+
# `CUDA_Compiler_jll.jl` (v0.3.0+0)
22

33
[![deps](https://juliahub.com/docs/CUDA_Compiler_jll/deps.svg)](https://juliahub.com/ui/Packages/General/CUDA_Compiler_jll/)
44

55
This is an autogenerated package constructed using [`BinaryBuilder.jl`](https://github.com/JuliaPackaging/BinaryBuilder.jl).
66

7-
The originating [`build_tarballs.jl`](https://github.com/JuliaPackaging/Yggdrasil/blob/a9adbb8e61cf4e590ec1560a4d8649f5771c1f61/C/CUDA/CUDA_Compiler/build_tarballs.jl) script can be found on [`Yggdrasil`](https://github.com/JuliaPackaging/Yggdrasil/), the community build tree.
7+
The originating [`build_tarballs.jl`](https://github.com/JuliaPackaging/Yggdrasil/blob/01b5ad637b06e19782504a2f90f11596c7972e0b/C/CUDA/CUDA_Compiler/build_tarballs.jl) script can be found on [`Yggdrasil`](https://github.com/JuliaPackaging/Yggdrasil/), the community build tree.
88

99
## Bug Reports
1010

0 commit comments

Comments
 (0)