Difference between revisions of "Tool interfaces (MPI-T), MPICH parameters and instrumentation"

From Mpich
Jump to: navigation, search
(Current MPICH Parameter and MPI-T Cvar Implementation)
Line 31: Line 31:
 
*cvars are statically defined, thus not supporting dynamically adding / removing cvars through dynamic loading libraries.
 
*cvars are statically defined, thus not supporting dynamically adding / removing cvars through dynamic loading libraries.
 
=> It seems this ability is not needed in MPICH.
 
=> It seems this ability is not needed in MPICH.
*Not very efficient when accessing a cvar. Have to test a cvar's data type before accessing it. For example, to read a cvar
+
*Not very efficient when accessing a cvar due to datatype dispatching
 +
For example, to read a cvar, the current code has
  
 +
<pre><nowiki>
 +
int MPIR_T_cvar_read_impl(MPI_T_cvar_handle handle, void *buf)
 +
{
 +
    int mpi_errno = MPI_SUCCESS;
 +
    struct MPIR_Param_t *p = handle->p;
 +
 +
    switch (p->default_val.type) {
 +
        case MPIR_PARAM_TYPE_INT:
 +
            {
 +
                int *i_buf = buf;
 +
                *i_buf = *(int *)p->val_p;
 +
            }
 +
            break;
 +
        case MPIR_PARAM_TYPE_DOUBLE:
 +
            {
 +
                double *d_buf = buf;
 +
                *d_buf = *(double *)p->val_p;
 +
            }
 +
            break;
 +
        case MPIR_PARAM_TYPE_BOOLEAN:
 +
            {
 +
                int *i_buf = buf;
 +
                *i_buf = *(int *)p->val_p;
 +
            }
 +
            break;
 +
        case MPIR_PARAM_TYPE_STRING:
 +
            if (*(char **)p->val_p == NULL) {
 +
                char *c_buf = buf;
 +
                c_buf[0] = '\0';
 +
            }
 +
            else {
 +
                MPIU_Strncpy(buf, *(char **)p->val_p, MPIR_PARAM_MAX_STRLEN);
 +
            }
 +
            break;
 +
    ...
 +
}
 +
</nowiki></pre>
  
 
== Current MPICH Instrumentation and MPI-T Pvar Implementation==
 
== Current MPICH Instrumentation and MPI-T Pvar Implementation==

Revision as of 02:55, 23 August 2013

This page describes the design of the MPI Tool (MPI-T) Information Interfaces in MPI-3. MPI-T provides a set of interfaces for users to list, query, read and possibly write variables internal to an MPI implementation. Each such variable represents a particular property, setting or performance measurement from within the MPI implementation. MPI-T classifies the variables into two parts: control variables and performance variables. Control variables correspond to the current MPICH parameters, through which MPICH tunes its configuration. Performance variables correspond to the current MPICH internal instrumentation variables, through which MPICH understands its performance.


MPI-T Basics

Through MPI-T, a user can,
for control variables (cvar),

  • Get the number of cvars by MPI_T_cvar_get_num();
  • Get attributes of each cvar, which includes its name, verbosity, datatype, description, bind and scope;
  • Allocate a handle for a cvar;
  • Read / write a cvar through its handle.

for performance variables (pvar),

  • Get the number of cvars by MPI_T_pvar_get_num();
  • Get attributes of each pvar, which includes its name, verbosity, datatype, description, bind, class;
  • Create a session so that accesses to pvars in different sessions won't conflict;
  • Allocate a handle for pvar in a specific session;
  • Start / stop / read / write / reset / readreset a pvar through its handle.

for cvars and pvars,

  • Know their categorization, i.e., how an MPI implementation categorizes its variables, which category contains which variables and which sub-categories.

Design Requirements

We wish to have a framework through which components of MPICH can add their parameters and instrumentation uniformly. And it is easy to expose variables to MPI-T interfaces and it is efficient to access variables through MPI-T interfaces.

Current MPICH Parameter and MPI-T Cvar Implementation

The document Parameters_in_MPICH describes requirements and a potential design of MPICH parameters. However, the current MPICH code doesn't follow this design. Currently, all MPICH parameters are declared in mpich/src/util/param/params.yml in a markup language, which then is parsed and the results are dumped into two files: mpich_param_vals.h/c. The main data structure is a static array MPIR_Param_params[], which is initialized to hold info for each parameter, such as its name, data type and a pointer to the parameter.

The current code connects a cvar handle to its corresponding element in MPIR_Param_params[], which makes MPI-T cvar implementation straightforward.

Potential Problems of the current design

  • cvars are statically defined, thus not supporting dynamically adding / removing cvars through dynamic loading libraries.

=> It seems this ability is not needed in MPICH.

  • Not very efficient when accessing a cvar due to datatype dispatching

For example, to read a cvar, the current code has

int MPIR_T_cvar_read_impl(MPI_T_cvar_handle handle, void *buf)
{
    int mpi_errno = MPI_SUCCESS;
    struct MPIR_Param_t *p = handle->p;

    switch (p->default_val.type) {
        case MPIR_PARAM_TYPE_INT:
            {
                int *i_buf = buf;
                *i_buf = *(int *)p->val_p;
            }
            break;
        case MPIR_PARAM_TYPE_DOUBLE:
            {
                double *d_buf = buf;
                *d_buf = *(double *)p->val_p;
            }
            break;
        case MPIR_PARAM_TYPE_BOOLEAN:
            {
                int *i_buf = buf;
                *i_buf = *(int *)p->val_p;
            }
            break;
        case MPIR_PARAM_TYPE_STRING:
            if (*(char **)p->val_p == NULL) {
                char *c_buf = buf;
                c_buf[0] = '\0';
            }
            else {
                MPIU_Strncpy(buf, *(char **)p->val_p, MPIR_PARAM_MAX_STRLEN);
            }
            break;
    ... 
}

Current MPICH Instrumentation and MPI-T Pvar Implementation