def test_mpi(self, tmp_path): setup_input_files(tmp_path) env = dict( list(os.environ.items()) + [('TEST_XTC_DIR', str(tmp_path)), ('PS_SRV_NODES', '0'), ('PS_EB_NODES', '1')]) run_steps = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'run_steps.py') subprocess.check_call(['python', run_steps], env=env) # Test one EventBuilder with multiple Bigata cores run_steps = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'run_steps.py') subprocess.check_call(['mpirun', '-n', '5', 'python', run_steps], env=env) # MONA: FIXME commented this out until StepHistory is working properly # Test multiple EventBuilder with multiple Bigata cores env['PS_EB_NODES'] = '2' run_steps = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'run_steps.py') subprocess.check_call(['mpirun', '-n', '7', 'python', run_steps], env=env)
def test_legion_pickle(self, tmp_path): # Again, in Legion setup_input_files(tmp_path) python_path = os.environ.get('PYTHONPATH', '').split(':') python_path.append(os.path.dirname(os.path.realpath(__file__))) env = dict( list(os.environ.items()) + [ ('PYTHONPATH', ':'.join(python_path)), ('PS_PARALLEL', 'legion'), ('TEST_XTC_DIR', str(tmp_path)), ]) subprocess.check_call(['legion_python', 'run_pickle', '-ll:py', '1'], env=env)
def test_mpi(self, tmp_path): setup_input_files(tmp_path) env = dict(list(os.environ.items()) + [ ('TEST_XTC_DIR', str(tmp_path)), ]) loop_based = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'user_loops.py') subprocess.check_call(['mpirun','-n','3','python',loop_based], env=env) callback_based = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'user_callbacks.py') subprocess.check_call(['mpirun','-n','3','python',callback_based], env=env) loop_exhaustive_based = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ds.py') subprocess.check_call(['mpirun','-n','3','python',loop_exhaustive_based], env=env)
def test_mpi(self, tmp_path): setup_input_files(tmp_path) env = dict( list(os.environ.items()) + [('TEST_XTC_DIR', str(tmp_path)), ('PS_SRV_NODES', '0'), ('PS_SMD_NODES', '1')]) loop_based = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'user_loops.py') subprocess.check_call(['mpirun', '-n', '3', 'python', loop_based], env=env) callback_based = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'user_callbacks.py') subprocess.check_call(['mpirun', '-n', '3', 'python', callback_based], env=env) loop_exhaustive_based = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'ds.py') subprocess.check_call( ['mpirun', '-n', '3', 'python', loop_exhaustive_based], env=env) # Test one EventBuilder with multiple Bigata cores run_steps = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'run_steps.py') subprocess.check_call(['mpirun', '-n', '5', 'python', run_steps], env=env) # Test multiple EventBuilder with multiple Bigata cores env['PS_SMD_NODES'] = '2' run_steps = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'run_steps.py') subprocess.check_call(['mpirun', '-n', '7', 'python', run_steps], env=env) env['PS_SMD_NODES'] = '1' # reset no. of eventbuilder cores env['PS_SRV_NODES'] = '2' run_smalldata = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'run_smalldata.py') subprocess.check_call(['mpirun', '-n', '6', 'python', run_smalldata], env=env)
def test_mpi(self, tmp_path): setup_input_files(tmp_path) env = dict(list(os.environ.items()) + [ ('TEST_XTC_DIR', str(tmp_path)), ('PS_SRV_NODES', '0'), ('PS_EB_NODES', '1') ]) loop_based = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'user_loops.py') subprocess.check_call(['mpirun','-n','3','python',loop_based], env=env) #callback_based = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'user_callbacks.py') #subprocess.check_call(['mpirun','-n','3','python',callback_based], env=env) run_early_termination = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'run_early_termination.py') subprocess.check_call(['mpirun','-n','3','python',run_early_termination], env=env) # Test more than 1 bigdata node loop_exhaustive_based = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'ds.py') subprocess.check_call(['mpirun','-n','5','python',loop_exhaustive_based], env=env) run_mixed_rate = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'run_mixed_rate.py') subprocess.check_call(['mpirun','-n','5','python',run_mixed_rate], env=env) run_chunking = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'run_chunking.py') subprocess.check_call(['mpirun','-n','5','python',run_chunking], env=env) run_intg_det = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'run_intg_det.py') subprocess.check_call(['mpirun','-n','4','python',run_intg_det], env=env) # Test more than 1 eb node env['PS_EB_NODES'] = '2' subprocess.check_call(['mpirun','-n','7','python',run_mixed_rate], env=env) subprocess.check_call(['mpirun','-n','7','python',run_chunking], env=env) env['PS_EB_NODES'] = '1' # reset no. of eventbuilder cores env['PS_SRV_NODES'] = '2' run_smalldata = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'run_smalldata.py') subprocess.check_call(['mpirun','-n','6','python',run_smalldata], env=env)
def test_legion(self, tmp_path): setup_input_files(tmp_path) # Legion script mode. env = dict( list(os.environ.items()) + [ ('PS_PARALLEL', 'legion'), ('TEST_XTC_DIR', str(tmp_path)), ]) callback_based = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'user_callbacks.py') subprocess.check_call(['legion_python', callback_based, '-ll:py', '1'], env=env) # Legion module mode. python_path = os.environ.get('PYTHONPATH', '').split(':') python_path.append(os.path.dirname(os.path.realpath(__file__))) env.update({ 'PYTHONPATH': ':'.join(python_path), }) subprocess.check_call( ['legion_python', 'user_callbacks', '-ll:py', '1'], env=env)
def test_serial(self, tmp_path): setup_input_files(tmp_path) env = dict( list(os.environ.items()) + [ ('TEST_XTC_DIR', str(tmp_path)), ]) loop_based = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'user_loops.py') subprocess.check_call(['python', loop_based], env=env) callback_based = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'user_callbacks.py') subprocess.check_call(['python', callback_based], env=env) loop_based_exhausted = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'ds.py') subprocess.check_call(['python', loop_based_exhausted], env=env) run_early_termination = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'run_early_termination.py') subprocess.check_call(['python', run_early_termination], env=env)
def test_mpi(self, tmp_path): setup_input_files(tmp_path) env = dict( list(os.environ.items()) + [('TEST_XTC_DIR', str(tmp_path)), ('PS_SRV_NODES', '0'), ('PS_EB_NODES', '1')]) run_steps = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'run_steps.py') subprocess.check_call(['python', run_steps], env=env) # Test one EventBuilder with multiple Bigata cores run_steps = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'run_steps.py') subprocess.check_call(['mpirun', '-n', '5', 'python', run_steps], env=env) # Test multiple EventBuilder with multiple Bigata cores env['PS_EB_NODES'] = '2' run_steps = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'run_steps.py') subprocess.check_call(['mpirun', '-n', '7', 'python', run_steps], env=env) # This also tests timestamps filter run_steps = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'run_steps_w_ts_filter.py') subprocess.check_call(['mpirun', '-n', '7', 'python', run_steps], env=env) # Test fakestep insert (note that the script overrides some of PS_ env. variables run_fakestep = os.path.join( os.path.dirname(os.path.realpath(__file__)), 'run_fakestep.py') subprocess.check_call(['mpirun', '-n', '5', 'python', run_steps], env=env)
result['evt_per_step'][i] = cn_evt_per_step result['n_steps'] = cn_steps result['n_events'] = cn_events return result if __name__ == "__main__": import pathlib p = pathlib.Path(xtc_dir) if not p.exists(): if rank == 0: p.mkdir() setup_input_files(p, n_files=2, slow_update_freq=4, n_motor_steps=3, n_events_per_step=10, gen_run2=False) comm.Barrier() # Test run.steps() test_cases = [\ (51, 1, 0), \ (51, 1, my_filter), \ (51, 5, 0), \ (51, 5, my_filter), \ (20, 1, 0), \ (19, 1, 0), \ (1, 1, my_filter), \ (1, 1, 0), \
def test_run_pickle(self, tmp_path): # Test that run is pickleable setup_input_files(tmp_path) import run_pickle run_pickle.test_run_pickle(tmp_path)
def test_smalldata(tmp_path): setup_input_files(tmp_path) # tmp_path is from pytest os.environ['TEST_XTC_DIR'] = str(tmp_path) run_smalldata.main(tmp_path) return