From 63bfe0b94672e99a86479f665b42678e6ae0b216 Mon Sep 17 00:00:00 2001 From: gongweibao Date: Thu, 9 Apr 2020 08:59:40 +0800 Subject: [PATCH] Fix the default value bug of started port in launch.py. (#23531) --- python/paddle/distributed/cloud_utils.py | 3 ++- python/paddle/distributed/launch.py | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/python/paddle/distributed/cloud_utils.py b/python/paddle/distributed/cloud_utils.py index fcd883d476..345b783d60 100644 --- a/python/paddle/distributed/cloud_utils.py +++ b/python/paddle/distributed/cloud_utils.py @@ -12,8 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -from utils import get_cluster, logger import os +import paddle +from paddle.distributed.utils import get_cluster, logger def get_cloud_cluster(args_node_ips, args_node_ip, args_port, selected_gpus): diff --git a/python/paddle/distributed/launch.py b/python/paddle/distributed/launch.py index 1228333f5d..ecd1cf0ca7 100644 --- a/python/paddle/distributed/launch.py +++ b/python/paddle/distributed/launch.py @@ -154,10 +154,12 @@ def get_cluster_from_args(args, selected_gpus): if free_ports is not None: free_ports = list(free_ports) else: + started_port = 6070 + if args.started_port is not None: + started_port = args.started_port + free_ports = [ - x - for x in range(args.started_port, args.started_port + len( - selected_gpus)) + x for x in range(started_port, started_port + len(selected_gpus)) ] return get_cluster(node_ips, node_ip, free_ports, selected_gpus) -- GitLab