HWRF  trunk@4391
Public Member Functions | Public Attributes | List of all members
produtil.mpi_impl.mpi_impl_base.CMDFGen Class Reference

Generates files with one line per MPI rank, telling what program to run on each rank. More...

Detailed Description

Generates files with one line per MPI rank, telling what program to run on each rank.

This class is used to generate command files for mpiserial, poe or mpirun.lsf. Command files are files with one MPI rank per line containing a shell command to run for that rank. Generally the input (lines) is generated by the to_arglist function in a subclass of produtil.mpiprog.MPIRanksBase. See the produtil.mpi_impl.mpirun_lsf for an example of how to use this.

Definition at line 30 of file mpi_impl_base.py.

Inheritance diagram for produtil.mpi_impl.mpi_impl_base.CMDFGen:

Public Member Functions

def __init__ (self, base, lines, cmd_envar='SCR_CMDFILE', model_envar=None, filename_arg=False, kwargs)
 CMDFGen constructor. More...
 
def __call__
 Adds the environment variables to runner and creates the command file. More...
 

Public Attributes

 filename
 command file's filename
 
 tmpprefix
 temporary file prefix
 
 tmpsuffix
 temporary file suffix
 
 tmpdir
 temporary file directory
 
 cmd_envar
 Environment variable to set telling the path to the command file.
 
 model_envar
 Environment variable to set to "MPMD".
 
 filename_arg
 
 cmdf_contents
 String containing the command file contents. More...
 

Constructor & Destructor Documentation

def produtil.mpi_impl.mpi_impl_base.CMDFGen.__init__ (   self,
  base,
  lines,
  cmd_envar = 'SCR_CMDFILE',
  model_envar = None,
  filename_arg = False,
  kwargs 
)

CMDFGen constructor.

Parameters
basetype of command file being generated. See below.
linesthe command file contents as a list of strings, one per line
cmd_envarenvironment variable to set to the command file path
model_envarenvironment variable to set to "MPMD"
kwargsSets the command file name. See below.
filename_argIf True, the name of the command file is appended to the program argument list.

The command file is generated from tempfile.NamedTemporaryFile, passing several arguments from kwargs, if provided, or suitable defaults otherwise. There are several arguments used. In all cases, replace "base" with the contents of the base argument:

  • base_suffix — temporary file suffix (default: "base.")
  • base_prefix — temporary file prefix (default: ".cmdf")
  • base_tempdir — directory in which to create the file
Bug:
The base_suffix keyword is used for both the suffix and prefix

Definition at line 41 of file mpi_impl_base.py.

Member Function Documentation

def produtil.mpi_impl.mpi_impl_base.CMDFGen.__call__ (   self,
  runner,
  logger = None 
)

Adds the environment variables to runner and creates the command file.

Parameters
[out]runnerA produtil.prog.Runner to modify
loggera logging.Logger for log messages

Definition at line 113 of file mpi_impl_base.py.

Member Data Documentation

produtil.mpi_impl.mpi_impl_base.CMDFGen.cmdf_contents

String containing the command file contents.

Definition at line 77 of file mpi_impl_base.py.

Referenced by produtil.mpi_impl.mpi_impl_base.CMDFGen.__call__().


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