mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-07 22:23:55 -05:00
fix some slow tests [pr] (#8979)
This commit is contained in:
@@ -24,7 +24,7 @@ class TestCopySpeed(unittest.TestCase):
|
||||
s.unlink()
|
||||
|
||||
def testCopyCPUtoDefault(self):
|
||||
t = Tensor.rand(N, N, device="clang").realize()
|
||||
t = Tensor.ones(N, N, device="clang").contiguous().realize()
|
||||
print(f"buffer: {t.nbytes()*1e-9:.2f} GB")
|
||||
for _ in range(3):
|
||||
with Timing("sync: ", on_exit=lambda ns: f" @ {t.nbytes()/ns:.2f} GB/s"):
|
||||
@@ -35,7 +35,7 @@ class TestCopySpeed(unittest.TestCase):
|
||||
def testCopyCPUtoDefaultFresh(self):
|
||||
print("fresh copy")
|
||||
for _ in range(3):
|
||||
t = Tensor.rand(N, N, device="clang").realize()
|
||||
t = Tensor.ones(N, N, device="clang").contiguous().realize()
|
||||
with Timing("sync: ", on_exit=lambda ns: f" @ {t.nbytes()/ns:.2f} GB/s"): # noqa: F821
|
||||
with Timing("queue: "):
|
||||
t.to(Device.DEFAULT).realize()
|
||||
@@ -43,7 +43,7 @@ class TestCopySpeed(unittest.TestCase):
|
||||
del t
|
||||
|
||||
def testCopyDefaulttoCPU(self):
|
||||
t = Tensor.rand(N, N).realize()
|
||||
t = Tensor.ones(N, N).contiguous().realize()
|
||||
print(f"buffer: {t.nbytes()*1e-9:.2f} GB")
|
||||
for _ in range(3):
|
||||
with Timing("sync: ", on_exit=lambda ns: f" @ {t.nbytes()/ns:.2f} GB/s"):
|
||||
@@ -54,7 +54,7 @@ class TestCopySpeed(unittest.TestCase):
|
||||
def testCopyCPUto6GPUs(self):
|
||||
from tinygrad.runtime.ops_gpu import CLDevice
|
||||
if len(CLDevice.device_ids) != 6: raise unittest.SkipTest("computer doesn't have 6 GPUs")
|
||||
t = Tensor.rand(N, N, device="clang").realize()
|
||||
t = Tensor.ones(N, N, device="clang").contiguous().realize()
|
||||
print(f"buffer: {t.nbytes()*1e-9:.2f} GB")
|
||||
for _ in range(3):
|
||||
with Timing("sync: ", on_exit=lambda ns: f" @ {t.nbytes()/ns:.2f} GB/s ({t.nbytes()*6/ns:.2f} GB/s total)"):
|
||||
|
||||
@@ -107,7 +107,7 @@ class TestLrScheduler(unittest.TestCase):
|
||||
self._test_multisteplr(1, {'milestones': [1], 'gamma': 0.133}, 1e-6, 1e-6, adam=False)
|
||||
if DEBUG>=2: print("third")
|
||||
|
||||
def test_onecyclelr(self): self._test_onecyclelr(1000, {'pct_start': 0.3, 'anneal_strategy': 'linear',
|
||||
def test_onecyclelr(self): self._test_onecyclelr(100, {'pct_start': 0.3, 'anneal_strategy': 'linear',
|
||||
'cycle_momentum': False, 'div_factor': 25.0,
|
||||
'final_div_factor': 10000.0, 'max_lr':1e-5}, 1e-6, 1e-6)
|
||||
@unittest.skip("slow")
|
||||
|
||||
Reference in New Issue
Block a user