code: def test_ema_final_weight_distrib_hvd(
      get_dummy_model, gloo_hvd_executor, interval
  ):
      nproc = (
          4
          if not torch.cuda.is_available()
          else torch.cuda.device_count()
      )
      # pass device = None to the executor. Different from other distributed tests where the processes are
      # already spawn in the context, the processes here will be explicitly spawn by the executor, so we
      # pass None to the function, and call idist.device() in side the function to get the corresponding device
      gloo_hvd_executor(
          _test_ema_final_weight,
          (get_dummy_model(), None, True, interval),
          np=nproc,
          do_init=True,
      )
  
imports: import os
  from typing import Any, Callable, Union
  import pytest
  import torch
  import torch.nn
  from torch.nn.parallel import DataParallel, DistributedDataParallel
  import ignite.distributed
  from ignite.engine import Engine, Events
  from ignite.handlers import EMAHandler
label_desc: Use image node_id 19 for calling a global function with example usage: test_ema_final_weight_distrib_hvd(get_dummy_model, gloo_hvd_executor, interval) without return types