From 6219f24a03469569dddabf6be56d990d78923503 Mon Sep 17 00:00:00 2001 From: William Falcon Date: Fri, 12 Jul 2019 16:07:57 -0400 Subject: [PATCH] fixed nccl init --- pytorch_lightning/models/trainer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pytorch_lightning/models/trainer.py b/pytorch_lightning/models/trainer.py index 6c5eaa82..b02ba332 100644 --- a/pytorch_lightning/models/trainer.py +++ b/pytorch_lightning/models/trainer.py @@ -367,7 +367,7 @@ class Trainer(TrainerIO): # continue training routine self.__run_pretrain_routine(model) - def __init_tcp_connection(self, port=12945): + def __init_tcp_connection(self): """ Connect all procs in the world using the env:// init Use the first node as the root address @@ -375,6 +375,10 @@ class Trainer(TrainerIO): :param tries: :return: """ + try: + port = os.environ['MASTER_PORT'] + except Exception as e: + port = 12910 root_node = os.environ['SLURM_NODELIST'].split(' ')[0] os.environ['MASTER_ADDR'] = root_node