code: def test_ddp_configure_ddp(mps_count_0):
      """Tests with ddp strategy."""
      model = BoringModel()
      ddp_strategy = DDPStrategy()
      trainer = Trainer(
          max_epochs=1,
          strategy=ddp_strategy,
      )
      # test wrap the model if fitting
      trainer.state.fn = TrainerFn.FITTING
      trainer.strategy.connect(model)
      trainer.lightning_module.trainer = trainer
      trainer.strategy.setup_environment()
      assert isinstance(trainer.model, LightningModule)
      trainer.strategy.setup(trainer)
      # in DDPStrategy configure_ddp(), model wrapped by DistributedDataParallel
      assert isinstance(trainer.model, DistributedDataParallel)
  
      ddp_strategy = DDPStrategy()
      trainer = Trainer(
          max_epochs=1,
          strategy=ddp_strategy,
      )
      # test do not wrap the model if TrainerFn is not fitting
      trainer.state.fn = TrainerFn.VALIDATING
      trainer.strategy.connect(model)
      trainer.lightning_module.trainer = trainer
      trainer.strategy.setup_environment()
      trainer.strategy.setup(trainer)
      # in DDPStrategy configure_ddp(), model are still LightningModule
      assert isinstance(trainer.model, LightningModule)
  
file_path: pytorch-lightning/tests/tests_pytorch/strategies/test_ddp.py
imports: import os
  from datetime import timedelta
  from unittest import mock
  import pytest
  import torch
  from lightning.fabric.plugins.environments import LightningEnvironment
  from lightning.fabric.utilities.imports import _TORCH_GREATER_EQUAL_2_0
  from lightning.pytorch import LightningModule, Trainer
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.plugins import DoublePrecision, HalfPrecision, Precision
  from lightning.pytorch.strategies import DDPStrategy
  from lightning.pytorch.trainer.states import TrainerFn
  from torch.nn.parallel import DistributedDataParallel
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 5 for calling a global function with example usage: test_ddp_configure_ddp(mps_count_0) without return types