Skip to content

Commit 3ad73ad

Browse files
author
Vincent Moens
committed
amend
1 parent 01e580d commit 3ad73ad

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

intermediate_source/pinmem_nonblock.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,14 @@
159159

160160

161161
def timer(cmd):
162-
return Timer(cmd, globals=globals()).adaptive_autorange().median * 1000
162+
median = (
163+
Timer(cmd, globals=globals())
164+
.adaptive_autorange(min_run_time=1.0, max_run_time=20.0)
165+
.median
166+
* 1000
167+
)
168+
print(f"{cmd}: {median: 4.4f} ms")
169+
return median
163170

164171

165172
# A tensor in pageable memory
@@ -378,7 +385,7 @@ def pin_copy_to_device_nonblocking(*tensors):
378385
# Add some text for labels, title and custom x-axis tick labels, etc.
379386
ax.set_ylabel("Runtime (ms)")
380387
ax.set_title("Runtime (pin-mem and non-blocking)")
381-
ax.set_xticks([])
388+
ax.set_xticks(strategies)
382389
ax.legend(loc="upper left", ncols=3)
383390

384391
plt.show()

0 commit comments

Comments
 (0)