HWRF  trunk@4391
no_mpi.py
1 ##@namespace produtil.mpi_impl.no_mpi
2 # Stub funcitons to allow produtil.mpi_impl to run when MPI is unavailable.
3 #
4 # This module is part of the produtil.mpi_impl package. It underlies
5 # the produtil.run.openmp, produtil.run.mpirun , and
6 # produtil.run.mpiserial functions, providing the implementation
7 # needed to run when MPI is unavailable.
8 
9 import os, logging
11 from .mpi_impl_base import MPIDisabled
12 module_logger=logging.getLogger('lsf_cray_intel')
13 
14 def runsync(logger=None):
15  """!Runs the "sync" command as an exe()."""
16  if logger is None: logger=module_logger
17  sync=produtil.prog.Runner(['/bin/sync'])
18  p=produtil.pipeline.Pipeline(sync,capture=True,logger=logger)
19  version=p.to_string()
20  status=p.poll()
21 def openmp(arg,threads):
22  """!Does nothing. This implementation does not support OpenMP.
23 
24  @param arg An produtil.prog.Runner or
25  produtil.mpiprog.MPIRanksBase object tree
26  @param threads the number of threads, or threads per rank, an
27  integer"""
28 def mpirunner(arg,**kwargs):
29  """!Raises an exception to indicate MPI is not supported
30  @param arg,kwargs Ignored."""
31  raise MPIDisabled('This job cannot run MPI programs.')
33  """!Returns False to indicate MPI is not supported."""
34  return False
35 def make_bigexe(exe,**kwargs):
36  """!Returns an ImmutableRunner that will run the specified program.
37  @returns an empty list
38  @param exe The executable to run on compute nodes.
39  @param kwargs Ignored."""
40  return produtil.prog.ImmutableRunner([str(exe)],**kwargs)
41 
def mpirunner(arg, kwargs)
Raises an exception to indicate MPI is not supported.
Definition: no_mpi.py:28
This class is a wrapper around launch and manage.
Definition: pipeline.py:564
def make_bigexe(exe, kwargs)
Returns an ImmutableRunner that will run the specified program.
Definition: no_mpi.py:35
Implements the produtil.run: provides the object tree for representing shell commands.
Definition: prog.py:1
def can_run_mpi()
Returns False to indicate MPI is not supported.
Definition: no_mpi.py:32
def openmp(arg, threads)
Does nothing.
Definition: no_mpi.py:21
Represents a single stage of a pipeline to execute.
Definition: prog.py:299
Internal module that launches and monitors processes.
Definition: pipeline.py:1
An copy-on-write version of Runner.
Definition: prog.py:884
def runsync
Runs the "sync" command as an exe().
Definition: no_mpi.py:14