@@ -331,10 +331,12 @@ def pfasst(self, comm, num_procs):
331331 # check whether to stop iterating (parallel)
332332
333333 self .hooks .pre_comm (step = self .S , level_number = 0 )
334+
335+ if self .req_send [0 ] is not None :
336+ self .req_send [0 ].wait ()
334337 self .S .levels [0 ].sweep .compute_end_point ()
338+
335339 if not self .S .status .last and self .params .fine_comm :
336- if self .req_send [0 ] is not None :
337- self .req_send [0 ].wait ()
338340 self .logger .debug ('isend data: process %s, stage %s, time %s, target %s, tag %s, iter %s' %
339341 (self .S .status .slot , self .S .status .stage , self .S .time , self .S .next ,
340342 0 , self .S .status .iter ))
@@ -401,6 +403,14 @@ def pfasst(self, comm, num_procs):
401403
402404 else :
403405
406+ # Need to finish alll pending isend requests. These will occur for the first active process, since
407+ # in the last iteration the wait statement will not be called ("send and forget")
408+ for req in self .req_send :
409+ if req is not None :
410+ req .wait ()
411+ if self .req_status is not None :
412+ self .req_status .wait ()
413+
404414 self .hooks .post_step (step = self .S , level_number = 0 )
405415 self .S .status .stage = 'DONE'
406416
@@ -416,10 +426,12 @@ def pfasst(self, comm, num_procs):
416426 self .S .levels [0 ].status .sweep += 1
417427
418428 self .hooks .pre_comm (step = self .S , level_number = 0 )
429+
430+ if self .req_send [0 ] is not None :
431+ self .req_send [0 ].wait ()
419432 self .S .levels [0 ].sweep .compute_end_point ()
433+
420434 if not self .S .status .last and self .params .fine_comm :
421- if self .req_send [0 ] is not None :
422- self .req_send [0 ].wait ()
423435 self .logger .debug ('isend data: process %s, stage %s, time %s, target %s, tag %s, iter %s' %
424436 (self .S .status .slot , self .S .status .stage , self .S .time , self .S .next ,
425437 0 , self .S .status .iter ))
@@ -455,10 +467,12 @@ def pfasst(self, comm, num_procs):
455467 for k in range (nsweeps ):
456468
457469 self .hooks .pre_comm (step = self .S , level_number = l )
470+
471+ if self .req_send [l ] is not None :
472+ self .req_send [l ].wait ()
458473 self .S .levels [l ].sweep .compute_end_point ()
474+
459475 if not self .S .status .last and self .params .fine_comm :
460- if self .req_send [l ] is not None :
461- self .req_send [l ].wait ()
462476 self .logger .debug ('isend data: process %s, stage %s, time %s, target %s, tag %s, iter %s' %
463477 (self .S .status .slot , self .S .status .stage , self .S .time , self .S .next ,
464478 l , self .S .status .iter ))
@@ -540,10 +554,12 @@ def pfasst(self, comm, num_procs):
540554 for k in range (nsweeps ):
541555
542556 self .hooks .pre_comm (step = self .S , level_number = l - 1 )
557+
558+ if self .req_send [l - 1 ] is not None :
559+ self .req_send [l - 1 ].wait ()
543560 self .S .levels [l - 1 ].sweep .compute_end_point ()
561+
544562 if not self .S .status .last and self .params .fine_comm :
545- if self .req_send [l - 1 ] is not None :
546- self .req_send [l - 1 ].wait ()
547563 self .logger .debug ('isend data: process %s, stage %s, time %s, target %s, tag %s, iter %s' %
548564 (self .S .status .slot , self .S .status .stage , self .S .time , self .S .next ,
549565 l - 1 , self .S .status .iter ))
0 commit comments