HWRF  trunk@4391
Public Member Functions | List of all members
produtil.mpiprog.MPIRank Class Reference

Represents a single MPI rank. More...

Detailed Description

Represents a single MPI rank.

Definition at line 469 of file mpiprog.py.

Inheritance diagram for produtil.mpiprog.MPIRank:
produtil.mpiprog.MPIRanksBase produtil.mpiprog.MPISerial

Public Member Functions

def __init__
 MPIRank constructor. More...
 
def getthreads (self)
 Returns the number of threads requested by this MPI rank, or by each MPI rank in this group of MPI ranks. More...
 
def setthreads (self, nthreads)
 Sets the number of threads requested by each MPI rank within this group of MPI ranks. More...
 
def delthreads (self)
 Removes the request for threads. More...
 
def to_shell (self)
 Return a POSIX sh representation of this MPI rank, if possible. More...
 
def __getitem__ (self, args)
 Adds arguments to this MPI rank's program. More...
 
def __repr__ (self)
 Returns a Pythonic representation of this object for debugging. More...
 
def get_logger (self)
 Returns a logging.Logger for this object, or None. More...
 
def validate
 Checks to see if this MPIRank is valid, or has errors. More...
 
def args (self)
 Iterates over the executable arguments. More...
 
def copy (self)
 Return a copy of self. More...
 
def nranks (self)
 Returns 1: the number of MPI ranks. More...
 
def ngroups (self)
 Returns 1: the number of groups of identical ranks. More...
 
def ranks (self)
 Yields self once: all MPI ranks. More...
 
def groups
 Yields (self,1): all groups of identical ranks and the number per group. More...
 
def __add__ (self, other)
 Creates an MPIRanksSPMD or MPIRanksMPMD with this MPIRank and the other ranks. More...
 
def __mul__ (self, factor)
 Creates an MPIRanksSPMD with this MPIRank duplicated factor times. More...
 
def __rmul__ (self, factor)
 Creates an MPIRanksSPMD with this MPIRank duplicated factor times. More...
 
def __eq__ (self, other)
 Returns True if this MPIRank is equal to the other object. More...
 
def check_serial (self)
 Returns (False,True): this is a pure parallel program. More...
 
- Public Member Functions inherited from produtil.mpiprog.MPIRanksBase
def to_arglist
 This is the underlying implementation of most of the mpi_impl modules, and hence make_runner as well. More...
 
def make_runners_immutable (self)
 Returns a copy of this object where all child produtil.prog.Runner objects have been replaced with produtil.prog.ImmutableRunner objects. More...
 
def get_logger (self)
 Returns a logger.Logger object for this MPIRanksBase or one from its child MPIRanksBase objects (if it has any). More...
 
def check_serial (self)
 Returns a tuple (s,p) where s=True if there are serial ranks in this part of the MPI program, and p=True if there are parallel ranks. More...
 
def nranks (self)
 Returns the number of ranks in this part of the MPI program. More...
 
def ranks (self)
 Iterates over all MPIRank objects in this part of the MPI program. More...
 
def ngroups (self)
 Returns the number of groups of repeated MPI ranks in the MPI program. More...
 
def groups
 Iterates over all groups of repeating MPI ranks in the MPI program returning tuples (r,c) containing a rank r and the count (number) of that rank c. More...
 
def getthreads (self)
 Returns the number of threads requested by this MPI rank, or by each MPI rank in this group of MPI ranks. More...
 
def setthreads (self, nthreads)
 Sets the number of threads requested by each MPI rank within this group of MPI ranks. More...
 
def delthreads (self)
 Removes the request for threads. More...
 
def __eq__ (self, other)
 Returns True if this part of the MPI program is the same as another part. More...
 
def __mul__ (self, factor)
 Returns a new set of MPI ranks that consist of this group of ranks repeated "factor" times. More...
 
def __rmul__ (self, other)
 Returns a new set of MPI ranks that consist of this group of ranks repeated "factor" times. More...
 
def __add__ (self, other)
 Returns a new set of MPI ranks that consist of this set of ranks with the "other" set appended. More...
 
def __radd__ (self, other)
 Returns a new set of MPI ranks that consist of the "other" set of ranks with this set appended. More...
 
def isplainexe (self)
 Determines if this set of MPI ranks can be represented by a single serial executable with a single set of arguments run without MPI. More...
 
def to_shell (self)
 Returns a POSIX sh command that will execute the serial program, if possible, or raise a subclass of NotValidPosixSh otherwise. More...
 
def expand_iter
 This is a wrapper around ranks() and groups() which will call self.groups() if expand=False. More...
 
def __repr__ (self)
 Returns a string representation of this object intended for debugging. More...
 

Constructor & Destructor Documentation

def produtil.mpiprog.MPIRank.__init__ (   self,
  arg,
  logger = None 
)

MPIRank constructor.

Parameters
argWhat program to run. Can be a produtil.prog.Runner, or some way of creating one, such as a program name or list of program+arguments.
loggera logging.Logger for log messages or None to have no logger.

Definition at line 471 of file mpiprog.py.

Member Function Documentation

def produtil.mpiprog.MPIRank.__add__ (   self,
  other 
)

Creates an MPIRanksSPMD or MPIRanksMPMD with this MPIRank and the other ranks.

Parameters
otherThe other ranks.

Definition at line 573 of file mpiprog.py.

def produtil.mpiprog.MPIRank.__eq__ (   self,
  other 
)

Returns True if this MPIRank is equal to the other object.

Definition at line 595 of file mpiprog.py.

def produtil.mpiprog.MPIRank.__getitem__ (   self,
  args 
)

Adds arguments to this MPI rank's program.

Definition at line 518 of file mpiprog.py.

def produtil.mpiprog.MPIRank.__mul__ (   self,
  factor 
)

Creates an MPIRanksSPMD with this MPIRank duplicated factor times.

Parameters
factorthe number of times to duplicate

Definition at line 583 of file mpiprog.py.

def produtil.mpiprog.MPIRank.__repr__ (   self)

Returns a Pythonic representation of this object for debugging.

Definition at line 526 of file mpiprog.py.

Referenced by produtil.prog.Runner.__str__().

def produtil.mpiprog.MPIRank.__rmul__ (   self,
  factor 
)

Creates an MPIRanksSPMD with this MPIRank duplicated factor times.

Parameters
factorthe number of times to duplicate

Definition at line 589 of file mpiprog.py.

def produtil.mpiprog.MPIRank.args (   self)

Iterates over the executable arguments.

Definition at line 550 of file mpiprog.py.

Referenced by produtil.mpiprog.MPIRank.validate().

def produtil.mpiprog.MPIRank.check_serial (   self)

Returns (False,True): this is a pure parallel program.

Definition at line 598 of file mpiprog.py.

def produtil.mpiprog.MPIRank.copy (   self)

Return a copy of self.

This is a deep copy except for the logger which whose reference is copied.

Definition at line 553 of file mpiprog.py.

Referenced by produtil.mpiprog.MPIRank.__add__(), produtil.mpiprog.MPIRank.__getitem__(), and produtil.prog.ImmutableRunner.runner().

def produtil.mpiprog.MPIRank.delthreads (   self)

Removes the request for threads.

Definition at line 511 of file mpiprog.py.

def produtil.mpiprog.MPIRank.get_logger (   self)

Returns a logging.Logger for this object, or None.

Definition at line 533 of file mpiprog.py.

def produtil.mpiprog.MPIRank.getthreads (   self)

Returns the number of threads requested by this MPI rank, or by each MPI rank in this group of MPI ranks.

Definition at line 502 of file mpiprog.py.

def produtil.mpiprog.MPIRank.groups (   self,
  threads = False 
)

Yields (self,1): all groups of identical ranks and the number per group.

Definition at line 566 of file mpiprog.py.

def produtil.mpiprog.MPIRank.ngroups (   self)

Returns 1: the number of groups of identical ranks.

Definition at line 560 of file mpiprog.py.

def produtil.mpiprog.MPIRank.nranks (   self)

Returns 1: the number of MPI ranks.

Definition at line 557 of file mpiprog.py.

def produtil.mpiprog.MPIRank.ranks (   self)

Yields self once: all MPI ranks.

Definition at line 563 of file mpiprog.py.

def produtil.mpiprog.MPIRank.setthreads (   self,
  nthreads 
)

Sets the number of threads requested by each MPI rank within this group of MPI ranks.

Definition at line 506 of file mpiprog.py.

def produtil.mpiprog.MPIRank.to_shell (   self)

Return a POSIX sh representation of this MPI rank, if possible.

Definition at line 514 of file mpiprog.py.

def produtil.mpiprog.MPIRank.validate (   self,
  more = None 
)

Checks to see if this MPIRank is valid, or has errors.

Parameters
moreArguments to the executable to validate.
Returns
None if there are no errors, or raises a descriptive exception.

Definition at line 536 of file mpiprog.py.

Referenced by produtil.mpiprog.MPIRank.__init__().


The documentation for this class was generated from the following file: