@@ -141,17 +141,22 @@ function main(dummyargs...)
141
141
142
142
while true
143
143
try
144
- plts = []
145
- append! (plts, plot_cpu_utilization_rates (CPUDevice))
146
144
_, cols = displaysize (stdout )
147
- n = max (1 , cols ÷ 25 )
148
- chunks = collect (Iterators. partition (plts, n))
149
- f = foldl (/ , map (c -> prod (UnicodePlots. panel .(c)), chunks))
150
-
151
- f /= prod (UnicodePlots. panel .(plot_cpu_memory_utilization (CPUDevice)))
145
+ t1 = @async begin
146
+ plts = []
147
+ append! (plts, plot_cpu_utilization_rates (CPUDevice))
148
+ n = max (1 , cols ÷ 25 )
149
+ chunks = collect (Iterators. partition (plts, n))
150
+ f = foldl (/ , map (c -> prod (UnicodePlots. panel .(c)), chunks))
151
+
152
+ f /= prod (UnicodePlots. panel .(plot_cpu_memory_utilization (CPUDevice)))
153
+ f
154
+ end
152
155
153
156
if isdefined (Main, :CUDA ) &&
154
157
getproperty (getproperty (Main, :CUDA ), :functional )()
158
+ wait (t1)
159
+ f = fetch (t1)
155
160
cudaplts = []
156
161
n = max (1 , cols ÷ 50 )
157
162
plts1 = plot_gpu_utilization_rates (CUDADevice):: Vector{Any}
@@ -162,13 +167,16 @@ function main(dummyargs...)
162
167
end
163
168
gpuchunks = collect (Iterators. partition (cudaplts, n))
164
169
f /= foldl (/ , map (c -> prod (UnicodePlots. panel .(c)), gpuchunks))
165
- end
166
-
167
- if isdefined (Main, :Metal ) && Sys. ARCH == :aarch64
170
+ elseif isdefined (Main, :Metal ) && Sys. isapple () && Sys. ARCH == :aarch64
168
171
metalplts = []
169
172
n = max (1 , cols ÷ 50 )
170
- plts1 = plot_cpu_utilization_rates (MetalDevice):: Vector{Any}
171
- plts2 = plot_gpu_utilization_rates (MetalDevice):: Vector{Any}
173
+ t2 = @async plot_cpu_utilization_rates (MetalDevice)
174
+ t3 = @async plot_gpu_utilization_rates (MetalDevice)
175
+ wait (t1)
176
+ wait (t2)
177
+ wait (t3)
178
+ plts1 = fetch (t2)
179
+ plts2 = fetch (t3)
172
180
for i in eachindex (plts1)
173
181
push! (metalplts, plts1[i])
174
182
end
@@ -177,12 +185,15 @@ function main(dummyargs...)
177
185
end
178
186
metalchunks = collect (Iterators. partition (metalplts, n))
179
187
f /= foldl (/ , map (c -> prod (UnicodePlots. panel .(c)), metalchunks))
188
+ else
189
+ wait (t1)
190
+ f = fetch (t1)
180
191
end
181
192
clearlinesall ()
182
193
display (f)
183
194
catch e
184
195
unhidecursor () # unhide cursor
185
- if e isa InterruptException
196
+ if e isa InterruptException || e isa TaskFailedException
186
197
@info " Intrrupted"
187
198
break
188
199
else
0 commit comments