executorlib.standalone.interactive.spawner.MpiExecSpawner#
- class executorlib.standalone.interactive.spawner.MpiExecSpawner(cwd: str | None = None, cores: int = 1, worker_id: int = 0, openmpi_oversubscribe: bool = False, threads_per_core: int = 1)[source]#
Bases:
SubprocessSpawner- __init__(cwd: str | None = None, cores: int = 1, worker_id: int = 0, openmpi_oversubscribe: bool = False, threads_per_core: int = 1)#
Subprocess interface implementation.
- Parameters:
cwd (str, optional) – The current working directory. Defaults to None.
cores (int, optional) – The number of cores to use. Defaults to 1.
threads_per_core (int, optional) – The number of threads per core. Defaults to 1.
worker_id (int) – The worker ID. Defaults to 0.
openmpi_oversubscribe (bool, optional) – Whether to oversubscribe the cores. Defaults to False.
Methods
__init__([cwd, cores, worker_id, ...])Subprocess interface implementation.
bootup(command_lst[, stop_function])Method to start the subprocess interface.
generate_command(command_lst)Generate the command list for the MPIExec interface.
poll()Method to check if the subprocess interface is running.
shutdown([wait])Method to shutdown the subprocess interface.
- bootup(command_lst: list[str], stop_function: Callable | None = None) bool#
Method to start the subprocess interface.
- Parameters:
command_lst (list[str]) – The command list to execute.
stop_function (Callable) – Function to stop the interface.
- Returns:
Whether the interface was successfully started.
- Return type:
bool
- generate_command(command_lst: list[str]) list[str][source]#
Generate the command list for the MPIExec interface.
- Parameters:
command_lst (list[str]) – The command list.
- Returns:
The generated command list.
- Return type:
list[str]
- poll() bool#
Method to check if the subprocess interface is running.
- Returns:
True if the interface is running, False otherwise.
- Return type:
bool
- shutdown(wait: bool = True)#
Method to shutdown the subprocess interface.
- Parameters:
wait (bool, optional) – Whether to wait for the interface to shutdown. Defaults to True.