11 from .mpi_impl_base 
import MPIMixed,CMDFGen
 
   16 module_logger=logging.getLogger(
'lsf_cray_intel')
 
   19     """!Runs the "sync" command as an exe().""" 
   20     if logger 
is None: logger=module_logger
 
   26     """!Adds OpenMP support to the provided object 
   28     @param arg An produtil.prog.Runner or 
   29     produtil.mpiprog.MPIRanksBase object tree 
   30     @param threads the number of threads, or threads per rank, an 
   32     assert(arg 
is not None)
 
   33     if threads 
is not None:
 
   35         return arg.env(OMP_NUM_THREADS=threads,KMP_NUM_THREADS=threads,
 
   36                        KMP_AFFINITY=
'scatter')
 
   42     """!Detects whether the SLURM srun command is available by looking 
   43     for it in the $PATH.""" 
   44     return srun_path 
is not None 
   47     """!Does this module represent an MPI implementation? Returns True.""" 
   51     """!Returns an ImmutableRunner that will run the specified program. 
   52     @returns an empty list 
   53     @param exe The executable to run on compute nodes. 
   54     @param kwargs Ignored.""" 
   58     """!Turns a produtil.mpiprog.MPIRanksBase tree into a produtil.prog.Runner 
   59     @param arg a tree of produtil.mpiprog.MPIRanksBase objects 
   60     @param allranks if True, and only one rank is requested by arg, then 
   61       all MPI ranks will be used 
   62     @param kwargs passed to produtil.mpi_impl.mpi_impl_base.CMDFGen 
   63       when mpiserial is in use. 
   64     @returns a produtil.prog.Runner that will run the selected MPI program""" 
   66     logging.getLogger(
'srun').info(
"%s => %s"%(repr(arg),repr(f)))
 
   70     """!This is the underlying implementation of mpirunner and should 
   71     not be called directly.""" 
   73     (serial,parallel)=arg.check_serial()
 
   74     if serial 
and parallel:
 
   75         raise MPIMixed(
'Cannot mix serial and parallel MPI ranks in the ' 
   78     srun_args=[srun_path,
'--export=ALL',
'--cpu_bind=core',
'--distribution=block:block']
 
   80     if arg.nranks()==1 
and allranks:
 
   81         arglist=[ str(a) 
for a 
in arg.to_arglist(
 
   82                 pre=srun_args,before=[],between=[])]
 
   85         raise MPIAllRanksError(
 
   86             "When using allranks=True, you must provide an mpi program " 
   87             "specification with only one MPI rank (to be duplicated across " 
   90         lines=[str(a) 
for a 
in arg.to_arglist(to_shell=
True,expand=
True)]
 
   92             raise MPISerialMissing(
 
   93                 'Attempting to run a serial program via srun but the ' 
   94                 'mpiserial program is not in your $PATH.')
 
   96             [srun_path,
'-n',
'%s'%(arg.nranks()),
'mpiserial'],
 
   97             prerun=CMDFGen(
'serialcmdf',lines,**kwargs))
 
  101         for rank,count 
in arg.expand_iter(expand=
False):
 
  102             cmdfile.append(
'%d-%d %s'%(irank,irank+count-1,rank.to_shell()))
 
  105             [srun_path,
'-n',str(irank),
'--multi-prog'],
 
  106             prerun=CMDFGen(
'srun_cmdfile',cmdfile,filename_arg=
True,**kwargs))
 
This module provides a set of utility functions to do filesystem operations. 
 
def mpirunner_impl(arg, allranks=False, kwargs)
This is the underlying implementation of mpirunner and should not be called directly. 
 
This class is a wrapper around launch and manage. 
 
def make_bigexe(exe, kwargs)
Returns an ImmutableRunner that will run the specified program. 
 
def mpirunner(arg, allranks=False, kwargs)
Turns a produtil.mpiprog.MPIRanksBase tree into a produtil.prog.Runner. 
 
def openmp(arg, threads)
Adds OpenMP support to the provided object. 
 
Implements the produtil.run: provides the object tree for representing shell commands. 
 
def runsync
Runs the "sync" command as an exe(). 
 
def can_run_mpi()
Does this module represent an MPI implementation? Returns True. 
 
Object structure for describing MPI programs. 
 
This is the abstract superclass of all classes that represent one or more MPI ranks, including MPI ranks that are actually serial programs. 
 
Represents a single stage of a pipeline to execute. 
 
def find_exe
Searches the $PATH or a specified iterable of directory names to find an executable file with the giv...
 
Internal module that launches and monitors processes. 
 
An copy-on-write version of Runner. 
 
def detect()
Detects whether the SLURM srun command is available by looking for it in the $PATH.