code: def mpi_worker(working_dir, mb_source, gpu):
      comm_rank = cntk.distributed.Communicator.rank()
      np.random.seed(comm_rank)
  
      if gpu:
          # test with only one GPU
          cntk.try_set_default_device(cntk.gpu(0))
  
      frame_mode = mb_source == "ctf_frame"
      bmuf = SimpleBMUFTrainer(frame_mode)
      for i, data in enumerate(
          get_minibatch(bmuf, working_dir, mb_source)
      ):
          bmuf.trainer.train_minibatch(data)
          if i % 50 == 0:
              bmuf.trainer.summarize_training_progress()
      print("SAMPLES %d" % (bmuf.trainer.total_number_of_samples_seen))
  
file_path: CNTK/bindings/python/cntk/learners/tests/bmuf_metrics_aggregation_test.py
imports: import pytest
  import cntk
  import numpy
  import sys, os
  from distributed_learner_test import mpiexec_execute
  import argparse
  import re
  import platform
label_desc: Use image node_id 2 for calling a global function with example usage: mpi_worker(working_dir, mb_source, gpu) without return types