April 4-7, 2016 Silicon Valley. CUDA DEBUGGING TOOLS IN CUDA8 Vyas Venkataraman, Kudbudeen Jalaludeen, April 6, 2016

Similar documents
Debugging Your CUDA Applications With CUDA-GDB

CUDA Development Using NVIDIA Nsight, Eclipse Edition. David Goodwin

NEW DEVELOPER TOOLS FEATURES IN CUDA 8.0. Sanjiv Satoor

CUDA Tools for Debugging and Profiling

CUDA Tools for Debugging and Profiling. Jiri Kraus (NVIDIA)

ME964 High Performance Computing for Engineering Applications

NSIGHT ECLIPSE EDITION

NSIGHT ECLIPSE EDITION

April 4-7, 2016 Silicon Valley

CSE 591: GPU Programming. Programmer Interface. Klaus Mueller. Computer Science Department Stony Brook University

DEEP DIVE INTO DYNAMIC PARALLELISM

S WHAT THE PROFILER IS TELLING YOU: OPTIMIZING GPU KERNELS. Jakob Progsch, Mathias Wagner GTC 2018

NSIGHT ECLIPSE EDITION

CUDA-GDB: The NVIDIA CUDA Debugger

NVIDIA Parallel Nsight. Jeff Kiel

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

GPU Programming. Rupesh Nasre.

CME 213 S PRING Eric Darve

CUDA-GDB CUDA DEBUGGER

GPU Computing Master Clss. Development Tools

PERFORMANCE OPTIMIZATIONS FOR AUTOMOTIVE SOFTWARE

CUDA-MEMCHECK. DU _v6.5 August User Manual

Hands-on CUDA exercises

PERFORMANCE ANALYSIS AND DEBUGGING FOR VOLTA. Felix Schmitt 11 th Parallel Tools Workshop September 11-12, 2017

OpenACC Course. Office Hour #2 Q&A

CUDA-MEMCHECK. DU _v5.0 October User Manual

ECE 574 Cluster Computing Lecture 17

NVIDIA CUDA DEBUGGER CUDA-GDB. User Manual

CUDA-MEMCHECK. DU _v5.5 July User Manual

Using a debugger. Segmentation fault? GDB to the rescue!

Tesla GPU Computing A Revolution in High Performance Computing

Seamless Compute and OpenGL Graphics Development in NVIDIA Nsight 3.0 Visual Studio Edition and Beyond 3/20/2013

Enabling the Next Generation of Computational Graphics with NVIDIA Nsight Visual Studio Edition. Jeff Kiel Director, Graphics Developer Tools

CUDA PROGRAMMING MODEL. Carlo Nardone Sr. Solution Architect, NVIDIA EMEA

CSC266 Introduction to Parallel Computing using GPUs Introduction to CUDA

CUDA-GDB. NVIDIA CUDA Debugger Release for Linux and Mac. User Manual. DU _V4.0 April 25, 2011

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

GPU Debugging Made Easy. David Lecomber CTO, Allinea Software

PERFWORKS A LIBRARY FOR GPU PERFORMANCE ANALYSIS

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

Debugging with GDB and DDT

CUDA DEBUGGER API. TRM _v7.0 March API Reference Manual

Use Dynamic Analysis Tools on Linux

CUDA DEBUGGER API. TRM _v8.0 February API Reference Manual

Princeton University COS 217: Introduction to Programming Systems GDB Tutorial and Reference

Introduction to CUDA C/C++ Mark Ebersole, NVIDIA CUDA Educator

Lecture 1: an introduction to CUDA

HPC Middle East. KFUPM HPC Workshop April Mohamed Mekias HPC Solutions Consultant. Introduction to CUDA programming

Debugging and Optimization strategies

Fundamental CUDA Optimization. NVIDIA Corporation

Speed Up Your Codes Using GPU

CSE 591: GPU Programming. Using CUDA in Practice. Klaus Mueller. Computer Science Department Stony Brook University

An Evaluation of Unified Memory Technology on NVIDIA GPUs

Red Hat Developer Tools

CSE 599 I Accelerated Computing Programming GPUS. Intro to CUDA C

Debugging with GDB and DDT

ECE 574 Cluster Computing Lecture 15

CUDA Workshop. High Performance GPU computing EXEBIT Karthikeyan

Fundamental CUDA Optimization. NVIDIA Corporation

An Introduction to GPU Architecture and CUDA C/C++ Programming. Bin Chen April 4, 2018 Research Computing Center

CSE 351. GDB Introduction

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

NEW FEATURES IN CUDA 6 MAKE GPU ACCELERATION EASIER MARK HARRIS

CptS 360 (System Programming) Unit 4: Debugging

TotalView. Debugging Tool Presentation. Josip Jakić

GPGPU/CUDA/C Workshop 2012

GPU Programming Introduction

CUDA-MEMCHECK. DU _v03 February 17, User Manual

NVIDIA GPU CODING & COMPUTING

Debug for GDB Users. Action Description Debug GDB $debug <program> <args> >create <program> <args>

CUDA Programming Model

Red Hat Developer Tools

Blocks, Grids, and Shared Memory

CUDA OPTIMIZATIONS ISC 2011 Tutorial

Practical Introduction to CUDA and GPU

CUDA C/C++ Basics GTC 2012 Justin Luitjens, NVIDIA Corporation

Introduction to GPU hardware and to CUDA

Introduction to CUDA C

CUDA and GPU Performance Tuning Fundamentals: A hands-on introduction. Francesco Rossi University of Bologna and INFN

Profiling High Level Heterogeneous Programs

GPU Fundamentals Jeff Larkin November 14, 2016

LDetector: A low overhead data race detector for GPU programs

Guillimin HPC Users Meeting July 14, 2016

Hands-on CUDA Optimization. CUDA Workshop

Advanced CUDA Optimization 1. Introduction

NVIDIA Nsight Visual Studio Edition 4.0 A Fast-Forward of All the Greatness of the Latest Edition. Sébastien Dominé, NVIDIA

PASCAL COMPATIBILITY GUIDE FOR CUDA APPLICATIONS

AMD CodeXL 1.3 GA Release Notes

Kernel optimizations Launch configuration Global memory throughput Shared memory access Instruction throughput / control flow

Exercise Session 6 Computer Architecture and Systems Programming

Profilers and Debuggers. Introductory Material. One-Slide Summary

CUDA Lecture 2. Manfred Liebmann. Technische Universität München Chair of Optimal Control Center for Mathematical Sciences, M17

Node.js I Getting Started

Introduction to CUDA

Stream Processing with CUDA TM A Case Study Using Gamebryo's Floodgate Technology

Advanced CUDA Optimizations. Umar Arshad ArrayFire

Assembly Language Fundamentals

System Wide Tracing User Need

Introduction to CUDA CME343 / ME May James Balfour [ NVIDIA Research

KEPLER COMPATIBILITY GUIDE FOR CUDA APPLICATIONS

Transcription:

April 4-7, 2016 Silicon Valley CUDA DEBUGGING TOOLS IN CUDA8 Vyas Venkataraman, Kudbudeen Jalaludeen, April 6, 2016

AGENDA General debugging approaches Cuda-gdb Demo 2

CUDA API CHECKING CUDA calls are asynchronous Errors returned by any subsequent call Check return status of CUDA API calls CUDA Runtime API cudaerror_t CUDA Driver API Curesult CUDA-GDB and CUDA-MEMCHECK have modes to do these checks 3

PRINTF() Device side printf() Output flushed to screen at explicit sync points No inter-thread ordering guarantee Increase backing storage cudadevicesetlimit(cudalimitprintfifosize, size) Include stdio.h to use in program 4

ASSERT() Stops device if conditional evaluates to 0 Error message printed to stderr All subsequent CUDA API calls will return error Include assert.h to use in program 5

NVCC COMPILER OPTIONS Device side debug : -G Full debug information (variables, functions, line number) Disables optimization Line number information only : -lineinfo No variable, function debug information No impact on optimizations 6

CUDA-MEMCHECK Functional correctness checking tool suite Part of CUDA toolkit Multiple tools memcheck : reports out of bounds/misaligned memory access errors racecheck : identifies races on shared memory initcheck : usage of uninitialized global memory synccheck : identify invalid usage of syncthreads() in applications Documentation : http://docs.nvidia.com/cuda/cuda-memcheck/index.html 7

CUDA-GDB 8

WHAT IS CUDA-GDB Overview Command line source and assembly (SASS) level debugger Feature parity with Nsight Eclipse Edition Simultaneous CPU and GPU debugging Inspect and modify memory, register, variable state Control program execution Runtime GPU error detection Support for multiple GPUs, multiple contexts, multiple kernels 9

LAUNCHING CUDA-GDB Overview Shipped as part of CUDA toolkit Supports all CUDA capable GPUs Supported on CUDA supported Linux distributions Binary called cuda-gdb, accepts standard GDB command line parameters $ cuda-gdb./my_app $ cuda-gdb --pid pid_to_attach_to 10

EXECUTION CONTROL Usage Identical to using GDB Launching application (cuda-gdb) run Resume application after a breakpoint (cuda-gdb) continue Kill application (cuda-gdb) Kill Interrupt the application : CTRL + C 11

BREAKPOINTS Usage By name (cuda-gdb) break bitreverse (cuda-gdb) break _Z10bitreversePv By file name and line number (cuda-gdb) break bitreverse.cu:10 By address (cuda-gdb) break *0xaf2468 At every CUDA kernel launch (cuda-gdb) set cuda break_on_launch application 12

CONDITIONAL BREAKPOINTS Usage Breakpoint is reported if condition is met Condition evaluated for all threads Condition follows C/C++ syntax (cuda-gdb) break bitreverse if (threadidx.x==33) (cuda-gdb) condition bpnum (threadidx.x==33) 13

THREAD FOCUS Overview Needed for thread specific commands 7 dimensional logical value to identify a thread Focus components kernel : Unique identifier, assigned to each kernel launch block : 3 dimensional block index blockidx.{x,y,z} thread : 3 dimensional thread index threadidx.{x,y,z} 14

THREAD FOCUS Get current focus Omitted focus components ignored (cuda-gdb) cuda kernel block thread kernel 2 block (2,0,0) thread (5,0,0) (cuda-gdb) cuda thread thread (5,0,0) 15

THREAD FOCUS Listing GPU state List all kernels, blocks, threads (cuda-gdb) info cuda kernels (cuda-gdb) info cuda blocks (cuda-gdb) info cuda threads Optional component specified focus filter (cuda-gdb) info cuda threads kernel 0 block (1,0,0) thread(31,0,0) (cuda-gdb) info cuda threads block (2,0,0) (cuda-gdb) info cuda threads kernel 0 16

THREAD FOCUS Switching focus Specify target focus Omitted components are assumed to stay same (cuda-gdb) cuda kernel 1 block 1,0,0 thread 5,7,0 (cuda-gdb) cuda kernel 2 block 4 (cuda-gdb) cuda thread 8 17

VARIABLES AND MEMORY Read a source variable or address (cuda-gdb) print my_variable (cuda-gdb) print *0x506b00000 Write a source variable or address (cuda-gdb) set my_variable = 2 (cuda-gdb) set *0x506b00000 = 3.0 Access GPU memory segments using specifiers @global, @shared, @local, @generic, @texture, @parameter, @managed 18

ATTACHING WITH CUDA-GDB No special environment variables required Full cuda-gdb functionality available after attach (cuda-gdb) attach PID $ cuda-gdb process_image PID Detach and resume application execution 19

ATTACH ON GPU EXCEPTIONS Allows CUDA application to wait when GPU exception is hit Run application with environment variable CUDA_DEVICE_WAITS_ON_EXCEPTION=1 $ CUDA_DEVICE_WAITS_ON_EXCEPTION=1./my_app On GPU exception, message is printed Can attach with cuda-gdb 20

GENERATING GPU COREDUMP GPU Coredump Enabled via environment variable $ CUDA_ENABLE_COREDUMP_ON_EXCEPTION=1./my_app By default, GPU coredump causes a CPU coredump Use environment variable CUDA_ENABLE_CPU_COREDUMP_ON_EXCEPTION to disable Default filename core_timestamp_hostname_pid.nvcudmp Environment variable CUDA_COREDUMP_FILE to set custom filename Special format specifiers : %p (PID) ; %h (hostname) ; %t (timestamp) 21

LOADING A GPU COREDUMP GPU Coredump Use target cudacore (cuda-gdb) target cudacore gpu_coredump_file.nvcudmp Loading both CPU and GPU coredump files simultaneously (cuda-gdb) target core core.cpu gpu_coredump_file.nvcudmp 22

CUDA ERROR REPORTING Usage CUDA API errors can be displayed, stopped on or hidden (cuda-gdb) set cuda api failures [ignore stop hide] Enhanced interoperation with cuda-memcheck (cuda-gdb) set cuda memcheck on 23

CUDA SPECIAL OPTIONS Read the CUDA Dynamic Parallelism (CDP) launch information (cuda-gdb) info cuda launch trace Read the list of allocations created via managed (cuda-gdb) info cuda managed 24

WHAT S NEW IN CUDA 8.0 25

NEW FEATURES IN CUDA 8.0 Support for Pascal SM 6.0 Support for Pascal Unified Memory Compute Preemption Debugging 26

COMPUTE PREEMPTION Functionality available on Pascal and newer GPUs Periodic preemption of compute contexts Enables applications with long running compute threads Always enabled on Pascal GPUs 27

DEBUG ON DISPLAY GPU WITH NO RESTRICTIONS 28

RUN GRAPHICS APPLICATIONS WHILE DEBUGGING CUDA APPLICATIONS 29

RUN MULTIPLE DEBUGGER SESSIONS 30

DEBUG CUDA/OPENGL INTEROP APPLICATIONS 31

UNIFIED MEMORY Information on hitting a process signal on managed memory Support to read static managed variables For cudamallocmanaged() allocated memory, no extra migrations 32

DEMO 33

COMPUTE PREEMPTION DEBUGGING Set up Single Machine(Ubuntu) with single Pascal GPU Full support for all cuda-gdb features 34

ADDITIONAL RESOURCES NVIDIA Nsight: http://www.nvidia.com/nsight CUDA-GDB : http://docs.nvidia.com/cuda/cuda-gdb/index.html CUDA-MEMCHECK : http://docs.nvidia.com/cuda/cuda-memcheck/index.html S6176 - Inside Pascal Talk S6224 - CUDA8 and Beyond S6810 - Optimizing Application Performance with CUDA Profiling Tools Thu. 4/7, 10:00am, Room 211B L6135A & L6135B - Jetson Developer Tools Lab Wed. 4/6, 1:30pm & 3:30pm, Room 210C 35

April 4-7, 2016 Silicon Valley THANK YOU JOIN THE NVIDIA DEVELOPER PROGRAM AT developer.nvidia.com/join