mpirun
Run parallel applications using MPI
SYNOPSIS
mpirun [options]
PARAMETERS
-np
Specifies the number of processes to launch. This is a fundamental parameter for controlling the level of parallelism.
-host
Specifies the hosts on which to run the processes. Allows for targeted distribution of the application.
-hostfile
Specifies a file containing a list of hosts on which to run the processes, with optional slot counts for each host.
-map-by
Controls how processes are mapped to nodes/cores. Keywords include node, socket, core, etc.
-mca
Allows setting various MPI parameters (MCA = Modular Component Architecture). Can be used to configure network settings, debugging options, and more.
-wdir
Sets the working directory for the launched processes.
-x
Export the specified environment variable to the processes.
DESCRIPTION
The mpirun command is a crucial tool for launching and managing parallel applications developed using the Message Passing Interface (MPI). It enables you to distribute and execute the application across multiple processes, often running on different nodes in a cluster or on multiple cores of a single machine. mpirun handles process startup, communication setup, and overall management of the parallel job. It's the primary interface for users to interact with MPI-based programs, allowing them to specify the number of processes, the hosts on which they should run, and other execution-related parameters.
mpirun relies on an underlying MPI implementation like Open MPI or MPICH. The specific options and behavior might slightly vary depending on the implementation used, so consulting the documentation for your particular MPI distribution is always recommended. With mpirun, users can easily transition from sequential code to parallel implementations, unlocking significant performance gains for computationally intensive tasks.
CAVEATS
The exact options and their behavior may vary slightly depending on the specific MPI implementation (e.g., Open MPI, MPICH) being used. Always refer to the documentation for your particular MPI distribution for the most accurate information. Proper network configuration and firewall settings are crucial for mpirun to function correctly across multiple nodes.
RETURN CODES
mpirun returns 0 on success, and a non-zero value on failure. The specific non-zero value may provide information about the nature of the error (e.g., failed process startup, communication problems). Refer to the MPI documentation for detailed error codes.
STANDARD INPUT/OUTPUT
By default, the standard input, output, and error streams of all processes are merged and directed to the standard input, output, and error streams of the mpirun command itself. Options like `-stdin`, `-stdout`, and `-stderr` can be used to redirect these streams to files or other destinations.
HISTORY
The mpirun command emerged with the rise of parallel computing and the standardization of the Message Passing Interface (MPI). MPI provided a portable way to write parallel programs that could be run on a variety of platforms. mpirun served as the primary launcher, abstracting away the details of process creation and communication setup. Over time, various MPI implementations, such as MPICH and Open MPI, have refined and extended the capabilities of mpirun, adding features for resource management, fault tolerance, and performance optimization.
SEE ALSO
mpi(7), mpiexec(1)