From 0e67773d2eefd62d94d386f21d67c14a39839c4a Mon Sep 17 00:00:00 2001 From: William Falcon Date: Thu, 18 Jul 2019 14:53:01 -0400 Subject: [PATCH] testing single process ddp --- pytorch_lightning/models/trainer.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pytorch_lightning/models/trainer.py b/pytorch_lightning/models/trainer.py index 47fd0c67..e1ad3432 100644 --- a/pytorch_lightning/models/trainer.py +++ b/pytorch_lightning/models/trainer.py @@ -375,7 +375,10 @@ class Trainer(TrainerIO): print('using ddp') # must copy only the meta of the exp so it survives pickle/unpickle when going to new process self.experiment = self.experiment.get_meta_copy() - mp.spawn(self.ddp_train, nprocs=len(self.data_parallel_device_ids), args=(model, )) + task = os.environ['SLURM_ARRAY_TASK_ID'] + print(f'task: {task}') + self.ddp_train(task, model) + # mp.spawn(self.ddp_train, nprocs=len(self.data_parallel_device_ids), args=(model, )) # 1 gpu or dp option triggers training using DP module # easier to avoid NCCL issues