19 from .mpi_impl_base
import MPIMixed,CMDFGen
24 module_logger=logging.getLogger(
'lsf_cray_intel')
27 """!Runs the "sync" command as an exe()."""
28 if logger
is None: logger=module_logger
35 """!Adds OpenMP support to the provided object
37 @param arg An produtil.prog.Runner or
38 produtil.mpiprog.MPIRanksBase object tree
39 @param threads the number of threads, or threads per rank, an
41 if threads
is not None:
43 return arg.env(OMP_NUM_THREADS=threads,KMP_NUM_THREADS=threads,
44 KMP_AFFINITY=
'scatter')
50 """!Detects whether the MPICH mpi implementation is available by
51 looking for the mpiexec program in $PATH."""
52 return mpiexec_path
is not None
55 """!Does this module represent an MPI implementation? Returns True."""
59 """!Returns an ImmutableRunner that will run the specified program.
60 @returns an empty list
61 @param exe The executable to run on compute nodes.
62 @param kwargs Ignored."""
66 """!Turns a produtil.mpiprog.MPIRanksBase tree into a produtil.prog.Runner
67 @param arg a tree of produtil.mpiprog.MPIRanksBase objects
68 @param allranks if True, and only one rank is requested by arg, then
69 all MPI ranks will be used
70 @param kwargs passed to produtil.mpi_impl.mpi_impl_base.CMDFGen
71 when mpiserial is in use.
72 @returns a produtil.prog.Runner that will run the selected MPI program
73 @warning Assumes the TOTAL_TASKS environment variable is set
76 (serial,parallel)=arg.check_serial()
77 if serial
and parallel:
78 raise MPIMixed(
'Cannot mix serial and parallel MPI ranks in the '
80 if arg.nranks()==1
and allranks:
81 arglist=[ a
for a
in arg.to_arglist(
83 before=[
'-np',os.environ[
'TOTAL_TASKS']],
87 raise MPIAllRanksError(
88 "When using allranks=True, you must provide an mpi program "
89 "specification with only one MPI rank (to be duplicated across "
92 lines=[a
for a
in arg.to_arglist(to_shell=
True,expand=
True)]
94 raise MPISerialMissing(
95 'Attempting to run a serial program via mpiexec but the '
96 'mpiserial program is not in your $PATH.')
98 [mpiexec_path,
'-np',
'%s'%(arg.nranks()),
'mpiserial'],
99 prerun=CMDFGen(
'serialcmdf',lines,**kwargs))
101 arglist=[ a
for a
in arg.to_arglist(
103 before=[
'-np',
'%(n)d'],
This module provides a set of utility functions to do filesystem operations.
def openmp(arg, threads)
Adds OpenMP support to the provided object.
This class is a wrapper around launch and manage.
def detect()
Detects whether the MPICH mpi implementation is available by looking for the mpiexec program in $PATH...
Implements the produtil.run: provides the object tree for representing shell commands.
def make_bigexe(exe, kwargs)
Returns an ImmutableRunner that will run the specified program.
Object structure for describing MPI programs.
def can_run_mpi()
Does this module represent an MPI implementation? Returns True.
This is the abstract superclass of all classes that represent one or more MPI ranks, including MPI ranks that are actually serial programs.
def mpirunner(arg, allranks=False, kwargs)
Turns a produtil.mpiprog.MPIRanksBase tree into a produtil.prog.Runner.
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 runsync
Runs the "sync" command as an exe().