Skip to content

Commit 2b42068

Browse files
authored
Decode the CUPTI version. (#2843)
1 parent f668533 commit 2b42068

File tree

2 files changed

+38
-2
lines changed

2 files changed

+38
-2
lines changed

lib/cupti/wrappers.jl

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,43 @@
1+
# https://docs.nvidia.com/cupti/api/group__CUPTI__VERSION__API.html
2+
const cupti_versions = [
3+
v"4.0",
4+
v"4.1",
5+
v"5.0",
6+
v"5.5",
7+
v"6.0",
8+
v"6.5",
9+
v"6.5.1", # with sm_52 support
10+
v"7.0",
11+
v"8.0",
12+
v"9.0",
13+
v"9.1",
14+
v"10.0", # and v10.1 and v10.2
15+
v"11.0",
16+
v"11.1",
17+
v"11.2", # and v11.3 and v11.4
18+
v"11.5",
19+
v"11.6",
20+
v"11.8",
21+
v"12.0",
22+
v"12.2",
23+
v"12.3",
24+
v"12.4",
25+
v"12.5",
26+
v"12.6",
27+
v"12.8",
28+
v"12.9",
29+
v"12.9.1"]
30+
131
function version()
232
version_ref = Ref{Cuint}()
333
cuptiGetVersion(version_ref)
4-
VersionNumber(version_ref[])
34+
if CUDA.runtime_version() < v"13"
35+
cupti_versions[version_ref[]]
36+
else
37+
major, ver = divrem(version_ref[], 10000)
38+
minor, patch = divrem(ver, 100)
39+
VersionNumber(major, minor, patch)
40+
end
541
end
642

743
# XXX: `cuptiGetVersion` returns something more like the API version, and doesn't change

src/initialization.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ function __init__()
160160
end
161161

162162
# if we're not running under an external profiler, let CUPTI handle NVTX events
163-
if !NVTX.isactive() && toolkit_version < v"13" # NVIDIA/NVTX#125
163+
if !NVTX.isactive() && CUPTI.version() != v"13.0" # NVIDIA/NVTX#125
164164
ENV["NVTX_INJECTION64_PATH"] = CUDA_Runtime.libcupti
165165
NVTX.activate()
166166
end

0 commit comments

Comments
 (0)