File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -84,21 +84,41 @@ function versioninfo(io::IO=stdout)
84
84
println (io, length (devs), " devices:" )
85
85
end
86
86
for (i, dev) in enumerate (devs)
87
- if has_nvml ()
87
+ function query_nvml ()
88
88
mig = uuid (dev) != parent_uuid (dev)
89
89
nvml_gpu = NVML. Device (parent_uuid (dev))
90
90
nvml_dev = NVML. Device (uuid (dev); mig)
91
91
92
92
str = NVML. name (nvml_dev)
93
93
cap = NVML. compute_capability (nvml_gpu)
94
94
mem = NVML. memory_info (nvml_dev)
95
- else
95
+
96
+ (; str, cap, mem)
97
+ end
98
+
99
+ function query_cuda ()
96
100
str = name (dev)
97
101
cap = capability (dev)
98
102
mem = device! (dev) do
99
103
# this requires a device context, so we prefer NVML
100
104
(free= available_memory (), total= total_memory ())
101
105
end
106
+ (; str, cap, mem)
107
+ end
108
+
109
+ str, cap, mem = if has_nvml ()
110
+ try
111
+ query_nvml ()
112
+ catch err
113
+ @show err
114
+ if ! isa (err, NVML. NVMLError) ||
115
+ ! in (err. code, [NVML. ERROR_NOT_SUPPORTED, NVML. ERROR_NO_PERMISSION])
116
+ rethrow ()
117
+ end
118
+ query_cuda ()
119
+ end
120
+ else
121
+ query_cuda ()
102
122
end
103
123
println (io, " $(i- 1 ) : $str (sm_$(cap. major)$(cap. minor) , $(Base. format_bytes (mem. free)) / $(Base. format_bytes (mem. total)) available)" )
104
124
end
You can’t perform that action at this time.
0 commit comments