| 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 |