def update_timestep(self, yieldstep, finaltime): """Calculate local timestep """ generic_comms.communicate_flux_timestep(self, yieldstep, finaltime) Domain.update_timestep(self, yieldstep, finaltime)
def update_timestep(self, yieldstep, finaltime): #LINDA: # moved the calculation so that it is done after timestep # has been broadcast # # Calculate local timestep # Domain.update_timestep(self, yieldstep, finaltime) import time t0 = time.time() # For some reason it looks like pypar only reduces numeric arrays # hence we need to create some dummy arrays for communication ltimestep = num.ones(1, num.float) ltimestep[0] = self.flux_timestep gtimestep = num.zeros(1, num.float) # Buffer for results #ltimestep = self.flux_timeste #print self.processor, ltimestep, gtimestep gtimestep = pypar.reduce(ltimestep, pypar.MIN, 0, buffer=gtimestep) #print self.processor, ltimestep, gtimestep pypar.broadcast(gtimestep, 0) #print self.processor, ltimestep, gtimestep self.flux_timestep = gtimestep[0] self.communication_reduce_time += time.time() - t0 # LINDA: # Now update time stats # Calculate local timestep Domain.update_timestep(self, yieldstep, finaltime)
def update_timestep(self, yieldstep, finaltime): #LINDA: # moved the calculation so that it is done after timestep # has been broadcast # # Calculate local timestep # Domain.update_timestep(self, yieldstep, finaltime) import time t0 = time.time() # For some reason it looks like pypar only reduces numeric arrays # hence we need to create some dummy arrays for communication ltimestep = num.ones( 1, num.float ) ltimestep[0] = self.flux_timestep gtimestep = num.zeros( 1, num.float ) # Buffer for results #ltimestep = self.flux_timeste #print self.processor, ltimestep, gtimestep gtimestep = pypar.reduce(ltimestep, pypar.MIN, 0, buffer=gtimestep) #print self.processor, ltimestep, gtimestep pypar.broadcast(gtimestep,0) #print self.processor, ltimestep, gtimestep self.flux_timestep = gtimestep[0] self.communication_reduce_time += time.time()-t0 # LINDA: # Now update time stats # Calculate local timestep Domain.update_timestep(self, yieldstep, finaltime)