Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mpirun without options runs a program on one process only

Here I read

If no value is provided for the number of copies to execute (i.e., neither the "-np" nor its synonyms are provided on the command line), Open MPI will automatically execute a copy of the program on each process slot (see below for description of a "process slot")

So I would expect

mpirun program

to run eight copies of the program (actually a simple hello world), since I have an Intel® Core™ i7-2630QM CPU @ 2.00GHz × 8, but it doesn't: it simply runs a single process.

like image 729
Enlico Avatar asked Mar 13 '23 19:03

Enlico


2 Answers

If you do not specify the number of processes to be used, mpirun tries to obtain them from the (specified or) default host file. From the corresponding section of the man page you linked:

If the hostfile does not provide slots information, a default of 1 is assumed.

Since you did not modify this file (I assume), mpirun will use one slot only.


On my machine, the default host file is located in

/etc/openmpi-x86_64/openmpi-default-hostfile
like image 162
Alexander Vogt Avatar answered Apr 06 '23 19:04

Alexander Vogt


i7-2630QM is a 4-core CPU with two hardware threads per core. With computationally intensive programs, you should better start four MPI processes instead of eight.

Simply use mpiexec -n 4 ... as you do not need a hostfile for starting processes on the same node where mpiexec is executed.

Hostfiles are used when launching MPI processes on remote nodes. If you really need to create one, the following should do it:

hostname slots=4 max_slots=8

(replace hostname with the host name of the machine)

Run the program as

mpiexec -hostfile name_of_hostfile ...

max_slots=8 allows you to oversubscribe the node with up to eight MPI processes if your MPI program can make use of the hyperthreading. You can also set the environment variable OMPI_MCA_orte_default_hostfile to the full path of the hostfile instead of explicitly passing it each and every time as a parameter to mpiexec.

If you happen to be using a distributed resource manager like Torque, LSF, SGE, etc., then, if properly compiled, Open MPI integrates with the environment and builds a host and slot list from the reservation automatically.

like image 44
Hristo Iliev Avatar answered Apr 06 '23 20:04

Hristo Iliev