def run_background(cfg_dir): data = simulation_db.read_json(template_common.INPUT_BASE_NAME) if data.report == 'setupAnimation': return mpi.run_program([ pkio.py_path(cfg_dir).join( _SIM_DATA.flash_exe_basename( simulation_db.read_json(template_common.INPUT_BASE_NAME, )), ) ])
def _run_opal(with_mpi=False): if with_mpi and mpi.cfg.cores < 2: with_mpi = False if with_mpi: mpi.run_program( ['opal', template.OPAL_INPUT_FILE], output=template.OPAL_OUTPUT_FILE, ) else: pksubprocess.check_call_with_signals( ['opal', template.OPAL_INPUT_FILE], output=template.OPAL_OUTPUT_FILE, msg=pkdlog, )
def _run_opal(with_mpi=False, compute_positions=False): if with_mpi and mpi.cfg.cores < 2: with_mpi = False if with_mpi: mpi.run_program( ['opal', template.OPAL_INPUT_FILE], output=template.OPAL_OUTPUT_FILE, ) else: pksubprocess.check_call_with_signals( ['opal', template.OPAL_INPUT_FILE], output=template.OPAL_OUTPUT_FILE, msg=pkdlog, ) if compute_positions: template_common.exec_parameters(template.OPAL_POSITION_FILE)
def run_elegant(with_mpi=False): # also used by pkcli.rcscon r = template_common.exec_parameters() pkio.write_text('elegant.lte', r.lattice_file) ele = 'elegant.ele' pkio.write_text(ele, r.elegant_file) kwargs = { 'output': ELEGANT_LOG_FILE, 'env': elegant_common.subprocess_env(), } #TODO(robnagler) Need to handle this specially, b/c different binary if r.execution_mode == 'parallel' and with_mpi and mpi.cfg.cores > 1: mpi.run_program(['Pelegant', ele], **kwargs) else: pksubprocess.check_call_with_signals(['elegant', ele], msg=pkdlog, **kwargs)
def _run_elegant(bunch_report=False, with_mpi=False): exec(pkio.read_text(template_common.PARAMETERS_PYTHON_FILE), locals(), locals()) pkio.write_text('elegant.lte', lattice_file) ele = 'elegant.ele' pkio.write_text(ele, elegant_file) kwargs = { 'output': ELEGANT_LOG_FILE, 'env': elegant_common.subprocess_env(), } try: #TODO(robnagler) Need to handle this specially, b/c different binary if execution_mode == 'parallel' and with_mpi and mpi.cfg.cores > 1: mpi.run_program(['Pelegant', ele], **kwargs) else: pksubprocess.check_call_with_signals(['elegant', ele], msg=pkdlog, **kwargs) except Exception as e: # ignore elegant failures - errors will be parsed from the log pass
def _run_elegant(bunch_report=False, with_mpi=False): exec(pkio.read_text(template_common.PARAMETERS_PYTHON_FILE), locals(), locals()) if bunch_report and re.search('\&sdds_beam\s', elegant_file): return pkio.write_text('elegant.lte', lattice_file) ele = 'elegant.ele' pkio.write_text(ele, elegant_file) kwargs = { 'output': ELEGANT_LOG_FILE, 'env': elegant_common.subprocess_env(), } #TODO(robnagler) Need to handle this specially, b/c different binary if execution_mode == 'parallel' and with_mpi and mpi.cfg.cores > 1: return mpi.run_program(['Pelegant', ele], **kwargs) pksubprocess.check_call_with_signals(['elegant', ele], msg=pkdp, **kwargs)
def _run_elegant(bunch_report=False, with_mpi=False): exec(pkio.read_text(template_common.PARAMETERS_PYTHON_FILE), locals(), locals()) if bunch_report and re.search('\&sdds_beam\s', elegant_file): return pkio.write_text('elegant.lte', lattice_file) ele = 'elegant.ele' pkio.write_text(ele, elegant_file) # TODO(robnagler) Need to handle this specially, b/c different binary env = copy.deepcopy(os.environ) env['RPN_DEFNS'] = pkresource.filename('defns.rpn') if with_mpi and mpi.cfg.cores > 1: return mpi.run_program(['Pelegant', ele], output=ELEGANT_LOG_FILE, env=env) pksubprocess.check_call_with_signals( ['elegant', ele], output=ELEGANT_LOG_FILE, env=env, msg=pkdp, )
def _run_elegant(bunch_report=False, with_mpi=False): exec(pkio.read_text(template_common.PARAMETERS_PYTHON_FILE), locals(), locals()) if bunch_report and re.search('\&sdds_beam\s', elegant_file): return pkio.write_text('elegant.lte', lattice_file) ele = 'elegant.ele' pkio.write_text(ele, elegant_file) # TODO(robnagler) Need to handle this specially, b/c different binary env = copy.deepcopy(os.environ) env['RPN_DEFNS'] = pkresource.filename('defns.rpn') if execution_mode == 'parallel' and with_mpi and mpi.cfg.cores > 1: return mpi.run_program(['Pelegant', ele], output=ELEGANT_LOG_FILE, env=env) pksubprocess.check_call_with_signals( ['elegant', ele], output=ELEGANT_LOG_FILE, env=env, msg=pkdp, )
def run_background(cfg_dir): data = simulation_db.read_json(template_common.INPUT_BASE_NAME) mpi.run_program( [pkio.py_path(cfg_dir).join(sirepo.sim_data.get_class(data).EXE_NAME) ], )
def run_background(cfg_dir): data = simulation_db.read_json(template_common.INPUT_BASE_NAME) mpi.run_program([sirepo.sim_data.get_class(data).flash_exe_path(data)], )
def run_background(cfg_dir): data = simulation_db.read_json(template_common.INPUT_BASE_NAME) with pkio.save_chdir(cfg_dir): mpi.run_program([_EXE_PATH[data.models.simulation.flashType]]) simulation_db.write_result({})