@@ -52,7 +52,7 @@ int mca_coll_han_comm_create_new(struct ompi_communicator_t *comm,
52
52
ompi_communicator_t * * low_comm = & (han_module -> sub_comm [INTRA_NODE ]);
53
53
ompi_communicator_t * * up_comm = & (han_module -> sub_comm [INTER_NODE ]);
54
54
mca_coll_han_collectives_fallback_t fallbacks ;
55
- int vrank , * vranks ;
55
+ int rc = OMPI_SUCCESS , vrank , * vranks ;
56
56
opal_info_t comm_info ;
57
57
58
58
/* The sub communicators have already been created */
@@ -91,9 +91,12 @@ int mca_coll_han_comm_create_new(struct ompi_communicator_t *comm,
91
91
* all participants.
92
92
*/
93
93
int local_procs = ompi_group_count_local_peers (comm -> c_local_group );
94
- comm -> c_coll -> coll_allreduce (MPI_IN_PLACE , & local_procs , 1 , MPI_INT ,
95
- MPI_MAX , comm ,
96
- comm -> c_coll -> coll_allreduce_module );
94
+ rc = comm -> c_coll -> coll_allreduce (MPI_IN_PLACE , & local_procs , 1 , MPI_INT ,
95
+ MPI_MAX , comm ,
96
+ comm -> c_coll -> coll_allreduce_module );
97
+ if ( OMPI_SUCCESS != rc ) {
98
+ goto return_with_error ;
99
+ }
97
100
if ( local_procs == 1 ) {
98
101
/* restore saved collectives */
99
102
HAN_SUBCOM_LOAD_COLLECTIVE (fallbacks , comm , han_module , allgatherv );
@@ -118,8 +121,12 @@ int mca_coll_han_comm_create_new(struct ompi_communicator_t *comm,
118
121
*/
119
122
opal_info_set (& comm_info , "ompi_comm_coll_preference" , "han" );
120
123
opal_info_set (& comm_info , "ompi_comm_coll_han_topo_level" , "INTRA_NODE" );
121
- ompi_comm_split_type (comm , MPI_COMM_TYPE_SHARED , 0 ,
122
- & comm_info , low_comm );
124
+ rc = ompi_comm_split_type (comm , MPI_COMM_TYPE_SHARED , 0 ,
125
+ & comm_info , low_comm );
126
+ if ( OMPI_SUCCESS != rc ) {
127
+ /* cannot create subcommunicators. Return the error upstream */
128
+ goto return_with_error ;
129
+ }
123
130
124
131
/*
125
132
* Get my local rank and the local size
@@ -132,7 +139,11 @@ int mca_coll_han_comm_create_new(struct ompi_communicator_t *comm,
132
139
* same intra-node rank id share such a sub-communicator
133
140
*/
134
141
opal_info_set (& comm_info , "ompi_comm_coll_han_topo_level" , "INTER_NODE" );
135
- ompi_comm_split_with_info (comm , low_rank , w_rank , & comm_info , up_comm , false);
142
+ rc = ompi_comm_split_with_info (comm , low_rank , w_rank , & comm_info , up_comm , false);
143
+ if ( OMPI_SUCCESS != rc ) {
144
+ /* cannot create subcommunicators. Return the error upstream */
145
+ goto return_with_error ;
146
+ }
136
147
137
148
up_rank = ompi_comm_rank (* up_comm );
138
149
@@ -150,14 +161,13 @@ int mca_coll_han_comm_create_new(struct ompi_communicator_t *comm,
150
161
* gather vrank from each process so every process will know other processes
151
162
* vrank
152
163
*/
153
- comm -> c_coll -> coll_allgather (& vrank ,
154
- 1 ,
155
- MPI_INT ,
156
- vranks ,
157
- 1 ,
158
- MPI_INT ,
159
- comm ,
160
- comm -> c_coll -> coll_allgather_module );
164
+ rc = comm -> c_coll -> coll_allgather (& vrank , 1 , MPI_INT ,
165
+ vranks , 1 , MPI_INT ,
166
+ comm , comm -> c_coll -> coll_allgather_module );
167
+ if ( OMPI_SUCCESS != rc ) {
168
+ /* cannot create subcommunicators. Return the error upstream */
169
+ goto return_with_error ;
170
+ }
161
171
162
172
/*
163
173
* Set the cached info
@@ -175,6 +185,17 @@ int mca_coll_han_comm_create_new(struct ompi_communicator_t *comm,
175
185
176
186
OBJ_DESTRUCT (& comm_info );
177
187
return OMPI_SUCCESS ;
188
+
189
+ return_with_error :
190
+ if ( NULL != * low_comm ) {
191
+ ompi_comm_free (low_comm );
192
+ * low_comm = NULL ; /* don't leave the MPI_COMM_NULL set by ompi_comm_free */
193
+ }
194
+ if ( NULL != * up_comm ) {
195
+ ompi_comm_free (up_comm );
196
+ * up_comm = NULL ; /* don't leave the MPI_COMM_NULL set by ompi_comm_free */
197
+ }
198
+ return rc ;
178
199
}
179
200
180
201
/*
0 commit comments