File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 88cupy_message = deps .cupy_import ("benchmark module" )
99if cupy_message is None :
1010 import cupy as cp
11- has_cupy = True
11+ if cp .cuda .runtime .getDeviceCount () == 0 :
12+ has_cupy = False
13+ print (UserWarning ("CuPy is installed, but no CUDA-capable device is available." ))
14+ else :
15+ has_cupy = True
1216else :
1317 has_cupy = False
1418
@@ -31,6 +35,7 @@ def _parse_output_tree(markers: List[str]):
3135 markers: :obj:`list`, optional
3236 A list of markers/labels generated from the benchmark call
3337 """
38+ global _markers
3439 output = []
3540 stack = []
3641 i = 0
@@ -53,13 +58,14 @@ def _parse_output_tree(markers: List[str]):
5358 if next_level >= level :
5459 stack .append (markers [i ])
5560 i += 1
61+ # reset markers, allowing other benchmarked function to start fresh
62+ _markers = []
5663 return output
5764
5865
5966def _sync ():
6067 """Synchronize all MPI processes or CUDA Devices"""
6168 if has_cupy :
62- cp .cuda .get_current_stream ().synchronize ()
6369 # this is ok to call even if CUDA runtime is not initialized
6470 cp .cuda .runtime .deviceSynchronize ()
6571
You can’t perform that action at this time.
0 commit comments