Skip to content

Handle Debugging:Type queries

Marc-Andre edited this page Apr 8, 2025 · 10 revisions

Type queries

These functions are analogous to the mpid_comm_* functions, but for MPI_Datatype.

//typedef union langHandle {mpid_address_t cType, int64 fortranType} langHandle;
typedef langHandle mpid_address_t;
int mpid_type_query(mpid_process_handle_t *process,
                    langHandle type,  // The MPI handle
                    int language, // mpid_TYPE_LANG_C or mpid_TYPE_LANG_FORTRAN 
                    mpid_type_handle_t **handle);  // The debugging handle


/*int mpid_ext_type_query(mpid_process_handle_t *process,
                          void* type,  // Pointer to the bytes of an MPI handle
                          size_t length, // Size of the handle
                          int language, // mpid_TYPE_LANG_C or mpid_TYPE_LANG_FORTRAN 
                          mpid_type_handle_t **handle);  // The debugging handle*/

MPI_Send(... , type = MPI_INT, );

Break at MPI_Send, if sendtype == MPI_INTEGER.

Function to query a Type debugging handle by name (e.g. MPI_INTEGER):

int mpid_type_query_by_name(mpid_process_handle_t *process,
                            const char* name, // The MPI handle
                            mpid_type_handle_t **handle);  // The debugging handle

Free a handle returned by the mpid_type_query() function.

int mpid_type_handle_free(mpid_type_handle_t *handle);

Function to query the list of predefined data types

int mpid_type_query_predefined_map(mpid_process_handle_t *process,
                                   mpid_name_map_t **mpid_type_name_map,
                                   int64 *num_elements);

enum mpid_type_bitmap_t{
  MPID_TYPE_KIND_INT = 0x1,
  MPID_TYPE_KIND_UINT = 0x2,
  MPID_TYPE_KIND_FLOAT = 0x4,
  MPID_TYPE_KIND_COMPLEX = 0x8,
  MPID_TYPE_KIND_NONTRIVIAL = 0x10, // use the combiner to get the structure (MPI_DOUBLE_INT)
  MPID_TYPE_LANG_C = 0x100,
  MPID_TYPE_LANG_FORTRAN = 0x200
};

mpid_name_map_t {
    /* Name of the handle */
    char *map_name;
    /* Size of the datatype in byte */
    int size;
    /* Handle that the name corresponds to.  Will be 0/NULL if there
       is no corresponding back-end object. */
    mpid_address_t type_c_handle; // allways C handle value
    int64 type_fortran_handle;
    enum mpid_type_bitmap_t kind;
};

Basic query function:

int mpid_type_query_basic(
        mpid_type_handle_t *handle,
        char **type_name,                         // or: use enum for all predefined types
        enum mpid_type_info_bitmap_t *type_bitflags,
        int64 *type_size,
        int64 *type_extent,                       // or in a separate query
        int64 *type_real_extent,                  // or in a separate query
        int64 *type_fortran_handle,
        int64 *type_fortran90_handle, /* might this be different? */
        mpid_address_t *type_c_handle,
        /*mpid_address_t *type_cxx_handle,   was deprecated and removed*/
?        mpid_keyvalue_pair_t **comm_extra_info);

Envelope functions:

int mpid_type_query_envelope(
        mpid_type_handle_t *handle,
        int64 *num_integers,
        int64 *num_addresses,
        int64 *num_datatypes);
int mpid_type_query_combiner(
        mpid_type_handle_t *handle,
        int64 max_integers,
        int64 max_addresses,
        int64 max_datatypes,
        int64 array_of_integers[],
        int64 array_of_addresses[],
        mpid_address_t array_of_type_mpi_handle[], // used to lookup predefined types in the map
        mpid_type_handle_t array_of_type_dbg_handle[] // used for further exploration);
mpid_dict_item {mpid_attr; mpid_type type; int len; void* value};

mpid_type_query_constructor{mpid_type_handle_t *handle,
                              mpid_dict_item** result}

For subarray type: 

result = [{mpid_attr_ndims, mpid_int, 1, value=},
{mpid_attr_arr_of_sizes, mpid_int_arr, 5, value=},
{mpid_attr_arr_of_subsizes, mpid_int_arr, 5, value=},
{mpid_attr_arr_of_starts, mpid_int_arr, 5, value=},
{mpid_order, mpid_int, 1, value=},
{mpid_oldtype, mpid_dtype, 1, value=}]

Clone this wiki locally