def run_mpi(self): @s_bd_wait_eb.time() def get_smd(): bd_comm = self.run.comms.bd_comm bd_rank = self.run.comms.bd_rank bd_comm.Send(np.array([bd_rank], dtype='i'), dest=0) info = MPI.Status() bd_comm.Probe(source=0, tag=MPI.ANY_TAG, status=info) count = info.Get_elements(MPI.BYTE) chunk = bytearray(count) bd_comm.Recv(chunk, source=0) return chunk events = Events(self.run, get_smd=get_smd) if self.run.scan: for evt in events: if evt.service() == TransitionId.BeginStep: if evt.timestamp > self.step_max_ts: self.step_max_ts = evt.timestamp yield Step(evt, events) else: for evt in events: if evt.service() == TransitionId.L1Accept: yield evt
def steps(self): """ Generates events between steps. """ events = Events(self) for evt in events: if evt.service() == TransitionId.BeginStep: yield Step(evt, events) self.close()
def events(self): events = Events(self) for evt in events: if evt.service() == TransitionId.L1Accept: st = time.time() yield evt en = time.time() self.c_ana.labels('seconds', 'None').inc(en - st) self.c_ana.labels('batches', 'None').inc()
def batch_events(smd_batch, run): batch_iter = iter([smd_batch, bytearray()]) def get_smd(): for this_batch in batch_iter: return this_batch events = Events(run, get_smd=get_smd) for evt in events: if evt.service() != TransitionId.L1Accept: continue yield evt
def events(self): events = Events(self) for evt in events: if evt.service() == TransitionId.L1Accept: yield evt