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,