Skip to content

Commit 74440de

Browse files
authored
Merge pull request #2836 from jjhursey/topic/ibm/v2.x/mpi_t_pvar
mpit: Fix MPI_T_pvar_get_index
2 parents 786b253 + 4bfa099 commit 74440de

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

ompi/mpi/tool/mpit_common.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ int ompit_var_type_to_datatype (mca_base_var_type_t type, MPI_Datatype *datatype
6060

6161
break;
6262
case MCA_BASE_VAR_TYPE_STRING:
63+
case MCA_BASE_VAR_TYPE_VERSION_STRING:
6364
*datatype = MPI_CHAR;
6465
break;
6566
case MCA_BASE_VAR_TYPE_BOOL:

opal/mca/base/mca_base_pvar.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ int mca_base_pvar_register (const char *project, const char *framework, const ch
179179
int bind, mca_base_pvar_flag_t flags, mca_base_get_value_fn_t get_value,
180180
mca_base_set_value_fn_t set_value, mca_base_notify_fn_t notify, void *ctx)
181181
{
182-
int ret, group_index;
182+
int ret, group_index, pvar_index;
183183
mca_base_pvar_t *pvar;
184184

185185
/* assert on usage errors */
@@ -284,15 +284,18 @@ int mca_base_pvar_register (const char *project, const char *framework, const ch
284284
}
285285
}
286286

287-
/* add this performance variable to the MCA variable group */
288-
ret = mca_base_var_group_add_pvar (group_index, pvar_count);
289-
if (0 > ret) {
287+
pvar_index = opal_pointer_array_add (&registered_pvars, pvar);
288+
if (0 > pvar_index) {
290289
break;
291290
}
291+
pvar->pvar_index = pvar_index;
292292

293-
ret = opal_pointer_array_add (&registered_pvars, pvar);
294-
if (0 > ret) {
295-
break;
293+
/* add this performance variable to the MCA variable group */
294+
if (0 <= group_index) {
295+
ret = mca_base_var_group_add_pvar (group_index, pvar_index);
296+
if (0 > ret) {
297+
break;
298+
}
296299
}
297300

298301
opal_hash_table_set_value_ptr (&mca_base_pvar_index_hash, pvar->name, strlen (pvar->name),

0 commit comments

Comments
 (0)