MPIRUN(1)

๐Ÿ’– mpirun โ€” Open MPI (MPIRUN(1)) ๐Ÿ’–

okay bestie, gather round, because this is the page: mpirun, mpiexec โ€” Execute serial and parallel jobs in Open MPI. It lives in the Open MPI manual, section 1. โœจ

๐Ÿ’ก Note, and it's important: mpirun and mpiexec are literally synonyms for each other. Like, they are symbolic links to the same executable. Use either name and you get the exact same behavior. No cap. ๐Ÿซถ

๐ŸŒธ SYNOPSIS ๐ŸŒธ

Single Process Multiple Data (SPMD) Model:

mpirun [ options ] <program> [ <args> ]

Multiple Instruction Multiple Data (MIMD) Model:

mpirun [ global_options ]
       [ local_options1 ] <program1> [ <args1> ] :
       [ local_options2 ] <program2> [ <args2> ] :
       ... :
       [ local_optionsN ] <programN> [ <argsN> ]

okay and here's a lil detail that's lowkey iconic: in both models, calling mpirun via an absolute path name is equivalent to specifying the --prefix option with a <dir> value equal to the directory where mpirun lives, minus its last subdirectory. So:

shell$ /usr/local/bin/mpirun ...

is exactly the same as

shell$ mpirun --prefix /usr/local

same energy, bestie. ๐Ÿ’…


๐ŸŽ€ QUICK SUMMARY ๐ŸŽ€

If you're just here like "how do I run an MPI application" โ€” this is the vibe you want:

shell$ mpirun [ -n X ] [ --hostfile <filename> ]  <program>

This runs X copies of <program> in your current run-time environment. (And if you're running under a supported resource manager, Open MPI's mpirun will usually automatically use the corresponding resource manager process starter, instead of ssh for example โ€” because ssh requires a hostfile, or it'll just default to running all X copies on the localhost.) It schedules, by default, in a round-robin fashion by CPU slot. The rest of this documentation has the details, bestie. ๐Ÿ“š

Also please note: mpirun automatically binds processes to hardware resources. With no further directives, three binding patterns get used (see map/rank/bind defaults for more details):

  • Bind to core: when the number of processes is <= 2
  • Bind to package: when the number of processes is > 2
  • Bind to none: when oversubscribed

If your application uses threads, then you probably want to make sure you're either not bound at all (by specifying --bind-to none), or bound to multiple cores using an appropriate binding level or a specific number of processing elements per application process. ๐Ÿงตโœจ


๐ŸŒˆ OPEN MPI'S USE OF PRRTE ๐ŸŒˆ

Open MPI uses the PMIx Reference Runtime Environment (PRRTE) as the main engine for launching, monitoring, and terminating MPI processes. It's giving infrastructure. ๐Ÿ‘‘

A lot of the documentation below is directly imported from PRRTE. So yeah, it talks about PRRTE concepts and command line options a lot. Except where noted, those concepts and command line arguments are all applicable to Open MPI too. ๐Ÿ’ฏ

But here's the tea: Open MPI extends the available PRRTE command line options, and it also slightly modifies PRRTE's default behaviors in a few cases. Those get specifically described in the documentation below. ๐Ÿซถ


๐Ÿฆ‹ COMMAND LINE OPTIONS ๐Ÿฆ‹

The core of Open MPI's mpirun processing is performed via the PRRTE <https://docs.prrte.org/>. Specifically: mpirun is effectively a wrapper around prterun, but mpirun's CLI options are slightly different than PRRTE's CLI commands. iykyk. ๐Ÿ’…

โญ General command line options

The following general command line options are available.

  • -h | --help โ€” This help message ๐Ÿ’ฌ
  • -v | --verbose โ€” Enable extra verbose output ๐Ÿ—ฃ๏ธ
  • -V | --version โ€” Print version and exit ๐Ÿท๏ธ

๐Ÿš€ Launch options

  • --default-hostfile <filename> โ€” Provide a default hostfile.
  • -H | --host <list> โ€” Comma-delimited list of hosts on which to to invoke processes. See below for details.
  • --hostfile <filename> โ€” Provide a hostfile. See below for details.
  • --machinefile <filename> โ€” Synonym for --hostfile.
  • --mca <key> <value> โ€” Pass context-specific MCA parameters; they are considered global if --gmca is not used and only one context is specified (<key> is the parameter name; <value> is the parameter value).
  • --path <path> โ€” Path to be used to look for executables to start processes.
  • --pmixmca <key> <value> โ€” Pass context-specific PMIx MCA parameters; they are considered global if only one context is specified (<key>> is the parameter name; <value> is the parameter value). See below for details.
  • --preload-files <list> โ€” Preload the comma-separated list of files to the remote machines current working directory before starting the remote process.
  • --prtemca <key> <value> โ€” Pass context-specific PRTE MCA parameters to the DVM. See below for details.
  • --pset <name> โ€” User-specified name assigned to the processes in their given application.
  • --rankfile <filename> โ€” Name of file to specify explicit task mapping.
  • --runtime-options <list> โ€” List of options to pass to the launcher. See below for details.
  • -s | --preload-binary โ€” Preload the binary on the remote machine before starting the remote process.
  • --set-cwd-to-session-dir โ€” Set the working directory of the started processes to their session directory.
  • --show-progress โ€” Output a brief periodic report on launch progress.
  • --wd <dir> โ€” Synonym for --wdir.
  • --wdir <dir> โ€” Set the working directory of the started processes.
  • -x <var> โ€” Export an environment variable, optionally specifying a value. See below for details.
  • --set-env <var>=<val> โ€” Set an environment variable. See below for details.
  • --unset-env <var> โ€” Unset an environment variable. See below for details.
  • --prepend-env <var[c]> <val> โ€” Prepend a value to an environment variable See below for details.
  • --append-env <var[c]> <val> โ€” Prepend a value to an environment variable See below for details.
  • --gpu-support <val> โ€” Direct application to either enable (true) or disable (false) its internal library's GPU support ๐ŸŽฎ
  • --app-pmix-prefix <val> โ€” Prefix to be used by an app to look for its PMIx installation on remote nodes.
  • --no-app-prefix โ€” Do not provide a prefix directive to this application.

๐Ÿ—บ๏ธ Mapping, ranking, and binding options

  • --map-by <value> โ€” Controls how processes are distributed within a host. See below for details.
  • --rank-by <value> โ€” Controls how processes are ordered in MPI_COMM_WORLD. See below for details.
  • --bind-to <value> โ€” Controls the resources to which processes are bound within a host. See below for details.

๐Ÿ“ค Output options

  • --output <list> โ€” Comma-delimited list of options that control how output is generated. See below for details.
  • --report-child-jobs-separately โ€” Return the exit status of the primary job only.
  • --stream-buffering <value> โ€” Control how output is buffered. See below for details.
  • --xterm <list> โ€” Create a new xterm window and display output from the specified ranks there. ๐Ÿ–ฅ๏ธ

๐Ÿ“ฅ Input options

  • --stdin <list> โ€” Specify procs to receive stdin; alloable values in <list> are: comma-delimited list of integer ranks, all, none. Defaults to 0, indicating rank 0.

๐Ÿ”ง Specific options

  • --allow-run-as-root โ€” Allow execution as root ((STRONGLY DISCOURAGED)). See below for details.
  • --daemonize โ€” Daemonize the DVM daemons into the background.
  • --forward-signals <list> โ€” Comma-delimited list of additional signals (names or integers) to forward to application processes. See below for details.
  • --launch-agent <agent> โ€” Name of daemon executable used to start processes on remote nodes (default: prted).
  • --max-vm-size <size> โ€” Number of daemons to start.
  • --noprefix โ€” Disable automatic --prefix behavior. See below for details.
  • --prefix <prefix> โ€” Prefix to be used to look for RTE executables.
  • --pmix-prefix <prefix> โ€” Prefix to be used by a PRRTE executable to look for its PMIx installation on remote nodes.
  • --set-sid โ€” Direct the DVM daemons to separate from the current session.
  • --singleton <id> โ€” ID of the singleton process that started us.
  • --tmpdir <dir> โ€” Set the root for the session directory tree.
  • --tune <filename> โ€” File(s) containing MCA params for tuning DVM operations. See below for details.
  • --uniform-nodes โ€” All allocated nodes should be treated as having the same topology

๐Ÿ‘‘ MPI Options

  • --initial-errhandler โ€” Specify the initial error handler that is attached to predefined communicators during the first MPI call.
  • --memory-alloc-kinds โ€” Value is a comma separated list of memory allocation kinds.
  • --display-comm โ€” Display table of communication methods between MPI_COMM_WORLD ranks during MPI_Init
  • --display-comm-finalize โ€” Display table of communication methods between ranks during MPI_Finalize
  • --soft โ€” This option does nothing, but is mandated by the MPI standard
  • --arch <filename> โ€” This option does nothing, but is mandated by the MPI standard
  • --file <filename> โ€” This option does nothing, but is mandated by the MPI standard

๐Ÿ› Debugger / tool options

  • --keepalive <filename> โ€” Named pipe filename to monitor โ€” DVM will terminate upon closure
  • --report-pid <value> โ€” Print out PID on stdout (-), stderr (+), or a filename (anything else)
  • --report-uri <value> โ€” Print out URI on stdout (-), stderr (+), or a filename (anything else)
  • --stop-on-exec <value> โ€” If supported, stop each specified process at start of execution
  • --stop-in-init <value> โ€” Direct the specified processes to stop in the MPI initialization function
  • --stop-in-app <value> โ€” Direct the specified processes to stop at an application-controlled location

๐Ÿ” Debug options

  • --debug-daemons โ€” Debug daemons โ€” if not set, the "verbose" setting will be limited to the DVM controller to reduce clutter. See below for details.
  • --debug-daemons-file โ€” Enable debugging of any PRTE daemons used by this application, storing their verbose output in files. See below for details.
  • --display <value> โ€” Comma-delimited list of options for displaying information about the allocation and job. Allowed values for <value>: allocation, bind, map, map-devel, topo. See below for details.
  • --get-stack-traces โ€” If a timeout occurs, get stack traces of all application processes.
  • --leave-session-attached โ€” Do not discard stdout/stderr of remote PRTE daemons. See below for details.
  • --report-state-on-timeout โ€” Report all job and process states upon timeout.
  • --spawn-timeout <seconds> โ€” Timeout the job if spawn takes more than the specified number of seconds.
  • --test-suicide <seconds> โ€” Suicide instead of clean abort after delay.
  • --timeout <seconds> โ€” Timeout the job after the specified number of seconds.
  • --output-proctable <value> โ€” prints the complete proctable straight to stdout after launch. The allowed <value>s are +, -, or a filename. That's the whole menu, no secret third thing. โœจ

๐Ÿ›Ÿ Fault Tolerance Options

Okay so bestie, real talk first: these ones only show up if Open MPI / PRRTE were compiled with Fault Tolerance functionality enabled. No FT build, no FT options, periodt. ๐Ÿ˜ญ

  • --enable-recovery โ€” enable recovery from process failure (Default = disabled)
  • --max-restarts โ€” max number of times to restart a failed process
  • --disable-recovery โ€” disable recovery (heads up: this resets all the recovery options to off)
  • --continuous โ€” job is to run until explicitly terminated
  • --with-ft โ€” specify the type(s) of error handling that the application will use.

๐Ÿ” Details of individual command line options

The sections below offer more detail than the abbreviated lists, above. Grab a snack and a blanket, we're going deep. ๐Ÿ“

The --allow-run-as-root option

Allow execution as root (STRONGLY DISCOURAGED). Like, the manpage itself is yelling at you in caps. Respect the caps. ๐Ÿ˜ญ

Running as root exposes the user to potentially catastrophic file system corruption and damage โ€” e.g., if the user accidentally points the root of the session directory to a system required point, this directory and all underlying elements will be deleted upon job completion, thereby rendering the system inoperable. Yeah. Deleted. Gone. The whole system, uninstalled by vibes. ๐Ÿ’€

That said, it is recognized that some environments (e.g., containers) may require operation as root, and that the user accepts the risks in those scenarios. So if it's truly your moment, you can override PRRTE's run-as-root protection by providing one of the following:

  • The --allow-run-as-root command line directive
  • Adding BOTH of the following environmental parameters:
    • OMPI_ALLOW_RUN_AS_ROOT=1
    • OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1

Again, we recommend this only be done if absolutely necessary. Not a cute shortcut. Not a flex. Only if you have to. ๐Ÿซถ

The --bind-to option

By default, processes are bound to individual CPUs (either COREs or HWTHREADs, as defined by default or by user specification for the job). On nodes that are OVERSUBSCRIBEd (i.e., where the number of procs exceeds the number of assigned slots), the default is to not bind the processes.

Note: Processes from prior jobs that are already executing on a node are not "unbound" when a new job mapping results in the node becoming oversubscribed. They just keep doing their thing. ๐Ÿ™ˆ

Binding is performed to the first available specified object type within the object where the process was mapped. In other words, binding can only be done to the mapped object or to a resource located beneath that object.

An object is considered completely consumed when the number of processes bound to it equals the number of CPUs within it. Unbound processes are not considered in this computation. Additional processes cannot be mapped to consumed objects unless the OVERLOAD qualifier is provided via the --bind-to command line option.

Note that directives and qualifiers are case-insensitive and can be shortened to the minimum number of characters to uniquely identify them. Thus, L1CACHE can be given as l1cache or simply as L1. Minimalist icon behavior. ๐Ÿ’…

Supported binding directives include:

  • NONE does not bind the processes
  • HWTHREAD binds each process to a single hardware thread/ This requires that hwthreads be treated as independent CPUs (i.e., that either the HWTCPUS qualifier be provided to the map-by option or that hwthreads be designated as CPUs by default).
  • CORE binds each process to a single core. This can be done whether hwthreads or cores are being treated as independent CPUs provided that mapping is performed at the core or higher level.
  • L1CACHE binds each process to all the CPUs in an L1 cache.
  • L2CACHE binds each process to all the CPUs in an L2 cache
  • L3CACHE binds each process to all the CPUs in an L3 cache
  • NUMA binds each process to all the CPUs in a NUMA region
  • PACKAGE binds each process to all the CPUs in a PACKAGE

Any directive can include qualifiers by adding a colon (:) and any combination of one or more of the following to the --bind-to option:

  • OVERLOAD indicates that objects can have more processes bound to them than CPUs within them
  • IF-SUPPORTED indicates that the job should continue to be launched and executed even if binding cannot be performed as requested.
  • LIMIT=n limits the number of processes bound to each eligible representative of the specified type to the given number. For example, specifying "โ€“bind-to l3:limit=2" would direct PRRTE to bind ranks to the L3caches, limiting the number of processes bound to each l3cache to two โ€” i.e., bind 2 processes to a given l3cache, and then move on to the next.
Note: Directives and qualifiers are case-insensitive. OVERLOAD is the same as overload.

The --debug-daemons option

Debug daemon output enabled. This is a somewhat limited stream of information normally used to simply confirm that the daemons started. Includes leaving the output streams open. Very "is it alive" energy. ๐Ÿฆ‹

The --debug-daemons-file option

Debug daemon output is enabled and all output from the daemons is redirected into files with names of the form:

output-prted-<daemon-nspace>-<nodename>.log

These names avoid conflict on shared file systems. The files are located in the top-level session directory assigned to the DVM.

The --display option

The display command line directive must be accompanied by a comma-delimited list of case-insensitive options indicating what information about the job and/or allocation is to be displayed. The full directive need not be provided โ€” only enough characters are required to uniquely identify the directive. For example, ALL is sufficient to represent the ALLOCATION directive โ€” while MAP can not be used to represent MAP-DEVEL (though MAP-D would suffice). Abbreviations: only as much as you need, never more. ๐Ÿ‘‘

Supported values include:

  • ALLOCATION displays the detected hosts and slot assignments for this job
  • BINDINGS displays the resulting bindings applied to processes in this job
  • MAP displays the resulting locations assigned to processes in this job
  • MAP-DEVEL displays a more detailed report on the locations assigned to processes in this job that includes local and node ranks, assigned bindings, and other data
  • TOPO=LIST displays the topology of each node in the semicolon-delimited list that is allocated to the job
  • CPUS[=LIST] displays the available CPUs on the provided semicolon-delimited list of nodes (defaults to all nodes)

The display command line directive can include qualifiers by adding a colon (:) and any combination of one or more of the following (delimited by colons):

  • PARSEABLE directs that the output be provided in a format that is easily parsed by machines. Note that PARSABLE is also accepted as a typical spelling for the qualifier.
  • PHYSICAL directs that the output of the BINDINGS option be displayed using physical (instead of logical) CPU IDs.

Provided qualifiers will apply to all of the display directives unless noted.

The --forward-signals option

Comma-delimited list of additional signals (names or integers) to forward to application processes (none = forward nothing). Signals provided by default include SIGTSTP, SIGUSR1, SIGUSR2, SIGABRT, SIGALRM, and SIGCONT.

The --host option

Host syntax consists of a comma-delimited list of node names, each entry optionally containing a :N extension indicating the number of slots to assign to that entry:

--host node01:5,node02

In the absence of the slot extension, one slot will be assigned to the node. Duplicate entries are aggregated and the number of slots assigned to that node are summed together.

Note: A "slot" is the PRRTE term for an allocatable unit where we can launch a process. Thus, the number of slots equates to the maximum number of processes PRRTE may start on that node without oversubscribing it. Slots = how many friends can come to this node's party. ๐ŸŽ€

The --hostfile option

PRRTE supports several levels of user-specified host lists based on an established precedence order. Users can specify a default hostfile that contains a list of nodes to be used by the DVM. Only one default hostfile can be provided for a given DVM. In addition, users can specify a hostfile that contains a list of nodes to be used for a DVM, or can provide a comma-delimited list of nodes to be used for that DVM via the --host command line option.

The precedence order applied to these various options depends to some extent on the local environment. Here's how host and hostfile directives work together to define the set of hosts upon which a DVM will execute in the absence of a resource manager (RM):

  • Default hostfile unset, host unset, hostfile unset โ€” The DVN will consist solely of the local host where the DVM was started.
  • Default hostfile unset, host set, hostfile unset โ€” Host option defines resource list for the DVM.
  • Default hostfile unset, host unset, hostfile set โ€” Hostfile option defines resource list for the DVM.
  • Default hostfile unset, host set, hostfile set โ€” Hostfile option defines resource list for the DVM, then host filters the list to define the final set of nodes to be used by the DVM
  • Default hostfile = set, hostfile = unset, host = unset โ€” the default hostfile defines the resource list for the DVM ๐Ÿ’…
  • Default hostfile = set, hostfile = set, host = unset โ€” the default hostfile defines the resource list for the DVM, and then host filters that list to define the final set of nodes the DVM actually uses โœจ
  • Default hostfile = set, hostfile = set, host = set โ€” the default hostfile defines the resource list for the DVM, then hostfile filters the list, and then host filters the list again to define the final set of nodes the DVM actually uses ๐Ÿซถ

This changes somewhat when there's an RM in the picture, because that entity specifies the initial allocation of nodes. In that case, the default hostfile, hostfile and host directives are all used to filter the RM's specification, so a user can utilize different portions of the allocation for different DVMs ๐Ÿ˜Œ. It's done according to the same precedence order as in the prior table, with the RM providing the initial pool of nodes.

Hostfiles (sometimes called "machine files", which is giving vintage) are a combination of two things:

  1. A listing of hosts on which to launch processes.
  2. Optionally, limit the number of processes which can be launched on each host.

Hostfile syntax is one node name on each line, optionally including a designated number of "slots":

# This is a comment line, and will be ignored
node01  slots=10
node13  slots=5

node15
node16
node17  slots=3
...

Blank lines and lines beginning with a # are ignored ๐Ÿ™ˆ.

A "slot" is the PRRTE term for an allocatable unit where we can launch a process. See the section on definition of the term slot for a longer description of slots (iykyk).

In the absence of the slot parameter, PRRTE will assign either the number of slots to be the number of CPUs detected on the node or the resource manager-assigned value if operating in the presence of an RM.

Important: If you're using a resource manager, the user-specified number of slots is capped by the RM-assigned value. No arguing with the RM, bestie. ๐Ÿ™…โ€โ™€๏ธ

The --leave-session-attached option

Do not discard stdout/stderr of remote PRRTE daemons. The primary use for this option is to ensure that the daemon output streams (i.e., stdout and stderr) remain open after launch, thus allowing the user to see any daemon-generated error messages ๐Ÿ‘€. Otherwise, the daemon will "daemonize" itself upon launch, thereby closing its output streams. It said "I'm going ghost", basically. ๐Ÿ’€

The --map-by option

Processes are mapped based on one of the following directives as applied at the job level:

  • SLOT assigns procs to each node up to the number of available slots on that node before moving to the next node in the allocation
  • HWTHREAD assigns a proc to each hardware thread on a node in a round-robin manner up to the number of available slots on that node before moving to the next node in the allocation
  • CORE (default) assigns a proc to each core on a node in a round-robin manner up to the number of available slots on that node before moving to the next node in the allocation
  • L1CACHE assigns a proc to each L1 cache on a node in a round-robin manner up to the number of available slots on that node before moving to the next node in the allocation
  • L2CACHE assigns a proc to each L2 cache on a node in a round-robin manner up to the number of available slots on that node before moving to the next node in the allocation
  • L3CACHE assigns a proc to each L3 cache on a node in a round-robin manner up to the number of available slots on that node before moving to the next node in the allocation
  • NUMA assigns a proc to each NUMA region on a node in a round-robin manner up to the number of available slots on that node before moving to the next node in the allocation
  • PACKAGE assigns a proc to each package on a node in a round-robin manner up to the number of available slots on that node before moving to the next node in the allocation
  • NODE assigns processes in a round-robin fashion to all nodes in the allocation, with the number assigned to each node capped by the number of available slots on that node
  • SEQ (often accompanied by the file=<path> qualifier) assigns one process to each node specified in the file. The sequential file is to contain an entry for each desired process, one per line of the file.
  • PPR:N:resource maps N procs to each instance of the specified resource type in the allocation
  • RANKFILE (often accompanied by the file=<path> qualifier) assigns one process to the node/resource specified in each entry of the file, one per line of the file.
  • PE-LIST=a,b assigns procs to each node in the allocation based on the ORDERED qualifier. The list is comprised of comma-delimited ranges of CPUs to use for this job. If the ORDERED qualifier is not provided, then each node will be assigned procs up to the number of available slots, capped by the availability of the specified CPUs. If ORDERED is given, then one proc will be assigned to each of the specified CPUs, if available, capped by the number of slots on each node and the total number of specified processes. Providing the OVERLOAD qualifier to the "bind-to" option removes the check on availability of the CPU in both cases. ๐Ÿ”ฅ

Any directive can include qualifiers by adding a colon (:) and any combination of one or more of the following (delimited by colons) to the --map-by option (except where noted):

  • PE=n bind n CPUs to each process (can not be used in combination with rankfile or pe-list directives)
  • SPAN load balance the processes across the allocation by treating the allocation as a single "super-node" (can not be used in combination with slot, node, seq, ppr, rankfile, or pe-list directives)
  • OVERSUBSCRIBE allow more processes on a node than processing elements
  • NOOVERSUBSCRIBE means !OVERSUBSCRIBE
  • NOLOCAL do not launch processes on the same node as prun
  • HWTCPUS use hardware threads as CPU slots
  • CORECPUS use cores as CPU slots (default)
  • INHERIT indicates that a child job (i.e., one spawned from within an application) shall inherit the placement policies of the parent job that spawned it.
  • NOINHERIT means !INHERIT
  • FILE=<path> (path to file containing sequential or rankfile entries).
  • ORDERED only applies to the PE-LIST option to indicate that procs are to be bound to each of the specified CPUs in the order in which they are assigned (i.e., the first proc on a node shall be bound to the first CPU in the list, the second proc shall be bound to the second CPU, etc.) ๐Ÿงš
Note: Directives and qualifiers are case-insensitive and can be shortened to the minimum number of characters to uniquely identify them. Thus, L1CACHE can be given as l1cache or simply as L1. Slay, typing is optional. โœจ

The type of CPU (core vs hwthread) used in the mapping algorithm is determined as follows:

  • by user directive on the command line via the HWTCPUS qualifier to the --map-by directive
  • by setting the rmaps_default_mapping_policy MCA parameter to include the HWTCPUS qualifier. This parameter sets the default value for a PRRTE DVM โ€” qualifiers are carried across to DVM jobs started via prun unless overridden by the user's command line
  • defaults to CORE in topologies where core CPUs are defined, and to hwthreads otherwise.

If your application uses threads, then you probably want to ensure that you are either not bound at all (by specifying --bind-to none), or bound to multiple cores using an appropriate binding level or specific number of processing elements per application process via the PE=# qualifier to the --map-by command line directive. Threads deserve their own room, fr fr. ๐Ÿ’–

A more detailed description of the mapping, ranking, and binding procedure can be obtained via the --help placement option.

The --output option

The output command line directive must be accompanied by a comma-delimited list of case-insensitive options that control how output is generated ๐Ÿ‘‘. The full directive need not be provided โ€” only enough characters are required to uniquely identify the directive. For example, MERGE is sufficient to represent the MERGE-STDERR-TO-STDOUT directive โ€” while TAG can not be used to represent TAG-DETAILED (though TAG-D would suffice, so close bestie ๐Ÿ˜ญ).

Supported values include:

  • TAG marks each output line with the [job,rank]<stream>: of the process that generated it
  • TAG-DETAILED marks each output line with a detailed annotation containing [namespace,rank][hostname:pid]<stream>: of the process that generated it
  • TAG-FULLNAME marks each output line with the [namespace,rank]<stream>: of the process that generated it
  • TAG-FULLNAME marks each output line with the [namespace,rank]<stream>: of the process that generated it (yes, it's listed twice in the page โ€” we don't question the lore ๐Ÿซถ)
  • TIMESTAMP prefixes each output line with a [datetime]<stream>: stamp. Note that the timestamp will be the time when the line is output by the DVM and not the time when the source output it
  • XML provides all output in a pseudo-XML format MERGE-STDERR-TO-STDOUT merges stderr into stdout
  • DIR=DIRNAME redirects output from application processes into DIRNAME/job/rank/std[out,err,diag]. The provided name will be converted to an absolute path
  • FILE=FILENAME redirects output from application processes into filename.rank. The provided name will be converted to an absolute path ๐ŸŒธ

Supported qualifiers include NOCOPY โ€” as in, do not copy the output over to the stdout/stderr streams ๐Ÿ’… โ€” and RAW โ€” which means do not buffer the output into complete lines, just yeet it out as it is received. โœจ


The --pmixmca option ๐Ÿ’œ

Pass a PMIx MCA parameter, bestie.

Syntax: --pmixmca <key> <value>, where key is the parameter name and value is the parameter value.

The --prefix option ๐ŸŽ€

The prefix that gets used to go look for PRRTE executables. PRRTE automatically sets the prefix for remote daemons if it was either configured with the --enable-prte-prefix-by-default option OR prte itself was executed with an absolute path to the prte command. This option overrides those settings, if present, and forces use of the path you provided. Periodt. ๐Ÿ‘‘

The --pmix-prefix option ๐ŸŒธ

The prefix a PRRTE executable uses to go find its PMIx installation on remote nodes. This is the location of the top-level directory for the installation. If the installation has not been moved, it would be the value given to โ€œโ€“prefixโ€ when the installation was configured.

Okay so heads up ๐Ÿ™ˆ โ€” PRRTE literally cannot determine the exact name of the library subdirectory under this location. Some systems will call it โ€œlibโ€ while others call it โ€œlib64โ€. Accordingly, PRRTE will use the library subdirectory name of the PMIx installation used to build PRRTE.

The --app-prefix option ๐Ÿฆ‹

The prefix an app uses to go look for its PMIx installation on remote nodes. This is the location of the top-level directory for the installation. If the installation has not been moved, it would be the value given to โ€œโ€“prefixโ€ when the installation was configured.

Same vibe check as before, bestie ๐Ÿ’€ โ€” PRRTE cannot determine the exact name of the library subdirectory under this location. For example, some systems will call it โ€œlibโ€ while others call it โ€œlib64โ€. Accordingly, PRRTE will use the library subdirectory name of the PMIx installation used to build PRRTE.

In the absence of providing an application-specific prefix, the PMIx prefix (if given) used by PRRTEโ€™s own executables will be applied unless the โ€œโ€“no-app-prefixโ€ directive is given.

The --no-app-prefix option ๐ŸŽ€

Do not apply any prefix to this application. This is needed when a default PMIx prefix has been given to PRRTE, but the application has been built against a PMIx library that (a) is different from the one used by PRRTE, and (b) was not moved. Otherwise, PRRTE will apply its default prefix to the application. So real โ€” no notes. ๐Ÿ’…

The --prtemca option โญ

Pass a PRRTE MCA parameter.

Syntax: --prtemca <key> <value>, where key is the parameter name and value is the parameter value.

The --noprefix option ๐ŸŒˆ

Disable automatic --prefix behavior. PRRTE automatically sets the prefix for remote daemons if it was either configured with the --enable-prte-prefix-by-default option OR prte itself was executed with an absolute path to the prte command. This option disables that behavior. That's it, that's the whole thing. โœจ

The --rank-by option ๐Ÿ‘‘

PRRTE automatically ranks processes for each job starting from zero. Regardless of the algorithm used, rank assignments span applications in the same job โ€” i.e., a command line of

-n 3 app1 : -n 2 app2

will result in app1 having three processes ranked 0-2 and app2 having two processes ranked 3-4.

By default, process ranks are assigned in accordance with the mapping directive โ€” e.g., jobs that are mapped by-node will have the process ranks assigned round-robin on a per-node basis. However, users can override the default by specifying any of the following directives using the --rank-by command line option:

  • SLOT assigns ranks to each process on a node in the order in which the mapper assigned them. This is the default behavior, but is provided as an explicit option to allow users to override any alternative default specified in the environment. When mapping to a specific resource type, procs assigned to a given instance of that resource on a node will be ranked on a per-resource basis on that node before moving to the next node.
  • NODE assigns ranks round-robin on a per-node basis.
  • FILL assigns ranks to procs mapped to a particular resource type on each node, filling all ranks on that resource before moving to the next resource on that node. For example, procs mapped by L1cache would have all procs on the first L1cache ranked sequentially before moving to the second L1cache on the node. Once all procs on the node have been ranked, ranking would continue on the next node.
  • SPAN assigns ranks round-robin to procs mapped to a particular resource type, treating the collection of resource instances spanning the entire allocation as a single โ€œsuper nodeโ€ before looping around for the next pass. Thus, ranking would begin with the first proc on the first L1cache on the first node, then the next rank would be assigned to the first proc on the second L1cache on that node, proceeding across until the first proc had been ranked on all L1cache used by the job before circling around to rank the second proc on each object.

The rank-by command line option has no qualifiers. Iconic behavior, no extra knobs. ๐Ÿ’–

Note: Directives are case-insensitive. SPAN is the same as span. iykyk ๐Ÿซถ

A more detailed description of the mapping, ranking, and binding procedure can be obtained via the --help placement option.

The --runtime-options option ๐Ÿ”ฅ

The --runtime-options command line directive must be accompanied by a comma-delimited list of case-insensitive options that control the runtime behavior of the job. The full directive need not be provided โ€” only enough characters are required to uniquely identify the directive.

Runtime options are typically true or false, though this is not a requirement on developers. Since the value of each option may need to be set (e.g., to override a default set by MCA parameter), the syntax of the command line directive includes the use of an = character to allow inclusion of a value for the option. For example, one can set the ABORT-NONZERO-STATUS option to true by specifying it as ABORT-NONZERO-STATUS=1. Note that boolean options can be set to true using a non-zero integer or a case-insensitive string of the word true. For the latter representation, the user need only provide at least the T character. The same policy applies to setting a boolean option to false.

Note that a boolean option will default to true if provided without a value. Thus, --runtime-options abort-nonzero is sufficient to set the ABORT-NONZERO-STATUS option to true.

Supported values include:

  • ERROR-NONZERO-STATUS[=(bool)]: if set to false, this directs the runtime to treat a process that exits with non-zero status as a normal termination. If set to true, the runtime will consider such an occurrence as an error termination and take appropriate action โ€” i.e., the job will be terminated unless a runtime option directs otherwise. This option defaults to a true value if the option is given without a value.
  • DONOTLAUNCH: directs the runtime to map but not launch the specified job. This is provided to help explore possible process placement patterns before actually starting execution. No value need be passed as this is not an option that can be set by default in PRRTE.
  • SHOW-PROGRESS[=(bool)]: requests that the runtime provide progress reports on its startup procedure โ€” i.e., the launch of its daemons in support of a job. This is typically used to debug DVM startup on large systems. This option defaults to a true value if the option is given without a value.
  • NOTIFYERRORS[=(bool)]: if set to true, requests that the runtime provide a PMIx event whenever a job encounters an error โ€” e.g., a process fails. The event is to be delivered to each remaining process in the job. This option defaults to a true value if the option is given without a value. See --help notifications for more detail as to the PMIx event codes available for capturing failure events.
  • RECOVERABLE[=(bool)]: if set to true, this indicates that the application wishes to consider the job as recoverable โ€” i.e., the application is assuming responsibility for recovering from any process failure. This could include application-driven spawn of a substitute process or internal compensation for the missing process. This option defaults to a true value if the option is given without a value.
  • AUTORESTART[=(bool)]: if set to true, this requests that the runtime automatically restart failed processes up to โ€œmax restartsโ€ number of times. This option defaults to a true value if the option is given without a value.
  • CONTINUOUS[=(bool)]: if set to true, this informs the runtime that the processes in this job are to run until explicitly terminated. Processes that fail are to be automatically restarted up to โ€œmax restartsโ€ number of times. Notification of process failure is to be delivered to all processes in the application. This is the equivalent of specifying RECOVERABLE, NOTIFYERRORS, and AUTORESTART options except that the runtime, not the application, assumes responsibility for process recovery. This option defaults to a true value if the option is given without a value.
  • MAX-RESTARTS=<int>: indicates the maximum number of times a given process is to be restarted. This can be set at the application or job level (which will then apply to all applications in that job).
  • EXEC-AGENT=<path> indicates the executable that shall be used to start an application process. The resulting command for starting an application process will be <path> app <app-argv>. The path may contain its own command line arguments.
  • DEFAULT-EXEC-AGENT: directs the runtime to use the system default exec agent to start an application process. No value need be passed as this is not an option that can be set by default in PRRTE.
  • OUTPUT-PROCTABLE[(=channel)]: directs the runtime to report the convential debugger process table (includes PID and host location of each process in the application). Output is directed to stdout if the channel is -, stderr if +, or into the specified file otherwise. If no channel is specified, output will be directed to stdout.
  • STOP-ON-EXEC: directs the runtime to stop the application process(es) immediately upon execโ€™ing them. The directive will apply to all processes in the job.
  • STOP-IN-INIT: indicates that the runtime should direct the application process(es) to stop in PMIx_Init(). The directive will apply to all processes in the job.
  • STOP-IN-APP: indicates that the runtime should direct application processes to stop at some application-defined place and notify they are ready-to-debug. The directive will apply to all processes in the job.
  • TIMEOUT=<string> โ€” tells the runtime to โœ‹ terminate the job once it's been running for the time you specified. The time goes in colon-delimited format, like 01:20:13:05, which means 1 day, 20 hours, 13 minutes and 5 seconds ๐Ÿ•. If you don't use colons at all, the value is assumed to be in seconds, fr fr.
  • SPAWN-TIMEOUT=<string> โ€” tells the runtime to terminate the job if the launch hasn't finished within the time you gave. Same colon-delimited format โ€” 01:20:13:05 = 1 day, 20 hours, 13 minutes and 5 seconds โณ. And again, no colons means seconds, periodt.
  • REPORT-STATE-ON-TIMEOUT[(=bool)] โ€” tells the runtime to hand you a detailed report on the job's and the application processes' state when a job timeout happens ๐Ÿ“‹. Defaults to a true value if you give the option with no value.
  • GET-STACK-TRACES[(=bool)] โ€” asks the runtime for stack traces on all the application processes that are still running when the timeout hits ๐Ÿง. Defaults to a true value if you give the option with no value.
  • REPORT-CHILD-JOBS-SEPARATELY[(=bool)] โ€” tells the runtime to report the exit status of any child jobs spawned by the primary job separately ๐Ÿ‘ถ. If it's false, then the final exit status reported will be zero if the primary job and all spawned jobs exited normally, or the first non-zero status returned by either the primary or the child jobs. Defaults to a true value if you give the option with no value.
  • AGGREGATE-HELP-MESSAGES[(=bool)] โ€” tells the runtime to aggregate help messages, reporting each unique help message just once, alongside the number of processes that reported it ๐Ÿ—‚๏ธ. Defaults to a true value if you give the option with no value.
  • FWD-ENVIRONMENT[(=bool)] โ€” tells the runtime to forward the entire local environment in support of the application ๐ŸŒ. Defaults to a true value if you give the option with no value.

The --runtime-options command line option has no qualifiers, bestie, that's just how it is ๐Ÿ’….

Note: Directives are case-insensitive. FWD-ENVIRONMENT is the same as fwd-environment. Slay, no caps-lock drama required.

๐ŸŒŠ The --stream-buffering option

Adjust buffering for stdout/stderr. Allowable values:

  • 0: unbuffered
  • 1: line buffered
  • 2: fully buffered

๐ŸŽš๏ธ The --tune option

A comma-delimited list of one or more files containing PRRTE and PMIx MCA params for tuning DVM and/or application operations โœจ. Parameters in the file get treated as generic parameters and are subject to the translation rules/uncertainties. See --help mca for more info.

The syntax in the file is:

param = value

One parameter and its associated value per line. Empty lines and lines that begin with the # character are ignored, and so is any whitespace around the = character ๐Ÿ™ˆ.


๐Ÿงฌ The --uniform-nodes option

The uniform-nodes command line directive tells everyone that the allocated nodes should be treated as having only one topology, so the launch can be optimized for that scenario ๐Ÿ‘‘. That includes making sure all CPU allocations are the same on each node, that each node has the same number of devices and topological layers, etc.

Note: The runtime does not currently support mixes of chips with different endianness ๐Ÿ˜ญ.

๐Ÿ“ค The -x option

Export an environment variable, optionally with a value. For example:

  • -x foo exports the environment variable foo and takes its value from the current environment.
  • -x foo=bar exports the environment variable name foo and sets its value to bar in the started processes.
  • -x foo* exports all current environmental variables starting with foo.

๐Ÿซ™ The --set-env option

Set the named environmental variable to the specified value. This will overwrite the existing value, if it exists. Equivalent to the โ€œ-x foo=valโ€ option. Simple as that ๐Ÿ’–.


๐Ÿšซ The --unset-env option

Unset the named environmental variable. Note that --unset-env foo* unsets all current environmental variables starting with โ€œfooโ€.


โฌ…๏ธ The --prepend-env option

Prepend the named environment variable with the given value. The โ€œ[c]โ€ must be appended to the name to specify the separator to be used when appending the value.

Example: --prepend-envar LD_LIBRARY_PATH[:] foo/lib will result in:

LD_LIBRARY_PATH=foo/lib:$LD_LIBRARY_PATH

โžก๏ธ The --append-env option

Append the named environment variable with the given value. The โ€œ[c]โ€ must be appended to the name to specify the separator to be used when appending the value.

Example: --append-envar LD_LIBRARY_PATH[:] foo/lib will result in:

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:foo/lib

๐Ÿ’€ Deprecated command line options

The following command line options are deprecated, and should generally not be used. They may be removed in a future release of Open MPI ๐Ÿ‘‹. (Read: don't get attached, they're on their way out.)

The --bind-to-core option

Bind each process to its own core.

Deprecated โ€” This option is deprecated. Please use --bind-to core.

The --display-allocation option

Display the allocation being used by this job.

Deprecated โ€” This option is deprecated. Please use --display alloc.

The --display-devel-allocation option

Display a detailed list (mostly intended for developers) of the allocation being used by this job.

Deprecated โ€” This option is deprecated. Please use --display alloc-devel.

The --display-devel-map option

Display a detailed process map (mostly intended for developers) just before launch.

Deprecated โ€” This option is deprecated. Please use --display map-devel.

The --display-map option

Display the process map just before launch.

Deprecated โ€” This option is deprecated. Please use --display map.

The --display-topo option

Display the topology as part of the process map (mostly intended for developers) just before launch.

Deprecated โ€” This option is deprecated. Please use --display topo.

The --gmca option

Syntax: --gmca <key> <value>, where key is the parameter name and value is the parameter value. The g prefix means this parameter is โ€œglobalโ€, and is to be applied to all application contexts โ€” not just the one where the directive shows up ๐Ÿ‘€.

Pass generic MCA parameters โ€” i.e., parameters whose project affiliation has to be figured out by PRRTE based on matching the name of the parameter with defined values from various projects that PRRTE knows about.

Deprecated โ€” This translation can be incomplete (e.g., if a known project adds or changes parameters) โ€” thus, it is strongly recommended that users use project-specific parameters such as --gprtemca or --gpmixmca.

The --mca option

Syntax: --mca <key> <value>, where key is the parameter name and value is the parameter value.

Pass generic MCA parameters โ€” i.e., parameters whose project affiliation has to be determined by PRRTE based on matching the name of the parameter with defined values from various projects that PRRTE knows about.

Deprecated โ€” This translation can be incomplete (e.g., if a project adds or changes parameters) โ€” thus, it is strongly recommended that users use project-specific parameters such as --prtemca or --pmixmca.

The --merge-stderr-to-stdout option

Merge stderr to stdout for each process.

Deprecated โ€” This option is deprecated. Please use --output merge.

The --output-directory option

Redirect output from application processes into filename/job/rank/std[out,err,diag] ๐Ÿ“. A relative path value will be converted to an absolute path. The directory name may include a colon followed by a comma-delimited list of optional case-insensitive directives. Supported directives currently include NOJOBID (do not include a job-id directory level) and NOCOPY (do not copy the output to the stdout/err streams).

Deprecated โ€” This option is deprecated. Please use --output dir=<path>.

The --output-filename option

Redirect output from application processes into filename.rank. A relative path value will be converted to an absolute path. The directory name may include a colon followed by a comma-delimited list of optional case-insensitive directives. Supported directives currently include NOCOPY (do not copy the output to the stdout/err streams).

Deprecated โ€” This option is deprecated. Please use --output file=<path>.

The --report-bindings option

Display process bindings to stderr.

Deprecated โ€” This option is deprecated. Please use --display bindings.

The --tag-output option

Tag all output with [job,rank].

Deprecated โ€” This option is deprecated. Please use --output.

The --timestamp-output option

Timestamp all application process output.

Deprecated โ€” This option is deprecated. Please use --output timestamp.

The --xml option

Provide all output in XML format.

Deprecated โ€” This option is deprecated. Please use --output.

๐Ÿšจ OPTIONS (OLD / HARD-CODED CONTENT โ€” TO BE AUDITED

๐Ÿ“ข This is old content

This is the old section of manually hard-coded content. It should probably be read / audited and see what we want to keep and what we want to discard. Feel free to refer to https://docs.prrte.org/ rather than replicating content here (e.g., for the definition of a slot and other things). Not me reading the internal monologue of the docs team ๐Ÿ’€.

mpirun will send the name of the directory where it was invoked on the local node to each of the remote nodes, and attempt to change to that directory. See the โ€œCurrent Working Directoryโ€ section below for further details ๐Ÿ .

  • <program>: The program executable. This is identified as the first non-recognized argument to mpirun.
  • <args>: Pass these run-time arguments to every new process. These must always be the last arguments to mpirun. If an app context file is used, <args> will be ignored.
  • -h, --help: Display help for this command.
  • -q, --quiet: Suppress informative messages from orterun during application execution ๐Ÿคซ.
  • -v, --verbose: Be verbose.
  • -V, --version: Print version number. If no other arguments are given, this will also cause orterun to exit.
  • -N <num>: Launch num processes per node on all allocated nodes (synonym for --npernode).
  • --display-map: Display a table showing the mapped location of each process prior to launch.
  • --display-allocation: Display the detected resource allocation.
  • --output-proctable: Output the debugger proctable after launch.
  • --dvm: Create a persistent distributed virtual machine (DVM) ๐Ÿ–ฅ๏ธ.
  • --max-vm-size <size>: Number of daemons to start.

okay bestie, this is the part where we decide where all the chaos physically goes down. use one of the following options to specify which hosts (nodes) of the cluster to run on. ๐ŸŒˆ

tiny history moment that actually matters: as of the start of the v1.8 release, mpirun will launch a daemon onto each host in the allocation (as modified by the following options) at the very beginning of execution โ€” regardless of whether or not application processes will eventually be mapped to execute there. why tho?? to allow collection of hardware topology information from the remote nodes, thus allowing us to map processes against known topology. โœจ that's the glow-up. However, it is a change from the behavior in prior releases, where daemons were only launched after mapping was complete, and thus only occurred on nodes where application processes would actually be executing. so if you're coming from an old version, this is your reminder that the daemons show up early now. ๐Ÿ’…

  • -H, --host <host1,host2,...,hostN> โ€” the list of hosts on which to invoke processes.
  • --hostfile <hostfile> โ€” provide a hostfile to use.
  • --default-hostfile <hostfile> โ€” provide a default hostfile.
  • --machinefile <machinefile> โ€” exactly the same thing as --hostfile, just wearing a different outfit. (It's a synonym for --hostfile.)
  • --cpu-set <list> โ€” restrict launched processes to the specified logical CPUs on each node (comma-separated list). and no, this doesn't cancel your binding options โ€” those still apply within the specified envelope. like, you can totally elect to bind each process to only one CPU within the specified CPU set. ๐ŸŽ€

๐Ÿซถ how many processes tho

The following options specify the number of processes to launch. major disclaimer: none of the options imply a particular binding policy โ€” e.g., requesting N processes for each package does not imply that the processes will be bound to the package. saying "do this many per package" is not the same as saying "glue them to the package", okay?? they are two separate slayings. ๐Ÿ’€

  • -n, --n, -c, -np <#> โ€” run this many copies of the program on the given nodes. this option indicates that the specified file is an executable program and not an application context. if no value is provided for the number of copies to execute (i.e., neither the -n nor its synonyms are provided on the command line), Open MPI will automatically execute a copy of the program on each process slot โ€” see PRRTE's definition of "slot" at https://docs.prrte.org/en/latest/placement/overview.html#definition-of-slot if you want the lore. but heads up: this feature can only be used in the SPMD model, and will return an error (without beginning execution of the application) otherwise. ๐Ÿ™ˆ
Note: the -n option is the preferred option to be used to specify the number of copies of the program to be executed, but the alternate options are also accepted. bestie behavior = use -n. ๐Ÿ’š
  • --map-by ppr:N:<object> โ€” launch N times the number of objects of the specified type on each node.
  • --npersocket <#persocket> โ€” on each node, launch this many processes times the number of processor sockets on the node. the -npersocket option also turns on the --bind-to-socket option. (deprecated in favor of --map-by ppr:n:package) ๐Ÿซ 
  • --npernode <#pernode> โ€” on each node, launch this many processes. (deprecated in favor of --map-by ppr:n:node)
  • --pernode โ€” on each node, launch one process โ€” equivalent to --npernode 1. (deprecated in favor of --map-by ppr:1:node)

๐Ÿ—บ๏ธ to map processes

  • --map-by <object> โ€” map to the specified object, defaults to package. the supported options include slot, hwthread, core, L1cache, L2cache, L3cache, package, numa, node, seq, rankfile, pe-list=#, and ppr. any object can include modifiers by adding a : and any combination of the following:
    • pe=n โ€” bind n processing elements to each proc
    • span โ€” load balance the processes across the allocation
    • oversubscribe โ€” allow more processes on a node than processing elements
    • nooversubscribe โ€” do not allow more processes on a node than processing elements (default)
    • nolocal โ€” do not place processes on the same host as the mpirun process
    • hwtcpus โ€” use hardware threads as CPU slots for mapping
    • corecpus โ€” use processor cores as CPU slots for mapping (default)
    • file=filename โ€” used with rankfile; use filename to specify the file to use
    • ordered โ€” used with pe-list to bind each process to one of the specified processing elements
Note: socket is also accepted as an alias for package. โœจ
  • --bycore โ€” map processes by core. (deprecated in favor of --map-by core)
  • --byslot โ€” map and rank processes round-robin by slot. (deprecated in favor of --map-by slot)
  • --nolocal โ€” do not run any copies of the launched application on the same node as orterun is running. this option will override listing the localhost with --host or any other host-specifying mechanism. it's an alias for --map-by :nolocal. ๐Ÿšซ๐Ÿ 
  • --nooversubscribe โ€” do not oversubscribe any nodes; error (without starting any processes) if the requested number of processes would cause oversubscription. this option implicitly sets "max_slots" equal to the "slots" value for each node. (Enabled by default). alias for --map-by :nooversubscribe.
  • --oversubscribe โ€” nodes are allowed to be oversubscribed, even on a managed system, and overloading of processing elements is fine. alias for --map-by :oversubscribe. ๐Ÿ”ฅ
  • --bynode โ€” launch processes one per node, cycling by node in a round-robin fashion. this spreads processes evenly among nodes and assigns MPI_COMM_WORLD ranks in a round-robin, "by node" manner. (deprecated in favor of --map-by node)
  • --cpu-list <cpus> โ€” comma-delimited list of processor IDs to which to bind processes [`default=NULL]. processor IDs are interpreted as hwloc logical core IDs.
Note: you can run the hwloc lstopo(1) command to see a list of available cores and their logical IDs. go peek, bestie, the info is right there. ๐Ÿ‘€

๐Ÿ‘‘ to order processes' ranks in MPI_COMM_WORLD

  • --rank-by <mode> โ€” rank in round-robin fashion according to the specified mode, defaults to slot. the supported options include slot, node, fill, and span.

๐ŸŽ€ for process binding

  • --bind-to <object> โ€” bind processes to the specified object, defaults to core. supported options include slot, hwthread, core, l1cache, l2cache, l3cache, package, numa, and none.
  • --cpus-per-proc <#perproc> โ€” bind each process to the specified number of cpus. (deprecated in favor of --map-by <obj>:PE=n)
  • --cpus-per-rank <#perrank> โ€” alias for --cpus-per-proc. (deprecated in favor of --map-by <obj>:PE=n)
  • --bind-to-core โ€” bind processes to cores. (deprecated in favor of --bind-to core)
  • --bind-to-socket โ€” bind processes to processor sockets. (deprecated in favor of --bind-to package)
  • --report-bindings โ€” report any bindings for launched processes. honestly iconic for debugging. ๐Ÿ’œ

๐Ÿงš for rankfiles

  • --rankfile <rankfile> โ€” provide a rankfile file. (deprecated in favor of --map-by rankfile:file=FILE)

๐ŸŒธ to manage standard I/O

  • --output-filename <filename> โ€” redirect the stdout, stderr, and stddiag of all processes to a process-unique version of the specified filename. any directories in the filename will automatically be created. each output file will consist of filename.id, where the id will be the processes' rank in MPI_COMM_WORLD, left-filled with zero's for correct ordering in listings. a relative path value will be converted to an absolute path based on the cwd where mpirun is executed. note that this will not work on environments where the file system on compute nodes differs from that where mpirun(1) is executed. ๐Ÿ˜ญ
  • --stdin <rank> โ€” the MPI_COMM_WORLD rank of the process that is to receive stdin. the default is to forward stdin to MPI_COMM_WORLD rank 0, but this option can be used to forward stdin to any process. it is also acceptable to specify none, indicating that no processes are to receive stdin. ๐Ÿ™Š
  • --merge-stderr-to-stdout โ€” merge stderr to stdout for each process.
  • --tag-output โ€” tag each line of output to stdout, stderr, and stddiag with [jobid, MCW_rank]<stdxxx> indicating the process jobid and MPI_COMM_WORLD rank of the process that generated the output, and the channel which generated it.
  • --timestamp-output โ€” timestamp each line of output to stdout, stderr, and stddiag. โฐ
  • --xml โ€” provide all output to stdout, stderr, and stddiag in an XML format.
  • --xml-file <filename> โ€” provide all output in XML format to the specified file.
  • --xterm <ranks> โ€” display the output from the processes identified by their MPI_COMM_WORLD ranks in separate xterm windows. the ranks are specified as a comma-separated list of ranges, with a -1 indicating all. a separate window will be created for each specified process.
Note: xterm will normally terminate the window upon termination of the process running within it. However, by adding a ! to the end of the list of specified ranks, the proper options will be provided to ensure that xterm keeps the window open after the process terminates, thus allowing you to see the process' output. each xterm window will subsequently need to be manually closed. Note: in some environments, xterm may require that the executable be in the user's path, or be specified in absolute or relative terms. thus, it may be necessary to specify a local executable as ./my_mpi_app instead of just my_mpi_app. if xterm fails to find the executable, mpirun will hang, but still respond correctly to a ctrl-C. if this happens, please check that the executable is being specified correctly and try again. ๐Ÿซ ๐Ÿ’€

๐Ÿฆ‹ to manage files and runtime environment

  • --path <path> โ€” <path> that will be used when attempting to locate the requested executables. this is used prior to using the local PATH environment variable setting.
  • --prefix <dir> โ€” prefix directory that will be used to set the PATH and LD_LIBRARY_PATH on the remote node before invoking Open MPI or the target process. see the Remote Execution section, below. ๐Ÿ‘€
  • --noprefix โ€” disable the automatic --prefix behavior.
  • --preload-binary โ€” copy the specified executable(s) to remote machines prior to starting remote processes. the executables will be copied to the Open MPI session directory and will be deleted upon completion of the job. ๐ŸŽ€
  • --preload-files <files> โ€” preload the comma-separated list of files to the current working directory of the remote machines where processes will be launched prior to starting those processes.
  • --set-cwd-to-session-dir โ€” set the working directory of the started processes to their session directory.
  • --wd <dir> โ€” synonym for -wdir. ๐Ÿ’…
  • --wdir <dir> โ€” bop into <dir> before any of your program's code even breathes. ๐Ÿ’… Peep the Current Working Directory section for the tea on relative paths. Big note though: if --wdir shows up both on the command line and in an application context, the context wins, no discussion. So if the wdir you want is a different path on the backend nodes, you gotta give it as an absolute path that's actually correct for the backend node. Otherwise bestie, it's giving chaos.
  • -x <env> โ€” yeet the environment variables you name over to the remote nodes before the program runs. ๐Ÿฆ‹ One env variable per -x, that's the rule. You can name variables that already exist, or name brand-new ones with values attached. Like so:
shell$ mpirun -x DISPLAY -x OFILE=/tmp/out ...
Heads up bestie: the parser for -x is not very sophisticated โ€” it does not even understand quoted values. ๐Ÿ˜ญ So the move is: set your variables in the environment, then use -x to export them (not define them). Periodt.

Setting MCA parameters: ๐ŸŽ›๏ธ

  • --gmca <key> <value> โ€” drop global MCA parameters that apply to all contexts. <key> is the parameter name, <value> is the parameter value. Simple as. โœจ
  • --mca <key> <value> โ€” send arguments to all the various MCA modules. Scroll to the Setting MCA Parameters section for the full lore.
Note: Open MPI will attempt to discern PMIx and PRRTE MCA parameters passed via --mca and handle them appropriately โ€” but it may not always guess correctly. ๐Ÿ™ˆ It is best to use --pmixmca and --prtemca when passing MCA parameters to PMIx and PRRTE, respectively. Trust.
  • --pmixmca <key> <value> โ€” send arguments to MCA modules inside the PMIx subsystem. See Setting MCA Parameters for more. ๐Ÿ’œ
  • --prtemca <key> <value> โ€” send arguments to MCA modules inside the PMIx Reference Runtime Environment (PRRTE) subsystem. Again, see Setting MCA Parameters. ๐Ÿ’œ
  • --tune <tune_file> โ€” name a tune file to set arguments for various MCA modules and environment variables. See:
:ref:`Setting MCA parameters and environment variables from file
<man1-mpirun-setting-mca-params-from-file>`

And for the record: --am <arg> is an alias for --tune <arg>. ๐Ÿซถ

For debugging: ๐Ÿ›

  • --get-stack-traces โ€” when you pair this with --timeout, mpirun will obtain and print out stack traces from all launched processes that are still alive when the timeout expires. Just know that grabbing stack traces can take a little time and produce a lot of output โ€” especially for large process-count jobs. So like, maybe don't do this casually. ๐Ÿ˜ญ
  • --timeout <seconds> โ€” the max number of seconds mpirun will run. After this many seconds, mpirun will abort the launched job and exit with a non-zero exit status. Using --timeout is also useful when you combine it with --get-stack-traces. ๐Ÿ”ฅ

There are also other options: โœจ

  • --allow-run-as-root โ€” let mpirun run when it's the root user executing it (by default, mpirun aborts when launched as root). Make sure you read the Running as root section for the details, okay? ๐Ÿ‘‘
  • --app <appfile> โ€” provide an appfile, and ignore all other command line options. Just straight up ignoring them.
  • --continuous โ€” the job runs until it's explicitly terminated. Run it into the ground, queen.
  • --disable-recovery โ€” disables recovery (resets all recovery options to off).
  • --do-not-launch โ€” do all the necessary prep work to launch the application, but don't actually launch it. All dressed up, no party. ๐Ÿ’…
  • --enable-recovery โ€” enable recovery from process failure (default: disabled).
  • --leave-session-attached โ€” do not detach the back-end daemons used by this application. This lets error messages from the daemons and the underlying environment (e.g., when it fails to launch a daemon) actually get output where you can see them. ๐Ÿ‘€
  • --max-restarts <num> โ€” max number of times to restart a failed process.
  • --personality <list> โ€” comma-separated list of programming model, languages, and containers being used (default = ompi).
  • --ppr <list> โ€” comma-separated list of number of processes on a given resource type (default: none). It's an alias for --map-by ppr:N:OBJ.
  • --report-child-jobs-separately โ€” return the exit status of the primary job only.
  • --report-events <URI> โ€” report events to a tool that's listening at the specified URI.
  • --report-pid <channel> โ€” print out mpirun's PID during startup. The channel has to be either a - to say "send the PID to stdout", a + to say "send the PID to stderr", or a filename to write the PID into. Pick your fighter. ๐ŸŽ€
  • --report-uri <channel> โ€” print out mpirun's URI during startup. Same deal: - means stdout, + means stderr, or a filename to write the URI into.
  • --show-progress โ€” output a brief, periodic report on launch progress. Little check-ins, love that. ๐Ÿซถ
  • --terminate โ€” terminate the DVM.
  • --use-hwthread-cpus โ€” use hardware threads as independent CPUs. ๐Ÿงš

Note that if a number of slots is not provided to Open MPI (e.g., via the slots keyword in a hostfile, or from a resource manager such as Slurm), using this option changes the default calculation of number of slots on a node. See PRRTE's definition of "slot" for more details: https://docs.prrte.org/en/latest/placement/overview.html#definition-of-slot

Also note that using this option changes Open MPI's definition of a "processor element" from a processor core to a hardware thread. See PRRTE's definition of a "processor element" for more details: https://docs.prrte.org/en/latest/placement/overview.html#definition-of-pe

The following options are useful for developers; they are not generally useful to most Open MPI users: ๐Ÿ› ๏ธ

  • --debug-daemons โ€” enable debugging of the run-time daemons used by this application.
  • --debug-daemons-file โ€” enable debugging of the run-time daemons used by this application, but store the output in files.
  • --display-devel-map โ€” display a more detailed table showing the mapped location of each process prior to launch.
  • --display-topo โ€” display the topology as part of the process map right before launch.
  • --launch-agent โ€” name of the executable to be used to start processes on the remote nodes. The default is prted. This option can be used to test new daemon concepts, or to pass options back to the daemons without mpirun itself having to see them. For example, specifying a launch agent of prted --prtemca odls_base_verbose 5 lets the developer ask the prted for debugging output without clutter from mpirun itself. Iconic dev behavior honestly. ๐Ÿ”ฅ
  • --report-state-on-timeout โ€” when paired with the --timeout command line option, report the run-time subsystem state of each process when the timeout expires.

There may be other options listed with mpirun --help. ๐Ÿ‘‘


๐ŸŒธ Environment Variables ๐ŸŒธ

This is old, hard-coded content. Is this content still current / accurate? Should it be updated and retained, or removed?
  • MPIEXEC_TIMEOUT โ€” synonym for the --timeout command line option. โœจ

๐Ÿ’– DESCRIPTION ๐Ÿ’–

This is old, hard-coded content. Is this content still current / accurate? Should it be updated and retained, or removed?

One invocation of mpirun starts an MPI application running under Open MPI. If your application is single process multiple data (SPMD), you can just specify the application right there on the mpirun command line. Easy. ๐Ÿ’…

If your application is multiple instruction multiple data (MIMD) โ€” so, made up of multiple programs โ€” you can specify the set of programs and arguments in one of two ways: Extended Command Line Arguments, and Application Context. Both valid, pick your vibe.

An application context describes the MIMD program set, including all the arguments, in a separate file. That file is essentially multiple mpirun command lines, minus the command name itself. Being able to specify different options for different instantiations of a program is another reason you'd reach for an application context. ๐Ÿฆ‹

Extended command line arguments let you describe the application layout right on the command line, using colons (:) to separate the specification of programs and arguments. Some options are globally set across all specified programs (e.g., --hostfile), while others are specific to a single program (e.g., -n). Very much "some things are for everyone, some things are personal." ๐Ÿ’œ

๐Ÿ–ฅ๏ธ Specifying Host Nodes ๐Ÿ–ฅ๏ธ

This is old, hard-coded content. Is this content still current / accurate? Should it be updated and retained, or removed?

Host nodes can be identified on the mpirun command line with the --host option, or in a hostfile. โœจ

For example:

shell$ mpirun -H aa,aa,bb ./a.out

Launches two processes on node aa and one on bb. ๐Ÿ’…

Or, consider the hostfile:

shell$ cat myhostfile
aa slots=2
bb slots=2
cc slots=2

Here we list both the host names (aa, bb, and cc) and how many slots there are for each. So organized of us. ๐ŸŽ€

shell$ mpirun --hostfile myhostfile ./a.out

will launch two processes on each of the three nodes.

shell$ mpirun --hostfile myhostfile --host aa ./a.out

will launch two processes, both on node aa.

shell$ mpirun --hostfile myhostfile --host dd ./a.out

will find no hosts to run on and will abort with an error. That is, the specified host dd is not in the specified hostfile. ๐Ÿ’€ Rude awakening, but okay.

When you're running under resource managers (e.g., Slurm, Torque, etc.), Open MPI will obtain both the hostnames and the number of slots directly from the resource manager. No manual labor required. ๐Ÿ‘‘

๐Ÿ”ข Specifying Number of Processes ๐Ÿ”ข

This is old, hard-coded content. Is this content still current / accurate? Should it be updated and retained, or removed?

As we just saw, the number of processes to run can be set using the hostfile. But bestie, other mechanisms exist. ๐Ÿฆ‹

You can specify the number of processes launched as a multiple of the number of nodes or processor packages available. For example:

shell$ mpirun -H aa,bb --map-by ppr:2:package ./a.out

launches processes 0-3 on node aa and processes 4-7 on node bb (assuming aa and bb both contain 4 slots each).

shell$ mpirun -H aa,bb --map-by ppr:2:node ./a.out

launches processes 0-1 on node aa and processes 2-3 on node bb.

shell$ mpirun -H aa,bb --map-by ppr:1:node ./a.out

launches one process per host node. Minimalist. โœจ

mpirun -H aa,bb --pernode ./a.out

is the same as --map-by ppr:1:node and --npernode 1. Same vibe, different spelling. ๐Ÿ’…

Another alternative is to specify the number of processes with the -n option. Consider now the hostfile:

shell$ cat myhostfile
aa slots=4
bb slots=4
cc slots=4

Now run with myhostfile:

shell$ mpirun --hostfile myhostfile -n 6 ./a.out

...processes 0-3 get dropped onto node aa and processes 4-5 pull up on node bb. And the leftover slots in the hostfile? Yeah those just sit there unused, because -n already said only 6 processes should launch. No notes. ๐Ÿ’…

๐Ÿ—บ๏ธ Mapping Processes to Nodes: Using Policies โœจ

okay bestie, hold up ๐Ÿ™ˆ This is old, hard-coded content. Is this content still current / accurate? Should it be updated and retained, or removed?

So the examples above are the default mapping of processes to nodes โ€” that's the vibe you get if you touch nothing. But you can absolutely take the wheel with various mpirun options that describe mapping policies. ๐Ÿ‘‘

Take the same hostfile as before, again with -n 6. Here's the tea on which MPI_COMM_WORLD ranks land on which node for a few mpirun variations:

  • mpirun โ€” Node aa: 0 1 2 3 ยท Node bb: 4 5 ยท Node cc: (nothing)
  • mpirun --map-by node โ€” Node aa: 0 3 ยท Node bb: 1 4 ยท Node cc: 2 5
  • mpirun --nolocal โ€” Node aa: (nothing) ยท Node bb: 0 1 2 3 ยท Node cc: 4 5

The --map-by node option load balances the processes across the available nodes, numbering each process in a round-robin fashion. It's giving โœจfairnessโœจ.

The --nolocal option stops any processes from being mapped onto the local host (in this case node aa). And yeah, mpirun typically consumes few system resources, so this might seem dramatic โ€” but --nolocal can genuinely be helpful for launching very large jobs where mpirun may actually need to use noticeable amounts of memory and/or processing time. Main character move when the job is huge. ๐Ÿ”ฅ

Just like -n can ask for fewer processes than there are slots, it can also oversubscribe the slots. For example, same hostfile:

shell$ mpirun --hostfile myhostfile -n 14 ./a.out

This will launch processes 0-3 on node aa, 4-7 on bb, and 8-11 on cc. Then it just adds the remaining two processes to whichever nodes it chooses. Bestie said "surprise me." ๐Ÿ˜Œ

You can also set limits on oversubscription. With the same hostfile:

shell$ mpirun --hostfile myhostfile -n 14 --nooversubscribe ./a.out

This will produce an error, since --nooversubscribe prevents oversubscription. Hard no. ๐Ÿ’€

Limits to oversubscription can also be specified in the hostfile itself:

shell$ cat myhostfile
aa slots=4 max_slots=4
bb         max_slots=4
cc slots=4

The max_slots field specifies such a limit. When it does, the slots value defaults to the limit. So now:

shell$ mpirun --hostfile myhostfile -n 14 ./a.out

This causes the first 12 processes to be launched as before, but the remaining two processes will be forced onto node cc. The other two nodes are protected by the hostfile against oversubscription by this job. Protected, guarded, gatekept. ๐Ÿ›ก๏ธ

Using the --nooversubscribe option can be helpful since Open MPI currently does not get max_slots values from the resource manager.

And of course, -n can also be used with the -H or -host option. For example:

shell$ mpirun -H aa,bb -n 8 ./a.out

launches 8 processes. Since only two hosts are specified, after the first two processes are mapped โ€” one to aa and one to bb โ€” the remaining processes oversubscribe the specified hosts.

And here's a MIMD example, because we love range ๐Ÿ’…:

shell$ mpirun -H aa -n 1 hostname : -H bb,cc -n 2 uptime

This will launch process 0 running hostname on node aa, and processes 1 and 2 each running uptime on nodes bb and cc, respectively. Different programs, different nodes, one command. Iconic.

๐Ÿ”ฎ Mapping, Ranking, and Binding: Oh My! ๐Ÿฆ‹

hehe okay another heads-up bestie ๐Ÿ™ˆ This is old, hard-coded content. Is this content still current / accurate? Should it be updated and retained, or removed?

Open MPI employs a three-phase procedure for assigning process locations and ranks:

  1. Mapping: Assigns a default location to each process
  2. Ranking: Assigns an MPI_COMM_WORLD rank value to each process
  3. Binding: Constrains each process to run on specific processors

The mapping step is what assigns a default location to each process, based on the mapper being employed. Mapping by slot, node, and sequentially results in the assignment of the processes to the node level. Meanwhile, mapping by object lets the mapper assign the process to an actual object on each node. Different flavors, same energy.

Note that the location assigned to the process is independent of where it will be bound โ€” that assignment is used solely as input to the binding algorithm. They're two separate steps, fr fr.

The mapping of processes to nodes can be defined not just with general policies but also, if necessary, using arbitrary mappings that cannot be described by a simple policy. For that you can use the "sequential mapper," which reads the hostfile line by line, assigning processes to nodes in whatever order the hostfile specifies. Use the ---map-by seq option. For example, using the same hostfile as before:

shell$ mpirun -hostfile myhostfile --map-by seq ./a.out

This will launch three processes โ€” one on each of nodes aa, bb, and cc, respectively. The slot counts don't matter; one process is launched per line on whatever node is listed on the line. Slots who? Never heard of her. ๐Ÿ˜Œ

Another way to specify arbitrary mappings is with a rankfile, which gives you detailed control over process binding as well. Rankfiles are discussed below. ๐Ÿ‘€

The second phase focuses on the ranking of the process within the job's MPI_COMM_WORLD. Open MPI separates this from the mapping procedure to allow more flexibility in the relative placement of MPI processes. This is best illustrated by considering the following cases, where we used the --np 8 --map-by ppr:2:package --host aa:4,bb:4 option:

  • --rank-by fill (i.e., dense packing) Default โ€” Node aa: 0 1 | 2 3 ยท Node bb: 4 5 | 6 7
  • --rank-by span (i.e., sparse or load balanced packing) โ€” Node aa: 0 4 | 1 5 ยท Node bb: 2 6 | 3 7
  • --rank-by node โ€” Node aa: 0 2 | 4 6 ยท Node bb: 1 3 | 5 7

Ranking by fill assigns MCW ranks in a simple progression across each node. Ranking by span and by slot provide the identical result โ€” a round-robin progression of the packages across all nodes before returning to the first package on the first node. Ranking by node assigns MCW ranks iterating first across nodes then by package.

The binding phase is where each process actually gets bound to a given set of processors. This can improve performance if the operating system is placing processes suboptimally. For example, it might oversubscribe some multi-core processor packages, leaving other packages idle โ€” which can lead processes to contend unnecessarily for common resources. Or, it might spread processes out too widely; that can be suboptimal if application performance is sensitive to interprocess communication costs. Binding can also keep the operating system from migrating processes excessively, regardless of how optimally those processes were placed to begin with. Stay. Put. ๐Ÿซถ

The processors to be used for binding can be identified in terms of topological groupings โ€” e.g., binding to an l3cache will bind each process to all processors within the scope of a single L3 cache within their assigned location. So if a process is assigned by the mapper to a certain package, then a --bind-to l3cache directive will cause the process to be bound to the processors that share a single L3 cache within that package. Nested, cute, very demure.

Alternatively, processes can be mapped and bound to specified cores using the --map-by pe-list= option. For example, --map-by pe-list=0,2,5 will map three processes, all three of which will be bound to logical cores 0,2,5. If you intend to bind each of the three processes to different cores, then the :ordered qualifier can be used like --map-by pe-list=0,2,5:ordered. In this example, the first process on a node will be bound to CPU 0, the second process on the node will be bound to CPU 2, and the third process on the node will be bound to CPU 5. Order matters bestie. ๐Ÿ’…

Finally, --report-bindings can be used to report bindings. Receipts.

As an example, consider a node with two processor packages, each comprised of four cores, and each of those cores contains one hardware thread. The --report-bindings option shows the binding of each process in a descriptive manner. Below are some examples.

shell$ mpirun --np 4 --report-bindings --map-by core --bind-to core
[...] Rank 0 bound to package[0][core:0]
[...] Rank 1 bound to package[0][core:1]
[...] Rank 2 bound to package[0][core:2]
[...] Rank 3 bound to package[0][core:3]

In the above case, the processes bind to successive cores. Slay.

shell$ mpirun --np 4 --report-bindings --map-by package --bind-to package
[...] Rank 0 bound to package[0][core:0-3]
[...] Rank 1 bound to package[0][core:0-3]
[...] Rank 2 bound to package[1][core:4-7]
[...] Rank 3 bound to package[1][core:4-7]

In the above case, processes bind to all cores on successive packages. The processes cycle through the processor packages in a round-robin fashion as many times as are needed. And by default, the processes are ranked in a fill manner. That's the whole vibe check, passed. โœ…

...and then you get this, which is chef's kiss:

shell$ mpirun --np 4 --report-bindings --map-by package --bind-to package --rank-by span
[...] Rank 0 bound to package[0][core:0-3]
[...] Rank 1 bound to package[1][core:4-7]
[...] Rank 2 bound to package[0][core:0-3]
[...] Rank 3 bound to package[1][core:4-7]

The above case demonstrates the difference in ranking when the span qualifier is used instead of the default.

And watch what happens when you ask for two processor elements per slot ๐Ÿซถ:

shell$ mpirun --np 4 --report-bindings --map-by slot:PE=2 --bind-to core
[...] Rank 0 bound to package[0][core:0-1]
[...] Rank 1 bound to package[0][core:2-3]
[...] Rank 2 bound to package[0][core:4-5]
[...] Rank 3 bound to package[0][core:6-7]

So in the above case, the output is literally telling us that 2 cores have been bound per process. Like, specifically: the mapping by slot with the PE=2 qualifier said "bestie, each slot (i.e., each process) eats two processor elements". And by default Open MPI defines "processor element" as "core", so the --bind-to core made each process get bound to both of the cores it was mapped to. No cap. ๐Ÿ’…

Swap that out for hardware threads and:

shell$ mpirun --np 4 --report-bindings --map-by slot:PE=2 --use-hwthread-cpus
[...]] Rank 0 bound to package[0][hwt:0-1]
[...]] Rank 1 bound to package[0][hwt:2-3]
[...]] Rank 2 bound to package[0][hwt:4-5]
[...]] Rank 3 bound to package[0][hwt:6-7]

Same deal as before, except we replaced --bind-to core with --use-hwthread-cpus. The --use-hwthread-cpus gets converted into --bind-to hwthread and tells the --report-bindings output to show the hardware threads that a process is bound to. In this case, processes are bound to 2 hardware threads per process. ๐Ÿฆ‹

And if you want the binding off off:

shell$ mpirun --np 4 --report-bindings --bind-to none
[...] Rank 0 is not bound (or bound to all available processors)
[...] Rank 1 is not bound (or bound to all available processors)
[...] Rank 2 is not bound (or bound to all available processors)
[...] Rank 3 is not bound (or bound to all available processors)

Yep โ€” binding is turned off, and it reports itself as such. Iconic honestly.

Open MPI's support for process binding depends on the underlying operating system. So yeah, certain process binding options may not be available on every system. Vibe check your OS first, bestie. ๐Ÿ˜ญ

Process binding can also be set with MCA parameters. Their usage is less convenient than that of mpirun options. On the other hand, MCA parameters can be set not only on the mpirun command line, but alternatively in a system or user mca-params.conf file or as environment variables, as described in the Setting MCA Parameters. These are MCA parameters for the PRRTE runtime, so the command line argument --prtemca (yes โ€” prte with a single r, not two r's) must be used to pass the MCA parameter key/value pair. Alternatively, the MCA parameter key/value pair may be specific on the command line by prefixing the key with PRTE_MCA_ (again, that is not a typo: PRTE not PRRTE). Some examples include:

  • --map-by core โ€” PRRTE MCA parameter key rmaps_default_mapping_policy, value core
  • --map-by package โ€” PRRTE MCA parameter key rmaps_default_mapping_policy, value package
  • --rank-by fill โ€” PRRTE MCA parameter key rmaps_default_ranking_policy, value fill
  • --bind-to core โ€” PRRTE MCA parameter key hwloc_default_binding_policy, value core
  • --bind-to package โ€” PRRTE MCA parameter key hwloc_default_binding_policy, value package
  • --bind-to none โ€” PRRTE MCA parameter key hwloc_default_binding_policy, value none

โœจ Defaults for Mapping, Ranking, and Binding โœจ

This is old, hard-coded content Is this content still current / accurate? Should it be updated and retained, or removed?

So if you don't specify each of --map-by, --rank-by, and --bind-to, the runtime just picks defaults for you, and here's the whole tea ๐Ÿ“:

  • If no options are specified then
    • If the number of processes is less than or equal to 2, then:
      • --map-by is core
      • --bind-to is core
      • --rank-by is span
      • Result: --map-by core --bind-to core --rank-by span
    • Otherwise:
      • --map-by is package
      • --bind-to is package
      • --rank-by is fill
      • Result: --map-by package --bind-to package --rank-by fill
  • If only --map-by OBJ (where OBJ is something like core) is specified, then:
    • --map-by specified OBJ
    • --bind-to uses the same OBJ as --map-by
    • --rank-by defaults to fill
    • Result: --map-by OBJ --bind-to OBJ --rank-by fill
  • If only --bind-to OBJ (where OBJ is something like core) is specified, then:
    • --map-by is either core or package depending on the number of processes
    • --bind-to specified OBJ
    • --rank-by defaults to fill
    • Result: --map-by OBJ --bind-to OBJ --rank-by fill
  • If --map-by OBJ1 --bind-to OBJ2, then:
    • --map-by specified OBJ1
    • --bind-to specified OBJ2
    • --rank-by defaults to fill
    • Result: --map-by OBJ2 --bind-to OBJ2 --rank-by fill

Picture 2 identical hosts (hostA and hostB) with 2 packages (denoted by []) each with 8 cores (denoted by /../) and 2 hardware threads per core (denoted by a .). ๐ŸŒˆ

Default of --map-by core --bind-to core --rank-by span when the number of processes is less than or equal to 2:

shell$ mpirun --np 2 --host hostA:4,hostB:2 ./a.out
R0  hostA  [BB/../../../../../../..][../../../../../../../..]
R1  hostA  [../BB/../../../../../..][../../../../../../../..]

Default of --map-by package --bind-to package --rank-by fill when the number of processes is greater than 2:

shell$ mpirun --np 4 --host hostA:4,hostB:2 ./a.out
R0  hostA  [BB/BB/BB/BB/BB/BB/BB/BB][../../../../../../../..]
R1  hostA  [BB/BB/BB/BB/BB/BB/BB/BB][../../../../../../../..]
R2  hostA  [../../../../../../../..][BB/BB/BB/BB/BB/BB/BB/BB]
R3  hostA  [../../../../../../../..][BB/BB/BB/BB/BB/BB/BB/BB]

If only --map-by OBJ is specified, then it implies --bind-to OBJ --rank-by fill. The example below results in --map-by hwthread --bind-to hwthread --rank-by fill:

shell$ mpirun --np 4 --map-by hwthread --host hostA:4,hostB:2 ./a.out
R0  hostA  [B./../../../../../../..][../../../../../../../..]
R1  hostA  [.B/../../../../../../..][../../../../../../../..]
R0  hostA  [../B./../../../../../..][../../../../../../../..]
R1  hostA  [../.B/../../../../../..][../../../../../../../..]

If only --bind-to OBJ is specified, then --map-by is determined by the number of processes and --rank-by fill. The example below results in --map-by package --bind-to core --rank-by fill:

shell$ mpirun --np 4 --bind-to core --host hostA:4,hostB:2 ./a.out
R0  hostA  [BB/../../../../../../..][../../../../../../../..]
R1  hostA  [../BB/../../../../../..][../../../../../../../..]
R2  hostA  [../../../../../../../..][BB/../../../../../../..]
R3  hostA  [../../../../../../../..][../BB/../../../../../..]

The mapping pattern might be better seen if we change the default --rank-by from fill to span. First, the processes are mapped by package iterating between the two, marking a core at a time. Next, the processes are ranked in a spanning manner that load balances them across the object they were mapped against. Finally, the processes are bound to the core that they were mapped against. ๐Ÿงš

shell$ mpirun --np 4 --bind-to core --rank-by span --host hostA:4,hostB:2 ./a.out
R0  hostA  [BB/../../../../../../..][../../../../../../../..]
R1  hostA  [../../../../../../../..][BB/../../../../../../..]
R2  hostA  [../BB/../../../../../..][../../../../../../../..]
R3  hostA  [../../../../../../../..][../BB/../../../../../..]

๐ŸŽ€ Rankfiles ๐ŸŽ€

This is old, hard-coded content Is this content still current / accurate? Should it be updated and retained, or removed?

Rankfiles are text files that spell out detailed info about how individual processes should be mapped to nodes, and to which processor(s) they should be bound. Each line of a rankfile specifies the location of one process (for MPI jobs, the process' "rank" refers to its rank in MPI_COMM_WORLD). The general form of each line in the rankfile is:

rank <N>=<hostname> slot=<slot list>

For example:

shell$ cat myrankfile
rank 0=aa slot=1:0-2
rank 1=bb slot=0:0,1
rank 2=cc slot=2-3
shell$ mpirun -H aa,bb,cc,dd --map-by rankfile:file=myrankfile ./a.out

Which means that:

  • Rank 0 runs on node aa, bound to logical package 1, cores 0-2.
  • Rank 1 runs on node bb, bound to logical package 0, cores 0 and 1.
  • Rank 2 runs on node cc, bound to logical cores 2 and 3.

Note that only logical processor locations are supported. By default, the values you give are assumed to be cores. If you intend to specify specific hardware threads, then you must add the :hwtcpus qualifier to the --map-by command line option (e.g., --map-by rankfile:file=myrankfile:hwtcpus). โญ

If the binding specification overlaps between any two ranks, then an error occurs. If you intend to allow processes to share the same logical processing unit, then you must pass the --bind-to :overload-allowed command line option to tell the runtime to ignore this check. ๐Ÿ™ˆ

The hostnames that got listed up there are what we call โ€œabsoluteโ€ โ€” meaning yes bestie, they're actual, real, resolvable hostnames. Actual addresses. Periodt. ๐ŸŽ€

But hostnames can also be โ€œrelativeโ€, meaning they're specified in relation to an externally-specified list of hostnames (like, say, from mpirun's --host argument, a hostfile, or a job scheduler). iykyk โœจ

That โ€œrelativeโ€ form looks like +n<X>, where X is an integer that says "gimme the Xth hostname in the set of all available hostnames," and the indexing starts from 0. For example:

shell$ cat myrankfile
rank 0=+n0 slot=1:0-2
rank 1=+n1 slot=0:0,1
rank 2=+n2 slot=2-3
shell$ mpirun -H aa,bb,cc,dd --map-by rankfile:file=myrankfile ./a.out

Every package/core slot location is specified as a logical index, no cap.

๐Ÿซถ Note: The Open MPI v1.6 series used physical indexes. Starting in Open MPI v5.0 only logical indexes are supported and the rmaps_rank_file_physical MCA parameter is no longer recognized. She's gone, bestie, she doesn't answer texts anymore ๐Ÿ’€

You can use tools such as Hwloc's lstopo(1) to find the logical indexes of packages and cores. Slay. ๐Ÿ”ฅ


๐Ÿง Application Context or Executable Program?

๐Ÿ’€ This is old, hard-coded content Is this content still current / accurate? Should it be updated and retained, or removed?

To tell these two different forms apart, mpirun peeks at the command line looking for the --app option. If it's specified, then the file named on the command line is assumed to be an application context. If it's not specified, then the file is assumed to be an executable program. Simple as that. ๐Ÿ’…


๐Ÿ” Locating Files

๐Ÿ’€ This is old, hard-coded content Is this content still current / accurate? Should it be updated and retained, or removed?

If no relative or absolute path is specified for a file, Open MPI will first go looking for files by searching the directories specified by the --path option. If there's no --path option set, or if the file just isn't found at the --path location, then Open MPI will search the user's PATH environment variable as it's defined on the source node(s). Okay so it's giving detective energy ๐Ÿ•ต๏ธโ€โ™€๏ธ

If a relative directory is specified, it must be relative to the initial working directory determined by the specific starter used. Like, when you're using the ssh starter, the initial directory is $HOME by default. Other starters may set the initial directory to the current working directory from the invocation of mpirun. ๐Ÿ™ˆ


๐Ÿ“ Current Working Directory

๐Ÿ’€ This is old, hard-coded content Is this content still current / accurate? Should it be updated and retained, or removed?

The --wdir mpirun option (and its synonym, --wd) lets you change to an arbitrary directory before the program is invoked. Iconic. It can also be used in application context files to specify working directories on specific nodes and/or for specific applications. ๐Ÿ™Œ

If the --wdir option shows up in both a context file and on the command line, the context file directory will override the command line value. Context file wins, sorry not sorry ๐Ÿ’…

If the -wdir option is specified, Open MPI will attempt to change to the specified directory on all of the remote nodes. If this fails, mpirun will abort. Like, it's not gonna just vibe through that one, bestie, it's over ๐Ÿ˜ญ

If the -wdir option is not specified, Open MPI will send the directory name where mpirun was invoked to each of the remote nodes. The remote nodes will try to change to that directory. If they can't (e.g., if the directory doesn't exist on that node), then Open MPI will use the default directory determined by the starter.

All of this directory changing happens before the user's program is invoked โ€” it does not wait until MPI_INIT(3) is called. So it's early, it's prompt, it has main character energy and it shows up on time. โฐโœจ


๐Ÿ“บ Standard I/O

๐Ÿ’€ This is old, hard-coded content Is this content still current / accurate? Should it be updated and retained, or removed?

Open MPI directs UNIX standard input to /dev/null on all processes except the MPI_COMM_WORLD rank 0 process. The MPI_COMM_WORLD rank 0 process inherits standard input from mpirun. Rank 0 is the chosen one, the main character, the one holding the aux cord ๐ŸŽง

๐Ÿ‘‘ Note: The node that invoked mpirun need not be the same as the node where the MPI_COMM_WORLD rank 0 process resides. Open MPI handles the redirection of mpirun's standard input to the rank 0 process. She handles it. She's got it. ๐Ÿซถ

Open MPI directs UNIX standard output and error from remote nodes to the node that invoked mpirun and prints it on the standard output/error of mpirun. Local processes inherit the standard output/error of mpirun and transfer to it directly.

So yeah, it's totally possible to redirect standard I/O for Open MPI applications by using the typical shell redirection procedure on mpirun. For example:

shell$ mpirun -n 2 my_app < my_input > my_output

Lowkey important note: in this example, only the MPI_COMM_WORLD rank 0 process will receive the stream from my_input on stdin. The stdin on all the other nodes will be tied to /dev/null. (Not them getting ghosted by stdin ๐Ÿ’€) However, the stdout from all nodes will be collected into the my_output file. So everybody's talking, only one of them is listening. It's giving group chat. ๐Ÿ“ฑ


๐Ÿ“ก Signal Propagation

๐Ÿ’€ This is old, hard-coded content Is this content still current / accurate? Should it be updated and retained, or removed?

When mpirun receives a SIGTERM and SIGINT, it will attempt to kill the entire job by sending all processes in the job a SIGTERM, waiting a small number of seconds, then sending all processes in the job a SIGKILL. Like, it gives them a heads up first โ€” polite! โ€” and then it does NOT play around. ๐Ÿ’€๐Ÿ”ฅ

SIGUSR1 and SIGUSR2 signals received by mpirun are propagated to all processes in the job.

A SIGTSTOP signal to mpirun will cause a SIGSTOP signal to be sent to all of the programs started by mpirun, and likewise a SIGCONT signal to mpirun will cause a SIGCONT sent. Matching set, bestie, we love symmetry โœจ

Other signals are not currently propagated by mpirun. She said "not those ones." ๐Ÿ™…โ€โ™€๏ธ


๐Ÿชฆ Process Termination / Signal Handling

๐Ÿ’€ This is old, hard-coded content Is this content still current / accurate? Should it be updated and retained, or removed?

During the run of an MPI application, if any process dies abnormally (either exiting before invoking MPI_FINALIZE(3), or dying as the result of a signal), mpirun will print out an error message and kill the rest of the MPI application. It's giving "if one of us goes down we ALL go down" ๐Ÿ˜ญ

User signal handlers should probably avoid trying to cleanup MPI state. Like, don't do it. Open MPI is currently not async-signal-safe; see MPI_INIT_THREAD(3) for details about MPI_THREAD_MULTIPLE and thread safety. For example, if a segmentation fault occurs in MPI_SEND(3) (perhaps because a bad buffer was passed in) and a user signal handler is invoked, and if this user handler attempts to invoke MPI_FINALIZE(3), Bad Things could happen since Open MPI was already โ€œinโ€ MPI when the error occurred. ๐Ÿ™ˆ

So: since mpirun will notice that the process died due to a signal, it's probably not necessary (and honestly the safest move) for the user to only clean up non-MPI state. Touch nothing that belongs to MPI. Hands off. ๐Ÿ’…


๐ŸŒฑ Process Environment

๐Ÿ’€ This is old, hard-coded content Is this content still current / accurate? Should it be updated and retained, or removed?

Processes in the MPI application inherit their environment from the PRRTE daemon on the node where they're running. That environment is typically inherited from the user's shell. On remote nodes, the exact environment is determined by the boot MCA module used. The rsh launch module, for example, uses either rsh/ssh to launch the PRRTE daemon on remote nodes, and typically executes one or more of the user's shell-setup files before launching the PRRTE daemon. So your .bashrc is lowkey part of the pipeline, bestie ๐Ÿšโœจ

When you're running dynamically linked applications which require the LD_LIBRARY_PATH environment variable to be set, care must be taken to ensure that it is correctly set when booting Open MPI. Genuinely, be careful here.

See the Remote Execution section for more details. ๐Ÿ‘€


๐Ÿ›ฐ๏ธ Remote Execution

๐Ÿ’€ This is old, hard-coded content Is this content still current / accurate? Should it be updated and retained, or removed?

Open MPI requires that the PATH environment variable be set to find executables on remote nodes. (This is typically only necessary in rsh- or ssh-based environments โ€” batch/scheduled environments typically copy the current environment to the execution of remote jobs, so if the current environment has PATH and/or LD_LIBRARY_PATH set properly, the remote nodes will also have it set properly. So sometimes it's fine, sometimes it's a whole thing. ๐Ÿ™ƒ)

If Open MPI was compiled with shared library support, it may also be necessary to have the LD_LIBRARY_PATH environment variable set on remote nodes as well โ€” especially to find the shared libraries required to run user MPI applications.

However (and this is the plot twist), it is not always desirable or possible to edit shell startup files to set PATH and/or LD_LIBRARY_PATH. That's literally why the --prefix option exists โ€” it's provided for some simple configurations where this is not possible. She's the backup plan and she ate ๐Ÿ’…

The --prefix option takes a single argument: the base directory on the remote node where Open MPI is installed. Open MPI will use this directory to set the remote PATH and LD_LIBRARY_PATH before executing any Open MPI or user applications. This lets you run Open MPI jobs without having pre-configured PATH and LD_LIBRARY_PATH on the remote nodes. Obsessed, honestly. ๐Ÿฅฐ

Here's the mechanics, bestie, stay with me: Open MPI adds the basename of the current node's $bindir (the directory where Open MPI's executables were installed) to the prefix and uses that to set the PATH on the remote node. Similarly, Open MPI adds the basename of the current node's $libdir (the directory where Open MPI's libraries were installed) to the prefix and uses that to set the LD_LIBRARY_PATH on the remote node. For example:

  • Local bindir: /local/node/directory/bin
  • Local libdir: /local/node/directory/lib64

If the following command line is used:

shell$ mpirun --prefix /remote/node/directory

then Open MPI will add /remote/node/directory/bin to the PATH and /remote/node/directory/lib64 to the LD_LIBRARY_PATH on the remote node before attempting to execute anything. Slay. โœจ

Now, the --prefix option is not sufficient if the installation paths on the remote node are different than the local node (e.g., if /lib is used on the local node, but /lib64 is used on the remote node), or if the installation paths are something other than a subdirectory under a common prefix. Like, she has limits. She's not a miracle worker. ๐Ÿ˜ญ

Note that executing mpirun via an absolute pathname is equivalent to specifying --prefix without the last subdirectory in the absolute pathname to mpirun. For example:

shell$ /usr/local/bin/mpirun ...

is equivalent to

shell$ mpirun --prefix /usr/local

Same vibes, different font. ๐ŸŽ€


๐Ÿ“ค Exported Environment Variables

๐Ÿ’€ This is old, hard-coded content Is this content still current / accurate? Should it be updated and retained, or removed?

Okay so like, the last lil' bit of the environment saga, then we get into the good stuff ๐Ÿ’–

All environment variables that are named in the form OMPI_* get auto-magically exported to your new processes on the local and the remote nodes. No cap, it just happens. You can also set/forward environmental parameters yourself using the MCA parameter mca_base_env_list. Real talk tho: the -x option to mpirun has been deprecated, but the syntax of the MCA param follows that prior example. And here's the tea โ€” while the syntax of the -x option and the MCA param does let you define new variables, the parser for these options is currently not very sophisticated โ€” it does not even understand quoted values. ๐Ÿ˜ญ So users are advised to set variables in the environment and use the option to export them; not to define them. Periodt.


โœจ Setting MCA Parameters โœจ

๐Ÿšง This is old, hard-coded content โ€” is this content still current / accurate? Should it be updated and retained, or removed?

The --mca switch is your bestie for passing parameters to the various MCA (that's Modular Component Architecture, iykyk) modules. MCA modules have a direct impact on MPI programs because they let you set tunable parameters at run time โ€” like which BTL communication device driver to use, what parameters to pass to that BTL, etc. โœจ

The --mca switch takes two arguments: <key> and <value>. The <key> argument generally specifies which MCA module will receive the value. For example, the <key> btl is used to select which BTL to be used for transporting MPI messages. The <value> argument is the value that is passed. For example:

shell$ mpirun --mca btl tcp,self -n 1 my_mpi_app

This tells Open MPI to use the tcp and self BTLs, and to run a single copy of my_mpi_app an allocated node.

shell$ mpirun --mca btl self -n 1 my_mpi_app

Tells Open MPI to use the self BTL, and to run a single copy of my_mpi_app an allocated node.

The --mca switch can be used multiple times to specify different <key> and/or <value> arguments. If the same <key> is specified more than once, the <value>s are concatenated with a comma (,) separating them. ๐Ÿ’…

Note that the --mca switch is simply a shortcut for setting environment variables. The same effect may be accomplished by setting corresponding environment variables before running mpirun. The form of the environment variables that Open MPI sets is:

OMPI_MCA_<key>=<value>

Thus, the --mca switch overrides any previously set environment variables. The --mca settings similarly override MCA parameters set in the $OPAL_PREFIX/etc/openmpi-mca-params.conf or $HOME/.openmpi/mca-params.conf file. ๐Ÿ‘‘

Unknown <key> arguments are still set as environment variable โ€” they are not checked (by mpirun) for correctness. Illegal or incorrect <value> arguments may or may not be reported โ€” it depends on the specific MCA module. ๐Ÿ™ˆ

To find the available component types under the MCA architecture, or to find the available parameters for a specific component, use the ompi_info command. See the ompi_info(1) man page for detailed information on this command.


โœจ Setting MCA parameters and environment variables from file โœจ

๐Ÿšง This is old, hard-coded content โ€” is this content still current / accurate? Should it be updated and retained, or removed?

The --tune command line option and its synonym --mca mca_base_envar_file_prefix allows a user to set MCA parameters and environment variables with the syntax described below. This option requires a single file or list of files separated by โ€œ,โ€ to follow. ๐ŸŒธ

A valid line in the file may contain zero or more -x or --mca. The following patterns are supported:

  • --mca var val
  • --mca var "val"
  • -x var=val
  • -x var

If any argument is duplicated in the file, the last value read will be used.

MCA parameters and environment specified on the command line have higher precedence than variables specified in the file. โœจ


โœจ Running as root โœจ

๐Ÿšง This is old, hard-coded content โ€” is this content still current / accurate? Should it be updated and retained, or removed?
โš ๏ธ Warning: The Open MPI team strongly advises against executing mpirun as the root user. MPI applications should be run as regular (non-root) users.

mpirun will refuse to run as root by default. ๐Ÿ›‘

To override this default, you can add the --allow-run-as-root option to the mpirun command line, or you can set the environmental parameters OMPI_ALLOW_RUN_AS_ROOT=1 and OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1. Note that it takes setting two environment variables to effect the same behavior as --allow-run-as-root in order to stress the Open MPI teamโ€™s strong advice against running as the root user. Like, they really want you to feel it. ๐Ÿ˜ญ

After extended discussions with communities who use containers (where running as the root user is the default), there was a persistent desire to be able to enable root execution of mpirun via an environmental control (vs. the existing --allow-run-as-root command line parameter). The compromise of using two environment variables was reached: it allows root execution via an environmental control, but it conveys the Open MPI teamโ€™s strong recommendation against this behavior. ๐Ÿค


โœจ Exit status โœจ

๐Ÿšง This is old, hard-coded content โ€” is this content still current / accurate? Should it be updated and retained, or removed?

There is no standard definition for what mpirun should return as an exit status. After considerable discussion, we settled on the following method for assigning the mpirun exit status (note: in the following description, the โ€œprimaryโ€ job is the initial application started by mpirun โ€” all jobs that are spawned by that job are designated โ€œsecondaryโ€ jobs): ๐Ÿซถ

  • If all processes in the primary job normally terminate with exit status 0, mpirun returns 0.
  • If one or more processes in the primary job normally terminate with non-zero exit status, mpirun returns the exit status of the process with the lowest MPI_COMM_WORLD rank to have a non-zero status.
  • If all processes in the primary job normally terminate with exit status 0, and one or more processes in a secondary job normally terminate with non-zero exit status, mpirun:
    1. Returns the exit status of the process with the lowest MPI_COMM_WORLD rank in the lowest jobid to have a non-zero status, and
    2. Outputs a message summarizing the exit status of the primary and all secondary jobs.
  • If the command line option --report-child-jobs-separately is set, we will return only the exit status of the primary job. Any non-zero exit status in secondary jobs will be reported solely in a summary print statement.

By default, the job will abort when any process terminates with non-zero status. The MCA parameter --prtemca state_base_error_non_zero_exit can be set to โ€œfalseโ€ (or โ€œ0โ€) to cause Open MPI to not abort a job if one or more processes return a non-zero status. In that situation the Open MPI records and notes that processes exited with non-zero termination status to report the appropriate exit status of mpirun (per bullet points above). ๐Ÿ’œ


โœจ EXAMPLES โœจ

๐Ÿšง This is old, hard-coded content โ€” is this content still current / accurate? Should it be updated and retained, or removed?

Be sure also to see the examples throughout the sections above. ๐Ÿ‘€

shell$ mpirun -n 4 --mca btl tcp,sm,self prog1

Run 4 copies of prog1 using the tcp, sm (shared memory), and self (process loopback) BTLโ€™s for the transport of MPI messages. Slay. ๐Ÿ”ฅ


โœจ RETURN VALUE โœจ

๐Ÿšง This is old, hard-coded content โ€” is this content still current / accurate? Should it be updated and retained, or removed?

mpirun returns 0 if all processes started by mpirun exit after calling MPI_FINALIZE(3). A non-zero value is returned if an internal error occurred in mpirun, or one or more processes exited before calling MPI_FINALIZE(3). If an internal error occurred in mpirun, the corresponding error code is returned. In the event that one or more processes exit before calling MPI_FINALIZE(3), the return value of the MPI_COMM_WORLD rank of the process that mpirun first notices died before calling MPI_FINALIZE(3) will be returned. Note that, in general, this will be the first process that died but is not guaranteed to be so. ๐Ÿ™ˆ

If the --timeout command line option is used and the timeout expires before the job completes (thereby forcing mpirun to kill the job) mpirun will return an exit status equivalent to the value of ETIMEDOUT (which is typically 110 on Linux and OS X systems). โฐ

See also: MPI_INIT(3), MPI_INIT_THREAD(3), MPI_FINALIZE(3), ompi_info(1)


2003-2026, The Open MPI Community


and that's the whole page bestie!! ๐ŸŽ€โœจ This lil' icon is from Sep 10, 2026, and it's version MPIRUN(1) โ€” go forth and spawn processes responsibly, you absolute main character. ๐Ÿฆ‹๐Ÿ’…๐Ÿ‘‘

๐Ÿ“ฆ where this page comes from