@@ -66,16 +66,14 @@ struct ompi_part_persist_t {
66
66
int32_t next_recv_tag ;
67
67
ompi_communicator_t * part_comm ; /* This approach requires a separate tag space, so we need a dedicated communicator. */
68
68
ompi_request_t * part_comm_req ;
69
- int32_t part_comm_ready ;
70
69
ompi_communicator_t * part_comm_setup ; /* We create a second communicator to send set-up messages (rational: these
71
70
messages go in the opposite direction of normal messages, need to use MPI_ANY_SOURCE
72
71
to support different communicators, and thus need to have a unique tag. Because tags
73
72
are controlled by the sender in this model, we cannot assume that the tag will be
74
73
unused in part_comm. */
75
74
ompi_request_t * part_comm_sreq ;
76
- int32_t part_comm_sready ;
77
- int32_t init_comms ;
78
75
int32_t init_world ;
76
+ int32_t init_world_step ;
79
77
int32_t my_world_rank ; /* Because the back end communicators use a world rank, we need to communicate ours
80
78
to set up the requests. */
81
79
opal_atomic_int32_t block_entry ;
@@ -182,32 +180,29 @@ mca_part_persist_progress(void)
182
180
183
181
/* Can't do anything if we don't have world */
184
182
if (0 == ompi_part_persist .init_world ) {
185
- ompi_part_persist .my_world_rank = ompi_comm_rank (& ompi_mpi_comm_world .comm );
186
- err = ompi_comm_idup (& ompi_mpi_comm_world .comm , & ompi_part_persist .part_comm , & ompi_part_persist .part_comm_req );
187
- if (OMPI_SUCCESS != err ) goto end_part_progress ;
188
- ompi_part_persist .part_comm_ready = 0 ;
189
- err = ompi_comm_idup (& ompi_mpi_comm_world .comm , & ompi_part_persist .part_comm_setup , & ompi_part_persist .part_comm_sreq );
190
- if (OMPI_SUCCESS != err ) goto end_part_progress ;
191
- ompi_part_persist .part_comm_sready = 0 ;
192
- ompi_part_persist .init_world = 1 ;
193
- completed ++ ;
194
- goto end_part_progress ;
195
- }
196
-
197
- /* Check to see if Comms are setup */
198
- if (0 == ompi_part_persist .init_comms ) {
199
- if (0 == ompi_part_persist .part_comm_ready ) {
200
- err = ompi_request_test (& ompi_part_persist .part_comm_req , & ompi_part_persist .part_comm_ready , MPI_STATUS_IGNORE );
201
- if (OMPI_SUCCESS != err ) goto end_part_progress ;
202
- }
203
- if (0 == ompi_part_persist .part_comm_sready ) {
204
- err = ompi_request_test (& ompi_part_persist .part_comm_sreq , & ompi_part_persist .part_comm_sready , MPI_STATUS_IGNORE );
205
- if (OMPI_SUCCESS != err ) goto end_part_progress ;
206
- }
207
- if (0 != ompi_part_persist .part_comm_ready && 0 != ompi_part_persist .part_comm_sready ) {
208
- ompi_part_persist .init_comms = 1 ;
183
+ int done = 0 ;
184
+ switch (ompi_part_persist .init_world_step ) {
185
+ case 0 :
186
+ ompi_part_persist .my_world_rank = ompi_comm_rank (& ompi_mpi_comm_world .comm );
187
+ err = ompi_comm_idup (& ompi_mpi_comm_world .comm , & ompi_part_persist .part_comm , & ompi_part_persist .part_comm_req );
188
+ done = 1 ;
189
+ break ;
190
+ case 1 :
191
+ err = ompi_request_test (& ompi_part_persist .part_comm_req , & done , MPI_STATUS_IGNORE );
192
+ break ;
193
+ case 2 :
194
+ err = ompi_comm_idup (& ompi_mpi_comm_world .comm , & ompi_part_persist .part_comm_setup , & ompi_part_persist .part_comm_sreq );
195
+ done = 1 ;
196
+ break ;
197
+ case 3 :
198
+ err = ompi_request_test (& ompi_part_persist .part_comm_sreq , & done , MPI_STATUS_IGNORE );
199
+ break ;
200
+ default :
201
+ ompi_part_persist .init_world = 1 ;
202
+ break ;
209
203
}
210
- completed ++ ;
204
+ ompi_part_persist .init_world_step += 0 != done ;
205
+ completed += 0 != done ;
211
206
goto end_part_progress ;
212
207
}
213
208
@@ -479,7 +474,7 @@ mca_part_persist_psend_init(const void* buf,
479
474
if (OMPI_SUCCESS != err ) return OMPI_ERROR ;
480
475
481
476
/* Non-blocking receive on setup info */
482
- if (1 == ompi_part_persist .init_comms ) {
477
+ if (1 == ompi_part_persist .init_world ) {
483
478
err = MCA_PML_CALL (irecv (& (req -> setup_info [1 ]), sizeof (struct ompi_mca_persist_setup_t ), MPI_BYTE , MPI_ANY_SOURCE , req -> my_recv_tag , ompi_part_persist .part_comm_setup , & req -> setup_req [1 ]));
484
479
if (OMPI_SUCCESS != err ) return OMPI_ERROR ;
485
480
req -> flag_post_setup_recv = false;
0 commit comments