Summary
All OMPD library interactions with the OpenMP program must be through a set of callbacks that the
third-party tool provides. These callbacks must also be used for allocating or releasing resources, such as
memory, that the OMPD library needs.
Description
The set of callbacks that the OMPD library must use is collected in the ompd_callbacks_t structure.
An instance of this type is passed to the OMPD library as a parameter to ompd_initialize
(see Section 5.5.1.1). Each field points to a function that the OMPD library must use either to interact with
the OpenMP program or for memory operations.
The alloc_memory and free_memory fields are pointers to functions the OMPD library uses to allocate and
to release dynamic memory.
The print_string field points to a function that prints a string.
The architecture on which the OMPD library and third-party tool execute may be different from the
architecture on which the OpenMP program that is being examined executes. The sizeof_type field
points to a function that allows the OMPD library to determine the sizes of the basic integer
and pointer types that the OpenMP program uses. Because of the potential differences in the
targeted architectures, the conventions for representing data in the OMPD library and the OpenMP
program may be different. The device_to_host field points to a function that translates data from
the conventions that the OpenMP program uses to those that the third-party tool and OMPD
library use. The reverse operation is performed by the function to which the host_to_device field
points.
The symbol_addr_lookup field points to a callback that the OMPD library can use to find the address of a
global or thread local storage symbol. The read_memory, read_string and write_memory fields are pointers
to functions for reading from and writing to global memory or thread local storage in the OpenMP
program.
The get_thread_context_for_thread_id field is a pointer to a function that the OMPD library can use to
obtain a thread context that corresponds to a native thread identifier.
Cross References
ompd_callback_memory_alloc_fn_t
type,
see
Section 5.4.1.1.
ompd_callback_memory_free_fn_t
type,
see
Section 5.4.1.2.
ompd_callback_get_thread_context_for_thread_id_fn_t
type,
see
Section 5.4.2.1.
ompd_callback_sizeof_fn_t
type,
see
Section 5.4.2.2.
ompd_callback_symbol_addr_fn_t
type,
see
Section 5.4.3.1.
ompd_callback_memory_read_fn_t
type,
see
Section 5.4.3.2.
ompd_callback_memory_write_fn_t
type,
see
Section 5.4.3.3.
ompd_callback_device_host_fn_t
type,
see
Section 5.4.4.
ompd_callback_print_string_fn_t
type,
see
Section 5.4.5