Open MPI (mpirun) commands

Command lines and options for launching MPI jobs with Open MPI 5.0, taken from the documentation of release 5.0.11: mpirun and its synonym mpiexec, plus ompi_info and the mpicc wrapper compilers. Rows are literal examples and options from that documentation, so host and program names are placeholders. Placement happens in three steps, mapping, ranking and binding, set with --map-by VALUE, --rank-by VALUE and --bind-to VALUE. Several long-familiar options such as --report-bindings are deprecated and appear with their replacements.

268 commands in 16 sections. Checked row by row against Open MPI 5.0.x documentation: mpirun(1) manual page on . Edited by Jay.

Launching 14

CommandWhat it does
mpirun -n 6 mpi-hello-worldRun N processesStarts six copies of the executable on the local machine; without -n, one process per processor core is launched.
mpiexec -n 2 mpi-hello-worldLaunch with mpiexecmpiexec and mpirun are the same executable under two names, so every option works with either.
mpirun -n 2 a.out : -n 2 b.outLaunch two programs as one jobBoth executables share one MPI_COMM_WORLD: a.out gets ranks 0 and 1, b.out ranks 2 and 3.
mpirun --app my_appfileLaunch from an application fileThe file lists one sub-application per line, such as -n 2 a.out, and may contain # comments.
mpirun -H aa -n 1 hostname : -H bb,cc -n 2 uptimeDifferent programs on different hostsProcess 0 runs hostname on aa while processes 1 and 2 run uptime on bb and cc.
mpirun -n 2 --host a,b uptimeRun a non-MPI commandmpirun also starts ordinary programs; here the Unix uptime command runs on hosts a and b.
-npOlder spelling of -nSets how many copies to run; the manual accepts -np, --n and -c but prefers -n.
--helpShow usage and option summaryOpen MPI's launch guide treats this output as the definitive list of options.
-VPrint the versionPrints the Open MPI version and exits; --version is the long form.
--verboseVerbose launcher outputShort form -v; turns on additional messages from mpirun itself.
--show-progressReport launch progressPrints a short status at intervals while daemons and processes start, mainly useful on large systems.
--allow-run-as-rootAllow rootPermit mpirun to launch as the root user; discouraged outside containers.
OMPI_ALLOW_RUN_AS_ROOT=1Allow root from the environmentOnly takes effect when the companion CONFIRM variable is set as well.
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1Confirm running as rootSecond variable of the pair that replaces --allow-run-as-root, added for container setups where root is the default user.

Hosts and slots 19

CommandWhat it does
--hostfile FILENAMEHost fileNames a file with one node per line and an optional slots=N count.
--machinefile FILENAMEHostfile under its other nameAccepted for compatibility with other MPI implementations; behaves exactly like --hostfile.
--default-hostfile FILENAMESet a default hostfileLowest-priority host list: --hostfile and then --host filter the nodes it names.
mpirun --hostfile my-hostfile.txt mpi-hello-worldLaunch across a hostfileWith no -n, one process starts per slot: 44 in the example, where two nodes default to their 16 cores.
node3.example.com slots=2Hostfile line with a slot countslots is the most processes Open MPI will place on that node; left out, the node's core count is used.
aa slots=4 max_slots=4Hostfile line with a hard limitmax_slots stops this job from oversubscribing the node even when -n asks for more processes.
-H host1,host2Host listComma-delimited list of hosts to launch processes on directly.
--host node01:5,node02Hosts with slot countsA :N suffix sets the slots for that entry; without it the node gets one slot.
mpirun --host a,b:2,c:3 hostnameStart a set number per hostLaunches one copy on a, two on b and three on c.
mpirun -H aa,aa,bb ./a.outRepeat a host for more slotsNaming aa twice puts two processes there and one on bb.
mpirun --hostfile myhostfile --host aa ./a.outFilter a hostfile by hostOnly nodes named by --host are used; naming a host that is not in the file makes mpirun abort.
mpirun --hostfile myhostfile -n 6 ./a.outUse only part of the slotsWith three 4-slot nodes, ranks 0-3 land on aa and 4-5 on bb; cc is left unused.
mpirun -n 1 --hostfile hostfile_1 hostname : -n 1 --hostfile hostfile_2 uptimeSeparate hostfile per programEach application context of a colon-separated command line can name its own hostfile.
mpirun -n 4 --hostfile my-hostfile --map-by :OVERSUBSCRIBE a.outRun more processes than slotsFour processes on a host declared with two slots fail unless this qualifier is added.
--oversubscribeAllow oversubscriptionAllow launching more processes than available CPU slots.
--nooversubscribeForbid oversubscriptionThe default behaviour: mpirun stops with an error before starting anything if the request exceeds the slots.
--nolocalKeep processes off the launch nodeAlias for --map-by :nolocal; it wins even when the local host is listed with --host.
--use-hwthread-cpusCount hardware threads as CPUsChanges the default slot count of a node and makes a processing element a hardware thread, not a core.
--hetero-nodesAssume differing node topologiesTells the launcher not to assume that every allocated node has the same hardware layout.

Mapping processes 24

CommandWhat it does
--map-by VALUESet the mapping policyDirectives include slot, hwthread, core, numa, package, node, seq, ppr, rankfile and pe-list, each with optional colon-separated qualifiers.
--map-by nodeMap round-robin by nodeDistribute processes round-robin across nodes instead of filling one node first.
--map-by slotFill each node in turnA node's slots are used up before the next node gets a process, so neighbouring ranks share a node.
--map-by coreMap one process per coreSame as setting the PRRTE parameter rmaps_default_mapping_policy to core.
--map-by packageMap round-robin by packageHands processes to processor packages in turn; socket is accepted as an alias for package.
--map-by numaMap round-robin by NUMA regionPlaces one process per NUMA region in turn until the node's slots are used.
mpirun --np 4 --map-by hwthread --host hostA:4,hostB:2 ./a.outMap to hardware threadsWith only --map-by given, binding follows the same object: each rank is pinned to one hardware thread.
--map-by ppr:N:OBJProcesses per resourceGeneral form: N processes on every object of the named type, such as node or package.
mpirun -H aa,bb --map-by ppr:2:package ./a.outTwo processes per packageIn the manual's example ranks 0-3 start on aa and ranks 4-7 on bb.
mpirun -H aa,bb --map-by ppr:2:node ./a.outTwo processes per nodeRanks 0 and 1 start on aa, ranks 2 and 3 on bb.
mpirun -H aa,bb --map-by ppr:1:node ./a.outOne process per nodeGives the same layout as the deprecated --pernode and --npernode 1 options.
-N NUMProcesses per nodeShort form of --npernode, which the manual marks as deprecated in favour of --map-by ppr:n:node.
mpirun --np 4 --report-bindings --map-by slot:PE=2 --bind-to coreTwo cores per processThe PE=2 qualifier gives each rank two processing elements, and the rank is bound to both cores.
mpirun --np 4 --report-bindings --map-by slot:PE=2 --use-hwthread-cpusTwo hardware threads per processHere a processing element is a hardware thread, so each rank is bound to two of them.
--map-by pe-list=0,2,5Map to listed coresAll three processes get the same binding: the logical cores named in the list.
--map-by pe-list=0,2,5:orderedOne listed core per processProcesses take the listed CPUs in order: 0 for the first one on each node, then 2, then 5.
mpirun -hostfile myhostfile --map-by seq ./a.outMap in hostfile orderSequential mapper: one process per hostfile line in file order, whatever the slot counts say.
mpirun -H aa,bb,cc,dd --map-by rankfile:file=myrankfile ./a.outPlace ranks from a rankfileEach line of the file fixes one rank's host and the logical package and cores it is bound to.
rank 0=aa slot=1:0-2Rankfile linePuts rank 0 on node aa, bound to cores 0 to 2 of logical package 1.
rank 0=+n0 slot=1:0-2Rankfile line with a relative host+n0 is the first host of the list supplied by --host, a hostfile or the scheduler.
--map-by rankfile:file=myrankfile:hwtcpusRankfile slots as hardware threadsWithout this qualifier the locations in a rankfile are read as cores.
--rankfile FILENAMEName a rankfile directlyListed among the launch options; the manual's older option text prefers --map-by rankfile:file=FILE.
--runtime-options donotlaunchMap without launchingThe job is mapped but not started, a way to explore placement patterns before a real run.
--help placementExplain mapping, ranking and bindingPrints the launcher's own longer description of the three placement phases.

Binding and ranking 19

mpirun binds processes even when no binding option is given: to a core for one or two processes, to a package for more, and not at all on an oversubscribed node.

CommandWhat it does
--bind-to VALUESet the binding policyDirectives are none, hwthread, core, l1cache to l3cache, numa and package; qualifiers such as overload follow a colon.
--bind-to coreCPU bindingBind each process to a specific CPU core for consistent performance.
--bind-to packageBind to a whole packageA rank may then run on any core of the package it was mapped to.
--bind-to noneTurn binding offWhat the manual suggests for threaded applications that are not bound to several cores.
--bind-to l3cacheBind to an L3 cacheThe rank may use every processor sharing one L3 cache inside the package it was mapped to.
--bind-to hwthreadBind to one hardware threadNeeds hardware threads to count as CPUs, which --use-hwthread-cpus or the hwtcpus mapping qualifier arranges.
--bind-to numaBind to a NUMA regionThe rank may use all CPUs of the NUMA region it was mapped to.
--bind-to :overload-allowedAllow overlapping bindingsLets ranks share a processing unit; otherwise overlapping rankfile bindings are an error.
mpirun --np 4 --report-bindings --map-by core --bind-to coreBind ranks to successive coresThe report shows rank 0 on core 0, rank 1 on core 1, and so on inside package 0.
mpirun --np 4 --report-bindings --map-by package --bind-to packageMap and bind by packageRanks 0 and 1 get all cores of package 0, ranks 2 and 3 those of package 1.
mpirun --np 4 --report-bindings --map-by package --bind-to package --rank-by spanAlternate ranks across packagesWith span ranking, even ranks sit on package 0 and odd ranks on package 1.
mpirun --np 4 --report-bindings --bind-to noneCheck that ranks are unboundThe report then lists every rank as unbound instead of naming cores.
mpirun --np 4 --bind-to core --host hostA:4,hostB:2 ./a.outBind to cores, map by packageWith only --bind-to given, mapping stays by package: ranks 0-1 take cores of package 0, ranks 2-3 of package 1.
--rank-by VALUESet the ranking policyTakes slot, node, fill or span and has no qualifiers; it changes rank numbers, not process locations.
--rank-by fillRank densely per resourceNumbers every process on one package before moving to the next; marked as the default in the manual's table.
--rank-by spanRank across all resourcesHands out rank numbers round-robin over the packages of all nodes before a second pass.
--rank-by nodeRank round-robin by nodeConsecutive rank numbers alternate between the nodes.
--map-by core --bind-to core --rank-by spanDefault for one or two processesWhat mpirun applies when no placement option is given and the job has at most two processes.
--map-by package --bind-to package --rank-by fillDefault for three or more processesApplied when no placement option is given and the job is larger than two processes: everything by package.

Environment and working directory 17

CommandWhat it does
-x VARExport env variableExport an environment variable from the launching shell to every process.
-x foo=barExport a variable with a valueThe started processes see foo set to bar, whatever the launching shell holds.
-x foo*Export variables by prefixThe trailing asterisk matches every variable in the current environment whose name begins with foo.
mpirun -x DISPLAY -x OFILE=/tmp/outExport several variablesEach -x option carries one variable; the manual advises exporting existing variables instead of defining values here.
--set-envSet a variable for the jobTakes NAME=VALUE and overwrites any existing value, like -x with a value.
--unset-env VARRemove a variableA name ending in an asterisk, as in foo*, removes every variable with that prefix.
--prepend-envPrepend to a list variableWrite the separator in brackets after the name, as in LD_LIBRARY_PATH[:], followed by the value.
--append-envAppend to a list variableSame syntax as --prepend-env; the new value goes after the existing content of the variable.
--wdir DIRSet the working directorympirun aborts if a node cannot change to it; by default nodes try the directory mpirun was started in.
--set-cwd-to-session-dirRun in the session directoryEach started process begins in its own session directory instead of the launch directory.
--path PATHSearch path for executablesLooked in before the PATH environment variable when the program name has no directory part.
--preload-binaryCopy the executable to the nodesShort form -s; the binary is sent to each remote machine before processes start.
--preload-files LISTCopy data files to the nodesTakes a comma-separated list; the files appear in the working directory of the remote processes.
mpirun --prefix /opt/openmpi-VERSION -n 4 a.outPoint remote nodes at an installPrepends that installation's bin and lib directories to PATH and LD_LIBRARY_PATH; mostly needed for ssh launches.
/opt/openmpi-VERSION/bin/mpirun -n 4 a.outInvoke mpirun by absolute pathHas the same effect as passing --prefix with the directory the installation lives in.
--noprefixDisable automatic prefixStops mpirun from setting a prefix for remote daemons when it was built or invoked to do so.
--tmpdir DIRMove the session directorySets the root under which the launcher creates its session directory tree.

MCA parameters 18

--mca is meant for Open MPI's own parameters; for PRRTE and PMIx parameters the manual advises --prtemca and --pmixmca, because mpirun otherwise has to guess the project from the parameter name.

CommandWhat it does
--mca KEY VALUESet MCA parameterPass a Modular Component Architecture parameter to tune Open MPI's behavior.
mpirun --mca mpi_show_handle_leaks 1 -np 4 a.outSet a parameter on the command lineThe command line has the highest precedence, above environment variables, tuning files and configuration files.
mpirun --mca param "value with multiple words"Quote a multi-word valueQuotes make the shell pass the words as one value; in parameter files quotes would become part of the value.
export OMPI_MCA_mpi_show_handle_leaks=1Set a parameter in the environmentAny variable named OMPI_MCA_ followed by the parameter name is read; command-line values override it.
--prtemca KEY VALUESet a PRRTE runtime parameterFor launcher settings such as default mapping and binding; note the single r in the option name.
--pmixmca KEY VALUESet a PMIx parameterPMIx keeps its own parameter system, so its settings go through this option, not --mca.
--tune FILENAMELoad parameters from a fileAccepts one file or a comma-separated list of files.
mpirun -np 2 --tune foo.conf a.outApply a tuning fileValues from the file beat mca-params.conf but lose to the command line and the environment.
mpirun -np 2 --tune foo.conf,bar.conf a.outApply several tuning filesFile names are joined with commas in a single --tune option.
mpi_show_handle_leaks = 1Line of mca-params.confOne parameter per line in $HOME/.openmpi/mca-params.conf or the system-wide openmpi-mca-params.conf; # starts a comment.
mpirun --mca mpi_show_mca_params enviro hello_cShow parameters set by the userRank 0 prints every parameter that came from the environment or the command line, with its value.
mpirun --mca btl self,sm,usnicUse only the listed componentsA framework name used as a parameter takes an include list; components not named are ignored.
mpirun --mca btl ^tcp,uctExclude componentsThe caret applies to the whole list: tcp and uct are left out and every other BTL stays eligible.
export PRTE_MCA_rmaps_default_mapping_policy=coreDefault mapping from the environmentPRRTE settings take the PRTE_MCA_ prefix; this one replaces the 4.x variable OMPI_MCA_rmaps_base_bycore.
export PRTE_MCA_hwloc_default_binding_policy=packageDefault binding from the environmentTakes over from the 4.x bind-to-socket setting of the hwloc_base framework.
export PRTE_MCA_rmaps_default_mapping_policy=:oversubscribeOversubscribe by defaultA qualifier on its own is a valid value; this replaces OMPI_MCA_rmaps_base_oversubscribe from 4.x.
export PRTE_MCA_display=map-devel,bindDefault display optionsShows the detailed map and the bindings for every job started from this environment.
export PRTE_MCA_output=file=output.txtSend output to files by defaultEnvironment form of the output file setting; it replaces the 4.x parameter orte_output_filename.

Transports and networks 16

CommandWhat it does
mpirun -n 4 --mca btl tcp,sm,self prog1Pick TCP, shared memory and loopbackRuns four copies that exchange messages only through the tcp, sm and self byte transfer layers.
mpirun --mca pml ob1 --mca btl tcp,sm,selfForce the TCP transport stackLeaving out sm slows traffic between ranks on one host; leaving out self breaks sends to the same process.
mpirun --mca btl_tcp_if_include eth1,eth2Restrict TCP to interfacesOnly the named interfaces carry MPI traffic; an include list cannot be combined with an exclude list.
mpirun --mca btl_tcp_if_exclude lo,eth0Keep TCP off interfacesAn exclude list has to name loopback and other local-only devices itself.
mpirun --mca btl_tcp_if_include 192.168.1.0/24,10.10.0.0/16Restrict TCP to subnetsInclude and exclude lists also accept networks written in CIDR notation.
mpirun --mca btl ^tcpDisable the TCP BTLAll other BTLs stay eligible; the runtime still uses TCP for its own control messages.
mpirun --mca btl self,sm,tcp --mca btl_base_verbose 30 -n 2 -host NodeA,NodeB a.outTrace TCP connection attemptsThe verbose output lists each address and port the TCP BTL tries to connect to.
mpirun --mca pml ucx --mca osc ucxForce UCXSelects UCX for two-sided and one-sided MPI communication; on InfiniBand and RoCE devices it is already the default.
mpirun -x UCX_NET_DEVICES=mlx5_0:1Choose the UCX network devicePins UCX to port 1 of device mlx5_0; by default it takes the port with the highest bandwidth.
mpirun --mca pml ucx -x UCX_NET_DEVICES=mlx5_0:1 -x UCX_IB_GID_INDEX=1Set the RoCE GID indexUCX picks IPv4 RoCEv2 by default; the second variable selects a different GID.
mpirun --mca pml ucx -x UCX_IB_SL=NSet the InfiniBand service levelN is a value from 0 to 15; 0 is the default.
mpirun --mca pml ucx --mca osc ucx --mca scoll ucx --mca atomic ucxForce UCX for OpenSHMEM tooThe scoll and atomic settings route OpenSHMEM memory access and atomics through UCX as well.
mpirun --mca pml cm --mca mtl ofi --mca mtl_ofi_provider_include psm2 mpi_helloUse Libfabric with one providerSelects the OFI matching transport layer and limits it to the psm2 provider.
--prtemca ras_base_launch_orted_on_hn 1Launch a daemon on the head nodeRecommended with the HPE CXI provider so processes on the first node of an allocation can use it.
--display-commShow transports between ranksPrints which communication method each pair of ranks uses, at the start of the run.
--display-comm-finalizeShow transports at shutdownSame table, printed when the program reaches MPI_Finalize.

GPU-aware communication 11

CommandWhat it does
ompi_info | grep "MPI extensions"Check for the CUDA extensioncuda appears in the list of MPI extensions when the build has CUDA support.
ompi_info --parsable --all | grep mpi_built_with_cuda_support:valueConfirm the CUDA build flagThe matching line ends in true on a build with CUDA support.
ucx_info -vCheck how UCX was configuredCUDA through UCX is the preferred route, so UCX itself must have been built with CUDA.
mpirun -n 2 --mca pml ucx -x UCX_TLS=rc,sm,cuda_copy,gdr_copy,cuda_ipc ./osu_latency D DGPU-to-GPU latency benchmarkRuns the OSU latency test with CUDA buffers on both sides over UCX with its CUDA transports enabled.
mpirun --mca opal_cuda_verbose 10Basic CUDA debug outputThis parameter has a single verbosity level.
mpirun --mca mpi_common_cuda_verbose 100Most detailed CUDA tracingValues 10, 20 and 100 give progressively more information about CUDA-aware activity.
mpirun --mca btl_smcuda_use_cuda_ipc 0Turn CUDA IPC offBy default the smcuda BTL uses CUDA IPC wherever it can; 0 switches that off.
mpirun --mca btl_smcuda_cuda_ipc_verbose 100Report whether CUDA IPC is usedShows for each pair of GPUs whether CUDA IPC was enabled.
mpirun -x PSM2_CUDA=1 -x PSM2_GPUDIRECT=1 --mca mtl psm2 mpi_helloCUDA over Omni-Path PSM2Both PSM2 variables must be in the environment before MPI_Init is called.
mpirun -x HCOLL_GPU_ENABLE=1 -x HCOLL_ENABLE_NBC=1GPU buffers in HCOLL collectivesEnables CUDA buffer support in the HCOLL versions of collectives such as MPI_Allreduce and MPI_Bcast.
--gpu-support VALToggle library GPU supporttrue or false tells the application's MPI library to switch its internal GPU support on or off.

Output and display 17

CommandWhat it does
--output LISTControl how output is printedValues include tag, timestamp, xml, merge-stderr-to-stdout, dir= and file=; nocopy and raw are qualifiers.
--output tagLabel lines with job and rankEach line is prefixed with [job,rank] and the stream it came from.
--output timestampTimestamp every output lineThe stamp is the time the launcher printed the line, not when the process wrote it.
--output mergeMerge stderr into stdoutApplies to each process; replaces the older --merge-stderr-to-stdout option.
--output file=FILENAMEWrite output to per-rank filesCreates one file per process, named with the rank as suffix; the name is made an absolute path.
--output dir=DIRNAMEWrite output to a directory treeOutput lands in DIRNAME/job/rank/ as separate stdout, stderr and stddiag files.
--display VALUEReport allocation, map or bindingsTakes a comma-separated list; values can be shortened as long as they stay unambiguous.
--display mapShow process mapPrint the mapped location of every process before launch, useful for debugging placement.
--display bindingsShow where each rank is boundCurrent spelling of --report-bindings; the report is written to stderr.
--display allocShow the detected allocationLists the hosts and slot counts the launcher found for the job.
--display map-develShow the detailed process mapAdds local and node ranks and the assigned bindings to the map.
--display topoShow node topologyPrints the hardware topology along with the process map when the job starts.
--stream-buffering VALUESet stdout and stderr buffering0 means unbuffered, 1 line buffered and 2 fully buffered.
--stdin LISTChoose which ranks read stdinTakes ranks, all or none; by default only rank 0 receives standard input.
mpirun -n 2 my_app < my_input > my_outputRedirect input and outputOnly rank 0 reads the input file, while standard output of all processes goes to the output file.
--report-pid VALUEPrint the launcher's PIDA minus sign sends it to stdout, a plus sign to stderr; anything else is a file name.
--report-uri VALUEPrint the launcher's contact URISame channel choices as --report-pid, applied to the contact URI of the running mpirun.

Debugging and launch checks 19

CommandWhat it does
mpirun -n 4 xterm -e gdb my_mpi_applicationOne gdb window per rankLikely to work on a personal computer; on a cluster the X display has to reach the nodes first.
mpirun -n 4 --hostfile my_hostfile -x DISPLAY=arcade.example.com:0 xterm -e gdb my_mpi_applicationDebugger windows from remote nodesExporting DISPLAY makes the xterm windows opened on the nodes appear on your own screen.
--xterm LISTShow ranks in xterm windowsOpens a separate window for the output of each listed rank.
--stop-on-exec VALUEStop processes at execHalts the named processes before they run any code so a debugger can attach, where supported.
--stop-in-init VALUEStop processes in MPI start-upThe named processes pause inside MPI initialization, a point where a debugger can attach.
mpirun -n 2 valgrind --suppressions=$PREFIX/share/openmpi/openmpi-valgrind.suppValgrind with Open MPI suppressionsThe suppression file shipped with Open MPI hides known false positives raised inside the library.
--debug-daemonsDebug the launch daemonsGives a limited stream of daemon output, normally just enough to confirm that the daemons started.
--debug-daemons-fileLog daemon debug output to filesEach daemon writes to a file named output-prted- plus its namespace and node name, in the session directory.
--leave-session-attachedKeep daemon error outputWithout it the daemons detach after launch and close the streams that carry their error messages.
mpirun --mca plm_base_verbose 10 --host remotehost hostnameTrace the remote launchLevel 10 prints extra detail on how Open MPI starts its daemons on the remote hosts.
mpirun --mca opal_base_help_aggregate 0Show every copy of an errorStops identical help messages from many processes being merged into one, which can hide the real error.
mpi_abort_delayWait before abortingSet with --mca: MPI_Abort prints host and PID, then waits that many seconds so a debugger can attach.
mpi_abort_print_stackStack trace on MPI_AbortA nonzero value makes an aborting program print its call stack, on systems that support it.
mpi_param_checkCheck MPI call argumentsWhen true, bad arguments such as NULL handles raise an MPI error at run time; false skips the checks.
mpirun --host remotehost,otherhost hostnameTest launching across hostsFirst check of an installation: a non-MPI program must start on every listed node.
mpirun --host remotehost,otherhost hello_cTest MPI start-uphello_c from the examples directory initializes and finalizes MPI without sending messages.
mpirun --host remotehost,otherhost ring_cTest message passingring_c passes a message around the processes, which proves MPI traffic crosses the network.
ssh remotehost env | grep -i pathInspect the remote environmentShows the PATH and LD_LIBRARY_PATH that a non-interactive ssh login gets on that host.
ssh remotenode which ompi_infoCheck which install a node findsMust print the ompi_info of the intended installation, otherwise the remote PATH is wrong.

Timeouts and failure handling 13

CommandWhat it does
--timeout SECONDSAbort after a time limitmpirun kills the job and exits with the ETIMEDOUT status, typically 110 on Linux.
MPIEXEC_TIMEOUTTime limit from the environmentEnvironment variable with the same meaning as the --timeout option.
--get-stack-tracesStack traces on timeoutCombined with --timeout, prints a trace of every process still running when time runs out.
--report-state-on-timeoutProcess states on timeoutPrints what the runtime knows about the job and each process when the limit is hit.
--spawn-timeout SECONDSTime limit for start-upEnds the job when launching it takes longer than the given number of seconds.
--runtime-options LISTPass runtime optionsComma-separated NAME=VALUE settings such as timeout, max-restarts or autorestart; a boolean given without a value is true.
--prtemca state_base_error_non_zero_exit falseKeep running after a non-zero exitWithout it, one process ending with a non-zero status makes mpirun abort the whole job.
--report-child-jobs-separatelyIgnore child jobs in exit statusNon-zero exits of jobs spawned by the application then appear only in a summary message.
--forward-signals LISTForward extra signalsSIGTSTP, SIGUSR1, SIGUSR2, SIGABRT, SIGALRM and SIGCONT are forwarded already; none forwards nothing.
--enable-recoveryEnable recovery from failuresOff by default, and only present when Open MPI and PRRTE were built with fault tolerance.
--max-restartsLimit restarts of a failed processTakes the highest count of restarts allowed for any one process.
--continuousKeep the job runningFailed processes are restarted automatically up to the restart limit, and the job ends only when it is terminated.
mpirun -n 4 --with-ft ulfm my-ft-programRun with ULFM fault toleranceFault tolerance stays inactive at run time unless this option is given; mpi is a synonym for ulfm.

Launching under schedulers 13

CommandWhat it does
mpirun mpi-hello-worldFill a scheduler allocationInside a Slurm, PBS or LSF job mpirun gets the process count and hosts from the scheduler.
salloc -n 4Allocate four Slurm slotsInteractive allocation; a plain mpirun inside it then starts four processes.
sbatch -n 4 my_script.shSubmit a script that calls mpirunThe script needs no -n or host options because mpirun reads them from Slurm at run time.
srun --mpi=listList Slurm's MPI pluginspmix must appear in the list before srun can launch Open MPI programs directly.
srun -N 4 --mpi=pmix mpi-hello-worldDirect launch with srunStarts the program without mpirun through Slurm's PMIx plugin; PMI-2 is no longer supported in 5.0.
bsub -n 8 -R "span[ptile=2]" "mpirun mpi-hello-world"Submit an LSF jobRequests four nodes with two processors each; mpirun takes hosts and counts from LSF.
prte_info | grep lsfCheck for LSF supportScheduler support lives in PRRTE, so prte_info, not ompi_info, shows it.
qsub -I -lnodes=4Interactive PBS jobAllocates four nodes; mpirun started inside it uses all of them.
qsub -l nodes=4 my_script.shSubmit a PBS scriptThe script simply calls mpirun; Open MPI warns against editing $PBS_NODEFILE.
prte_info | grep rasCheck for PBS or Torque supportA line naming the tm component means the build can read PBS allocations.
qrsh -V -pe ompi 4 mpirun hostnameGrid Engine job in one lineRequests four slots from the parallel environment named ompi and runs mpirun in them.
qsub -pe ompi 4 my_mpirun_job.cshSubmit a Grid Engine batch jobThe mpirun command sits inside the submitted script.
prte_info | grep gridengineCheck for Grid Engine supportSupport has to be requested with --with-sge when Open MPI is configured.

Inspecting the installation 20

CommandWhat it does
ompi_infoSummarise the installationPrints version, build options and the list of installed components in readable form.
ompi_info --allShow everythingLists all components and their MCA parameters at every level, 1 through 9.
ompi_info --parsableMachine-readable outputSame information in a colon-separated form meant for scripts.
ompi_info --param btl tcpParameters of one componentShows only level 1 parameters of the tcp BTL unless a level is added.
ompi_info --param btl tcp --level 6Parameters up to a levelLevels 1 to 6 cover end-user and application-tuner parameters.
ompi_info --param FRAMEWORK COMPONENT --level 9All parameters of a componentLevel 9 is the maximum; without --level only parameters that decide whether jobs run are shown.
ompi_info --param all allParameters of every componentall is accepted for the framework and for the component; add --level 9 to see more than level 1.
ompi_info --type string --pretty-print --level 3Parameters of one data typeLists the string-valued parameters of levels 1 to 3.
ompi_info --path bindirShow an installation pathOther accepted names are prefix, libdir, incdir, pkglibdir and sysconfdir.
ompi_info --versionShow Open MPI version numbersPrints the release numbers in pretty-print format; -V is the short form.
ompi_info --configShow configuration optionsShort form -c; reports how this build of Open MPI was configured.
ompi_info --level LEVELRaise the parameter levelParameters of levels 1 through LEVEL are shown; the default is 1, or 9 together with --all.
--selected-onlyOnly selected componentsompi_info option: limits the variables shown to components that are actually selected.
--internalInclude internal parametersompi_info option: also lists parameters that users are not meant to change.
ompi_info --param btl tcp --level 9All TCP BTL parametersLists every tuning parameter of the component that carries MPI traffic over TCP.
ompi_info --param pml ucx --level 9All UCX PML parametersThe UCX PML is tuned mainly through UCX environment variables, not through these MCA parameters.
ompi_info --param mtl ofi --level 9All OFI MTL parametersIncludes the settings that include or exclude Libfabric providers.
ompi_info --param mpi all --level 9MPI-layer parametersLists the debugging parameters of the MPI layer, such as mpi_show_handle_leaks.
ompi_info | grep smscList single-copy mechanismsShows which shared-memory single-copy components, such as cma, the build contains.
prte_infoList PRRTE parametersCounterpart of ompi_info for the PRRTE runtime; pmix_info does the same for PMIx.

Compiling with wrappers 21

CommandWhat it does
mpicc hello_world_mpi.c -o hello_world_mpi -gCompile a C MPI programThe wrapper adds Open MPI's compiler and linker flags and then calls the underlying C compiler.
mpicxxC++ wrapper compilermpic++ and, where file names are case-sensitive, mpiCC call the same compiler with the same options.
mpifortFortran wrapper compilerHandles mpif.h, the mpi module and the mpi_f08 module; mpif77 and mpif90 are deprecated aliases.
mpicc --showmeShow the full compiler commandPrints what would be run without running it.
mpicc --showme:compileShow the compile flagsPrints only the flags the wrapper would pass when compiling.
mpicc --showme:linkShow the link flagsPrints only the linker flags and libraries the wrapper would add.
--showme:commandShow the underlying compilerWrapper option: prints the back-end compiler command, which may be more than one word.
--showme:incdirsList header directoriesWrapper option: prints the include directories as a plain space-separated list.
--showme:libdirsList library directoriesWrapper option: prints the directories given to the linker as a plain space-separated list.
--showme:libsList linked librariesWrapper option: prints the library names used to link an application.
--showme:versionShow the wrapper's Open MPI versionWrapper option: prints the release number of the installation the wrapper belongs to.
cc -c file1.c `mpicc --showme:compile`Compile without the wrapperCommand substitution inserts the wrapper's compile flags into a plain compiler call.
cc file1.o file2.o `mpicc --showme:link` -o my_mpi_programLink without the wrapperSame technique for the link step, using the wrapper's linker flags.
pkg-config ompi-c --cflags --libsGet flags from pkg-configompi-c is the C package; ompi-cxx and ompi-fort exist for the other languages.
export PKG_CONFIG_PATH=/opt/openmpi/lib/pkgconfigLet pkg-config find Open MPIThe .pc files are installed in the pkgconfig directory under the library directory.
MPI_COMPILE_FLAGS = $(shell mpicc --showme:compile)Query flags from a MakefileOpen MPI advises querying the wrapper at build time instead of hard-coding its output.
OMPI_CCOverride the C compilerEnvironment variable read by mpicc at run time in place of the compiler chosen at configure time.
OMPI_CFLAGSReplace the C compiler flagsRead by mpicc; OMPI_CPPFLAGS, OMPI_LDFLAGS and OMPI_LIBS replace the other flag groups.
OMPI_CXXOverride the C++ compilerRead by mpic++ and mpiCC; Open MPI cautions that a different compiler may be binary incompatible.
OMPI_FCOverride the Fortran compilerRead by mpifort in place of the Fortran compiler selected when Open MPI was configured.
ompi_info --all | grep -i wrapperShow extra flags the wrappers addLeaves out the -I and -L flags for Open MPI's own headers and libraries.

Variables set in each process 6

CommandWhat it does
OMPI_COMM_WORLD_SIZENumber of processes in the jobHolds the size of the MPI_COMM_WORLD the process belongs to.
OMPI_COMM_WORLD_RANKRank of this processIts rank in MPI_COMM_WORLD, available to the program as an ordinary environment variable.
OMPI_COMM_WORLD_LOCAL_SIZERanks of the job on this nodeCounts only processes of the same job that share the node.
OMPI_COMM_WORLD_LOCAL_RANKRank within the nodeFour processes of one job sharing a node get local ranks 0 to 3.
OMPI_COMM_WORLD_NODE_RANKRank on the node across all jobsUnlike the local rank, this numbering counts processes of every job on the node.
OMPI_UNIVERSE_SIZESlots allocated to the jobMay differ from the count of processes that were actually started.

Deprecated options 21

Deprecated options are still listed in the 5.0 manual, which says they should generally not be used and may be removed in a future release.

CommandWhat it does
--report-bindingsOld form of --display bindingsStill used throughout the manual's own examples, but listed as deprecated.
--display-mapOld form of --display mapPrinted the process layout ahead of the launch.
--display-allocationOld form of --display allocShowed which hosts and slots the job had been given.
--display-devel-mapOld form of --display map-develDeveloper-oriented, more detailed variant of the process map.
--display-topoOld form of --display topoPrinted the node topology together with the process map.
--tag-outputOld way to tag output linesPrefixed all output with [job,rank]; the manual now points to --output.
--timestamp-outputOld form of --output timestampStamped every line of application output with the time.
--merge-stderr-to-stdoutOld form of --output mergeFolded the error stream of each process into its standard output.
--output-filenameOld form of --output file=Redirected the output of each process to a file named filename.rank.
--output-directoryOld form of --output dir=Accepted NOJOBID and NOCOPY directives after a colon.
--xmlOld way to get XML outputThe manual now points to --output, whose xml value gives pseudo-XML formatting.
--bind-to-coreOld form of --bind-to coreGave every process a core of its own.
--gmca KEY VALUEGlobal generic MCA parameterApplied to all application contexts; the manual recommends the project-specific --gprtemca or --gpmixmca.
--npernodeOld per-node count optionUse the ppr:n:node mapping directive instead; it launched n processes on every node.
--pernodeOld one-per-node optionUse the ppr:1:node mapping directive instead.
--npersocketOld per-socket count optionUse the ppr:n:package mapping directive instead; it also switched on binding to sockets.
--bynodeOld form of --map-by nodeSpread processes over the nodes in turn and ranked them by node as well.
--bycoreOld form of --map-by core
--byslotOld form of --map-by slotMapped and ranked processes by slot with a single option.
--bind-to-socketOld form of --bind-to packageSocket is the older word for package, which mapping options still accept as an alias.
--cpus-per-procOld form of the PE=n qualifierBound each process to a number of CPUs; --cpus-per-rank was an alias.

The maintainers mark the hand-written half of the mpirun manual page as older content still to be audited; rows taken from it, such as -N, --nolocal and the rankfile lines, can lag behind the generated option list.

Notes

Where processes run

mpirun -n 6 mpi-hello-world starts six ranks on the local machine; without -n it starts one per processor core, or one per slot of the hosts it was given. --hostfile FILENAME names the hosts (with an optional slots= count per line) and -H host1,host2 lists them inline, where a :N suffix as in --host node01:5,node02 sets the slots. Asking for more ranks than slots is an error unless --oversubscribe is given. Inside a Slurm, PBS, LSF or Grid Engine job none of this is needed: mpirun mpi-hello-world reads the allocation from the scheduler. Slurm can also launch directly with srun -N 4 --mpi=pmix mpi-hello-world, but the Open MPI team recommends mpirun there.

Mapping and binding

Open MPI places processes in three steps: mapping assigns each one a location, ranking gives it its number in MPI_COMM_WORLD, and binding restricts it to particular processors. --map-by node deals ranks out round-robin across nodes instead of filling one node first; --map-by ppr:N:OBJ puts N processes on every node, package or other object, and a PE=n qualifier gives each rank n cores for threaded codes. Binding happens even when you ask for nothing: to a core for one or two processes, to a package for more, and not at all on an oversubscribed node. --bind-to core pins each rank to one core, which keeps the operating system from migrating it, and --bind-to none switches binding off. --display map and --display bindings print the resulting layout; they replace --display-map and --report-bindings, which the 5.0 manual lists as deprecated.

Environment and MCA

-x VAR exports an environment variable to every rank and -x foo=bar sets one, which is how UCX settings such as UCX_NET_DEVICES reach remote hosts. --mca KEY VALUE sets an Open MPI parameter: mpirun --mca btl_tcp_if_include eth1,eth2 chooses the TCP interfaces and mpirun --mca pml ucx --mca osc ucx forces UCX. The same parameter can come from an OMPI_MCA_ environment variable or from mca-params.conf, with the command line winning. Parameters of the launcher itself belong to PRRTE and are passed with --prtemca KEY VALUE. ompi_info --param FRAMEWORK COMPONENT --level 9 lists every parameter of a component; without --level only the first of nine levels is shown. --allow-run-as-root, or the two OMPI_ALLOW_RUN_AS_ROOT variables, lets mpirun run as root, which Open MPI strongly discourages outside cases such as containers.

Transports and GPU support

Open MPI normally chooses the transport itself: UCX on InfiniBand and RoCE devices when the build includes it, otherwise TCP together with shared memory. --display-comm prints which communication method each pair of ranks ended up with. For GPU buffers the preferred route is UCX built with CUDA: ucx_info -v shows how UCX was configured, and ompi_info --parsable --all | grep mpi_built_with_cuda_support:value tells whether Open MPI itself was built with CUDA support.

Questions

What is the difference between mpirun and mpiexec in Open MPI?

None. Both names are symbolic links to the same launcher, so mpiexec -n 2 mpi-hello-world behaves exactly like the mpirun form.

How do I run more MPI processes than cores with Open MPI?

Add --oversubscribe, an alias for the :oversubscribe qualifier of --map-by. Without it mpirun refuses to start more processes than the slots it knows about. Processes are not bound on an oversubscribed node.

Do I need a hostfile when running mpirun under Slurm?

No. Inside an salloc or sbatch allocation mpirun mpi-hello-world takes the hosts and the process count from Slurm. Direct launch with srun -N 4 --mpi=pmix mpi-hello-world also works when Slurm has the PMIx plugin, but Open MPI recommends mpirun; PMI-2 is not supported from 5.0 on.

What replaced --report-bindings and --display-map in Open MPI 5?

--display bindings and --display map. The 5.0 manual lists the old spellings, along with --tag-output, --timestamp-output and --output-filename, as deprecated in favour of --display VALUE and --output LIST.

How do I see which MCA parameters a component has?

ompi_info --param btl tcp --level 9 lists all parameters of the tcp BTL; put another framework and component in place of btl and tcp. Without --level only level 1 parameters appear. To see what a job actually received, set mpi_show_mca_params, as in mpirun --mca mpi_show_mca_params enviro hello_c.

How can I run mpirun as root inside a container?

Pass --allow-run-as-root, or set both OMPI_ALLOW_RUN_AS_ROOT=1 and OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1 in the environment. mpirun refuses to run as root by default, and the Open MPI team strongly advises against it wherever it can be avoided.

Sources and checks

25 more source pages

Every row on this page was matched to a line in the documentation above on . A binding that could not be found there is not listed.

Found a wrong or missing key? Tell us and it gets checked against the source. How we verify describes the process and its limits.