Skip to content

Commit 19e3be3

Browse files
authored
Merge pull request #2421 from nysal/master
mpit: Fix MPI_T_pvar_get_index
2 parents 54c8419 + 25ba507 commit 19e3be3

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
@@ -183,7 +183,7 @@ int mca_base_pvar_register (const char *project, const char *framework, const ch
183183
int bind, mca_base_pvar_flag_t flags, mca_base_get_value_fn_t get_value,
184184
mca_base_set_value_fn_t set_value, mca_base_notify_fn_t notify, void *ctx)
185185
{
186-
int ret, group_index;
186+
int ret, group_index, pvar_index;
187187
mca_base_pvar_t *pvar;
188188

189189
/* assert on usage errors */
@@ -288,15 +288,18 @@ int mca_base_pvar_register (const char *project, const char *framework, const ch
288288
}
289289
}
290290

291-
/* add this performance variable to the MCA variable group */
292-
ret = mca_base_var_group_add_pvar (group_index, pvar_count);
293-
if (0 > ret) {
291+
pvar_index = opal_pointer_array_add (&registered_pvars, pvar);
292+
if (0 > pvar_index) {
294293
break;
295294
}
295+
pvar->pvar_index = pvar_index;
296296

297-
ret = opal_pointer_array_add (&registered_pvars, pvar);
298-
if (0 > ret) {
299-
break;
297+
/* add this performance variable to the MCA variable group */
298+
if (0 <= group_index) {
299+
ret = mca_base_var_group_add_pvar (group_index, pvar_index);
300+
if (0 > ret) {
301+
break;
302+
}
300303
}
301304

302305
pvar->pvar_index = pvar_count;

0 commit comments

Comments
 (0)