@@ -152,35 +152,6 @@ def restart_block(self, size, time, u0):
152152 lvl .status .time = time
153153 lvl .status .sweep = 1
154154
155- @staticmethod
156- def recv (target , source , tag , comm ):
157- """
158- Receive function
159-
160- Args:
161- target: process/level which will receive the values
162- source: process/level which initiated the send
163- tag: identifier to check if this message is really for me
164- comm: communicator
165- """
166- # do a blocking receive and re-compute f(u0)
167- target .u [0 ] = comm .recv (source = source , tag = tag )
168- target .f [0 ] = target .prob .eval_f (target .u [0 ], target .time )
169-
170- @staticmethod
171- def send (source , target , tag , comm ):
172- """
173- Send function
174-
175- Args:
176- source: process/level which has the new values
177- target: process/level which will receive the values
178- tag: identifier for this message
179- comm: communicator
180- """
181- # do a blocking send
182- comm .send (source .uend , dest = target , tag = tag )
183-
184155 def predictor (self , comm ):
185156 """
186157 Predictor function, extracted from the stepwise implementation (will be also used by matrix sweppers)
@@ -199,7 +170,7 @@ def predictor(self, comm):
199170 self .logger .debug ('recv data predict: process %s, stage %s, time, %s, source %s, tag %s, phase %s' %
200171 (self .S .status .slot , self .S .status .stage , self .S .time , self .S .prev ,
201172 self .S .status .iter , p ))
202- self .recv ( target = self . S .levels [- 1 ], source = self .S .prev , tag = self .S .status .iter , comm = comm )
173+ self .S .levels [- 1 ]. u [ 0 ]. recv ( source = self .S .prev , tag = self .S .status .iter , comm = comm )
203174
204175 # do the sweep with new values
205176 self .S .levels [- 1 ].sweep .update_nodes ()
@@ -209,7 +180,7 @@ def predictor(self, comm):
209180 self .logger .debug ('send data predict: process %s, stage %s, time, %s, target %s, tag %s, phase %s' %
210181 (self .S .status .slot , self .S .status .stage , self .S .time , self .S .next ,
211182 self .S .status .iter , p ))
212- self .send ( source = self . S .levels [- 1 ], target = self .S .next , tag = self .S .status .iter , comm = comm )
183+ self .S .levels [- 1 ]. uend . send ( dest = self .S .next , tag = self .S .status .iter , comm = comm )
213184
214185 # interpolate back to finest level
215186 for l in range (len (self .S .levels ) - 1 , 0 , - 1 ):
@@ -320,7 +291,7 @@ def pfasst(self, comm, num_procs):
320291 self .logger .debug ('isend data: process %s, stage %s, time %s, target %s, tag %s, iter %s' %
321292 (self .S .status .slot , self .S .status .stage , self .S .time , self .S .next ,
322293 0 , self .S .status .iter ))
323- self .req_send .append (comm . isend ( self .S .levels [0 ].uend , dest = self .S .next , tag = 0 ))
294+ self .req_send .append (self .S .levels [0 ].uend . isend ( dest = self .S .next , tag = 0 , comm = comm ))
324295
325296 # update stage
326297 self .S .status .stage = 'IT_CHECK'
@@ -349,7 +320,7 @@ def pfasst(self, comm, num_procs):
349320 self .logger .debug ('isend data: process %s, stage %s, time %s, target %s, tag %s, iter %s' %
350321 (self .S .status .slot , self .S .status .stage , self .S .time , self .S .next ,
351322 l , self .S .status .iter ))
352- self .req_send .append (comm . isend ( self .S .levels [l ].uend , dest = self .S .next , tag = l ))
323+ self .req_send .append (self .S .levels [l ].uend . isend ( dest = self .S .next , tag = l , comm = comm ))
353324
354325 # transfer further up the hierarchy
355326 self .S .transfer (source = self .S .levels [l ], target = self .S .levels [l + 1 ])
@@ -364,7 +335,7 @@ def pfasst(self, comm, num_procs):
364335 self .logger .debug ('recv data: process %s, stage %s, time %s, source %s, tag %s, iter %s' %
365336 (self .S .status .slot , self .S .status .stage , self .S .time , self .S .prev ,
366337 len (self .S .levels ) - 1 , self .S .status .iter ))
367- self .recv ( target = self . S .levels [- 1 ], source = self .S .prev , tag = len (self .S .levels ) - 1 , comm = comm )
338+ self .S .levels [- 1 ]. u [ 0 ]. recv ( source = self .S .prev , tag = len (self .S .levels ) - 1 , comm = comm )
368339
369340 # update stage
370341 self .S .status .stage = 'IT_COARSE'
@@ -386,7 +357,7 @@ def pfasst(self, comm, num_procs):
386357 self .logger .debug ('isend data: process %s, stage %s, time %s, target %s, tag %s, iter %s' %
387358 (self .S .status .slot , self .S .status .stage , self .S .time , self .S .next ,
388359 len (self .S .levels ) - 1 , self .S .status .iter ))
389- self .send ( source = self . S .levels [- 1 ], target = self .S .next , tag = len (self .S .levels ) - 1 , comm = comm )
360+ self .S .levels [- 1 ]. uend . send ( dest = self .S .next , tag = len (self .S .levels ) - 1 , comm = comm )
390361
391362 # update stage
392363 self .S .status .stage = 'IT_DOWN'
@@ -402,7 +373,7 @@ def pfasst(self, comm, num_procs):
402373 self .logger .debug ('recv data: process %s, stage %s, time %s, source %s, tag %s, iter %s' %
403374 (self .S .status .slot , self .S .status .stage , self .S .time , self .S .prev ,
404375 l - 1 , self .S .status .iter ))
405- self .recv ( target = self . S .levels [l - 1 ], source = self .S .prev , tag = l - 1 , comm = comm )
376+ self .S .levels [l - 1 ]. u [ 0 ]. recv ( source = self .S .prev , tag = l - 1 , comm = comm )
406377
407378 # prolong values
408379 self .S .transfer (source = self .S .levels [l ], target = self .S .levels [l - 1 ])
0 commit comments