Skip to content

Commit b2e0957

Browse files
authored
Merge pull request #7610 from bosilca/topic/fix_MPI_T
Follow the MPI_T guidelines on return errors.
2 parents 6a51d0a + f4af184 commit b2e0957

24 files changed

+112
-38
lines changed

examples/spc_example.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018 The University of Tennessee and The University
2+
* Copyright (c) 2018-2020 The University of Tennessee and The University
33
* of Tennessee Research Foundation. All rights
44
* reserved.
55
*
@@ -37,7 +37,7 @@ void message_exchange(int num_messages, int message_size)
3737

3838
int main(int argc, char **argv)
3939
{
40-
int num_messages, message_size;
40+
int num_messages, message_size, rc;
4141

4242
if(argc < 3) {
4343
printf("Usage: mpirun -np 2 --mca mpi_spc_attach all --mca mpi_spc_dump_enabled true ./spc_example [num_messages] [message_size]\n");
@@ -72,9 +72,11 @@ int main(int argc, char **argv)
7272
MPI_T_pvar_get_num(&num);
7373
for(i = 0; i < num; i++) {
7474
name_len = desc_len = 256;
75-
PMPI_T_pvar_get_info(i, name, &name_len, &verbosity,
76-
&var_class, &datatype, &enumtype, description, &desc_len, &bind,
77-
&readonly, &continuous, &atomic);
75+
rc = PMPI_T_pvar_get_info(i, name, &name_len, &verbosity,
76+
&var_class, &datatype, &enumtype, description, &desc_len, &bind,
77+
&readonly, &continuous, &atomic);
78+
if( MPI_SUCCESS != rc )
79+
continue;
7880
if(strcmp(name, counter_names[rank]) == 0) {
7981
index = i;
8082
printf("[%d] %s -> %s\n", rank, name, description);

ompi/mpi/tool/category_get_categories.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
* reserved.
55
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
66
* Copyright (c) 2017 IBM Corporation. All rights reserved.
7+
* Copyright (c) 2020 The University of Tennessee and The University
8+
* of Tennessee Research Foundation. All rights
9+
* reserved.
710
* $COPYRIGHT$
811
*
912
* Additional copyrights may follow
@@ -38,7 +41,7 @@ int MPI_T_category_get_categories(int cat_index, int len, int indices[])
3841
do {
3942
rc = mca_base_var_group_get (cat_index, &group);
4043
if (0 > rc) {
41-
rc = (OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX : MPI_ERR_OTHER;
44+
rc = (OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX : MPI_T_ERR_INVALID;
4245
break;
4346
}
4447

ompi/mpi/tool/category_get_cvars.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
* reserved.
55
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
66
* Copyright (c) 2017 IBM Corporation. All rights reserved.
7+
* Copyright (c) 2020 The University of Tennessee and The University
8+
* of Tennessee Research Foundation. All rights
9+
* reserved.
710
* $COPYRIGHT$
811
*
912
* Additional copyrights may follow
@@ -38,7 +41,7 @@ int MPI_T_category_get_cvars(int cat_index, int len, int indices[])
3841
do {
3942
rc = mca_base_var_group_get (cat_index, &group);
4043
if (0 > rc) {
41-
rc = (OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX : MPI_ERR_OTHER;
44+
rc = (OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX : MPI_T_ERR_INVALID;
4245
break;
4346
}
4447

ompi/mpi/tool/category_get_index.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
* reserved.
55
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
66
* Copyright (c) 2017 IBM Corporation. All rights reserved.
7+
* Copyright (c) 2020 The University of Tennessee and The University
8+
* of Tennessee Research Foundation. All rights
9+
* reserved.
10+
711
* $COPYRIGHT$
812
*
913
* Additional copyrights may follow
@@ -31,7 +35,7 @@ int MPI_T_category_get_index (const char *name, int *category_index)
3135
}
3236

3337
if (MPI_PARAM_CHECK && (NULL == category_index || NULL == name)) {
34-
return MPI_ERR_ARG;
38+
return MPI_T_ERR_INVALID;
3539
}
3640

3741
ompi_mpit_lock ();

ompi/mpi/tool/category_get_info.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
* reserved.
55
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
66
* Copyright (c) 2017 IBM Corporation. All rights reserved.
7+
* Copyright (c) 2020 The University of Tennessee and The University
8+
* of Tennessee Research Foundation. All rights
9+
* reserved.
710
* $COPYRIGHT$
811
*
912
* Additional copyrights may follow
@@ -38,7 +41,7 @@ int MPI_T_category_get_info(int cat_index, char *name, int *name_len,
3841
do {
3942
rc = mca_base_var_group_get (cat_index, &group);
4043
if (0 > rc) {
41-
rc = (OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX : MPI_ERR_OTHER;
44+
rc = (OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX : MPI_T_ERR_INVALID;
4245
break;
4346
}
4447

ompi/mpi/tool/category_get_num.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
* reserved.
55
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
66
* Copyright (c) 2017 IBM Corporation. All rights reserved.
7+
* Copyright (c) 2020 The University of Tennessee and The University
8+
* of Tennessee Research Foundation. All rights
9+
* reserved.
710
* $COPYRIGHT$
811
*
912
* Additional copyrights may follow
@@ -29,7 +32,7 @@ int MPI_T_category_get_num (int *num_cat)
2932
}
3033

3134
if (MPI_PARAM_CHECK && NULL == num_cat) {
32-
return MPI_ERR_ARG;
35+
return MPI_T_ERR_INVALID;
3336
}
3437

3538
ompi_mpit_lock ();

ompi/mpi/tool/category_get_pvars.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
* reserved.
55
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
66
* Copyright (c) 2017 IBM Corporation. All rights reserved.
7+
* Copyright (c) 2020 The University of Tennessee and The University
8+
* of Tennessee Research Foundation. All rights
9+
* reserved.
710
* $COPYRIGHT$
811
*
912
* Additional copyrights may follow
@@ -38,7 +41,7 @@ int MPI_T_category_get_pvars(int cat_index, int len, int indices[])
3841
do {
3942
rc = mca_base_var_group_get (cat_index, &group);
4043
if (0 > rc) {
41-
rc = (OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX : MPI_ERR_OTHER;
44+
rc = (OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX : MPI_T_ERR_INVALID;
4245
break;
4346
}
4447

ompi/mpi/tool/cvar_get_index.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
* reserved.
55
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
66
* Copyright (c) 2017 IBM Corporation. All rights reserved.
7+
* Copyright (c) 2020 The University of Tennessee and The University
8+
* of Tennessee Research Foundation. All rights
9+
* reserved.
710
* $COPYRIGHT$
811
*
912
* Additional copyrights may follow
@@ -31,7 +34,7 @@ int MPI_T_cvar_get_index (const char *name, int *cvar_index)
3134
}
3235

3336
if (MPI_PARAM_CHECK && (NULL == cvar_index || NULL == name)) {
34-
return MPI_ERR_ARG;
37+
return MPI_T_ERR_INVALID;
3538
}
3639

3740
ompi_mpit_lock ();

ompi/mpi/tool/cvar_get_info.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
* reserved.
55
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
66
* Copyright (c) 2017 IBM Corporation. All rights reserved.
7+
* Copyright (c) 2020 The University of Tennessee and The University
8+
* of Tennessee Research Foundation. All rights
9+
* reserved.
710
* $COPYRIGHT$
811
*
912
* Additional copyrights may follow
@@ -39,7 +42,7 @@ int MPI_T_cvar_get_info(int cvar_index, char *name, int *name_len, int *verbosit
3942
rc = mca_base_var_get (cvar_index, &var);
4043
if (OPAL_SUCCESS != rc) {
4144
rc = (OPAL_ERR_VALUE_OUT_OF_BOUNDS == rc || OPAL_ERR_NOT_FOUND == rc) ? MPI_T_ERR_INVALID_INDEX :
42-
MPI_ERR_OTHER;
45+
MPI_T_ERR_INVALID;
4346
break;
4447
}
4548

@@ -49,6 +52,8 @@ int MPI_T_cvar_get_info(int cvar_index, char *name, int *name_len, int *verbosit
4952
/* find the corresponding mpi type for an mca type */
5053
rc = ompit_var_type_to_datatype (var->mbv_type, datatype);
5154
if (OMPI_SUCCESS != rc) {
55+
rc = MPI_T_ERR_INVALID; /* can't really happen as MPI_SUCCESS is the only
56+
possible return from ompit_var_type_to_datatype */
5257
break;
5358
}
5459

ompi/mpi/tool/cvar_get_num.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
* reserved.
55
* Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
66
* Copyright (c) 2017 IBM Corporation. All rights reserved.
7+
* Copyright (c) 2020 The University of Tennessee and The University
8+
* of Tennessee Research Foundation. All rights
9+
* reserved.
710
* $COPYRIGHT$
811
*
912
* Additional copyrights may follow
@@ -28,7 +31,7 @@ int MPI_T_cvar_get_num (int *num_cvar) {
2831
}
2932

3033
if (MPI_PARAM_CHECK && NULL == num_cvar) {
31-
return MPI_ERR_ARG;
34+
return MPI_T_ERR_INVALID;
3235
}
3336

3437
ompi_mpit_lock ();

0 commit comments

Comments
 (0)