Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the advantage (if any) of MPI + threads parallelization vs. MPI-only?

Given a cluster of several nodes, each of which hosts multiple-core processor, is there any advantage of using MPI between nodes and OpenMP/pthreads within nodes over using pure all-MPI? If I understand correctly, if I run an MPI-program on a single node and indicate the number of processes equal to the number of cores, then I will have an honest parallel MPI-job of several processes running on separate cores. So why bother about hybrid parallelization using threads within nodes and MPI only between nodes? I have no question in case of MPI+CUDA hybrid, as MPI cannot employ GPUs, but it can employ CPU cores, so why use threads?

like image 288
Maximko Avatar asked Dec 31 '16 19:12

Maximko


People also ask

What is MPI thread?

MPI and Threads. • MPI describes parallelism between processes. (with separate address spaces) • Thread parallelism provides a shared-memory. model within a process.

Does MPI use threads?

The process may be multi-threaded, but only the main thread will make MPI calls (all MPI calls are funneled to the main thread).

What is the advantage of single threaded architecture?

The obvious advantage of the single- threaded approach is that it minimizes the execution times of individual applications (especially preexisting or legacy applica- tions)—but potentially at the cost of longer design and verification times and lower power efficiency.

Why is multithreading faster than multiprocessing?

Multiprocessing is used to create a more reliable system, whereas multithreading is used to create threads that run parallel to each other. multithreading is quick to create and requires few resources, whereas multiprocessing requires a significant amount of time and specific resources to create.


1 Answers

Using a combination of OpenMP/pthread threads and MPI processes is known as Hybrid Programming. It is tougher to program than pure MPI but with the recent reduction in latencies with OpenMP, it makes a lot of sense to use Hybrid MPI. Some advantages are:

  1. Avoiding data replication: Since threads can share data within a node, if any data needs to be replicated between processes, we can avoid this.
  2. Light-weight : Threads are lightweight and thus you reduce the meta-data associated with processes.
  3. Reduction in number of messages : A single process within a node can communicate with other processes, reducing number of messages between nodes (and thus reducing pressure on the Network Interface Card). The number of messages involved in collective communication is notable.
  4. Faster communication : As pointed out by @user3528438 above, since threads communicate using shared memory, you can avoid using point-to-point MPI communication within a node. A recent approach (2012) recommends using RMA shared memory instead of threads within a node - this model is called MPI+MPI (search google scholar using MPI plus MPI).

But Hybrid MPI has its disadvantages as well but you asked only about the advantages.

like image 129
Gaurav Saxena Avatar answered Sep 24 '22 01:09

Gaurav Saxena