18.2.396. MPI_T_event_get_num

MPI_T_event_get_num — Query the number of MPI_T event types

18.2.396.1. SYNTAX

18.2.396.1.1. C Syntax

int MPI_T_event_get_num(int* num_events)

18.2.396.2. OUTPUT PARAMETERS

  • num_events: Returns number of event types

18.2.396.3. DESCRIPTION

MPI_T_event_get_num can be used to query the current number of MPI_T event types.

The number of available event types can be queried with a call to MPI_T_event_get_num. An MPI implementation is allowed to increase the number of event types during the execution of an MPI process. However, MPI implementations are not allowed to change the index of an event type or to delete an event type once it has been made visible to the user.

Note

The set of event types Open MPI exports depends on the platform and on MCA parameters. With all built-in producers disabled (the MCA parameter mca_base_event_register_producers set to 0) the count is 0.

18.2.396.4. DISCOVERING AVAILABLE EVENTS

Open MPI registers a set of event types and sources, such as communicator and session lifecycle, error-handler invocations, and (where the OS supports it) memory releases. To list the registered sources and event types from the command line, use:

ompi_info --event

To enumerate them programmatically, query the count and then each event’s metadata with MPI_T_event_get_info:

#include <mpi.h>
#include <stdio.h>

int main(void) {
    int provided, i, num = 0;
    MPI_T_init_thread(MPI_THREAD_SINGLE, &provided);
    MPI_T_event_get_num(&num);
    for (i = 0; i < num; ++i) {
        char name[256];
        int name_len = sizeof(name), num_elements = 0, verbosity, bind;
        MPI_T_event_get_info(i, name, &name_len, &verbosity, NULL, NULL,
                             &num_elements, NULL, NULL, NULL, NULL, &bind);
        printf("event %d: %s (%d elements)\n", i, name, num_elements);
    }
    MPI_T_finalize();
    return 0;
}

18.2.396.5. ERRORS

MPI_T_event_get_num will fail if:

  • MPI_T_ERR_NOT_INITIALIZED: The MPI Tools interface is not initialized

See also