HOME
| OPENMP API Specification: "Version 5.2 -- GIT rev 95b2e3a44"

20  OMPD Interface

This chapter describes OMPD, which is an interface for third-party tools. Third-party tools exist in separate processes from the OpenMP program. To provide OMPD support, an OpenMP implementation must provide an OMPD library that the third-party tool can load. An OpenMP implementation does not need to maintain any extra information to support OMPD inquiries from third-party tools unless it is explicitly instructed to do so.

OMPD allows third-party tools such as debuggers to inspect the OpenMP state of a live program or core file in an implementation-agnostic manner. That is, a third-party tool that uses OMPD should work with any conforming OpenMP implementation. An OpenMP implementer provides a library for OMPD that a third-party tool can dynamically load. The third-party tool can use the interface exported by the OMPD library to inspect the OpenMP state of a program. In order to satisfy requests from the third-party tool, the OMPD library may need to read data from the OpenMP program, or to find the addresses of symbols in it. The OMPD library provides this functionality through a callback interface that the third-party tool must instantiate for the OMPD library.

To use OMPD, the third-party tool loads the OMPD library. The OMPD library exports the API that is defined throughout this section, and the third-party tool uses the API to determine OpenMP information about the OpenMP program. The OMPD library must look up the symbols and read data out of the program. It does not perform these operations directly but instead directs the third- party tool to perform them by using the callback interface that the third-party tool exports.

The OMPD design insulates third-party tools from the internal structure of the OpenMP runtime, while the OMPD library is insulated from the details of how to access the OpenMP program. This decoupled design allows for flexibility in how the OpenMP program and third-party tool are deployed, so that, for example, the third-party tool and the OpenMP program are not required to execute on the same machine.

Generally, the third-party tool does not interact directly with the OpenMP runtime but instead interacts with the runtime through the OMPD library. However, a few cases require the third-party tool to access the OpenMP runtime directly. These cases fall into two broad categories. The first is during initialization where the third-party tool must look up symbols and read variables in the OpenMP runtime in order to identify the OMPD library that it should use, which is discussed in Section 20.2.2 and Section 20.2.3. The second category relates to arranging for the third-party tool to be notified when certain events occur during the execution of the OpenMP program. For this purpose, the OpenMP implementation must define certain symbols in the runtime code, as is discussed in Section 20.6. Each of these symbols corresponds to an event type. The OpenMP runtime must ensure that control passes through the appropriate named location when events occur. If the third-party tool requires notification of an event, it can plant a breakpoint at the matching location. The location can, but may not, be a function. It can, for example, simply be a label. However, the names of the locations must have external C linkage.

  20.3.4  Address Type
  20.3.5  Frame Information Type
  20.3.6  System Device Identifiers
  20.3.7  Native Thread Identifiers
  20.3.8  OMPD Handle Types
  20.3.9  OMPD Scope Types
  20.3.10  ICV ID Type
  20.3.11  Tool Context Types
  20.3.12  Return Code Types
  20.3.13  Primitive Type Sizes
 20.4  OMPD Third-Party Tool Callback Interface
  20.4.1  Memory Management of OMPD Library
  20.4.2  Context Management and Navigation
  20.4.3  Accessing Memory in the OpenMP Program or Runtime
  20.4.4  Data Format Conversion: ompd_callback_device_host_fn_t
  20.4.5  ompd_callback_print_string_fn_t
  20.4.6  The Callback Interface
 20.5  OMPD Tool Interface Routines
  20.5.1  Per OMPD Library Initialization and Finalization
  20.5.2  Per OpenMP Process Initialization and Finalization
  20.5.3  Thread and Signal Safety
  20.5.4  Address Space Information
  20.5.5  Thread Handles
  20.5.6  Parallel Region Handles
  20.5.7  Task Handles
  20.5.8  Querying Thread States
  20.5.9  Display Control Variables
  20.5.10  Accessing Scope-Specific Information
 20.6  Runtime Entry Points for OMPD
  20.6.1  Beginning Parallel Regions
  20.6.2  Ending Parallel Regions
  20.6.3  Beginning Task Regions
  20.6.4  Ending Task Regions
  20.6.5  Beginning OpenMP Threads
  20.6.6  Ending OpenMP Threads
  20.6.7  Initializing OpenMP Devices
  20.6.8  Finalizing OpenMP Devices