mirror of
https://github.com/NVIDIA/nvbench.git
synced 2026-04-19 22:38:52 +00:00
Add examples/cpu_only.py based on code from PR feedback
https://github.com/NVIDIA/nvbench/pull/237#issuecomment-3058594793
This commit is contained in:
18
python/examples/cpu_only.py
Normal file
18
python/examples/cpu_only.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import sys
|
||||
import time
|
||||
|
||||
import cuda.nvbench as nvbench
|
||||
|
||||
|
||||
def throughput_bench(state: nvbench.State) -> None:
|
||||
def launcher(launch: nvbench.Launch):
|
||||
time.sleep(1)
|
||||
|
||||
state.exec(launcher)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
b = nvbench.register(throughput_bench)
|
||||
b.setIsCPUOnly(True)
|
||||
|
||||
nvbench.run_all_benchmarks(sys.argv)
|
||||
Reference in New Issue
Block a user