From b6ea6373dd1431ebe20bde2b8a0ce33841f5d7d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20W=C3=A4lchli?= Date: Fri, 30 Jul 2021 12:01:00 +0200 Subject: [PATCH] exclude mpi run from auto-detection of horovod (#8610) --- CHANGELOG.md | 2 +- pytorch_lightning/trainer/connectors/accelerator_connector.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2806602291e7..8415e35e5a1d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,7 +70,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). -- +- Fixed horovod auto-detection when horovod is not installed and the launcher is `mpirun` ([#8610](https://github.com/PyTorchLightning/pytorch-lightning/pull/8610)) ### Fixed diff --git a/pytorch_lightning/trainer/connectors/accelerator_connector.py b/pytorch_lightning/trainer/connectors/accelerator_connector.py index 94c3045c87928..d46aa014ce062 100644 --- a/pytorch_lightning/trainer/connectors/accelerator_connector.py +++ b/pytorch_lightning/trainer/connectors/accelerator_connector.py @@ -857,7 +857,7 @@ def check_horovod(self): @staticmethod def has_horovodrun() -> bool: """Returns True if running with `horovodrun` using Gloo or OpenMPI.""" - return "OMPI_COMM_WORLD_RANK" in os.environ or "HOROVOD_RANK" in os.environ + return _HOROVOD_AVAILABLE and ("OMPI_COMM_WORLD_RANK" in os.environ or "HOROVOD_RANK" in os.environ) def update_device_type_if_ipu_plugin(self) -> None: # This allows the poptorch.Options that are passed into the IPUPlugin to be the source of truth,