Executing commands¶
Wrappers for non-submitting executors (mpiexec, srun, etc.).
-
class
squirm.execution.Executor¶ Base class for a general MPI executor.
-
abstract
get_command(command, exec_params=None)¶ Return the full command that will be used to launch a command with MPI.
- Parameters
command – A list of strings representing the command to execute with MPI.
exec_params – An instance of
ExecParams.
-
abstract
__call__(command, exec_params=None)¶ Execute a command with MPI.
- Parameters
command – A list of strings representing the command to execute with MPI.
exec_params – An instance of
ExecParams.
-
run(code_string, exec_params=None)¶ Run Python code with MPI.
- Parameters
code_string – A string containing the Python code to execute with MPI.
exec_params – An instance of
ExecParams.
-
call(func, *args, exec_params=None, **kwargs)¶ Call a function with MPI.
- Parameters
func – The function to execute with MPI. Must be picklable.
*args – Positional arguments to pass to func. Must be picklable.
**kwargs – Keyword arguments to pass to func. Must be picklable.
exec_params – An instance of
ExecParams.
-
abstract
-
class
squirm.execution.ExecParams(num_tasks=None, num_nodes=None, tasks_per_node=None, gpus_per_task=None)¶ Collection of parameters to pass to the executor.
-
__init__(num_tasks=None, num_nodes=None, tasks_per_node=None, gpus_per_task=None)¶ - Parameters
num_tasks – The number of MPI tasks to launch.
num_nodes – The number of nodes on which to run.
tasks_per_node – The number of MPI tasks to launch per node.
gpus_per_task – The number of GPUs to assign per task.
Note
A given executor may not support all of these arguments. If it is passed an unsupported argument, it will raise an instance of
ExecParamError.
-
-
class
squirm.execution.ProcessError(exit_code)¶ Error raised when a command executed with MPI fails.
-
class
squirm.execution.ExecParamError(param_name)¶ Error raised when an executor is passed an unsupported parameter.
-
class
squirm.execution.BasicExecutor¶ Simple mpiexec executor.
-
class
squirm.execution.SlurmExecutor¶ Executor for Slurm.
-
class
squirm.execution.LCLSFExecutor¶ Executor for Livermore wrapper around IBM LSF.