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 run_mpi(self): while True: 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) if count == 0: break if chunk == bytearray(b'wait'): continue pf = PacketFooter(view=chunk) smd_chunk, epics_chunk = pf.split_packets() pfe = PacketFooter(view=epics_chunk) epics_views = pfe.split_packets() self.run.epics_store.update(epics_views) if self.run.scan: yield Step(self.run, smd_batch=smd_chunk) else: for event in self.evt_man.events(smd_chunk): yield event
def steps(self): current_step_pos = 0 """ Generates events between steps. """ smdr_man = SmdReaderManager(self.smd_dm.fds, self.max_events) for i, (smd_chunk, step_chunk) in enumerate(smdr_man.chunks()): # Update step stores step_pf = PacketFooter(view=step_chunk) step_views = step_pf.split_packets() self.epics_store.update(step_views) self.step_store.update(step_views) eb_man = EventBuilderManager(smd_chunk, self.configs, \ batch_size=self.batch_size, filter_fn=self.filter_callback) for i, step_dgram in enumerate( self.step_store.dgrams(from_pos=current_step_pos + 1)): if step_dgram: limit_ts = step_dgram.seq.timestamp() current_step_pos += 1 else: limit_ts = -1 yield Step(self, eb_man=eb_man, limit_ts=limit_ts)
def steps(self): for evt in self.dm: if evt._dgrams[0].service() == TransitionId.BeginStep: yield Step(evt, self.dm)