code: def main_server(COMM):
      nprocs = COMM.Get_size()
      myrank = COMM.Get_rank()
  
      service, port, info = None, None, MPI.INFO_NULL
      if myrank == 0:
          port = MPI.Open_port(info)
          log(COMM, "open port '%s'", port)
          service = "cpi"
          MPI.Publish_name(service, port, info)
          log(COMM, "service '%s' published.", service)
      else:
          port = ""
  
      log(COMM, "waiting for client connection ...")
      icomm = COMM.Accept(port, info, root=0)
      log(COMM, "client connection accepted.")
  
      worker(icomm)
  
      log(COMM, "disconnecting from client ...")
      icomm.Disconnect()
      log(COMM, "client disconnected.")
  
      if myrank == 0:
          MPI.Unpublish_name(service, port, info)
          log(COMM, "service '%s' unpublished", port)
          MPI.Close_port(port)
          log(COMM, "closed  port '%s' ", port)
  
file_path: mpi4py/demo/compute-pi/cpi-dpm.py
imports: import sys
  from mpi4py import MPI
  import numpy
label_desc: Use image node_id 8 for calling a global function with example usage: main_server(COMM) without return types