MPI-Checker Static Analysis for MPI



Similar documents
Session 2: MUST. Correctness Checking

How to Write a Checker in 24 Hours

MPI Application Development Using the Analysis Tool MARMOT

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

High performance computing systems. Lab 1

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

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

Introduction to Hybrid Programming

A Memory Model for Static Analysis of C Programs

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

Applying Clang Static Analyzer to Linux Kernel

Secure Software Programming and Vulnerability Analysis

Stack Allocation. Run-Time Data Structures. Static Structures

Parallel and Distributed Computing Programming Assignment 1

Object Oriented Software Design II

Software Testing & Analysis (F22ST3): Static Analysis Techniques 2. Andrew Ireland

Parallel Programming with MPI on the Odyssey Cluster

Grigore Rosu Founder, President and CEO Professor of Computer Science, University of Illinois

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)

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

A Static Analyzer for Large Safety-Critical Software. Considered Programs and Semantics. Automatic Program Verification by Abstract Interpretation

Software Testing. Definition: Testing is a process of executing a program with data, with the sole intention of finding errors in the program.

Parallelization: Binary Tree Traversal

Visualizing Information Flow through C Programs

Storage Classes CS 110B - Rule Storage Classes Page 18-1 \handouts\storclas

Debugging with TotalView

Stacks. Linear data structures

Fully Automated Static Analysis of Fedora Packages

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++

Glossary of Object Oriented Terms

C++ Programming Language

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

Lecture 11 Doubly Linked Lists & Array of Linked Lists. Doubly Linked Lists

The Software Model Checker BLAST: Applications to Software Engineering

Common Errors in C/C++ Code and Static Analysis

System Software Prof. Dr. H. Mössenböck

Towards practical reactive security audit using extended static checkers 1

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

Know or Go Practical Quest for Reliable Software

Software Reliability Estimation Based on Static Error Detection

The programming language C. sws1 1

Beyond the Mouse A Short Course on Programming

Monitors, Java, Threads and Processes

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Informatica e Sistemi in Tempo Reale

Checking Access to Protected Members in the Java Virtual Machine

Automated Program Behavior Analysis

Logistics. Software Testing. Logistics. Logistics. Plan for this week. Before we begin. Project. Final exam. Questions?

1 Abstract Data Types Information Hiding

Critical Systems Validation. Objectives

A static analyzer for finding dynamic programming errors

Developing Parallel Applications with the Eclipse Parallel Tools Platform

C Compiler Targeting the Java Virtual Machine

Illustration 1: Diagram of program function and data flow

SMTP-32 Library. Simple Mail Transfer Protocol Dynamic Link Library for Microsoft Windows. Version 5.2

APPROACHES TO SOFTWARE TESTING PROGRAM VERIFICATION AND VALIDATION

8.5. <summary> Cppcheck addons Using Cppcheck addons Where to find some Cppcheck addons

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

Scoping (Readings 7.1,7.4,7.6) Parameter passing methods (7.5) Building symbol tables (7.6)

A Comparative Study of Industrial Static Analysis Tools (Extended Version)

CS555: Distributed Systems [Fall 2015] Dept. Of Computer Science, Colorado State University

Probabilistic Assertions

Building Embedded Systems

Object Oriented Software Design

Introduction to Automated Testing

C++ INTERVIEW QUESTIONS

Moving from CS 61A Scheme to CS 61B Java

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

If you wanted multiple screens, there was no way for data to be accumulated or stored

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

The C Programming Language course syllabus associate level

Bypassing Browser Memory Protections in Windows Vista

How To Trace

Programming languages C

Generalised Socket Addresses for Unix Squeak

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

InvGen: An Efficient Invariant Generator

Memory management. Announcements. Safe user input. Function pointers. Uses of function pointers. Function pointer example

Heartbleed. or: I read the news, too. Martin R. Albrecht. Information Security Group, Royal Holloway, University of London

Organization of Programming Languages CS320/520N. Lecture 05. Razvan C. Bunescu School of Electrical Engineering and Computer Science

McMPI. Managed-code MPI library in Pure C# Dr D Holmes, EPCC dholmes@epcc.ed.ac.uk

Mutual Exclusion using Monitors

Scanner. It takes input and splits it into a sequence of tokens. A token is a group of characters which form some unit.

Variable Base Interface

Optimizing Generation of Object Graphs in Java PathFinder

Memory Debugging with TotalView on AIX and Linux/Power

Static Checking of C Programs for Vulnerabilities. Aaron Brown

Software Testing. Quality & Testing. Software Testing

PerfExpert: An Easy-to-Use Performance Diagnosis Tool for HPC Applications

C Dynamic Data Structures. University of Texas at Austin CS310H - Computer Organization Spring 2010 Don Fussell

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

HECTOR a software model checker with cooperating analysis plugins. Nathaniel Charlton and Michael Huth Imperial College London

Static Code Analysis Procedures in the Development Cycle

Massachusetts Institute of Technology 6.005: Elements of Software Construction Fall 2011 Quiz 2 November 21, 2011 SOLUTIONS.

SIMULATION OF LOAD BALANCING ALGORITHMS: A Comparative Study

AUTOMATED TEST GENERATION FOR SOFTWARE COMPONENTS

- An Essential Building Block for Stable and Reliable Compute Clusters

RA MPI Compilers Debuggers Profiling. March 25, 2009

UNIX Sockets. COS 461 Precept 1

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

Transcription:

MPI-Checker Static Analysis for MPI Alexander Droste, Michael Kuhn, Thomas Ludwig November 15, 2015

Motivation 2 / 39

Why is runtime analysis in HPC challenging? Large amount of resources are used State of the program can get very complex Hard to survey Long run duration 3 / 39

Why is runtime analysis in HPC challenging? Large amount of resources are used State of the program can get very complex Hard to survey Long run duration Is there a way to complement dynamic tooling? 3 / 39

Static analysis Extensive static analysis of the source code Executed in the frontend Verify focused aspects of the code In contrast to normal compiler errors, warnings: More computational resources are used Better suited for domain specific checks 4 / 39

What are the benefits of static analysis for MPI? Analysis without running the program Unrelated to runtime resources Not affected by the commonness of a sequence at runtime Low maintenance effort 5 / 39

Clang Static Analyzer 6 / 39

Clang Static Analyzer Framework for static analysis: Core and checkers Provides two techniques to base a checker upon: AST-based analysis Path-sensitive analysis Descriptive HTML reports Extensible 7 / 39

AST-based analysis 1 void memory( int x ) { 2 int * i = malloc ( sizeof ( int ) ) ; 3 if ( x < 2) f r e e ( i ) ; 4 if ( x > 0) f r e e ( i ) ; 5 } malloc N0 (x < 2)!(x < 2) N1 (x > 0)!(x > 0) N2 Works if a check can verify an invariant locally No differentiation of distinct paths No assumptions can be made about the range of x range of x is unknown 8 / 39

Motivation Clang Static Analyzer MPI-Checker Limitations Evaluation Future Work Path-sensitive analysis 1 void memory( int x ) { 2 int * i = malloc ( sizeof ( int ) ) ; 3 if ( x < 2) f r e e ( i ) ; 4 if ( x > 0) f r e e ( i ) ; 5 } Distincts path sequences Symbolic execution Higher level of abstraction 9 / 39

Symbolic execution Symbolic representation of values, memory regions Variables are defined by constraints to ranges Each node represents a program point and state Operations are conceptually transitions between nodes 10 / 39

MPI-Checker 11 / 39

MPI-Checker Realised as a Clang Static Analyzer checker Hybrid: Provides AST-based and path-sensitive checks Can verify C and C++ code Checks are MPI implementation independent 12 / 39

Path-sensitive Checks 13 / 39

Path-sensitive checks Check aspects of nonblocking communication Based on MPI request usage verification Request can be in different last user states Unused, used by nonblocking call, used by wait Requests are tracked by their symbolic memory region 14 / 39

Double nonblocking Nonblocking call using a request that is already in use by a nonblocking call Checked when a call is symbolically executed nb nb unused used by nb double nb Makes it impossible to wait for both nonblocking calls 15 / 39

Unmatched wait Checks for waits on requests not used by a nonblocking call unused wait unmatched wait Request is in an undefined state undefined behavior 16 / 39

Missing wait Checks if a nonblocking call is not matched by a wait Checked when a symbol goes out of scope nb oos unused used by nb missing wait Nonblocking operation might not complete 17 / 39

AST-based Checks 18 / 39

Type mismatch 1 int buf ; 2 MPI_Send(&buf, *, MPI_DOUBLE, *, *, * ) ; Buffer type, MPI datatype tag correspondence 19 / 39

Type mismatch 1 int buf ; 2 MPI_Send(&buf, *, MPI_DOUBLE, *, *, * ) ; Buffer type, MPI datatype tag correspondence Clang already has type checking support limited to MPICH MPI-Checker is MPI implementation independent 19 / 39

Type mismatch 1 int buf ; 2 MPI_Send(&buf, *, MPI_DOUBLE, *, *, * ) ; Buffer type, MPI datatype tag correspondence Support for all types defined by the MPI 3.1 standard Skipped: Custom buffer types, nullpointer constants, custom MPI types, MPI_BYTE, MPI_DATATYPE_NULL 20 / 39

Incorrect buffer referencing 1 int ** buf ; 2 MPI_Send( buf, *, MPI_INT, *, *, * ) ; MPI functions specify void * as their buffer type Allows passing pointers not sufficiently dereferenced Subroutine of the type mismatch check 21 / 39

Invalid argument type 1 int x = 0; 2 MPI_Send( *, 1.1 + x, *, *, *, * ) ; Check if non-integer types are used for rank, count or tag Can handle expressions of arbitrary complexity Corresponds to -Wfloat-conversion -Wfloat-conversion can produce a lot of output -Wfloat-conversion is neither included in -Wall nor -Wextra Convenience check 22 / 39

Unmatched point-to-point call 1 MPI_Send( *, 1, MPI_INT, f () + N + 3 + rank + 1, 0, C) ; 2 MPI_Recv( *, 1, MPI_INT, N + f () + 3 + rank - 1, 0, C, * ) ; Checks for unmatched point-to-point operations Names, values must be equal Rank needs a specific notation Will be changed to a path-sensitive check +c Partner a: rank x Partner b: rank y -c 23 / 39

Unreachable call 1 if ( rank == 0) { 2 MPI_Send( *, 1, MPI_INT, rank + 1, 0, C) ; 3 MPI_Recv( *, 1, MPI_INT, rank + 1, 0, C, * ) ; 4 } 5 else if ( rank == 1) { 6 MPI_Send( *, 1, MPI_INT, rank - 1, 0, C) ; 7 MPI_Recv( *, 1, MPI_INT, rank - 1, 0, C, * ) ; 8 } Checks for deadlocks caused by blocking calls Based on the same point-to-point matching mechanism 24 / 39

Limitations 25 / 39

Limitations No assumption about runtime dependent results can be made MPI_Waitany or MPI_Waitsome are not taken into account Heap allocated MPI_Request variables are not taken into account Analysis is limited to the scope of a translation unit 26 / 39

Evaluation 27 / 39

Evaluation AMG2013 ~75KLOC, 10x CombBLAS ~40KLOC, 2x OpenFFT ~5KLOC, 4x No false positives but the likeliness of appearance differs Point-to-point checks were excluded 28 / 39

AMG2013 - Report overview 29 / 39

AMG2013 - Detail report - Missing wait 30 / 39

AMG2013 - Detail report - Missing wait 31 / 39

AMG2013 - Detail report - Type mismatch 32 / 39

Future Work 33 / 39

Future work Merge MPI-Checker into Clang Detect race condition on buffer between nonblocking call and wait Path-sensitive point-to-point matching Possibility to type match custom types Analysis for a given process count... Adding new checks will now be a lot easier 34 / 39

Current State 35 / 39

Current state GitHub: https://github.com/0ax1/mpi-checker Range of checks Limitations Examples Planned: Evaluation 36 / 39

Acknowledgments 37 / 39

Acknowledgments Hal Finkel Anna Zaks Dmitri Gribenko Devin Coughlin Jeff Hammond + Clang mailing list 38 / 39

Questions? 39 / 39