Welcome. HRSK Practical on Debugging, Zellescher Weg 12 Willers-Bau A106 Tel

Similar documents
Introduction to debugging. Martin Čuma Center for High Performance Computing University of Utah

Debugging with GDB and DDT

Typical Bugs in parallel Programs

Debugging with GDB and DDT

TotalView. Debugging Tool Presentation. Josip Jakić

Compiler Options. Linux/x86 Performance Practical,

Parallel Debugging with TotalView BSC-CNS

DDT: A visual, parallel debugger on Ra

SGI Altix Getting Correct Code Reiner Vogelsang SGI GmbH

Cache Profiling with Callgrind

Debugging. John Lockman Texas Advanced Computing Center

Altix Usage and Application Programming

Debugging. Marcelo Ponce SciNet HPC Consortium University of Toronto. July 15, /41 Ontario HPC Summerschool 2016 Central Edition: Toronto

Short Introduction to Debugging Tools on the Cray XC40

Intro to Segmentation Fault Handling in Linux. By Khanh Ngo-Duy

Short Introduction to tools on the Cray XC system. Making it easier to port and optimise apps on the Cray XC30

Debugging with TotalView

DDT Debugging Techniques

Guillimin HPC Users Meeting July 14, 2016

Debugging with Totalview. Martin Čuma Center for High Performance Computing University of Utah

CS354 gdb Tutorial Written by Chris Feilbach

Short Introduction to Tools on the Cray XC systems

Exercise Session 6 Computer Architecture and Systems Programming

12. Debugging. Overview. COMP1917: Computing 1. Developing Programs. The Programming Cycle. Programming cycle. Do-it-yourself debugging

COSC 6374 Parallel Computation. Debugging MPI applications. Edgar Gabriel. Spring 2008

Allinea DDT Debugger. Dan Mazur, McGill HPC March 5,

Debugging, benchmarking, tuning i.e. software development tools. Martin Čuma Center for High Performance Computing University of Utah

CSE 374 Programming Concepts & Tools

Scientific Programming in C IX. Debugging

Addressing the Increasing Challenges of Debugging on Accelerated HPC Systems. Ed Hinkel Senior Sales Engineer

Debugging. Erwan Demairy Dream

Debugging with TotalView

GPU Debugging Made Easy. David Lecomber CTO, Allinea Software

ECE/ME/EMA/CS 759 High Performance Computing for Engineering Applications

Blue Gene/Q User Workshop. Debugging

Debugging and Profiling

Programming Studio #9 ECE 190

Debugging on Intel Platforms

Coupling DDT and Marmot for Debugging of MPI Applications

Debugging with gdb and valgrind

Laboratory 1 Semester 1 11/12

Programming Environment 4/11/2015

Debugging. ICS312 Machine-Level and Systems Programming. Henri Casanova

Profiling and debugging. Carlos Rosales September 18 th 2009 Texas Advanced Computing Center The University of Texas at Austin

COSC 6374 Parallel Computation. Analytical Modeling of Parallel Programs (I) Edgar Gabriel Fall Execution Time

Lab 8. Follow along with your TA as they demo GDB. Make sure you understand all of the commands, how and when to use them.

Debugging. P.Dagna, M.Cremonesi. May 2015

Introduction to Parallel Programming. Martin Čuma Center for High Performance Computing University of Utah

MPI Application Development with MARMOT

Introduction to Parallel Programming. Martin Čuma Center for High Performance Computing University of Utah

GPU Technology Conference Three Ways to Debug Parallel CUDA Applications: Interactive, Batch, and Corefile

Debugging Your CUDA Applications With CUDA-GDB

Data and File Structures Laboratory

Tips on Using GDB to Track Down and Stamp Out Software Bugs

DEBUGGING ON FERMI PREPARING A DEBUGGABLE APPLICATION GDB. GDB on front-end nodes

IBM PSSC Montpellier Customer Center. Content

Intel Parallel Studio XE 2017 Composer Edition BETA C++ - Debug Solutions Release Notes

CSE 374 Programming Concepts & Tools. Brandon Myers Winter 2015 Lecture 11 gdb and Debugging (Thanks to Hal Perkins)

Tool for Analysing and Checking MPI Applications

Hands-on Workshop on How To Debug Codes at the Institute

Debugging at Scale Lindon Locks

Basic functions of a debugger

ECMWF Workshop on High Performance Computing in Meteorology. 3 rd November Dean Stewart

Improving the Productivity of Scalable Application Development with TotalView May 18th, 2010

Debugging and profiling of MPI programs

Debugging HPC Applications. David Lecomber CTO, Allinea Software

Understanding Dynamic Parallelism

18-600: Recitation #3

Debugging Applications Using Totalview

1. Allowed you to see the value of one or more variables, or 2. Indicated where you were in the execution of a program

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

Debugging for the hybrid-multicore age (A HPC Perspective) David Lecomber CTO, Allinea Software

Performance Analysis and Debugging Tools

CS2141 Software Development using C/C++ Debugging

Introduction to Parallel Programming. Martin Čuma Center for High Performance Computing University of Utah

Tools and Methodology for Ensuring HPC Programs Correctness and Performance. Beau Paisley

Allinea Unified Environment

MPI Runtime Error Detection with MUST and Marmot For the 8th VI-HPS Tuning Workshop

Reviewing gcc, make, gdb, and Linux Editors 1

Scout. A Source-to-Source Transformator for SIMD-Optimizations. Zellescher Weg 12 Willers-Bau A 105 Tel

Scalable Debugging with TotalView on Blue Gene. John DelSignore, CTO TotalView Technologies

Introduction to High Performance Computing at ZIH

Debugging, Profiling and Optimising Scientific Codes. Wadud Miah Research Computing Group

Debugging process. The debugging process can be divided into four main steps: 1. Start your program, specifying anything that might affect its

Development in code_aster Debugging a code_aster execution

Performance Metrics (I)

Source level debugging. October 18, 2016

Using the Debugger. Michael Jantz Dr. Prasad Kulkarni

Developing, Debugging, and Optimizing GPU Codes for High Performance Computing with Allinea Forge

Systems software design. Software build configurations; Debugging, profiling & Quality Assurance tools

LAB #8. Last Survey, I promise!!! Please fill out this really quick survey about paired programming and information about your declared major and CS.

MPI Runtime Error Detection with MUST

Parallel Programming and Debugging with CUDA C. Geoff Gerfin Sr. System Software Engineer

The Dynamic Debugger gdb

Intel MPI Cluster Edition on Graham A First Look! Doug Roberts

STARTING THE DDT DEBUGGER ON MIO, AUN, & MC2. (Mouse over to the left to see thumbnails of all of the slides)

LAB #8. GDB can do four main kinds of things (plus other things in support of these) to help you catch bugs in the act:

The Cray Programming Environment. An Introduction

Using gdb to find the point of failure

Introduction to Parallel Programming. Martin Čuma Center for High Performance Computing University of Utah

Transcription:

Center for Information Services and High Performance Computing (ZIH) Welcome HRSK Practical on Debugging, 03.04.2009 Zellescher Weg 12 Willers-Bau A106 Tel. +49 351-463 - 31945 Matthias Lieber (matthias.lieber@tu-dresden.de) Tobias Hilbrich (tobias.hilbrich@zih.tu-dresden.de)

Agenda 08:00 Introduction 08:30 Typical Bugs and how to avoid them 09:00 The Heat Equation Example 09:30 COFFEE BREAK 09:45 First Steps with GDB 10:30 DDT and Totalview I 11:30 LUNCH BREAK 12:30 DDT and Totalview II 13:30 Memory Debugging 14:00 COFFEE BREAK 14:15 Debugging Multithreaded Applications 15:00 Debugging MPI Applications 16:00 THE END Introduction 2

Center for Information Services and High Performance Computing (ZIH) Introduction HRSK Practical on Debugging, 03.04.2009 Zellescher Weg 12 Willers-Bau A106 Tel. +49 351-463 - 31945 Matthias Lieber (matthias.lieber@tu-dresden.de) Tobias Hilbrich (tobias.hilbrich@zih.tu-dresden.de)

Why using a Debugger? Your program terminates abnormally produces wrong results shows incomprehensible behavior You want to know what your program is (really) doing Typical example: your program crashes with a segmentation fault % gcc myprog.c o myprog %./myprog Segmentation fault % What s going wrong? Introduction 4

What can a Debugger do? Observe a running program: Print variables (scalars, arrays, structures / derived types, classes) Inform about current source code line and function (function call stack) Control the program execution: Stop the program at a specific source code line (Breakpoints) Stop the program by evaluating variable expressions (Conditional Breakpoints and Watchpoints) Stop the program before terminating abnormally Execute the program line-by-line (Stepping) Introduction 5

Function call stack program main... call print_date... end program main subroutine print_date... call date_and_time... end subroutine print_date calls calls Function call stack: information of all active functions of a process which have been called but not yet finished. Stack: #0: date_and_time #1: print_date #2: main subroutine date_and_time... program is here Introduction 6

Typical Usage of a Debugger Compile the program with the g compiler flag gcc g myprog.c o myprog Run the program under control of the debugger: ddt./myprog Locate the position of the problem and examine variables Find out why the program shows unexpected behavior Edit the source code, modify parameters, etc. Repeat until problem is solved Introduction 7

Advanced Debugger Features Support for parallel applications, i.e. observe N processes at a time Graphical display of type structures and pointers Visualization of array contents Memory debugging Modify variables Reverse stepping Introduction 8

Debugging Tools at HRSK vendor / name command graphical user interface parallel support Mars Deimos GNU Debugger gdb Threads GNU Data Display Debugger ddd Threads Allinea Distributed Debugging Tool ddt Totalview totalview Threads, MPI Threads, MPI Valgrind valgrind Threads DUMA duma (yes) Introduction 9

Example: Allinea DDT (Distributed Debugging Tool) Introduction 10

Example: Totalview Introduction 11

Example: GNU Debugger (gdb) Introduction 12

Example: GNU DDD (GUI for GDB) Introduction 13

Debugger Usage at HRSK On login CPUs (not recommended) Works for short runs only (10 minutes runtime limit) As batch job Start your program like normal batch job, but under control of the debugger Closing the debugger finishes the batch job new job necessary for next debugging run From interactive batch session (recommended) Start a shell on compute CPUs and start program from there Very useful if you plan to do multiple debugging sessions: consecutive program runs in one batch job In the interactive batch session you can work like on the login CPUs but with your own private CPUs Introduction 14

DDT Usage at HRSK Compile your code with the g compiler flag (common across all compilers) icc g O0 myprog.c o myprog Set the environment for DDT module load ddt Start the program under control of DDT on the login CPUs (short runs only): ddt./myprog as batch job: bsub W 2:00 n 1 ddt./myprog from interactive batch session: bsub W 2:00 n 1 Is bash ddt./myprog Introduction 15

Debugger Operation Modes: Start program under Debugger Most common way to use a debugger Fully interactive Not useful if you want to observe what the program does after a long runtime Introduction 16

Debugger Operation Modes: Attach to a running Program Debuggers can attach to an already running program Useful if program has been running for a long time You observe incomprehensive behavior (hangs, wrong results) Program was not started under debugger You don t want to rerun the program Introduction 17

Debugger Operation Modes: Core File Debugging Core dumps are memory and register state of a crashed program written to disk These files can be analyzed after program termination with a debugger Must be enabled before starting the program ulimit c <corefile size limit> in the bash Shell Useful if you don t expect a crash or don t want to wait until a crash happens (probably after long runtime) Drawback: Program is not alive anymore Only static analysis of program s data Corefile can become huge, especially for parallel production codes Introduction 18

More Tools Memory debugger Detect dynamic memory management bugs Today: Valgrind, DUMA Correctness checking tools for multithreaded applications Detect faulty use of thread parallelization (e.g. deadlocks) Today: Intel Thread Checker Correctness checking tools for MPI applications Detect wrong use of the MPI library Today: MARMOT Introduction 19

Remarks on Compiler Flags Use compiler s check capabilities like -Wall etc. Read compiler s manual: man {gcc ifort pathcc pgf90...} Intel C Compiler: -Wall -Wp64 -Wuninitialized -strict-ansi Intel Fortran Compiler: -warn all -std95 -C -fpe0 -traceback Always compile your application with the g flag, especially during developing and testing Optimizations often interfere with debugging (e.g. functions or variables of interest are optimized away ) If necessary, compile with O0 to disable optimizations Introduction 20