Cuda-Gdb Cuda Debugger
Total Page:16
File Type:pdf, Size:1020Kb
CUDA-GDB CUDA DEBUGGER DU-05227-042 _v5.0 | October 2012 User Manual TABLE OF CONTENTS Chapter 1. Introduction.........................................................................................1 1.1 What is CUDA-GDB?...................................................................................... 1 1.2 Supported Features...................................................................................... 1 1.3 About This Document.................................................................................... 2 Chapter 2. Release Notes...................................................................................... 3 Chapter 3. Getting Started.....................................................................................6 3.1 Installation Instructions..................................................................................6 3.2 Setting Up the Debugger Environment................................................................6 3.2.1 Linux...................................................................................................6 3.2.2 Mac OS X............................................................................................. 6 3.2.3 Temporary Directory................................................................................ 7 3.3 Compiling the Application...............................................................................8 3.3.1 Debug Compilation.................................................................................. 8 3.3.2 Compiling for Fermi GPUs......................................................................... 8 3.3.3 Compiling for Fermi and Tesla GPUs.............................................................8 3.4 Using the Debugger...................................................................................... 8 3.4.1 Single GPU Debugging.............................................................................. 9 3.4.2 Multi-GPU Debugging............................................................................... 9 3.4.3 Multi-GPU Debugging in Console Mode.......................................................... 9 3.4.4 Multi-GPU Debugging with the Desktop Manager Running.................................... 9 3.4.5 Remote Debugging................................................................................. 11 3.4.6 Multiple Debuggers................................................................................ 11 3.4.7 Attaching/Detaching...............................................................................12 3.4.8 CUDA/OpenGL Interop Applications on Linux................................................. 12 Chapter 4. CUDA-GDB Extensions........................................................................... 13 4.1 Command Naming Convention........................................................................ 13 4.2 Getting Help............................................................................................. 13 4.3 Initialization File........................................................................................ 13 4.4 GUI Integration.......................................................................................... 14 Chapter 5. Kernel Focus...................................................................................... 15 5.1 Software Coordinates vs. Hardware Coordinates.................................................. 15 5.2 Current Focus............................................................................................ 15 5.3 Switching Focus..........................................................................................16 Chapter 6. Program Execution...............................................................................17 6.1 Interrupting the Application...........................................................................17 6.2 Single Stepping.......................................................................................... 17 Chapter 7. Breakpoints........................................................................................ 19 7.1 Symbolic Breakpoints................................................................................... 19 7.2 Line Breakpoints.........................................................................................20 7.3 Address Breakpoints.................................................................................... 20 www.nvidia.com CUDA Debugger DU-05227-042 _v5.0 | ii 7.4 Kernel Entry Breakpoints.............................................................................. 20 7.5 Conditional Breakpoints................................................................................ 20 Chapter 8. Inspecting Program State....................................................................... 22 8.1 Memory and Variables.................................................................................. 22 8.2 Variable Storage and Accessibility....................................................................22 8.3 Inspecting Textures..................................................................................... 23 8.4 Info CUDA Commands.................................................................................. 23 8.4.1 info cuda devices.................................................................................. 24 8.4.2 info cuda sms.......................................................................................24 8.4.3 info cuda warps.................................................................................... 25 8.4.4 info cuda lanes.....................................................................................25 8.4.5 info cuda kernels.................................................................................. 26 8.4.6 info cuda blocks................................................................................... 26 8.4.7 info cuda threads.................................................................................. 27 Chapter 9. Context and Kernel Events.................................................................... 29 9.1 Display CUDA context events......................................................................... 29 9.2 Display CUDA kernel events........................................................................... 29 9.3 Examples of displayed events.........................................................................29 Chapter 10. Checking Memory Errors...................................................................... 31 10.1 Increasing the Precision of Memory Errors With Autostep.......................................31 10.1.1 Usage............................................................................................... 32 10.1.2 Related Commands............................................................................... 33 10.1.2.1 info autosteps............................................................................... 33 10.1.2.2 disable autosteps n......................................................................... 33 10.1.2.3 delete autosteps n..........................................................................33 10.1.2.4 ignore n i.....................................................................................33 10.2 GPU Error Reporting...................................................................................33 Chapter 11. Walk-Through Examples.......................................................................36 11.1 Example 1: bitreverse................................................................................ 36 11.1.1 Walking through the Code...................................................................... 37 11.2 Example 2: autostep.................................................................................. 40 11.2.1 Debugging with Autosteps.......................................................................40 11.3 Example 3: Debugging an MPI CUDA Application................................................. 41 Appendix A. Supported Platforms...........................................................................44 A.1 Host Platform Requirements.......................................................................... 44 Appendix B. Known Issues.................................................................................... 46 www.nvidia.com CUDA Debugger DU-05227-042 _v5.0 | iii LIST OF FIGURES Figure 1 deviceQuery Output................................................................................. 11 www.nvidia.com CUDA Debugger DU-05227-042 _v5.0 | iv LIST OF TABLES Table 1 CUDA Exception Codes............................................................................... 34 www.nvidia.com CUDA Debugger DU-05227-042 _v5.0 | v www.nvidia.com CUDA Debugger DU-05227-042 _v5.0 | vi Chapter 1. INTRODUCTION This document introduces CUDA-GDB, the NVIDIA® CUDA™ debugger for Linux and Mac OS. 1.1 What is CUDA-GDB? CUDA-GDB is the NVIDIA tool for debugging CUDA applications running on Linux and Mac. CUDA-GDB is an extension to the x86-64 port of GDB, the GNU Project debugger. The tool provides developers with a mechanism for debugging CUDA applications running on actual hardware. This enables developers to debug applications without the potential variations introduced by simulation and emulation environments. CUDA-GDB runs on Linux and Mac OS X, 32-bit and 64-bit. CUDA-GDB is based on GDB 7.2 on both Linux and Mac OS X. 1.2 Supported Features CUDA-GDB is designed to present the user with a seamless debugging