def test_all_rank_logging_ddp_cpu(tmp_path):
    """Check that all ranks can be logged from."""
    model = TestModel()
    all_rank_logger = AllRankLogger()
    trainer = Trainer(
        accelerator="cpu",
        devices=2,
        strategy="ddp_spawn",
        default_root_dir=tmp_path,
        limit_train_batches=1,
        limit_val_batches=1,
        max_epochs=1,
        enable_model_summary=False,
        logger=all_rank_logger,
        log_every_n_steps=1,
    )
    trainer.fit(model)
Check that all ranks can be logged from.
tests/tests_pytorch/trainer/logging_/test_distributed_logging.py