int MPI_T_cvar_get_info(int cvar_index, char *name, int *name_len, int *verbosity, MPI_Datatype *datatype, MPI_T_enum *enumtype, char *desc, int *desc_len, int *bind, int *scope) { const mca_base_var_t *var; int rc = MPI_SUCCESS; if (!mpit_is_initialized ()) { return MPI_T_ERR_NOT_INITIALIZED; } mpit_lock (); do { rc = mca_base_var_get (cvar_index, &var); if (OPAL_SUCCESS != rc) { rc = (OPAL_ERR_VALUE_OUT_OF_BOUNDS == rc || OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX : MPI_ERR_OTHER; break; } mpit_copy_string (name, name_len, var->mbv_full_name); mpit_copy_string (desc, desc_len, var->mbv_description); /* find the corresponding mpi type for an mca type */ rc = ompit_var_type_to_datatype (var->mbv_type, datatype); if (OMPI_SUCCESS != rc) { break; } if (NULL != enumtype) { *enumtype = var->mbv_enumerator ? (MPI_T_enum) var->mbv_enumerator : MPI_T_ENUM_NULL; } if (NULL != scope) { *scope = var->mbv_scope; } /* XXX -- TODO -- All bindings are currently 0. Add support for variable binding. */ if (NULL != bind) { *bind = var->mbv_bind; } if (NULL != verbosity) { *verbosity = var->mbv_info_lvl; } } while (0); mpit_unlock (); return rc; }
int MPI_T_enum_get_item(MPI_T_enum enumtype, int index, int *value, char *name, int *name_len) { const char *tmp; int rc, count; if (!mpit_is_initialized ()) { return MPI_T_ERR_NOT_INITIALIZED; } mpit_lock (); do { rc = enumtype->get_count (enumtype, &count); if (OPAL_SUCCESS != rc) { rc = MPI_ERR_OTHER; break; } if (index >= count) { rc = MPI_T_ERR_INVALID_INDEX; break; } rc = enumtype->get_value(enumtype, index, value, &tmp); if (OPAL_SUCCESS != rc) { rc = MPI_ERR_OTHER; break; } mpit_copy_string(name, name_len, tmp); } while (0); mpit_unlock (); return rc; }
int MPI_T_pvar_get_info(int pvar_index, char *name, int *name_len, int *verbosity, int *var_class, MPI_Datatype *datatype, MPI_T_enum *enumtype, char *desc, int *desc_len, int *bind, int *readonly, int *continuous, int *atomic) { const mca_base_pvar_t *pvar; int ret; if (!mpit_is_initialized ()) { return MPI_T_ERR_NOT_INITIALIZED; } ompi_mpit_lock (); do { /* Find the performance variable. mca_base_pvar_get() handles the bounds checking. */ ret = mca_base_pvar_get (pvar_index, &pvar); if (OMPI_SUCCESS != ret) { break; } /* Check the variable binding is something sane */ if (pvar->bind > MPI_T_BIND_MPI_INFO || pvar->bind < MPI_T_BIND_NO_OBJECT) { /* This variable specified an invalid binding (not an MPI object). */ ret = MPI_T_ERR_INVALID_INDEX; break; } /* Copy name an description */ mpit_copy_string (name, name_len, pvar->name); mpit_copy_string (desc, desc_len, pvar->description); if (verbosity) { *verbosity = pvar->verbosity; } if (var_class) { *var_class = pvar->var_class; } ret = ompit_var_type_to_datatype (pvar->type, datatype); if (OMPI_SUCCESS != ret) { break; } if (NULL != enumtype) { *enumtype = pvar->enumerator ? (MPI_T_enum) pvar->enumerator : MPI_T_ENUM_NULL; } if (NULL != bind) { *bind = pvar->bind; } if (NULL != readonly) { *readonly = mca_base_pvar_is_readonly (pvar); } if (NULL != continuous) { *continuous = mca_base_pvar_is_continuous (pvar); } if (NULL != atomic) { *atomic = mca_base_pvar_is_atomic (pvar); } } while (0); ompi_mpit_unlock (); return ret; }