Session 2: MUST. Correctness Checking

Similar documents
MPI Runtime Error Detection with MUST For the 13th VI-HPS Tuning Workshop

Parallelization: Binary Tree Traversal

MPI Application Development Using the Analysis Tool MARMOT

High performance computing systems. Lab 1

MPI-Checker Static Analysis for MPI

LOAD BALANCING DISTRIBUTED OPERATING SYSTEMS, SCALABILITY, SS Hermann Härtig

Lecture 6: Introduction to MPI programming. Lecture 6: Introduction to MPI programming p. 1

Debugging with TotalView

To connect to the cluster, simply use a SSH or SFTP client to connect to:

Compute Cluster Server Lab 3: Debugging the parallel MPI programs in Microsoft Visual Studio 2005

HP-MPI User s Guide. 11th Edition. Manufacturing Part Number : B September 2007

HPCC - Hrothgar Getting Started User Guide MPI Programming

Lightning Introduction to MPI Programming

Introduction to Hybrid Programming

Advanced MPI. Hybrid programming, profiling and debugging of MPI applications. Hristo Iliev RZ. Rechen- und Kommunikationszentrum (RZ)

RA MPI Compilers Debuggers Profiling. March 25, 2009

MARMOT- MPI Analysis and Checking Tool Demo with blood flow simulation. Bettina Krammer, Matthias Müller

PREDICTIVE ANALYSIS OF MESSAGE PASSING APPLICATIONS

Asynchronous Dynamic Load Balancing (ADLB)

Parallel Programming with MPI on the Odyssey Cluster

Message Passing with MPI

Parallel Debugging with DDT

Dynamic Software Testing of MPI Applications with Umpire

Eliminate Memory Errors and Improve Program Stability

Load Balancing. computing a file with grayscales. granularity considerations static work load assignment with MPI

Application Performance Tools on Discover

Parallel Computing. Parallel shared memory computing with OpenMP

Debugging and Profiling Lab. Carlos Rosales, Kent Milfeld and Yaakoub Y. El Kharma

The Double-layer Master-Slave Model : A Hybrid Approach to Parallel Programming for Multicore Clusters

Memory Debugging with TotalView on AIX and Linux/Power

Introduction to MPI Programming!

Helping you avoid stack overflow crashes!

High Performance Computing in Aachen

Using the Intel Inspector XE

Chao Chen 1 Michael Lang 2 Yong Chen 1. IEEE BigData, Department of Computer Science Texas Tech University

MUSIC Multi-Simulation Coordinator. Users Manual. Örjan Ekeberg and Mikael Djurfeldt

Message Passing Interface (MPI)

Message Passing Interface (MPI)

Introduction. Reading. Today MPI & OpenMP papers Tuesday Commutativity Analysis & HPF. CMSC 818Z - S99 (lect 5)

Parallelizing Heavyweight Debugging Tools with MPIecho

Parallel and Distributed Computing Programming Assignment 1

Libmonitor: A Tool for First-Party Monitoring

Basic Concepts in Parallelization

How To Port A Program To Dynamic C (C) (C-Based) (Program) (For A Non Portable Program) (Un Portable) (Permanent) (Non Portable) C-Based (Programs) (Powerpoint)

Overview. Lecture 1: an introduction to CUDA. Hardware view. Hardware view. hardware view software view CUDA programming

High Performance Computing in Aachen

Introduction to Cloud Computing

Introduction. dnotify

Performance analysis with Periscope

Oracle Solaris Studio Code Analyzer

High-Performance Computing: Architecture and APIs

Introduction to grid technologies, parallel and cloud computing. Alaa Osama Allam Saida Saad Mohamed Mohamed Ibrahim Gaber

GPU Tools Sandra Wienke

MPI / ClusterTools Update and Plans

Sources: On the Web: Slides will be available on:

The Asterope compute cluster

Debugging in Heterogeneous Environments with TotalView. ECMWF HPC Workshop 30 th October 2014

Unified Performance Data Collection with Score-P

ADVANCED MPI. Dr. David Cronk Innovative Computing Lab University of Tennessee

- An Essential Building Block for Stable and Reliable Compute Clusters

Interconnect Efficiency of Tyan PSC T-630 with Microsoft Compute Cluster Server 2003

Leak Check Version 2.1 for Linux TM

Introduction to Synoptic

University of Amsterdam - SURFsara. High Performance Computing and Big Data Course

The V-model. Validation and Verification. Inspections [24.3] Testing overview [8, 15.2] - system testing. How much V&V is enough?

Andreas Burghart 6 October 2014 v1.0

How To Visualize Performance Data In A Computer Program

System Calls and Standard I/O

Parallel Computing. Shared memory parallel programming with OpenMP

The RWTH Compute Cluster Environment

An Incomplete C++ Primer. University of Wyoming MA 5310

Purify User s Guide. Version 4.1 support@rational.com

Allinea Performance Reports User Guide. Version 6.0.6

Java Troubleshooting and Performance

Building Embedded Systems

Agenda. Using HPC Wales 2

Load Balancing MPI Algorithm for High Throughput Applications

OMPT and OMPD: OpenMP Tools Application Programming Interfaces for Performance Analysis and Debugging

Frysk The Systems Monitoring and Debugging Tool. Andrew Cagney

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Secure Programming with Static Analysis. Jacob West

The Easiest Way to Run Spark Jobs. How-To Guide

Programming the Intel Xeon Phi Coprocessor

System Calls Related to File Manipulation

Tools for Performance Debugging HPC Applications. David Skinner

Get the Better of Memory Leaks with Valgrind Whitepaper

Integrating SNiFF+ with the Data Display Debugger (DDD)

Application-Level Debugging and Profiling: Gaps in the Tool Ecosystem. Dr Rosemary Francis, Ellexus

Developing Parallel Applications with the Eclipse Parallel Tools Platform

Parallel I/O on Mira Venkat Vishwanath and Kevin Harms

Improve Fortran Code Quality with Static Analysis

GDB Tutorial. A Walkthrough with Examples. CMSC Spring Last modified March 22, GDB Tutorial

How to Design and Manage a Multi- Migger for parallel Programs

DiskBoss. File & Disk Manager. Version 2.0. Dec Flexense Ltd. info@flexense.com. File Integrity Monitor

Optimization tools. 1) Improving Overall I/O

ASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters

BG/Q Performance Tools. Sco$ Parker BG/Q Early Science Workshop: March 19-21, 2012 Argonne Leadership CompuGng Facility

Lazy OpenCV installation and use with Visual Studio

Developing, Deploying, and Debugging Applications on Windows Embedded Standard 7

Transcription:

Center for Information Services and High Performance Computing (ZIH) Session 2: MUST Correctness Checking Dr. Matthias S. Müller (RWTH Aachen University) Tobias Hilbrich (Technische Universität Dresden) Joachim Protze (RWTH Aachen University, LLNL) Email: mueller@itc.rwth-aachen.de tobias.hilbrich@tu-dresden.de protze@itc.rwth-aachen.de

Content! Motivation! MPI usage errors! Examples: Common MPI usage errors Ø Including MUST s error descriptions! Correctness tools! MUST usage Matthias Müller, Joachim Protze, Tobias Hilbrich 2

How many errors can you spot in this tiny example? #include <mpi.h> #include <stdio.h> int main (int argc, char** argv) { int rank, size, buf[8]; MPI_Comm_rank (MPI_COMM_WORLD, &rank); MPI_Comm_size (MPI_COMM_WORLD, &size); MPI_Datatype type; MPI_Type_contiguous (2, MPI_INTEGER, &type); MPI_Recv (buf, 2, MPI_INT, size - rank, 123, MPI_COMM_WORLD, MPI_STATUS_IGNORE); MPI_Send (buf, 2, type, size - rank, 123, MPI_COMM_WORLD); printf ("Hello, I am rank %d of %d.\n", rank, size); } return 0; At least 8 issues in this code example Matthias Müller, Joachim Protze, Tobias Hilbrich 3

Content! Motivation! MPI usage errors! Examples: Common MPI usage errors Ø Including MUST s error descriptions! Correctness tools! MUST usage Matthias Müller, Joachim Protze, Tobias Hilbrich 4

MPI usage errors! MPI programming is error prone! Bugs may manifest as: Ø Crashes Ø Hangs Ø Wrong results Ø Not at all! (Sleeping bugs)! Tools help to detect these issues Matthias Müller, Joachim Protze, Tobias Hilbrich 5

MPI usage errors (2)! Complications in MPI usage: Ø Non-blocking communication Ø Persistent communication Ø Complex collectives (e.g. Alltoallw) Ø Derived datatypes Ø Non-contiguous buffers! Error Classes include: Ø Incorrect arguments Ø Resource errors Ø Buffer usage Ø Type matching Ø Deadlocks Matthias Müller, Joachim Protze, Tobias Hilbrich 6

Content! Motivation! MPI usage errors! Examples: Common MPI usage errors Ø Including MUST s error descriptions! Correctness tools! MUST usage Matthias Müller, Joachim Protze, Tobias Hilbrich 7

Skipping some errors! Missing MPI_Init:! Current release doesn t start to work, implementation in progress! Missing MPI_Finalize:! Current release doesn t terminate all analyses, work in progress! Src/dest rank out of range (size-rank): leads to crash, use crash save version of tool Matthias Müller, Joachim Protze, Tobias Hilbrich 8

MUST: Tool design PMPI Interface P^nMPI Library Application Additional tool ranks MPI Library Split-comm-world Force status wrapper GTI: event forwarding, network Local Analyses Non-Local Analyses Rewrite-comm-world MPI Library Matthias Müller, Joachim Protze, Tobias Hilbrich 9

0 4 1 GTI: event forwarding, network 2 Local Analyses 6 Non-Local 5 Analyses 3 Matthias Müller, Joachim Protze, Tobias Hilbrich 10

Fixed some errors: #include <mpi.h> #include <stdio.h> int main (int argc, char** argv) { int rank, size, buf[8]; MPI_Init (&argc, &argv); MPI_Comm_rank (MPI_COMM_WORLD, &rank); MPI_Comm_size (MPI_COMM_WORLD, &size); MPI_Datatype type; MPI_Type_contiguous (2, MPI_INTEGER, &type); MPI_Recv (buf, 2, MPI_INT, size - rank - 1, 123, MPI_COMM_WORLD, MPI_STATUS_IGNORE); MPI_Send (buf, 2, type, size - rank - 1, 123, MPI_COMM_WORLD); printf ("Hello, I am rank %d of %d.\n", rank, size); MPI_Finalize (); } return 0; Matthias Müller, Joachim Protze, Tobias Hilbrich 11

Must detects deadlocks Click for graphical representa2on of the detected deadlock situa2on. Matthias Müller, Joachim Protze, Tobias Hilbrich 12

Graphical representation of deadlocks Rank 0 waits for rank 1 and vv. Simple call stack for this example. Matthias Müller, Joachim Protze, Tobias Hilbrich 13

Fix1: use asynchronous receive #include <mpi.h> #include <stdio.h> int main (int argc, char** argv) { int rank, size, buf[8]; MPI_Init (&argc, &argv); MPI_Comm_rank (MPI_COMM_WORLD, &rank); MPI_Comm_size (MPI_COMM_WORLD, &size); MPI_Datatype type; MPI_Type_contiguous (2, MPI_INTEGER, &type); MPI_Request request; MPI_Irecv (buf, 2, MPI_INT, size - rank - 1, 123, MPI_COMM_WORLD, &request); MPI_Send (buf, 2, type, size - rank - 1, 123, MPI_COMM_WORLD); printf ("Hello, I am rank %d of %d.\n", rank, size); MPI_Finalize (); Use asynchronous receive: (MPI_Irecv) } return 0; Matthias Müller, Joachim Protze, Tobias Hilbrich 14

MUST detects errors in handling datatypes Use of uncommited datatype: type Matthias Müller, Joachim Protze, Tobias Hilbrich 15

Fix2: use MPI_Type_commit #include <mpi.h> #include <stdio.h> int main (int argc, char** argv) { int rank, size, buf[8]; MPI_Init (&argc, &argv); MPI_Comm_rank (MPI_COMM_WORLD, &rank); MPI_Comm_size (MPI_COMM_WORLD, &size); MPI_Datatype type; MPI_Type_contiguous (2, MPI_INTEGER, &type); MPI_Type_commit (&type); MPI_Request request; MPI_Irecv (buf, 2, MPI_INT, size - rank - 1, 123, MPI_COMM_WORLD, &request); MPI_Send (buf, 2, type, size - rank - 1, 123, MPI_COMM_WORLD); printf ("Hello, I am rank %d of %d.\n", rank, size); MPI_Finalize (); Commit the datatype before usage } return 0; Matthias Müller, Joachim Protze, Tobias Hilbrich 16

MUST detects errors in transfer buffer sizes / types Size of sent message larger than receive buffer Matthias Müller, Joachim Protze, Tobias Hilbrich 17

Fix3: use same message size for send and receive #include <mpi.h> #include <stdio.h> int main (int argc, char** argv) { int rank, size, buf[8]; MPI_Init (&argc, &argv); MPI_Comm_rank (MPI_COMM_WORLD, &rank); MPI_Comm_size (MPI_COMM_WORLD, &size); MPI_Datatype type; MPI_Type_contiguous (2, MPI_INTEGER, &type); MPI_Type_commit (&type); MPI_Request request; MPI_Irecv (buf, 2, MPI_INT, size - rank - 1, 123, MPI_COMM_WORLD, &request); MPI_Send (buf, 1, type, size - rank - 1, 123, MPI_COMM_WORLD); printf ("Hello, I am rank %d of %d.\n", rank, size); MPI_Finalize (); Reduce the message size } return 0; Matthias Müller, Joachim Protze, Tobias Hilbrich 18

MUST detects use of wrong argument values Use of Fortran type in C, datatype mismatch between sender and receiver Matthias Müller, Joachim Protze, Tobias Hilbrich 19

Fix4: use C-datatype constants in C-code #include <mpi.h> #include <stdio.h> int main (int argc, char** argv) { int rank, size, buf[8]; MPI_Init (&argc, &argv); MPI_Comm_rank (MPI_COMM_WORLD, &rank); MPI_Comm_size (MPI_COMM_WORLD, &size); MPI_Datatype type; MPI_Type_contiguous (2, MPI_INT, &type); MPI_Type_commit (&type); MPI_Request request; MPI_Irecv (buf, 2, MPI_INT, size - rank - 1, 123, MPI_COMM_WORLD, &request); MPI_Send (buf, 1, type, size - rank - 1, 123, MPI_COMM_WORLD); printf ("Hello, I am rank %d of %d.\n", rank, size); MPI_Finalize (); Use the integer datatype intended for usage in C } return 0; Matthias Müller, Joachim Protze, Tobias Hilbrich 20

MUST detects data races in asynchronous communication Data race between send and ascynchronous receive opera2on Matthias Müller, Joachim Protze, Tobias Hilbrich 21

Graphical representation of the race condition Graphical representa2on of the data race loca2on Matthias Müller, Joachim Protze, Tobias Hilbrich 22

Fix5: use independent memory regions #include <mpi.h> #include <stdio.h> int main (int argc, char** argv) { int rank, size, buf[8]; MPI_Init (&argc, &argv); MPI_Comm_rank (MPI_COMM_WORLD, &rank); MPI_Comm_size (MPI_COMM_WORLD, &size); MPI_Datatype type; MPI_Type_contiguous (2, MPI_INTEGER, &type); MPI_Type_commit (&type); MPI_Request request; MPI_Irecv (buf, 2, MPI_INT, size - rank - 1, 123, MPI_COMM_WORLD, &request); MPI_Send (buf + 4, 1, type, size - rank - 1, 123, MPI_COMM_WORLD); printf ("Hello, I am rank %d of %d.\n", rank, size); MPI_Finalize (); Offset points to independent memory } return 0; Matthias Müller, Joachim Protze, Tobias Hilbrich 23

MUST detects leaks of user defined objects Leak of user defined datatype object! User defined objects include! MPI_Comms (even by MPI_Comm_dup)! MPI_Datatypes! MPI_Groups Matthias Müller, Joachim Protze, Tobias Hilbrich 24

Fix6: Deallocate datatype object #include <mpi.h> #include <stdio.h> int main (int argc, char** argv) { int rank, size, buf[8]; MPI_Init (&argc, &argv); MPI_Comm_rank (MPI_COMM_WORLD, &rank); MPI_Comm_size (MPI_COMM_WORLD, &size); MPI_Datatype type; MPI_Type_contiguous (2, MPI_INT, &type); MPI_Type_commit (&type); MPI_Request request; MPI_Irecv (buf, 2, MPI_INT, size - rank - 1, 123, MPI_COMM_WORLD, &request); MPI_Send (buf + 4, 1, type, size - rank - 1, 123, MPI_COMM_WORLD); } printf ("Hello, I am rank %d of %d.\n", rank, size); MPI_Type_free (&type); MPI_Finalize (); return 0; Deallocate the created datatype Matthias Müller, Joachim Protze, Tobias Hilbrich 25

MUST detects unfinished asynchronous communication Remaining unfinished asynchronous receive Matthias Müller, Joachim Protze, Tobias Hilbrich 26

Fix8: use MPI_Wait to finish asynchronous communication #include <mpi.h> #include <stdio.h> int main (int argc, char** argv) { int rank, size, buf[8]; MPI_Init (&argc, &argv); MPI_Comm_rank (MPI_COMM_WORLD, &rank); MPI_Comm_size (MPI_COMM_WORLD, &size); MPI_Datatype type; MPI_Type_contiguous (2, MPI_INT, &type); MPI_Type_commit (&type); MPI_Request request; MPI_Irecv (buf, 2, MPI_INT, size - rank - 1, 123, MPI_COMM_WORLD, &request); MPI_Send (buf + 4, 1, type, size - rank - 1, 123, MPI_COMM_WORLD); MPI_Wait (&request, MPI_STATUS_IGNORE); printf ("Hello, I am rank %d of %d.\n", rank, size); MPI_Type_free (&type); Finish the asynchronous communica2on MPI_Finalize (); } return 0; Matthias Müller, Joachim Protze, Tobias Hilbrich 27

No further error detected Hopefully this message applies to many applica2ons Matthias Müller, Joachim Protze, Tobias Hilbrich 28

Content! Motivation! MPI usage errors! Examples: Common MPI usage errors Ø Including MUST s error descriptions! Correctness tools! MUST usage Matthias Müller, Joachim Protze, Tobias Hilbrich 29

Classes of Correctness Tools! Debuggers: Ø Helpful to pinpoint any error Ø Finding the root cause may be very hard Ø Won t detect sleeping errors Ø E.g.: gdb, TotalView, Alinea DDT! Static Analysis: Ø Compilers and Source analyzers Ø Typically: type and expression errors Ø E.g.: MPI-Check! Model checking: Ø Requires a model of your applications Ø State explosion possible Ø E.g.: MPI-Spin Matthias Müller, Joachim Protze, Tobias Hilbrich 30

Strategies of Correctness Tools! Runtime error detection: Ø Inspect MPI calls at runtime Ø Limited to the timely interleaving that is observed Ø Causes overhead during application run Ø E.g.: Intel Trace Analyzer, Umpire, Marmot, MUST! Formal verification: Ø Extension of runtime error detection Ø Explores ALL possible timely interleavings Ø Can detect potential deadlocks or type missmatches that would otherwise not occur in the presence of a tool Ø For non-deterministic applications exponential exploration space Ø E.g.: ISP Matthias Müller, Joachim Protze, Tobias Hilbrich 31

Content! Motivation! MPI usage errors! Examples: Common MPI usage errors Ø Including MUST s error descriptions! Correctness tools! MUST usage Matthias Müller, Joachim Protze, Tobias Hilbrich 32

MUST Usage 1) Compile and link application as usual Link against the shared version of the MPI lib (Usually default) 2) Replace mpiexec with mustrun E.g.: mustrun np 4 myapp.exe input.txt output.txt 3) Inspect MUST_Output.html in run directory MUST_Output/MUST_Deadlock.dot exists in case of deadlock Visualize with: dot Tps MUST_Deadlock.dot o deadlock.ps The mustrun script will use an extra process for nonlocal checks (Invisible to application) I.e.: mustrun np 4 will issue a mpirun np 5 Make sure to allocate the extra task in batch jobs Matthias Müller, Joachim Protze, Tobias Hilbrich 33

MUST - Features! Local checks: Ø Integer validation Ø Integrity checks (pointers valid, etc.) Ø Operation, Request, Communicator, Datatype, Group usage Ø Resource leak detection Ø Memory overlap checks! Non-local checks: Ø Collective verification Ø Lost message detection Ø Type matching (For P2P and collectives) Ø Deadlock detection (with root cause visualization) Matthias Müller, Joachim Protze, Tobias Hilbrich 34

MUST - Features: Scalability! Local checks largely scalable! Non-local checks:! Current default uses a central process Ø This process is an MPI task taken from the application Ø Limited scalability ~100 tasks (Depending on application)! Distributed analysis available (tested with 10k tasks) Ø Uses more extra tasks (10%-100%)! Recommended: Logging to an HTML file! Uses a scalable tool infrastructure! Tool configuration happens at execution time Matthias Müller, Joachim Protze, Tobias Hilbrich 35