Ejemplo n.º 1
0
def hpctoolkit_profile(executable: pathlib.Path,
                       results_path: pathlib.Path,
                       sample_size: int,
                       events: t.Dict[str, t.Union[bool, int]] = None,
                       mpi_proc: int = 0,
                       *,
                       test_name: str,
                       phase_name: str = 'profile'):
    assert isinstance(executable, pathlib.Path), type(executable)
    if events is None:
        events = {}
    results_path.parent.mkdir(exist_ok=True)
    events_options = [
        ' -e {}{}'.format(
            event, '' if rate is True else '@{}'.format(
                rate if isinstance(rate, int) else 'f{}'.format(round(1 /
                                                                      rate))))
        for event, rate in events.items()
    ]
    hpcrun_command = '{}{} -o "{}" {}'.format(HPCRUN_EXE,
                                              ''.join(events_options),
                                              results_path, executable)
    if mpi_proc > 0:
        hpcrun_command = 'mpirun -np {} {}'.format(mpi_proc, hpcrun_command)
    _LOG.warning('%s.%s: running the experiment %i times...', test_name,
                 phase_name, sample_size)
    for i in range(sample_size):
        _run_and_check(hpcrun_command,
                       executable.parent,
                       test_name=test_name,
                       phase_name=phase_name)
Ejemplo n.º 2
0
def make_sfocu(flash_dir: pathlib.Path):
    sfocu_dir = flash_dir.joinpath('tools', 'sfocu')
    _run_and_check('make -f Makefile.hello clean',
                   sfocu_dir,
                   test_name='sfocu',
                   phase_name='clean')
    _run_and_check('make -f Makefile.hello',
                   sfocu_dir,
                   test_name='sfocu',
                   phase_name='make')
Ejemplo n.º 3
0
def setup_flash(experiment,
                objdir: str,
                setup_dir,
                *,
                test_name: str,
                phase_name: str = 'setup'):
    setup_command = './setup -site {} {}'.format(FLASH_SITE, experiment)
    if objdir != 'object':
        setup_command += ' -objdir={}'.format(objdir)
    _run_and_check(setup_command,
                   setup_dir,
                   test_name=test_name,
                   phase_name=phase_name)
Ejemplo n.º 4
0
def hpctoolkit_summarize(executable: pathlib.Path,
                         results_path: pathlib.Path,
                         source_path: pathlib.Path,
                         *,
                         test_name: str,
                         phase_name: str = 'summarize'):
    struct_path = results_path.joinpath(executable.name + '.hpcstruct')
    hpcstruct_command = '{} -I "{}" --verbose -o {} {}'.format(
        HPCSTRUCT_EXE, source_path.joinpath('*'), struct_path, executable)
    _run_and_check(hpcstruct_command,
                   source_path,
                   test_name=test_name,
                   phase_name='{}.hpcstruct'.format(phase_name))
    hpcprof_command = '{} -I "{}" --replace-path "{}=." {} -S {} -M stats -o {}'.format(
        HPCPROF_EXE, source_path.joinpath('+'), source_path, results_path,
        struct_path, profile_db_path(test_name=test_name))
    _run_and_check(hpcprof_command,
                   source_path,
                   test_name=test_name,
                   phase_name='{}.hpcprof'.format(phase_name))
Ejemplo n.º 5
0
 def _run_and_check(self, cmd, wd, log_filename_prefix):
     _run_and_check(cmd,
                    wd,
                    test_name=self.id(),
                    phase_name=log_filename_prefix)
Ejemplo n.º 6
0
def clean_flash(build_dir, *, test_name: str, phase_name: str = 'clean'):
    _run_and_check('make clean',
                   build_dir,
                   test_name=test_name,
                   phase_name=phase_name)
Ejemplo n.º 7
0
def make_flash(build_dir, *, test_name: str, phase_name: str = 'make'):
    _run_and_check('make',
                   build_dir,
                   test_name=test_name,
                   phase_name=phase_name)