0754b1f24109e56eea1c72a7380a97cd115b9049,test/test_run.py,RunTests,test_mpi_run_on_large_cluster,#RunTests#,381
Before Change
cmd = ["cmd"]
settings = copy.copy(self.minimal_settings)
settings.num_hosts = large_cluster_threshold
run_func = MagicMock(return_value=0)
mpi_run(settings, None, {}, cmd, run_func=run_func)
mpi_flags, binding_args = _get_mpi_implementation_flags(False)
self.assertIsNotNone(mpi_flags)
mpi_flags.append("-mca plm_rsh_no_tree_spawn true")
After Change
def mpi_impl_flags(tcp):
return ["--mock-mpi-impl-flags"], ["--mock-mpi-binding-args"]
with mock.patch("horovod.run.mpi_run._get_mpi_implementation_flags", side_effect=mpi_impl_flags):
with mock.patch("horovod.run.mpi_run.safe_shell_exec.execute", return_value=0) as execute:
mpi_run(settings, None, {}, cmd)
// call the mocked _get_mpi_implementation_flags method
mpi_flags, binding_args = horovod.run.mpi_run._get_mpi_implementation_flags(False)
self.assertIsNotNone(mpi_flags)
mpi_flags.append("-mca plm_rsh_no_tree_spawn true")
mpi_flags.append("-mca plm_rsh_num_concurrent {}".format(settings.num_hosts))
expected_cmd = ("mpirun "
"--allow-run-as-root --tag-output "
"-np 2 -H host "
"{binding_args} "
"{mpi_flags} "
"cmd").format(binding_args=" ".join(binding_args), mpi_flags=" ".join(mpi_flags))
expected_env = {}
execute.assert_called_once_with(expected_cmd, env=expected_env, stdout=None, stderr=None)
Tests mpi_run with full settings.
def test_mpi_run_full(self):
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 11
Instances
Project Name: horovod/horovod
Commit Name: 0754b1f24109e56eea1c72a7380a97cd115b9049
Time: 2020-04-01
Author: github@enrico.minack.dev
File Name: test/test_run.py
Class Name: RunTests
Method Name: test_mpi_run_on_large_cluster
Project Name: horovod/horovod
Commit Name: 0754b1f24109e56eea1c72a7380a97cd115b9049
Time: 2020-04-01
Author: github@enrico.minack.dev
File Name: test/test_run.py
Class Name: RunTests
Method Name: test_mpi_run_minimal
Project Name: horovod/horovod
Commit Name: 0754b1f24109e56eea1c72a7380a97cd115b9049
Time: 2020-04-01
Author: github@enrico.minack.dev
File Name: test/test_run.py
Class Name: RunTests
Method Name: test_mpi_run_full