MPI: cores or processors?

February 22, 2014

situs favorit saat ini: !

stakoverflow ini situs yang sangat konstruktif, semua pertanyaan dan jawaban adalah menuju sebuah solusi. bukan untuk berdebat, beropini, apalagi ber-lovers_vs_haters, yang mana rajin sekali muncul di berbagai forum, termasuk fb (karena itu, deactive !).

lebih baik baca-baca di sini, adem.

berikut saya pastekan. krn memang terngiang-ngiang di benak.


Hi I am kind of MPI noob so please bear with me on this one.🙂

Say I have an MPI program called foo.c and I run the executable with

mpirun -np 3 ./foo

Now this means the program will be run in parallel using 3 processors (1 process per processor). But since most processors today have more than one core, (take 2 cores per processor say) does this mean the program will be run on 3 cores or 3 processors?

Probably this has to do with my poor understanding of what the difference between a core and a processor really is so if you could also explain a little more that would be helpful.

Thank you.


mpirun will execute a number of “processes” on the machine. The cpu or core where these processes are executed is operating-system dependent. On a N cpu machines with M cores on each cpu, you have room for N*M processes running at full speed.

But, typically:

  • If you have multiple cores, each process will run on a separate core
  • If you ask for more processes than the available core*cpus, everything will run, but with a lower efficiency (yes, you can run multi-process jobs on a single-cpu single-core machine…)
  • If you are using a queuing system or a pre configured MPI system for which a list of remote machines exists, the allocation will be distributed on the remote machines.

(Depending of the mpi implementation, there might be some options to force a specific cpu or core, but you should not need to worry about that)

The OS Scheduler will try to optimally allocate separate cores to your parallel application’s processes in a multi core system OR to separate processors in multi processor system.

The interesting case is a multi-core multi cpu system. Again you can let the OS Scheduler do it for you , OR you can enforce the ( logical/physical) core affinity to your processes to bind them to a particular core.

Distribution of processes to cores and processors is handled by the operating system and the MPI implementation. Running on a desktop, the operating system will generally put each process on a different core, potentially redistributing processes during run-time. In larger systems such a s a supercomputer or a cluster, the distribution is handled by resource managers such as SLURM. However this happens, one or multiple processes will be assigned to each core.

Regarding hardware, a core can run only a single process at a time. Technologies such as hyper-threading allows multiple processes to share the resources of a single core. There are cases where two or more processes per core is optimal. For instance, if a processes is doing a large amount of file I/O another may take its place and do computation while the first is hung on a read or write.

In short, give MPI the number of processes you want to execute. Distribution of these processes is then handled transparent to the user. The number of processes that you use should be determined by requirements of the application (powers of 2, number of files to be read), the number of cores available, and the optimal number of processes per core for the application.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: