code: def result_reduce_ddp_fn(strategy):
      rank = strategy.local_rank
      worldsize = strategy.num_processes
      tensor([1.0])
  
      metric_a = DummyMetric()
      metric_b = DummyMetric()
      metric_c = DummyMetric()
  
      metric_a = metric_a.to(f"cuda:{rank}")
      metric_b = metric_b.to(f"cuda:{rank}")
      metric_c = metric_c.to(f"cuda:{rank}")
  
      result = _ResultCollection(True)
  
      for _ in range(3):
          cumulative_sum = 0
          for i in range(5):
              metric_a(i)
              metric_b(i)
              metric_c(i)
  
              cumulative_sum += i
  
              result.log(
                  "h", "a", metric_a, on_step=True, on_epoch=True
              )
              result.log(
                  "h", "b", metric_b, on_step=False, on_epoch=True
              )
              result.log(
                  "h", "c", metric_c, on_step=True, on_epoch=False
              )
  
              batch_log = result.metrics(True)["log"]
              assert batch_log == {"a_step": i, "c": i}
  
          epoch_log = result.metrics(False)["log"]
          result.reset()
  
          # assert metric state reset to default values
          assert metric_a.x == metric_a._defaults["x"], (
              metric_a.x,
              metric_a._defaults["x"],
          )
          assert metric_b.x == metric_b._defaults["x"]
          assert metric_c.x == metric_c._defaults["x"]
  
          assert epoch_log == {
              "b": cumulative_sum * worldsize,
              "a_epoch": cumulative_sum * worldsize,
          }
  
imports: import os
  import pickle
  from contextlib import nullcontext, suppress
  from unittest import mock
  import lightning.pytorch
  import pytest
  import torch
  from lightning.fabric.utilities.warnings import PossibleUserWarning
  from lightning.pytorch import Trainer
  from lightning.pytorch.callbacks import OnExceptionCheckpoint
  from lightning.pytorch.demos.boring_classes import BoringModel
  from lightning.pytorch.trainer.connectors.logger_connector.result import _Metadata, _ResultCollection, _ResultMetric, _Sync
  from lightning.pytorch.utilities.imports import _TORCHMETRICS_GREATER_EQUAL_0_11
  from lightning_utilities.test.warning import no_warning_call
  from torch import Tensor, tensor
  from torch.nn import ModuleDict, ModuleList
  from torchmetrics import Metric, MetricCollection
  from torchmetrics.classification import Accuracy
  from tests_pytorch.core.test_results import spawn_launch
  from tests_pytorch.helpers.runif import RunIf
label_desc: Use image node_id 1 for calling a global function with example usage: result_reduce_ddp_fn(strategy) without return types