From 5bce06c05023b9798c42533bc1e7e5868930dcdb Mon Sep 17 00:00:00 2001 From: Jirka Borovec Date: Fri, 14 Aug 2020 11:37:21 +0200 Subject: [PATCH] nb. devices (#2973) --- pytorch_lightning/accelerators/ddp_backend.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytorch_lightning/accelerators/ddp_backend.py b/pytorch_lightning/accelerators/ddp_backend.py index 2ecf084774..d0110f1a77 100644 --- a/pytorch_lightning/accelerators/ddp_backend.py +++ b/pytorch_lightning/accelerators/ddp_backend.py @@ -87,7 +87,7 @@ class DDPBackend(object): command = [sys.executable] + command # since this script sets the visible devices we replace the gpus flag with a number - num_gpus = os.environ.get('CUDA_VISIBLE_DEVICES', []).split(',').__len__() + num_gpus = torch.cuda.device_count() if '--gpus' in command: gpu_flag_idx = command.index('--gpus')