MPI Resources Module

Manages libensemble resources related to MPI tasks launched from nodes.

exception mpi_resources.MPIResourcesException

Resources module exception


Returns MPI base implementation


mpi_variant – MPI variant ‘aprun’ or ‘jsrun’ or ‘msmpi’ or ‘mpich’ or ‘openmpi’ or ‘srun’

Return type:



Return whether mpirun is openmpi or mpich

Return type:


mpi_resources.task_partition(num_procs, num_nodes, procs_per_node, machinefile=None)

Takes provided nprocs/nodes/ranks and outputs working configuration of procs/nodes/ranks or error

  • num_procs (int | None) –

  • num_nodes (int | None) –

  • procs_per_node (int | None) –

  • machinefile (str | None) –

Return type:

Tuple[None, None, None] | Tuple[int, int, int]

mpi_resources.get_resources(resources, num_procs=None, num_nodes=None, procs_per_node=None, hyperthreads=False)

Reconciles user-supplied options with available worker resources to produce run configuration.

Detects resources available to worker, checks whether an existing user-supplied config is valid, and fills in any missing config information (i.e., num_procs/num_nodes/procs_per_node)

User-supplied config options are honored, and an exception is raised if these are infeasible.

mpi_resources.create_machinefile(resources, machinefile=None, num_procs=None, num_nodes=None, procs_per_node=None, hyperthreads=False)

Creates a machinefile based on user-supplied config options, completed by detected machine resources

  • resources (resources.Resources) –

  • machinefile (str | None) –

  • num_procs (int) –

  • num_nodes (int | None) –

  • procs_per_node (int | None) –

  • hyperthreads (bool) –

Return type:

Tuple[bool, None, int, int]

mpi_resources.get_hostlist(resources, num_nodes=None)

Creates a hostlist based on user-supplied config options.

completed by detected machine resources