Parallel Debugging Techniques Le Yan Louisiana Optical Network Initiative 8/3/2009Scaling to Petascale Virtual Summer School.

Slides:



Advertisements
Similar presentations
Matt Wolfe LC Development Environment Group Lawrence Livermore National Laboratory Lawrence Livermore National Laboratory, P. O. Box 808, Livermore, CA.
Advertisements

TOTALVIEW Majdi Baddourah June 4, 2002 NERSC. Objective How to use totalview MPI codes OpenMp Codes.
Debugging Techniques1. 2 Introduction Bugs How to debug Using of debugger provided by the IDE Exception Handling Techniques.
Dr. Fabrizio Gala Dipartimento di Scienze di Base e Applicate Per l’Ingegneria – Sezione di Fisica Via Scarpa Rome, Italy 1.
The Path to Multi-core Tools Paul Petersen. Multi-coreToolsThePathTo 2 Outline Motivation Where are we now What is easy to do next What is missing.
CMSC 345, Version 11/07 SD Vick from S. Mitchell Software Testing.
Lecture Roger Sutton CO331 Visual programming 15: Debugging 1.
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The.
Scripting Languages For Virtual Worlds. Outline Necessary Features Classes, Prototypes, and Mixins Static vs. Dynamic Typing Concurrency Versioning Distribution.
Computer Science 162 Section 1 CS162 Teaching Staff.
1 Chapter 4 The Fundamentals of VBA, Macros, and Command Bars.
Finding and Debugging Errors
Visual Basic Debugging Tools Appendix D 6/27/20151Dr. Monther Aldwairi.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
ECE122 L17: Method Development and Testing April 5, 2007 ECE 122 Engineering Problem Solving with Java Lecture 17 Method Development and Testing.
Debugging Logic Errors CPS120 Introduction to Computer Science Lecture 6.
Parallel Debugging Techniques & Introduction to Totalview Le Yan Louisiana Optical Network Initiative 7/6/2010Scaling to Petascale Virtual Summer School.
Microsoft ® Official Course Monitoring and Troubleshooting Custom SharePoint Solutions SharePoint Practice Microsoft SharePoint 2013.
TIBCO Designer TIBCO BusinessWorks is a scalable, extensible, and easy to use integration platform that allows you to develop, deploy, and run integration.
Introduction to Symmetric Multiprocessors Süha TUNA Bilişim Enstitüsü UHeM Yaz Çalıştayı
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering.
Exercise problems for students taking the Programming Parallel Computers course. Janusz Kowalik Piotr Arlukowicz Tadeusz Puzniakowski Informatics Institute.
Debugging Cluster Programs using symbolic debuggers.
Christopher Jeffers August 2012
Debugging applications, using properties Jim Warren – COMPSCI 280 S Enterprise Software Development.
CS 501: Software Engineering Fall 1999 Lecture 16 Verification and Validation.
Parallel Programming Models Jihad El-Sana These slides are based on the book: Introduction to Parallel Computing, Blaise Barney, Lawrence Livermore National.
COP 4620 / 5625 Programming Language Translation / Compiler Writing Fall 2003 Lecture 10, 10/30/2003 Prof. Roy Levow.
Chapter 3 Parallel Algorithm Design. Outline Task/channel model Task/channel model Algorithm design methodology Algorithm design methodology Case studies.
Support for Debugging Automatically Parallelized Programs Robert Hood Gabriele Jost CSC/MRJ Technology Solutions NASA.
A Framework for Elastic Execution of Existing MPI Programs Aarthi Raveendran Tekin Bicer Gagan Agrawal 1.
TotalView Debugging Tool Presentation Josip Jakić
DDT Debugging Techniques Carlos Rosales Scaling to Petascale 2010 July 7, 2010.
Debugging. 2 © 2003, Espirity Inc. Module Road Map 1.Eclipse Debugging  Debug Perspective  Debug Session  Breakpoint  Debug Views  Breakpoint Types.
Debugging in Java. Common Bugs Compilation or syntactical errors are the first that you will encounter and the easiest to debug They are usually the result.
Testing and Debugging Version 1.0. All kinds of things can go wrong when you are developing a program. The compiler discovers syntax errors in your code.
Martin Schulz Center for Applied Scientific Computing Lawrence Livermore National Laboratory Lawrence Livermore National Laboratory, P. O. Box 808, Livermore,
Introduction to Software Testing. Types of Software Testing Unit Testing Strategies – Equivalence Class Testing – Boundary Value Testing – Output Testing.
Profiling, Tracing, Debugging and Monitoring Frameworks Sathish Vadhiyar Courtesy: Dr. Shirley Moore (University of Tennessee)
Module 6: Debugging a Windows CE Image.  Overview Debug Zones IDE Debug Setup IDE Debug Commands Platform Builder Integrated Kernel Debugger Other Debugging.
Issues Autonomic operation (fault tolerance) Minimize interference to applications Hardware support for new operating systems Resource management (global.
Chapter 10 Algorithm Analysis.  Introduction  Generalizing Running Time  Doing a Timing Analysis  Big-Oh Notation  Analyzing Some Simple Programs.
A New Parallel Debugger for Franklin: DDT Katie Antypas User Services Group NERSC User Group Meeting September 17, 2007.
Debugging parallel programs. Breakpoint debugging Probably the most widely familiar method of debugging programs is breakpoint debugging. In this method,
Lecture 5 Page 1 CS 111 Online Processes CS 111 On-Line MS Program Operating Systems Peter Reiher.
1 Debugging and Syntax Errors in C++. 2 Debugging – a process of finding and fixing bugs (errors or mistakes) in a computer program.
Concurrency Properties. Correctness In sequential programs, rerunning a program with the same input will always give the same result, so it makes sense.
CompSci 100E 18.1 Testing and Debugging Robert A Wagner.
Source Level Debugging of Parallel Programs Roland Wismüller LRR-TUM, TU München Germany.
Debugging tools in Flash CIS 126. Debugging Flash provides several tools for testing ActionScript in your SWF files. –The Debugger, lets you find errors.
Mitglied der Helmholtz-Gemeinschaft Debugging and Validation Tools on Parallel Systems 2012 |Bernd Mohr Institute for Advanced Simulation (IAS) Jülich.
1 Advanced.Net Debugging Using Visual Studio, R# and OzCode IT Week, Summer 2015.
CS Class 04 Topics  Selection statement – IF  Expressions  More practice writing simple C++ programs Announcements  Read pages for next.
Debugging Lab Antonio Gómez-Iglesias Texas Advanced Computing Center.
Active-HDL Server Farm Course 11. All materials updated on: September 30, 2004 Outline 1.Introduction 2.Advantages 3.Requirements 4.Installation 5.Architecture.
Introduction to HPC Debugging with Allinea DDT Nick Forrington
Beyond Application Profiling to System Aware Analysis Elena Laskavaia, QNX Bill Graham, QNX.
Xxx Presentation, No 1 Copyright © TAC AB Engineering Classic Networks1.
HP-SEE TotalView Debugger Josip Jakić Scientific Computing Laboratory Institute of Physics Belgrade The HP-SEE initiative.
Processes and threads.
YAHMD - Yet Another Heap Memory Debugger
Game Architecture Rabin is a good overview of everything to do with Games A lot of these slides come from the 1st edition CS 4455.
Testing and Debugging.
Testing Key Revision Points.
Important terms Black-box testing White-box testing Regression testing
Parallel Debugging Techniques & Introduction to Totalview
Important terms Black-box testing White-box testing Regression testing
Capriccio – A Thread Model
DEBUGGING JAVA PROGRAMS USING ECLIPSE DEBUGGER
CSE 1020:Software Development
Presentation transcript:

Parallel Debugging Techniques Le Yan Louisiana Optical Network Initiative 8/3/2009Scaling to Petascale Virtual Summer School

Outline Overview of parallel debugging – Challenges – Tools – Strategies Get familiar with TotalView/DDT through hands-on exercises 8/3/2009Scaling to Petascale Virtual Summer School 1

Bugs in Parallel Programming Parallel programs are prone to the usual bugs found in sequential programs – Improper pointer usage – Stepping over array bounds – Infinite loops – … Plus… 8/3/2009Scaling to Petascale Virtual Summer School 2

Common Types of Bugs in Parallel Programming Erroneous use of language features – Mismatched parameters, missing mandatory calls etc. Defective space decomposition Incorrect/improper synchronization Hidden serialization …… 8/3/2009Scaling to Petascale Virtual Summer School 3

Debugging Essentials Reproducibility – Find the scenario where the error is reproducible Reduction – Reduce the problem to its essence Deduction – Form hypotheses on what the problem might be Experimentation – Filter out invalid hypotheses Terrence Parr, Learn The Essentials of Debugging 8/3/2009Scaling to Petascale Virtual Summer School 4

Challenges in Parallel Debugging Reproducibility – Many problems cannot be easily reproduced Reduction – Smallest scale might still be too large and complex to handle Deduction – Need to consider concurrent and interdependent program instances Experimentation – Cyclic debugging might be very expensive 8/3/2009Scaling to Petascale Virtual Summer School 5

A Nasty Little Bug What is the potential problem? … integer*4 :: i,ista,iend integer*4 :: chunksize=1024*1024 … call MPI_Comm_Rank(MPI_COMM_WORLD, & myrank,error) … ista=myrank*chunksize+1 iend=(myrank+1)*chunksize do i = ista,iend … enddo … 8/3/2009Scaling to Petascale Virtual Summer School 6

A Nasty Little Bug A bug that shows up only when running with more than 4096 cores … integer*4 :: i,ista,iend integer*4 :: chunksize=1024*1024 … call MPI_Comm_Rank(MPI_COMM_WORLD, & myrank,error) … ista=myrank*chunksize+1 iend=(myrank+1)*chunksize do i = ista,iend … enddo … Integer overflow if myrank ≥ 4096 ! 8/3/2009Scaling to Petascale Virtual Summer School 7

printf/write Debugging Extremely easy to use, therefore dangerously attractive, but… – Need to edit, recompile and rerun when additional information is desired – May change program behavior – Only capable of displaying a subset of the program’s state – Output size grows rapidly with increasing core count and harder to comprehend Not scalable, not recommended 8/3/2009Scaling to Petascale Virtual Summer School 8

Compilers Can Help Most compilers can (at runtime) – Check array bounds – Trap floating operation errors – Provide traceback information Relatively scalable, but… – Overhead added – Limited capability – Non-interactive 8/3/2009Scaling to Petascale Virtual Summer School 9

Parallel Debuggers Capable of what serials debuggers can do – Control program execution – Set action points – View/change values of variables More importantly – Control program execution at various levels Group/process/thread – View MPI message queues 8/3/2009Scaling to Petascale Virtual Summer School 10

An Ideal Parallel Debugger Should allow easy process/thread control and navigation Should support multiple high performance computing platforms Should not limit the number of processes being debugged and should allow it to vary at runtime 8/3/2009Scaling to Petascale Virtual Summer School 11

How Parallel Debuggers Work Frontend – GUI – Debugger engine Debugger Agents – Control application processes – Send data back to the debugger engine to analyze Compute nodes Interactive node … User processes Debugger engine Agent GUI 8/3/2009Scaling to Petascale Virtual Summer School 12

At Very Large Scale The debugger itself becomes a large parallel application Bottlenecks – Debugger framework startup cost – Communication between frontend and agents – Access to shared resources, e.g. file system 8/3/2009Scaling to Petascale Virtual Summer School 13

Validation Is Crucial Have a solid validation procedure to check the correctness Test smaller components before putting them together 8/3/2009Scaling to Petascale Virtual Summer School 14

General Parallel Debugging Strategy Incremental debugging – Downscale if possible Participating processes, problem size and/or number of iterations Example: run with one single thread to detect scope errors in OpenMP programs – Add more instances to reveal other issues Example: run MPI programs on more than one node to detect problems introduced by network delays 8/3/2009Scaling to Petascale Virtual Summer School 15

Strategy at Large Scale Again, downscale if possible Reduce the number of processes to which the debugger is attached – Reduces overhead – Reduces the required number of license seats as well Focus on one or a small number of processes/threads – Analyze call path and message queues to find problematic processes – Control the execution of as few processes/threads as possible while keeping others running Provides the context where the error occurs 8/3/2009Scaling to Petascale Virtual Summer School 16

Trends in Debugging Technology Lightweight trace analysis tools – Help to identify processes/threads that have similar behavior and reduce the search space – Complementary to full feature debuggers – Example: Stack Trace Analysis Tool (STAT) Replay/Reverse execution – ReplayEngine now available from TotalView – Checkpointing supported in DDT 2.4 Post-mortem statistical analysis – Detect anomalies by analyzing profile dissimilarity of multiple runs 8/3/2009Scaling to Petascale Virtual Summer School 17

Hands-on Exercise Debug MPI and OpenMP programs that solve a simple problem to get familiar with – Basic functionalities of parallel debuggers TotalView: Pople, Bluefire and Athena DDT: Ranger – Some common types of bugs in parallel programming Programs and instructions can be found at 8/3/2009Scaling to Petascale Virtual Summer School 18

Problem …45 A 1-D periodic array with N elements Initial value – C: cell(x)=x%10 – Fortran: cell(x)=mod(x-1,10) In each iteration, all elements are updated with the value of two adjacent elements: – cell(x) i+1 =[cell(x-1) i +cell(x+1) i ]%10 Execute N iter iterations The final outputs are the global maximum and average 8/3/2009Scaling to Petascale Virtual Summer School 19

Sequential Program Use an integer array to hold current values Use another integer array to hold the calculated values Swap the pointers at the end of each iteration The result is used to check the correctness of the parallel programs – Chances are that we will not have such a luxury for large jobs 8/3/2009Scaling to Petascale Virtual Summer School 20

MPI Program Divide the array among n processes Each process works on its local array Exchange boundary data with neighbor processes at the end of each iteration Ring topology … …565678…237890…50…… Process 1Process nProcess 2 8/3/2009Scaling to Petascale Virtual Summer School 21

OpenMP Program Each thread works on its own part of the global array All threads have access to the entire array, so no data exchange is necessary …45 Thread 0Thread 1 …Thread n 8/3/2009Scaling to Petascale Virtual Summer School 22

Three Ways to Start TotalView/DDT Start with core dumps Start by attaching to one or more running processes Start the executable within TotalView/DDT 8/3/2009Scaling to Petascale Virtual Summer School 23

TotalView – Root Window Host name Status TotalView ID MPI Rank Status CodeDescription BlankExited BAt breakpoint EError HHeld KIn kernel MMixed RRunning TStopped WAt watchpoint 8/3/2009Scaling to Petascale Virtual Summer School 24

TotalView – Process Window Stack trace pane – Call stack of routines Stack frame pane – Local variables, registers and function parameters Source pane – Source code Action points, processes, threads pane – Manage action points, processes and threads 8/3/2009Scaling to Petascale Virtual Summer School 25

DDT - Main Window Process group window Variable window Source code window Evaluation window Project window Parallel stack view and output window 8/3/2009Scaling to Petascale Virtual Summer School 26

Controlling Execution The process window (TotalView) or main window (DDT) always focuses on one process/thread Switch between processes/threads – TotalView: p+/p-, t+/t-, double click in root window, process/thread tab – DDT: click on process rank in process window Need to set the appropriate scope when – Giving control commands – Setting action points 8/3/2009Scaling to Petascale Virtual Summer School 27

Control Commands 8/3/2009Scaling to Petascale Virtual Summer School 28 TotalViewDDTDescription GoPlay/ContinueStart/resume execution HaltPauseStop execution KillTerminate the job RestartRestarts a running program NextStep overRun to the next source line without stepping into another function StepStep intoRun to next source line OutStep outRun to the completion of current function Run toRun to lineRun to the indicated location

Process/Thread Groups - TotalView Scope of commands and action points – Group(control) All processes and threads – Group(workers) All threads that are executing user code – Rank X Current process and its threads – Process(workers) User threads in the current process – Thread X.Y Current thread – User defined group Group -> Custom Groups, or Create in call graph 8/3/2009Scaling to Petascale Virtual Summer School 29

Process/Thread Groups - DDT 8/3/2009Scaling to Petascale Virtual Summer School 30 Create custom groups – Ctrl+click on all desired processes – Right click on the process window then “create group”

Action Points Breakpoints stop the execution of the processes and threads that reach it – Unconditional – Conditional: stop only if the condition is satisfied – Evaluation: stop and execute a code fragment when reached Useful when testing small patches Process barrier points synchronize a set of processes or threads – TotalView only Watchpoints monitor a location in memory and stop execution when its value changes 8/3/2009Scaling to Petascale Virtual Summer School 31

Setting Action Points - TotalView Breakpoints – Right click on a source line -> Set breakpoint – Click on the line number Watch points – Right click on a variable -> Create watchpoint Barrier points – Right click on a source line -> Set barrier Edit action point property – Right click on a action point in the Action Points tab -> Properties 8/3/2009Scaling to Petascale Virtual Summer School 32

Setting Action Points - DDT Breakpoints – Double click on a source code line – Right click in the Breakpoints tab -> Add breakpoint Watch points – Right click on a variable -> Add to Watches – Right click in the Watches tab -> Add Watch 8/3/2009Scaling to Petascale Virtual Summer School 33

Viewing/Editing Data View values and types of variables – At one process/thread – Across all processes/threads Edit variable value and type Array Data – Slicing – Filtering – Visualization – Statistics 8/3/2009Scaling to Petascale Virtual Summer School 34

Viewing/Editing Data - TotalView Viewing data in – Stack frame – Expression list – Variable window (dive on a variable by double clicking on its name) Editing data by clicking on the value in – Stack frame – Variable window 8/3/2009Scaling to Petascale Virtual Summer School 35

Viewing/Editing Data - DDT Viewing data in – Variable window (in the main window) – Evaluation window Editing data – Right click on the variable name in the evaluation window – Then choose “Edit value” or “Edit type” 8/3/2009Scaling to Petascale Virtual Summer School 36

Viewing Dynamic Arrays in C/C++ TotalView – Edit “type” in the variable window – Tell TotalView how to interpret the memory from a starting location – Example To view an array of 100 integers – Int * -> int[100]* DDT – Drag a pointer variable into the evaluation window – Right click on the variable -> “View as vector” 8/3/2009Scaling to Petascale Virtual Summer School 37

MPI Message Queues Detect – Deadlocks – Load balancing issues TotalView – Tools -> Message Queue Graph – More options available DDT – View -> Message Queues 8/3/2009Scaling to Petascale Virtual Summer School 38

TotalView - Call Graph Tools -> Call graph Quick view of program state – Nodes: functions – Edges: calls Look for outliers 8/3/2009Scaling to Petascale Virtual Summer School 39

DDT - Parallel Stack View Allow users to see the position of each process/thread in the source code in same window Hover over any function to see a list of processes that are currently at that location 8/3/2009Scaling to Petascale Virtual Summer School 40

References TotalView user manual – ex.html DDT user manual – LLNL TotalView tutorial – NCSA Cyberinfrastructure Tutor – “Debugging Serial and Parallel Codes” course HPCBugBase – 8/3/2009Scaling to Petascale Virtual Summer School 41