diff --git a/superbench/runner/runner.py b/superbench/runner/runner.py index 4afc18946..7a8fd4417 100644 --- a/superbench/runner/runner.py +++ b/superbench/runner/runner.py @@ -233,17 +233,17 @@ def __get_mode_command(self, benchmark_name, mode, timeout=None): mode_command = ( '{trace} ' 'mpirun ' # use default OpenMPI in image - '-tag-output ' # tag mpi output with [jobid,rank] prefix - '-allow-run-as-root ' # allow mpirun to run when executed by root user + '--tag-output ' # tag mpi output with [jobid,rank] prefix + '--allow-run-as-root ' # allow mpirun to run when executed by root user '{host_list} ' # use prepared hostfile or specify nodes and launch {proc_num} processes on each node - '-bind-to numa ' # bind processes to numa + '--bind-to numa ' # bind processes to numa '{mca_list} {env_list} {command}' ).format( trace=trace_command, - host_list=f'-host localhost:{mode.proc_num}' if 'node_num' in mode and mode.node_num == 1 else - f'-hostfile hostfile -map-by ppr:{mode.proc_num}:node' if 'host_list' not in mode else '-host ' + + host_list=f'--host localhost:{mode.proc_num}' if 'node_num' in mode and mode.node_num == 1 else + f'--hostfile hostfile --map-by ppr:{mode.proc_num}:node' if 'host_list' not in mode else '--host ' + ','.join(f'{host}:{mode.proc_num}' for host in mode.host_list), - mca_list=' '.join(f'-mca {k} {v}' for k, v in mode.mca.items()), + mca_list=' '.join(f'--mca {k} {v}' for k, v in mode.mca.items()), env_list=' '.join( f'-x {k}={str(v).format(proc_rank=mode.proc_rank, proc_num=mode.proc_num)}' if isinstance(v, str) else f'-x {k}' for k, v in mode.env.items() diff --git a/tests/runner/test_runner.py b/tests/runner/test_runner.py index fe17adbd7..6a718c2c2 100644 --- a/tests/runner/test_runner.py +++ b/tests/runner/test_runner.py @@ -163,7 +163,7 @@ def test_get_mode_command(self): }, }, 'expected_command': ( - 'mpirun -tag-output -allow-run-as-root -hostfile hostfile -map-by ppr:8:node -bind-to numa ' + 'mpirun --tag-output --allow-run-as-root --hostfile hostfile --map-by ppr:8:node --bind-to numa ' ' -x PATH -x LD_LIBRARY_PATH ' f'sb exec --output-dir {self.sb_output_dir} -c sb.config.yaml -C superbench.enable=foo' ), @@ -186,8 +186,8 @@ def test_get_mode_command(self): }, }, 'expected_command': ( - 'mpirun -tag-output -allow-run-as-root -hostfile hostfile -map-by ppr:8:node -bind-to numa ' - '-mca coll_hcoll_enable 0 -x SB_MICRO_PATH=/sb -x FOO=BAR -x RANK=2 -x NUM=8 ' + 'mpirun --tag-output --allow-run-as-root --hostfile hostfile --map-by ppr:8:node --bind-to numa ' + '--mca coll_hcoll_enable 0 -x SB_MICRO_PATH=/sb -x FOO=BAR -x RANK=2 -x NUM=8 ' f'sb exec --output-dir {self.sb_output_dir} -c sb.config.yaml -C superbench.enable=foo' ), }, @@ -210,8 +210,8 @@ def test_get_mode_command(self): }, }, 'expected_command': ( - 'mpirun -tag-output -allow-run-as-root -host localhost:8 -bind-to numa ' - '-mca coll_hcoll_enable 0 -x SB_MICRO_PATH=/sb -x FOO=BAR -x RANK=2 -x NUM=8 ' + 'mpirun --tag-output --allow-run-as-root --host localhost:8 --bind-to numa ' + '--mca coll_hcoll_enable 0 -x SB_MICRO_PATH=/sb -x FOO=BAR -x RANK=2 -x NUM=8 ' f'sb exec --output-dir {self.sb_output_dir} -c sb.config.yaml -C superbench.enable=foo' ), }, @@ -232,7 +232,7 @@ def test_get_mode_command(self): }, }, 'expected_command': ( - 'mpirun -tag-output -allow-run-as-root -host node0:8,node1:8 -bind-to numa ' + 'mpirun --tag-output --allow-run-as-root --host node0:8,node1:8 --bind-to numa ' ' -x PATH -x LD_LIBRARY_PATH ' f'sb exec --output-dir {self.sb_output_dir} -c sb.config.yaml -C superbench.enable=foo' ),