PGDBG

From Alliance Doc
Revision as of 19:25, 19 July 2019 by Diane27 (talk | contribs)
Jump to navigation Jump to search
Other languages:

Description

PGDBG est un outil simple mais puissant pour le débogage d’applications parallèles MPI et OpenMP sous Linux. L’outil fait partie du paquet du compilateur PGI et est configuré pour OpenMP avec fils parallèles. Il peut être utilisé en mode ligne de commande ou en mode graphique avec redirection X11.

Un débogueur GNU comme GDB conviendra pour la plupart des programmes C, C++ ou Fortran77. Cependant, GDB ne fonctionne pas très bien avec les programmes Fortran 90/95; c’est pourquoi le Portland Group a développé pgdbg.

Guide de démarrage

Le travail avec PFDBG s’effectue généralement en deux étapes :

  1. compilation : le code est compilé (avec l’option -g pour obtenir les symboles de débogage);
  2. exécution et débogage : le code est exécuté et les résultats sont analysés.

Le débogage peut se faire en mode ligne de commande ou en mode graphique.


Modules d’environnement

Il faut d’abord charger le module pour le paquet PGI. Pour connaître les versions disponibles pour les modules du compilateur, de MPI et de CUDA que vous avez chargés, lancez module avail pgi. Pour connaître la liste complète des modules PGI disponibles, lancez module -r spider '.*pgi.*'. En date de décembre 2018, les versions disponibles sont

  • pgi/13.10
  • pgi/17.3

Pour charger un module, lancez module load pgi/version; par exemple, pour la version 17.3, la commande est

Question.png
[name@server ~]$ module load pgi/17.3

Compilation

Avant d’être débogué, le code doit d’abord être compilé en ajoutant l’indicateur -g pour obtenir les renseignements utiles au débogage.

Question.png
[name@server ~]$ pgcc -g program.c -o program

Command-line mode

Once your code is compiled with the proper options, you can run the PGDBG for the analysis. The debugger's default user interface is a graphical user interface or GUI. However, if for some reasons you don't want to run in GUI or don't have X11 forwarding, you can run pgdbg in a text mode by adding an extra option "-text" :

Question.png
[name@server ~]$ pgdbg -text program arg1 arg2

Once the PGDBG is invoked in the command-line mode, you will have an access to prompt:

Question.png
[name@server ~]$ pgdbg -text program 
PGDBG 17.3-0 x86-64 (Cluster, 256 Process)
PGI Compilers and Tools
Copyright (c) 2017, NVIDIA CORPORATION.  All rights reserved.
Loaded: /home/user/program
pgdbg>

Before you can debug you need to execute run in the prompt:

Question.png
[name@server ~]$ 
pgdbg> run

PGDBG automatically attaches to new threads as they are created during program execution. PGDBG describes when a new thread is created. During a debug session, at any one time, PGDBG operates in the context of a single thread, the current thread. The current thread is chosen by using the thread command. The threads command lists all threads currently employed by an active program:

Question.png
[name@server ~]$ pgdbg > threads
0  ID PID    STATE      SIGNAL      LOCATION
   3  18399  Stopped    SIGTRAP     main line: 31 in "omp.c" address: 0x80490ab
=> 2  18398  Stopped    SIGTRAP     main line: 32 in "omp.c" address: 0x80490cf
   1  18397  Stopped    SIGTRAP     main line: 31 in "omp.c" address: 0x80490ab
   0  18395  Stopped    SIGTRAP     f line: 5 in "omp.c" address: 0x8048fa0

For example, now we switch the context to thread with ID 2. Use command thread to do so:

Question.png
[name@server ~]$ pgdbg > thread 3
pgdbg > threads
0  ID PID    STATE      SIGNAL      LOCATION
=> 3  18399  Stopped    SIGTRAP     main line: 31 in "omp.c" address: 0x80490ab
   2  18398  Stopped    SIGTRAP     main line: 32 in "omp.c" address: 0x80490cf
   1  18397  Stopped    SIGTRAP     main line: 31 in "omp.c" address: 0x80490ab
   0  18395  Stopped    SIGTRAP     f line: 5 in "omp.c" address: 0x8048fa0

Graphical mode

This is the default user interface of the PGDBG debugger. If you have set the X11 forwarding then the PGDBG will start in the graphical mode in a pop-up window.

PGDGB in graphical mode(click for a larger image)

As the illustration shows, the GUI is divided into several areas:

  • menu bar
  • main toolbar
  • source window
  • program I/O window
  • and debug information tabs.

Menu bar

The main menu bar contains these menus: File, Edit, View, Connections, Debug and Help. This section describes these menus and their contents. You can navigate the menus using the mouse or the system’s mouseless modifier.

Main toolbar

The debugger's main toolbar contains several buttons and four drop-down lists. The first drop-down list displays the current process or in other words, the current thread. The list’s label changes depending on whether processes or threads are described. When multiple threads are available use this drop-down list to specify which process or thread should be the current one.

Drop-Down Lists on Toolbar(click for a larger image)

The second drop-down list is labeled Apply. The selection in the Apply drop-down determines the set of processes and threads to which action commands are applied. The third drop-down list is labeled Display. The selection in the Display drop-down determines the set of processes and threads to which data display commands are applied.

The fourth drop-down list, labeled as File, displays the source file that contains the current target location.

Source window

The source window (shown on the figure below) and all of the debug information tabs are dockable tabs, meaning that they can be taken apart from the main window. This can be done by double-clicking the tab. The source window shows the source code for the current session.

The source window contains a number of visual aids that allow you to know more about the execution of your code.(click for a larger image)

Program I/O Window

Program output is displayed in the Program IO tab’s central window. Program input is entered into this tab’s Input field.

Debug information tab

Debug information tabs take up the lower half of the debugger GUI. Each of these tabs provides a particular function or view of debug information. The following sections discuss the tabs as they appear from left-to-right in the GUI’s default configuration.

References