MCPcopy
hub / github.com/tinygrad/tinygrad / _test_allreduce

Function _test_allreduce

test/backend/test_multitensor.py:28–33  ·  view source on GitHub ↗
(t:Tensor)

Source from the content-addressed store, hash-verified

26# shard_w is "model parallel"
27
28def _test_allreduce(t:Tensor):
29 aa = (t[0:64] + t[64:128] + t[128:192] + t[192:256]).repeat([4,1]).realize()
30 ts = t.shard(devices_4, 0).realize()
31 b = Tensor(UOp.allreduce(ts.uop, Ops.ADD, ts.device))
32 b.realize()
33 return aa, b
34
35@unittest.skipIf(not_support_multi_device(), "no multi")
36class TestMultiTensor(unittest.TestCase):

Callers 3

test_allreduce_naiveMethod · 0.85
test_allreduce_ringMethod · 0.85

Calls 5

realizeMethod · 0.95
TensorClass · 0.90
repeatMethod · 0.80
allreduceMethod · 0.80
shardMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…