示例#1
0
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, )), )
    ])
示例#2
0
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,
        )
示例#3
0
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)
示例#4
0
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)
示例#5
0
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
示例#6
0
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
示例#7
0
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)
示例#8
0
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,
    )
示例#9
0
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,
    )
示例#10
0
文件: flash.py 项目: ahebnl/Sirepo
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)
         ], )
示例#11
0
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)], )
示例#12
0
文件: flash.py 项目: yeeon/sirepo
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({})