class_docstr: Context manager for `MPIPoolExecutor`.
  
  This context manager splits a MPI (intra)communicator in two
  disjoint sets: a single master process and the remaining worker
  processes. These sets are then connected through an intercommunicator.
  The target of the ``with`` statement is assigned either an
  `MPIPoolExecutor` instance (at the master) or ``None`` (at the workers).
  
  Example::
  
      with MPICommExecutor(MPI.COMM_WORLD, root=0) as executor:
          if executor is not None: # master process
              executor.submit(...)
              executor.map(...)
class_docstr_tok: ["Context","manager","for","`","MPIPoolExecutor","`",".","This","context","manager","splits","a","MPI","(","intra",")","communicator","in","two","disjoint","sets",":","a","single","master","process","and","the","remaining","worker","processes",".","These","sets","are","then","connected","through","an","intercommunicator",".","The","target","of","the","``","with","``","statement","is","assigned","either","an","`","MPIPoolExecutor","`","instance","(","at","the","master",")","or","``","None","``","(","at","the","workers",")",".","Example",":",":","with","MPICommExecutor","(","MPI.COMM_WORLD",",","root=0",")","as","executor",":","if","executor","is","not","None",":","#","master","process","executor.submit","(","...",")","executor.map","(","...",")"]
docstr: Initialize a new MPICommExecutor instance.
  
  Args:
      comm: MPI (intra)communicator.
      root: Designated master process.
  
  Raises:
      ValueError: If the communicator has wrong kind or
         the root value is not in the expected range.
docstr_tok: ["Initialize","a","new","MPICommExecutor","instance",".","Args",":","comm",":","MPI","(","intra",")","communicator",".","root",":","Designated","master","process",".","Raises",":","ValueError",":","If","the","communicator","has","wrong","kind","or","the","root","value","is","not","in","the","expected","range","."]
code: def __init__(self, comm=None, root=0, **kwargs):
      """Initialize a new MPICommExecutor instance.
  
      Args:
          comm: MPI (intra)communicator.
          root: Designated master process.
  
      Raises:
          ValueError: If the communicator has wrong kind or
             the root value is not in the expected range.
  
      """
      if comm is None:
          comm = _core.MPI.COMM_WORLD
      if comm.Is_inter():
          raise ValueError("expecting an intracommunicator")
      if root < 0 or root >= comm.Get_size():
          raise ValueError("expecting root in range(comm.size)")
      if _core.SharedPool is not None:
          comm = _core.MPI.COMM_WORLD
          root = comm.Get_rank()
  
      self._comm = comm
      self._root = root
      self._options = kwargs
      self._executor = None
  
imports: import sys
  import time
  import functools
  import itertools
  import threading
  from ._base import Future
  from ._base import Executor
  from ._base import as_completed
  from .None import _core
label_desc: Use image node_id 1 to create a new MPICommExecutor object  with example: obj = MPICommExecutor(comm, root)