(self, num_ranks, batch, micro_batch, gas, success)
| 86 | world_size = 2 |
| 87 | |
| 88 | def test(self, num_ranks, batch, micro_batch, gas, success): |
| 89 | assert dist.get_world_size() == num_ranks, \ |
| 90 | f'The test assumes a world size of {num_ranks}' |
| 91 | |
| 92 | ds_batch_config = get_test_path('ds_batch_config.json') |
| 93 | ds_config = DeepSpeedConfig(ds_batch_config) |
| 94 | |
| 95 | #test cases when all parameters are provided |
| 96 | status = _run_batch_config(ds_config, train_batch=batch, micro_batch=micro_batch, gas=gas) |
| 97 | _batch_assert(status, ds_config, batch, micro_batch, gas, success) |
| 98 | |
| 99 | #test cases when two out of three parameters are provided |
| 100 | status = _run_batch_config(ds_config, train_batch=batch, micro_batch=micro_batch) |
| 101 | _batch_assert(status, ds_config, batch, micro_batch, gas, success) |
| 102 | |
| 103 | if success: |
| 104 | #when gas is provided with one more parameter |
| 105 | status = _run_batch_config(ds_config, train_batch=batch, gas=gas) |
| 106 | _batch_assert(status, ds_config, batch, micro_batch, gas, success) |
| 107 | |
| 108 | status = _run_batch_config(ds_config, micro_batch=micro_batch, gas=gas) |
| 109 | _batch_assert(status, ds_config, batch, micro_batch, gas, success) |
| 110 | |
| 111 | #test the case when only micro_batch or train_batch is provided |
| 112 | if gas == 1: |
| 113 | status = _run_batch_config(ds_config, micro_batch=micro_batch) |
| 114 | _batch_assert(status, ds_config, batch, micro_batch, gas, success) |
| 115 | |
| 116 | status = _run_batch_config(ds_config, train_batch=batch) |
| 117 | _batch_assert(status, ds_config, batch, micro_batch, gas, success) |
| 118 | else: |
| 119 | #when only gas is provided |
| 120 | status = _run_batch_config(ds_config, gas=gas) |
| 121 | _batch_assert(status, ds_config, batch, micro_batch, gas, success) |
| 122 | |
| 123 | #when gas is provided with something else and gas does not divide batch |
| 124 | if gas != 1: |
| 125 | status = _run_batch_config(ds_config, train_batch=batch, gas=gas) |
| 126 | _batch_assert(status, ds_config, batch, micro_batch, gas, success) |
| 127 | |
| 128 | |
| 129 | def test_temp_config_json(tmpdir): |
nothing calls this directly
no test coverage detected