Mpi Test Suite Multi Threaded


Published on

Published in: Education, Technology, Business
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Mpi Test Suite Multi Threaded

  1. 1. Presenter : Nageeb Yahya Alsurmi GS21565 Lecturer : Assoc. Prof. Dr Mohamed Othman Test Suite for Evaluating Performance of MPI Implementations That Support MPI_THREAD_MULTIPLE By: Rajeev Thakur and William Gropp Argonne National Laboratory, USA
  2. 2. <ul><li>Introduction </li></ul><ul><li>Literature Review </li></ul><ul><li>Problem Statement </li></ul><ul><li>Problem Objective </li></ul><ul><li>Methodology </li></ul><ul><ul><li>Test Suite </li></ul></ul><ul><ul><li>Experimental Result </li></ul></ul><ul><li>Conclusion </li></ul><ul><li>References </li></ul>Outline
  3. 3. <ul><li>With thread-safe MPI implementations becoming increasingly common. </li></ul><ul><li>an MPI process is a process that may be multithreaded . </li></ul><ul><li>Each thread can issue MPI calls. </li></ul><ul><li>threads are not separately addressable: a rank in a send or receive call identifies a process , not a thread. </li></ul><ul><li>A message sent to a process can be received by any thread in this process. </li></ul><ul><li>The user can make sure that two threads in the same process will not issue conflicting communication calls by using distinct communicators at each thread. </li></ul>
  4. 4. <ul><li>The two main requirements for a thread-compliant implementation: </li></ul><ul><ul><li>1- All MPI calls are thread-safe. </li></ul></ul><ul><ul><li>2- Blocking MPI calls will block the calling thread only, allowing another thread to execute, if available. </li></ul></ul>
  5. 5. <ul><li>The MPI benchmarks from Ohio State University only contain a multithreaded latency test. </li></ul><ul><li>The latency test is a ping-pong test with one thread on the sender side and two (or more) threads on the receiver side. </li></ul><ul><li>There are a number of MPI benchmarks exist, such as SKaMPI and Intel MPI Benchmarks , but they do not measure the performance of multithreaded MPI programs. </li></ul>
  6. 6. <ul><li>With thread-safe MPI implementations becoming increasingly common, users are able to write multithreaded MPI programs that make MPI calls concurrently from multiple threads. </li></ul><ul><li>Developing a thread-safe MPI implementation </li></ul><ul><li>is a fairly complex task. </li></ul><ul><li>Users, therefore, need a way to measure the outcome and determine how efficiently an implementation can support multiple threads. </li></ul>
  7. 7. <ul><li>The authors proposed a test suite that can shed light on the performance of an MPI implementation in the multithreaded case. </li></ul>
  8. 8. <ul><li>To understand the test suite you have first to understand the thread-safety specification in MPI. </li></ul><ul><li>MPI defines four “levels” of thread safety: </li></ul><ul><ul><li>1-MPI_THREAD_SINGLE Each process has a single thread of execution . </li></ul></ul><ul><li>2. MPI_THREAD_FUNNELED A process may be multithreaded, but only the Main thread that initialized MPI may make MPI calls. </li></ul>T P1 T T m T P1 T T m T P2 P2 T MPI Call MPI Call MPI Call MPI Call
  9. 9. <ul><ul><li>3. MPI THREAD SERIALIZED A process may be multithreaded, but only one thread at a time may make MPI calls. </li></ul></ul><ul><ul><li>4. MPI THREAD MULTIPLE A process may be multithreaded, and multiple threads may simultaneously call MPI functions (with some restrictions mentioned below). </li></ul></ul>T T P1 T T P1 T 1 2 3 MPI Call MPI Call MPI Call T MPI Call MPI Call MPI Call
  10. 10. <ul><li>if your code does not access the same memory location from multiple threads without protection, it is most likely thread-safe. </li></ul><ul><li>This is fairly minimal thread safety since you must ensure that your programs logic is thread safe, that is if your application is multithreaded . </li></ul><ul><li>In this context thread safety means that execution of multiple threads does not in itself corrupt the state of your objects . </li></ul>
  11. 11. <ul><li>Deadlock occurs when a process holds a lock and then attempts to acquire a second lock. If the second lock is already held by another process, the first process will be blocked. If the second process then attempts to acquire the lock held by the first process, the system has &quot;deadlocked&quot;: no progress will ever be made </li></ul><ul><li>They cause blocking, which means some threads/processes have to wait until a lock (or a whole set of locks) is released </li></ul>Process 0 Process 1 Thread 0 Thread 1 Thread 1 Thread 0 MPI_Recv(src1) MPI_Send(dest1) MPI_Recv(src0) MPI_Send(dest0) Buffer full Wait for thread 1 to complete the send operation to start reading from the buffer The buffer is full but still a data are sending so thread 1 wait for thread 0 to empty (read) the buffer
  12. 12. <ul><li>There are many MPI implementations but in this paper , just used four implementations: </li></ul><ul><ul><li>MPICH2  it’s a library and portable </li></ul></ul><ul><ul><ul><li>It’s a library ( not compiler ), It can achieve parallelism using networked machines or using multitasking on a single machine. </li></ul></ul></ul><ul><ul><ul><li>portable implementation of MPI , a standard for message-passing . </li></ul></ul></ul><ul><ul><ul><li>can be used for communication between processors. </li></ul></ul></ul><ul><ul><li>OPEN MPI </li></ul></ul><ul><ul><ul><li>merger between three well-known MPI implementations (FT-MPI, LA-MPI, LAM/MPI ). </li></ul></ul></ul><ul><ul><li>(MPI) SUN MPI  run on SUN machines </li></ul></ul><ul><ul><ul><li>It is Sun Microsystems' implementation of MPI </li></ul></ul></ul><ul><ul><li>IBM’s MPI  runs on IBM SP systems and AIX workstation clusters. </li></ul></ul>
  13. 13. <ul><li>The test suit has carried on multiple MPI implementation with different platforms. </li></ul><ul><li>Linux Cluster (AMD Opetron two DualCore) </li></ul><ul><ul><li>MPICH2 V 1.05 </li></ul></ul><ul><ul><li>OpenMPI V1.2.1 </li></ul></ul><ul><li>SUN Fire SMP E2900 UtraSparc has 8 DualCore (SUN cluster) </li></ul><ul><ul><li>SUN MPI. </li></ul></ul><ul><li>IBM p566+ SMP has 8 Power4+ CPU </li></ul><ul><ul><li>IBM MPI </li></ul></ul>
  14. 14. <ul><li>The test has three categorization: </li></ul><ul><li>1-Cost of thread safety test </li></ul><ul><ul><li>1-1 MPI THREAD MULTIPLE overhead </li></ul></ul><ul><li>2-Concurrent progress test </li></ul><ul><ul><li>2-1 Concurrent bandwidth </li></ul></ul><ul><ul><li>2-2 Concurrent latency </li></ul></ul><ul><ul><li>2-3 Concurrent short-long messages </li></ul></ul><ul><li>3-Computation/ communication tests </li></ul><ul><ul><li>3-1 Computation/ communication overlap </li></ul></ul><ul><ul><li>3-2 Concurrent collective operation </li></ul></ul><ul><ul><li>3-3 Concurrent collective and computation </li></ul></ul>
  15. 15. <ul><li>MPI THREAD MULTIPLE Overhead test </li></ul><ul><ul><li>Ping pong Latency ( command : mpiexec –n 2 latency ) </li></ul></ul><ul><ul><li>Command (muti-thread) : mpiexec –n 2 latency_th 4 </li></ul></ul>Single thread Multiple thread Ping Pong Ping Pong The difference = Overhead MPI_Init(&argc,&argv) MPI_Init_thread(MPI_THREAD_MULTIPLE);
  16. 16. <ul><li>MPI THREAD MULTIPLE Overhead Results: </li></ul><ul><ul><li>Linux Cluster </li></ul></ul><ul><ul><ul><li>MPICH2 & OpenMPI  overhead average <= o.5 us </li></ul></ul></ul><ul><ul><li>IBM cluster </li></ul></ul><ul><ul><ul><li>IBM MPI  Overhead avearage < 0.25 us </li></ul></ul></ul><ul><ul><li>SUN Cluster </li></ul></ul><ul><ul><ul><li>SUN MPI  Overhead avearage > 3 us </li></ul></ul></ul>
  17. 17. <ul><li>2-1- concurrent bandwidth (cumulative bandwidth) </li></ul><ul><li>Test on Large Messages </li></ul><ul><ul><li>Process ( 4 processes at each node) </li></ul></ul><ul><ul><li>Threads ( 2 processes each one has 2 threads) </li></ul></ul>P1 P2 P3 P4 P4 P2 P3 P2 P1 P2 P3 P4 P1 P1 P1 T1 T2 T1 T2 T1 T2 T1 T1 T2 T2 T1 T1 T2 T2 T1 T1 T2 + + Large message Large message cumulative bandwidth
  18. 18. <ul><li>Why this test? </li></ul><ul><li>how much thread locks affect the cumulative bandwidth. </li></ul><ul><ul><li>Linux Cluster (AMD Opetron two dual-core) </li></ul></ul><ul><ul><ul><li>MPICH2  no measurable difference in bandwidth between threads and processes. </li></ul></ul></ul><ul><ul><ul><li>OpenMPI  there is a decline in bandwidth with threads. </li></ul></ul></ul><ul><ul><li>IBM MPI & SUN MPI  there is a substantial decline </li></ul></ul><ul><ul><li>(more than 50% in some cases) in the bandwidth when threads were used. </li></ul></ul>
  19. 20. <ul><li>This is similar to the concurrent bandwidth test except that it measures the time for individual short messages. </li></ul>P1 P2 P3 P4 P4 P2 P3 P2 P1 P2 P3 P4 P1 P1 P1 T1 T2 T1 T2 T1 T2 T1 T1 T2 T2 T1 T1 T2 T2 T1 T1 T2 Short message series Short message series Process Mutti threading
  20. 21. <ul><li>overhead in latency when using concurrent threads instead of processes </li></ul><ul><li>Linux cluster </li></ul><ul><ul><li>MPICH2  overhead is about 20 μ s. </li></ul></ul><ul><ul><li>Open MPI  overhead is about 30 μ s. </li></ul></ul><ul><li>IBM MPI & SUN MPI </li></ul><ul><ul><li>the latency with threads is about 10 times the latency with processes. </li></ul></ul><ul><li>But still the IBM & SUN has the low latency compared with MPICH & Open MPI. </li></ul>
  21. 23. <ul><li>This test is a blend of the concurrent bandwidth and concurrent latency tests </li></ul><ul><li>This test tests the fairness of thread scheduling and locking </li></ul>P1 P2 P0 P1 P2 P3 P1 P1 P0 T1 T2 T1 T2 T1 T2 T1 T2 T2 T1 T1 T2 Short message series Short message series Long message P2 Long message Process Multi Threads
  22. 24. <ul><li>This result demonstrates that, in the threaded. </li></ul><ul><li>case, locks are fairly held and released and that the thread blocked in the long message send does not block the other thread. </li></ul>
  23. 25. <ul><li>Test1 (non threading mode )- has an iterative loop in which a process communicates with its four nearest neighbors by posting nonblocking sends and receives, followed by a computation phase, followed by an MPI_ Waitall for the communication to complete. </li></ul><ul><li>T est2 ( threading mode ). - is similar except that, before the iterative loop, each process spawns a thread that blocks on an MPI_Recv. </li></ul><ul><li>This technique effectively simulates asynchronous progress by the MPI implementation. </li></ul><ul><li>If total time ( threading mode ) < total time ( non threading )  there is no overlap. </li></ul>
  24. 27. <ul><li>compares the performance of concurrent calls to a collective function (MPI Allreduce) issued from multiple threads to that when issued from multiple processes. </li></ul>T1 T2 T1 T2 P1 P1 P1 T1 T2 Multi Threads
  25. 28. 3-2 Concurrent Collectives test 2/3 <ul><li>For processes </li></ul>P1 P1 P1 Process
  26. 29. <ul><li>results on the Linux cluster. MPICH2 has relatively small overhead for the threaded version, compared with Open MPI. </li></ul>
  27. 30. <ul><li>evaluates the ability to use a thread to hide the latency of a collective operation. </li></ul><ul><li>The same test as last test but each node has p cores, specify a p+1 as the number of threads. </li></ul><ul><li>Thread p does an MPI_Allreduce with its corresponding threads on other nodes. </li></ul><ul><li>Then compared with the case with no allreduce thread (the higher the better). </li></ul>
  28. 31. <ul><li>the results on the Linux cluster. MPICH2 demonstrates a better ability than Open MPI to hide the latency of the allreduce. </li></ul>
  29. 32. <ul><li>MPI implementations supporting MPI THREAD MULTIPLE become increasingly available. </li></ul><ul><li>The Authors have developed such a test </li></ul><ul><li>suite and show its performance on multiple platforms and implementations </li></ul><ul><li>The results indicate </li></ul><ul><ul><li>Good performance with MPICH2 and Open MPI </li></ul></ul><ul><ul><li>on Linux clusters. </li></ul></ul><ul><ul><li>Poor performance with IBM and Sun MPI on IBM and </li></ul></ul><ul><ul><li>Sun SMP systems </li></ul></ul><ul><li>The Authors plan to add more tests to the suite, such as to measure the overlap of computation/communication with the MPI-2 file I/O and connect-accept features. </li></ul>
  30. 33. <ul><li>1. Francisco Garc´ıa, Alejandro Calder´on, and Jes´us Carretero. MiMPI: A multithreadsafe </li></ul><ul><li>implementation of MPI. In Recent Advances in Parallel Virtual Machine and </li></ul><ul><li>Message Passing Interface, 6th European PVM/MPI Users’ Group Meeting , pages </li></ul><ul><li>207–214. Lecture Notes in Computer Science 1697, Springer, September 1999. </li></ul><ul><li>2. William Gropp and Rajeev Thakur. Issues in developing a thread-safe MPI implementation. </li></ul><ul><li>In Recent Advances in Parallel Virtual Machine and Message Passing </li></ul><ul><li>Interface, 13th European PVM/MPI Users’ Group Meeting , pages 12–21. Lecture </li></ul><ul><li>Notes in Computer Science 4192, Springer, September 2006. </li></ul><ul><li>3. Intel MPI benchmarks. </li></ul><ul><li>4. OSU MPI benchmarks. </li></ul><ul><li>5. Boris V. Protopopov and Anthony Skjellum. A multithreaded message passing </li></ul><ul><li>interface (MPI) architecture: Performance and program issues. Journal of Parallel </li></ul><ul><li>and Distributed Computing , 61(4):449–466, April 2001. </li></ul><ul><li>6. Ralf Reussner, Peter Sanders, and Jesper Larsson Tr¨aff. SKaMPI: A comprehensive </li></ul><ul><li>benchmark for public benchmarking of MPI. Scientific Programming , 10(1):55–65, </li></ul><ul><li>January 2002. </li></ul>
  31. 34. Any Questions @ MPI Multiple threading Ada Soalan !!!!