Skip to content

Remove rank restrictions on loggers #8589

@edward-io

Description

@edward-io

🚀 Feature

Allow loggers to log on non rank 0 processes.

Motivation

We want to log system data across all ranks (e.g. using a custom logger to log GPU memory, latency stats, etc). This is important if we want to detect stragglers or anomalous conditions in a rank.

Pitch

The trainer should not check that the process is on global rank 0 before calling the logger.

We already have rank_zero_experiment (https://github.com/PyTorchLightning/pytorch-lightning/blob/a64cc373946a755ce6c3aef57c1be607dfe29a0c/pytorch_lightning/loggers/base.py#L33) and @rank_zero_only decorating all loggers. We can simply remove the global zero checks in logger_connector.py here (https://github.com/PyTorchLightning/pytorch-lightning/blob/6b47cbe3ca8aa3fd82211bc9fa32e734753a6950/pytorch_lightning/trainer/connectors/logger_connector/logger_connector.py#L105-L109), and here (https://github.com/PyTorchLightning/pytorch-lightning/blob/6b47cbe3ca8aa3fd82211bc9fa32e734753a6950/pytorch_lightning/trainer/connectors/logger_connector/logger_connector.py#L180).

Alternatives

Additional context

Part of #7740

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureIs an improvement or enhancementloggerRelated to the Loggers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions