MCPcopy Create free account
hub / github.com/NVIDIA/cuda-samples / timer

Function timer

python/1_GettingStarted/numpyVsCupy/numpyVsCupy.py:49–54  ·  view source on GitHub ↗

CPU timing context manager.

(message)

Source from the content-addressed store, hash-verified

47
48@contextlib.contextmanager
49def timer(message):
50 """CPU timing context manager."""
51 start = time.time()
52 yield
53 end = time.time()
54 print(f"{message}: {(end - start):.6f} seconds")
55
56
57@contextlib.contextmanager

Callers 1

runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected