hotfix: copy size is in bytes

This commit is contained in:
George Hotz 2024-01-17 16:44:15 +00:00
parent 2e6162b281
commit 743b36f0ce
2 changed files with 19 additions and 1 deletions

18
extra/transfer_speed.py Normal file
View File

@ -0,0 +1,18 @@
from tinygrad import Tensor, Device
#N = 1024
N = 32
t = Tensor.rand(N, N, N, device="CPU").realize()
d1 = Device.DEFAULT + ":1"
d2 = Device.DEFAULT + ":2"
d3 = Device.DEFAULT + ":3"
for i in range(3):
t.to_(d1)
t.realize()
# t.to_("CPU")
# t.realize()
t.to_(d2)
t.realize()
t.to_(d3)
t.realize()

View File

@ -130,7 +130,7 @@ class _BufferCopy(JITRunner):
if wait or DEBUG >= 2: if wait or DEBUG >= 2:
Device[dest.device].synchronize() Device[dest.device].synchronize()
et = time.perf_counter() - st et = time.perf_counter() - st
update_stats(colored(f"copy {dest.size:8d}, {dest.device[:7]:>7s} <- {src.device[:7]:7s}", "yellow"), update_stats(colored(f"copy {dest.size*dest.dtype.itemsize:8d}, {dest.device[:7]:>7s} <- {src.device[:7]:7s}", "yellow"),
0, dest.size*dest.dtype.itemsize, {}, et, 2, jit, device=dest.device) 0, dest.size*dest.dtype.itemsize, {}, et, 2, jit, device=dest.device)
BufferCopy = _BufferCopy() BufferCopy = _BufferCopy()