From 65b7727758a4c0ee08597a88ab4f051abcfc2a8a Mon Sep 17 00:00:00 2001 From: Alienfeel Date: Sat, 16 Dec 2023 07:35:00 +0800 Subject: [PATCH] Fix 4649 (#4650) Co-authored-by: Michael Wyatt --- deepspeed/launcher/runner.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/deepspeed/launcher/runner.py b/deepspeed/launcher/runner.py index 99ebc9771e41..4f45e1831b48 100755 --- a/deepspeed/launcher/runner.py +++ b/deepspeed/launcher/runner.py @@ -443,7 +443,11 @@ def main(args=None): if not args.master_addr: assert multi_node_exec first_host = list(active_resources.keys())[0] - hostname_cmd = [f"ssh {first_host} hostname -I"] + ssh_check_cmd = "ssh " + if args.ssh_port is not None: + ssh_check_cmd += f" -p {args.ssh_port}" + ssh_check_cmd += f" {first_host} hostname -I" + hostname_cmd = [ssh_check_cmd] try: result = subprocess.check_output(hostname_cmd, shell=True) except subprocess.CalledProcessError as err: