I implemented a peer-to-peer connection in MPI using MPI_Open_port
and MPI_Comm_accept
. I run a server and a client program using
rafael@server1:~$ mpirun server
rafael@server2:~$ mpirun client
on different computers. I noticed that
rafael@server1:~$ ./server
rafael@server2:~$ ./client
also works just fine. Do you know if there is any difference between starting an MPI executable with and without mpirun
?
Of course, I can't give additional parameters (e.g. mpirun --mca btl self,openib
), and the rank of all processes is 0, which is all totally fine. But is there anything less obvious?
"mpirun" is a shell script that attempts to hide the differences in starting jobs for various devices from the user. Mpirun attempts to determine what kind of machine it is running on and start the required number of jobs on that machine.
Mpiexec is a replacement program for the script mpirun, which is part of the mpich package. It is used to initialize a parallel job from within a PBS batch or interactive environment. Mpiexec uses the task manager library of PBS to spawn copies of the executable on the nodes in a PBS allocation.
Running without mpirun
/mpiexec
is called "singleton MPI_INIT
" and is part of the MPI recommendations for high quality implementations, found under §10.5.2 in the latest MPI standard document:
A high-quality implementation will allow any process (including those not started with a "parallel application" mechanism) to become an MPI process by calling
MPI_INIT
. Such a process can then connect to other MPI processes using theMPI_COMM_ACCEPT
andMPI_COMM_CONNECT
routines, or spawn other MPI processes. MPI does not mandate this behavior, but strongly encourages it where technically feasible.If a process enters
MPI_INIT
and determines that no special steps were taken (i.e., it has not been given the information to form anMPI_COMM_WORLD
with other processes) it succeeds and forms a singleton MPI program, that is, one in whichMPI_COMM_WORLD
has size 1.
Using mpirun
in your case is the "parallel application" mechanism, mentioned in the standard text. It provides MPI_INIT
with the information necessary to establish MPI_COMM_WORLD
over all started processes. Without the information from mpirun
processes can only run as singleton MPI instances and hence all of them have rank 0
(which is OK, since each MPI_COMM_WORLD
is a separate one).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With