def __init__(self, exp, run_no, run_src, **kwargs): """ Parallel read using Legion """ super(RunLegion, self).__init__(exp, run_no, max_events=kwargs['max_events'], batch_size=kwargs['batch_size'], filter_callback=kwargs['filter_callback'], prom_man=kwargs['prom_man']) xtc_files, smd_files, other_files = run_src # get Configure and BeginRun using SmdReader self.smd_fds = np.array( [os.open(smd_file, os.O_RDONLY) for smd_file in smd_files], dtype=np.int32) self.smdr_man = SmdReaderManager(self) self.configs = self.smdr_man.get_next_dgrams() self.beginruns = self.smdr_man.get_next_dgrams(configs=self.configs) self._get_runinfo() self.smd_dm = DgramManager(smd_files, configs=self.configs) self.dm = DgramManager(xtc_files, configs=self.smd_dm.configs) super()._set_configinfo() super()._set_calibconst() self.esm = EnvStoreManager(self.configs, 'epics', 'scan')
def __init__(self, exp, run_no, xtc_files, max_events, batch_size, filter_callback, tag, prom_man): super(RunShmem, self).__init__(exp, run_no, max_events=max_events, batch_size=batch_size, filter_callback=filter_callback, prom_man=prom_man) self.dm = DgramManager(xtc_files,tag=tag) self.configs = self.dm.configs super()._get_runinfo() super()._set_configinfo() super()._set_calibconst() self.dm.calibconst = self.calibconst self.esm = EnvStoreManager(self.dm.configs, 'epics', 'scan')
def __init__(self, comms, exp, run_no, run_src, **kwargs): """ Parallel read requires that rank 0 does the file system works. Configs and calib constants are sent to other ranks by MPI. Note that destination callback only works with RunParallel. """ super(RunParallel, self).__init__(exp, run_no, max_events=kwargs['max_events'], \ batch_size=kwargs['batch_size'], filter_callback=kwargs['filter_callback'], \ destination=kwargs['destination']) xtc_files, smd_files, other_files = run_src self.comms = comms psana_comm = comms.psana_comm # TODO tjl and cpo to review rank = psana_comm.Get_rank() size = psana_comm.Get_size() if rank == 0: self.smd_dm = DgramManager(smd_files, run=self) self.dm = DgramManager(xtc_files, configs=self.smd_dm.configs, run=self) self.configs = self.dm.configs nbytes = np.array([memoryview(config).shape[0] for config in self.configs], \ dtype='i') self.calibs = {} for det_name in self.detnames: self.calibs[det_name] = super(RunParallel, self)._get_calib(det_name) else: self.smd_dm = None self.dm = None self.configs = None self.calibs = None nbytes = np.empty(len(smd_files), dtype='i') psana_comm.Bcast(nbytes, root=0) # no. of bytes is required for mpich # create empty views of known size if rank > 0: self.configs = [np.empty(nbyte, dtype='b') for nbyte in nbytes] for i in range(len(self.configs)): psana_comm.Bcast([self.configs[i], nbytes[i], MPI.BYTE], root=0) self.calibs = psana_comm.bcast(self.calibs, root=0) if rank > 0: # Create dgram objects using views from rank 0 (no disk operation). self.configs = [ dgram.Dgram(view=config, offset=0) for config in self.configs ] self.dm = DgramManager(xtc_files, configs=self.configs, run=self) self.esm = EnvStoreManager(self.configs, 'epics', 'scan')
def __init__(self, exp, run_no, run_src, **kwargs): super(RunSingleFile, self).__init__(exp, run_no, \ max_events=kwargs['max_events'], batch_size=kwargs['batch_size'], \ filter_callback=kwargs['filter_callback']) xtc_files, smd_files, epics_file = run_src self.dm = DgramManager(xtc_files) self.configs = self.dm.configs super()._get_runinfo() super()._set_configinfo() super()._set_calibconst() self.esm = EnvStoreManager(self.dm.configs, 'epics', 'scan')
def __init__(self, exp, run_no, run_src, **kwargs): super(RunSingleFile, self).__init__(exp, run_no, \ max_events=kwargs['max_events'], batch_size=kwargs['batch_size'], \ filter_callback=kwargs['filter_callback']) xtc_files, smd_files, epics_file = run_src self.dm = DgramManager(xtc_files) self.configs = self.dm.configs self.esm = EnvStoreManager(self.dm.configs, 'epics', 'scan') self.calibs = {} for det_name in self.detnames: self.calibs[det_name] = self._get_calib(det_name)
def __init__(self, exp, run_no, run_src, **kwargs): """ Parallel read using Legion """ super(RunLegion, self).__init__(exp, run_no, max_events=kwargs['max_events'], \ batch_size=kwargs['batch_size'], filter_callback=kwargs['filter_callback']) xtc_files, smd_files, other_files = run_src self.smd_dm = DgramManager(smd_files) self.dm = DgramManager(xtc_files, configs=self.smd_dm.configs) self.configs = self.dm.configs super()._get_runinfo() super()._set_configinfo() super()._set_calibconst() self.esm = EnvStoreManager(self.configs, 'epics', 'scan')
def __init__(self, exp, run_no, run_src, **kwargs): """ Parallel read using Legion """ super(RunLegion, self).__init__(exp, run_no, max_events=kwargs['max_events'], \ batch_size=kwargs['batch_size'], filter_callback=kwargs['filter_callback']) xtc_files, smd_files, other_files = run_src self.smd_dm = DgramManager(smd_files) self.dm = DgramManager(xtc_files, configs=self.smd_dm.configs) self.configs = self.dm.configs self.esm = EnvStoreManager(self.configs, 'epics', 'scan') self.calibs = {} for det_name in self.detnames: self.calibs[det_name] = super(RunLegion, self)._get_calib(det_name)
def __init__(self, comms, exp, run_no, run_src, **kwargs): """ Parallel read requires that rank 0 does the file system works. Configs and calib constants are sent to other ranks by MPI. Note that destination callback only works with RunParallel. """ super(RunParallel, self).__init__(exp, run_no, max_events=kwargs['max_events'], batch_size=kwargs['batch_size'], filter_callback=kwargs['filter_callback'], destination=kwargs['destination'], prom_man=kwargs['prom_man']) xtc_files, smd_files, other_files = run_src self.comms = comms psana_comm = comms.psana_comm # TODO tjl and cpo to review rank = psana_comm.Get_rank() size = psana_comm.Get_size() g_ts = self.prom_man.get_metric("psana_timestamp") if rank == 0: # get Configure and BeginRun using SmdReader self.smd_fds = np.array( [os.open(smd_file, os.O_RDONLY) for smd_file in smd_files], dtype=np.int32) self.smdr_man = SmdReaderManager(self) self.configs = self.smdr_man.get_next_dgrams() g_ts.labels("first_event").set(time.time()) self.beginruns = self.smdr_man.get_next_dgrams( configs=self.configs) self._get_runinfo() self.smd_dm = DgramManager(smd_files, configs=self.configs, run=self, fds=self.smd_fds) self.dm = DgramManager(xtc_files, configs=self.smd_dm.configs, run=self) nbytes = np.array([memoryview(config).shape[0] for config in self.configs], \ dtype='i') super()._set_configinfo() super()._set_calibconst() self.bcast_packets = {'calibconst': self.calibconst, \ 'expt': self.expt, 'runnum': self.runnum, 'timestamp': self.timestamp} else: self.smd_dm = None self.dm = None self.configs = None nbytes = np.empty(len(smd_files), dtype='i') self.bcast_packets = None # Send configs without pickling psana_comm.Bcast(nbytes, root=0) # no. of bytes is required for mpich if rank > 0: self.configs = [np.empty(nbyte, dtype='b') for nbyte in nbytes] for i in range(len(self.configs)): psana_comm.Bcast([self.configs[i], nbytes[i], MPI.BYTE], root=0) # Send other small things using small-case bcast self.bcast_packets = psana_comm.bcast(self.bcast_packets, root=0) if rank > 0: self.configs = [ dgram.Dgram(view=config, offset=0) for config in self.configs ] g_ts.labels("first_event").set(time.time()) self.dm = DgramManager(xtc_files, configs=self.configs, run=self) super()._set_configinfo( ) # after creating a dgrammanger, we can setup config info self.calibconst = self.bcast_packets['calibconst'] self.expt = self.bcast_packets['expt'] self.runnum = self.bcast_packets['runnum'] self.timestamp = self.bcast_packets['timestamp'] self.esm = EnvStoreManager(self.configs, 'epics', 'scan')