From 8217ebe029e590c56ba43d8731ab2001ecc9bac6 Mon Sep 17 00:00:00 2001 From: William Falcon Date: Sun, 21 Jul 2019 08:20:06 -0400 Subject: [PATCH] updated auto ddp for > 1 node --- pytorch_lightning/models/trainer.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pytorch_lightning/models/trainer.py b/pytorch_lightning/models/trainer.py index ba47ab6c..91de1b69 100644 --- a/pytorch_lightning/models/trainer.py +++ b/pytorch_lightning/models/trainer.py @@ -150,6 +150,7 @@ class Trainer(TrainerIO): self.use_ddp = False self.use_dp = False + # gpus come in as a string. # if gpus = -1 then use all available devices # otherwise, split the string using commas @@ -176,6 +177,15 @@ class Trainer(TrainerIO): self.use_dp = distributed_backend == 'dp' self.use_ddp = distributed_backend == 'ddp' + # use ddp automatically if nb_gpu_nodes > 1 + if nb_gpu_nodes > 1: + self.use_ddp = True + self.use_ddp = False + w = 'DataParallel does not support nb_gpu_nodes > 1. ' \ + 'Switching to DistributedDataParallel for you. ' \ + 'To silence this warning set distributed_backend=ddp' + warnings.warn(w) + # process info self.proc_rank = 0