MCPcopy
hub / github.com/horovod/horovod / test_timeline

Method test_timeline

test/parallel/test_timeline.py:40–57  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

38 warnings.simplefilter('module')
39
40 def test_timeline(self):
41 with temppath() as t:
42 with env(HOROVOD_TIMELINE=t, HOROVOD_TIMELINE_MARK_CYCLES='1'):
43 hvd.init()
44
45 # Perform a simple allreduce operation
46 hvd.allreduce(torch.tensor([1, 2, 3], dtype=torch.float32), name='test_allreduce')
47
48 # Wait for it to register in the timeline.
49 time.sleep(0.1)
50
51 if hvd.rank() == 0:
52 with open(t, 'r') as tf:
53 timeline_text = tf.read()
54 assert 'allreduce.test_allreduce' in timeline_text, timeline_text
55 assert 'NEGOTIATE_ALLREDUCE' in timeline_text, timeline_text
56 assert 'ALLREDUCE' in timeline_text, timeline_text
57 assert 'CYCLE_START' in timeline_text, timeline_text

Callers

nothing calls this directly

Calls 6

temppathFunction · 0.90
envFunction · 0.90
initMethod · 0.45
sleepMethod · 0.45
rankMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected