Skip to content

Handle Debugging:Type queries

Joachim edited this page Apr 22, 2024 · 8 revisions

Type queries

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

//typedef union langHandle {mqs_taddr_t cType, int64 fortranType} langHandle;
typedef langHandle mqs_taddr_t;
int mpidbg_type_query(mqs_process *process,
                      langHandle type,  // The MPI handle
                      int language, // MPIDBG_TYPE_LANG_C or MPIDBG_TYPE_LANG_FORTRAN 
                      struct mpidbg_type_handle_t **handle);  // The debugging handle


/*int mpidbg_ext_type_query(mqs_process *process,
                      void* type,  // Pointer to the bytes of an MPI handle
                      size_t length, // Size of the handle
                      int language, // MPIDBG_TYPE_LANG_C or MPIDBG_TYPE_LANG_FORTRAN 
                      struct mpidbg_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 mpidbg_type_query_by_name(mqs_process *process,
                      const char* name, // The MPI handle
                      struct mpidbg_type_handle_t **handle);  // The debugging handle

Free a handle returned by the mpidbg_type_query() function.

int mpidbg_type_handle_free(struct mpidbg_type_handle_t *handle);

Function to query the list of predefined data types

int mpidbg_type_query_predefined_map(mqs_process *process,
                                    struct mpidbg_name_map_t **mpidbg_type_name_map,
                                    int64 *num_elements);

enum mpidbg_type_bitmap_t{
  MPIDBG_TYPE_KIND_INT = 0x1,
  MPIDBG_TYPE_KIND_UINT = 0x2,
  MPIDBG_TYPE_KIND_FLOAT = 0x4,
  MPIDBG_TYPE_KIND_COMPLEX = 0x8,
  MPIDBG_TYPE_KIND_NONTRIVIAL = 0x10, // use the combiner to get the structure (MPI_DOUBLE_INT)
  MPIDBG_TYPE_LANG_C = 0x100,
  MPIDBG_TYPE_LANG_FORTRAN = 0x200
};

struct mpidbg_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. */
    mqs_taddr_t type_c_handle; // allways C handle value
    int64 type_fortran_handle;
    enum mpidbg_type_bitmap_t kind;
};

Basic query function:

int mpidbg_type_query_basic(
                      struct mpidbg_type_handle_t *handle,
                      char **type_name,                         // or: use enum for all predefined types
                      enum mpidbg_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? */
                      mqs_taddr_t *type_c_handle,
                      /*mqs_taddr_t *type_cxx_handle,   was deprecated and removed*/
?                      struct mpidbg_keyvalue_pair_t **comm_extra_info);

Envelope functions:

int mpidbg_type_query_envelope(
                      struct mpidbg_type_handle_t *handle,
                      int64 *num_integers,
                      int64 *num_addresses,
                      int64 *num_datatypes);
int mpidbg_type_query_combiner(
                      struct mpidbg_type_handle_t *handle,
                      int64 max_integers,
                      int64 max_addresses,
                      int64 max_datatypes,
                      int64 array_of_integers[],
                      int64 array_of_addresses[],
                      mqs_taddr_t array_of_type_mpi_handle[], // used to lookup predefined types in the map
                      struct mpidbg_type_handle_t array_of_type_dbg_handle[] // used for further exploration);
struct mpidbg_dict_item {mpidbg_attr; mpidbg_type type; int len; void* value};

mpidbg_type_query_constructor{struct mpidbg_type_handle_t *handle,
                              struct mpidbg_dict_item** result}

For subarray type: 

result = [{mpidbg_attr_ndims, mpidbg_int, 1, value=},
{mpidbg_attr_arr_of_sizes, mpidbg_int_arr, 5, value=},
{mpidbg_attr_arr_of_subsizes, mpidbg_int_arr, 5, value=},
{mpidbg_attr_arr_of_starts, mpidbg_int_arr, 5, value=},
{mpidbg_order, mpidbg_int, 1, value=},
{mpidbg_oldtype, mpidbg_dtype, 1, value=}]
Clone this wiki locally