@@ -219,7 +219,6 @@ def pfasst(self, S, num_procs):
219219 if len (S .levels ) > 1 and self .params .predict : # MLSDC or PFASST with predict
220220 S .status .stage = 'PREDICT_RESTRICT'
221221 else : # SDC
222- self .hooks .pre_iteration (step = S , level_number = 0 )
223222 S .status .stage = 'IT_CHECK'
224223
225224 return S
@@ -286,10 +285,36 @@ def pfasst(self, S, num_procs):
286285 S .transfer (source = S .levels [l ], target = S .levels [l - 1 ])
287286
288287 # update stage and return
289- self .hooks .pre_iteration (step = S , level_number = 0 )
290288 S .status .stage = 'IT_CHECK'
291289 return S
292290
291+ elif stage == 'IT_CHECK' :
292+
293+ # check whether to stop iterating
294+
295+ S .levels [0 ].sweep .compute_residual ()
296+ S .status .done = self .check_convergence (S )
297+
298+ if S .status .iter > 0 :
299+ self .hooks .post_iteration (step = S , level_number = 0 )
300+
301+ # if the previous step is still iterating but I am done, un-do me to still forward values
302+ if not S .status .first and S .status .done and (S .prev .status .done is not None and not S .prev .status .done ):
303+ S .status .done = False
304+
305+ # if I am done, signal accordingly, otherwise proceed
306+ if S .status .done :
307+ S .levels [0 ].sweep .compute_end_point ()
308+ self .hooks .post_step (step = S , level_number = 0 )
309+ S .status .stage = 'DONE'
310+ else :
311+ # increment iteration count here (and only here)
312+ S .status .iter += 1
313+ self .hooks .pre_iteration (step = S , level_number = 0 )
314+ S .status .stage = 'IT_FINE_SWEEP'
315+ # return
316+ return S
317+
293318 elif stage == 'IT_FINE_SWEEP' :
294319 # do sweep on finest level
295320
@@ -324,33 +349,6 @@ def pfasst(self, S, num_procs):
324349 # return
325350 return S
326351
327- elif stage == 'IT_CHECK' :
328-
329- # check whether to stop iterating
330-
331- S .levels [0 ].sweep .compute_residual ()
332- S .status .done = self .check_convergence (S )
333-
334- if S .status .iter > 0 :
335- self .hooks .post_iteration (step = S , level_number = 0 )
336-
337- # if the previous step is still iterating but I am done, un-do me to still forward values
338- if not S .status .first and S .status .done and (S .prev .status .done is not None and not S .prev .status .done ):
339- S .status .done = False
340-
341- # if I am done, signal accordingly, otherwise proceed
342- if S .status .done :
343- S .levels [0 ].sweep .compute_end_point ()
344- self .hooks .post_step (step = S , level_number = 0 )
345- S .status .stage = 'DONE'
346- else :
347- # increment iteration count here (and only here)
348- S .status .iter += 1
349- self .hooks .pre_iteration (step = S , level_number = 0 )
350- S .status .stage = 'IT_FINE_SWEEP'
351- # return
352- return S
353-
354352 elif stage == 'IT_UP' :
355353 # go up the hierarchy from finest to coarsest level
356354
@@ -416,7 +414,6 @@ def pfasst(self, S, num_procs):
416414 for k in range (S .levels [- 1 ].params .nsweeps ):
417415 S .levels [- 1 ].sweep .update_nodes ()
418416 S .levels [- 1 ].sweep .compute_residual ()
419-
420417 self .hooks .post_sweep (step = S , level_number = len (S .levels ) - 1 )
421418
422419 # update stage and return
@@ -432,10 +429,7 @@ def pfasst(self, S, num_procs):
432429 % (S .status .slot , len (S .levels ) - 1 , True ))
433430 self .send (S .levels [- 1 ], tag = True )
434431 # update stage
435- if len (S .levels ) > 1 : # MLSDC or PFASST
436- S .status .stage = 'IT_DOWN'
437- else : # MSSDC
438- S .status .stage = 'IT_CHECK'
432+ S .status .stage = 'IT_DOWN'
439433 else :
440434 S .status .stage = 'IT_COARSE_SEND'
441435 # return
0 commit comments