Skip to content

Commit

Permalink
updates teardown to account for ddp (#2389)
Browse files Browse the repository at this point in the history
* remove warnings

* remove warnings

* added doc lines

* added doc lines
  • Loading branch information
williamFalcon committed Jun 28, 2020
1 parent d910cc5 commit 66ffbad
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions pytorch_lightning/trainer/training_loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,6 @@ def train(self):
self.interrupted = True
self.on_keyboard_interrupt()

for proc in self.interactive_ddp_procs:
subprocess.Popen.kill(proc)

self.run_training_teardown()

def prepare_train_loop_dataloader(self, train_dataloader):
Expand Down Expand Up @@ -853,9 +850,7 @@ def run_training_teardown(self):
if hasattr(self, '_teardown_already_run') and self._teardown_already_run:
return

# clean up dist group
if self.use_ddp or self.use_ddp2:
torch_distrib.destroy_process_group()
self._teardown_already_run = True

# Train end events
with self.profiler.profile('on_train_end'):
Expand All @@ -869,8 +864,16 @@ def run_training_teardown(self):
self.logger.finalize("success")

# summarize profile results
self.profiler.describe()
self._teardown_already_run = True
if self.global_rank == 0:
self.profiler.describe()

if self.global_rank == 0:
for proc in self.interactive_ddp_procs:
subprocess.Popen.kill(proc)

# clean up dist group
if self.use_ddp or self.use_ddp2:
torch_distrib.destroy_process_group()

def training_forward(self, batch, batch_idx, opt_idx, hiddens):
"""
Expand Down

0 comments on commit 66ffbad

Please sign in to comment.