code: def test_value(self):
      rank = dist.get_rank()
      nprocs = dist.get_world_size()
      is_cuda = dist.get_backend() == dist.Backend.NCCL
      if is_cuda:
          torch.cuda.set_device(rank)
  
      device = torch.device(rank) if is_cuda else torch.device("cpu")
  
      avg_meter = (
          CumulativeAverage()
      )  # each process rank has it's own AverageMeter
      n_iter = 10
      for i in range(n_iter):
          val = torch.as_tensor(rank + i, device=device)
          avg_meter.append(val=val)
  
      avg_val = avg_meter.aggregate()  # average across all processes
      expected_val = sum(
          sum(list(range(rank_i, rank_i + n_iter)))
          for rank_i in range(nprocs)
      ) / (n_iter * nprocs)
      np.testing.assert_equal(avg_val, expected_val)
  
file_path: MONAI/tests/test_cumulative_average_dist.py
imports: from __future__ import annotations
  import unittest
  import numpy
  import torch
  import torch.distributed
  from monai.metrics import CumulativeAverage
  from tests.utils import DistCall, DistTestCase, SkipIfBeforePyTorchVersion
label_desc: Use image node_id 1 for calling the DistributedCumulativeAverage obj's underlying member method code with example usage: obj.test_value() without return types