def setUpClass(cls): sys.stdout.write('(' + os.path.basename(__file__).split('.')[0] + '.' + cls.__name__ + ') ...') cls._test_name = 'tutorial_base' cls._skip_launch = not util.do_launch() cls._script_dir = os.path.dirname(os.path.realpath(__file__)) cls._base_dir = os.path.dirname(os.path.dirname(cls._script_dir)) cls._tmp_link = os.path.join(cls._script_dir, 'test_tutorial_base') # Work around to avoid building on compute nodes: # Check if the test setup script has been run more recently # than the geopm library build. do_build = True try: lib_path = os.path.join(cls._base_dir, '.libs', 'libgeopm.so') if os.stat(cls._tmp_link).st_mtime > os.stat(lib_path).st_mtime: do_build = False except: pass if do_build: build_script = os.path.join(cls._script_dir, 'test_tutorial_base.sh') subprocess.check_call(build_script, shell=True) # Clear out exception record for python 2 support geopmpy.error.exc_clear() if not cls._skip_launch: cls.launch()
def setUpClass(cls): """Create launcher, execute benchmark and set up class variables. """ sys.stdout.write('(' + os.path.basename(__file__).split('.')[0] + '.' + cls.__name__ + ') ...') test_name = 'test_omp_outer_loop' test_config = ['_with_ompt', '_without_ompt'] cls._expected_regions = ['MPI_Barrier'] cls._report_path = [] cls._skip_launch = not util.do_launch() num_node = 1 num_rank = 4 geopmpy.error.exc_clear() for config in test_config: curr_run = test_name + config report_path = curr_run + '.report' cls._report_path.append(report_path) cls._agent_conf_path = test_name + '-agent-config.json' if not cls._skip_launch: agent_conf = geopmpy.io.AgentConf(cls._agent_conf_path) launcher = geopm_test_launcher.TestLauncher(AppConf(), agent_conf, report_path, time_limit=6000) launcher.set_num_node(num_node) launcher.set_num_rank(num_rank) if config == '_without_ompt': launcher.disable_ompt() launcher.run(curr_run)
def setUpClass(cls): """Create launcher, execute benchmark and set up class variables. """ sys.stdout.write('(' + os.path.basename(__file__).split('.')[0] + '.' + cls.__name__ + ') ...') test_name = 'test_ee_timed_scaling_mix' cls._report_path = test_name + '.report' cls._trace_path = test_name + '.trace' cls._skip_launch = not util.do_launch() cls._agent_conf_path = test_name + '-agent-config.json' geopmpy.error.exc_clear() if not cls._skip_launch: num_node = 2 num_rank = 2 min_freq = geopm_test_launcher.geopmread( "CPUINFO::FREQ_MIN board 0") sticker_freq = geopm_test_launcher.geopmread( "CPUINFO::FREQ_STICKER board 0") agent_conf = geopmpy.io.AgentConf(cls._agent_conf_path, 'energy_efficient', { 'frequency_min': min_freq, 'frequency_max': sticker_freq }) launcher = geopm_test_launcher.TestLauncher(AppConf(), agent_conf, cls._report_path, cls._trace_path, time_limit=6000) launcher.set_num_node(num_node) launcher.set_num_rank(num_rank) launcher.run(test_name)
def setUpClass(cls): """Create launcher, execute benchmark and set up class variables. """ sys.stdout.write('(' + os.path.basename(__file__).split('.')[0] + '.' + cls.__name__ + ') ...') cls._test_name = 'epoch_inference' cls._skip_launch = not util.do_launch() cls._files = [] cls._trace_path_prefix = 'test_{}_trace'.format(cls._test_name) cls._agent_conf_path = 'test_' + cls._test_name + '-agent-config.json' cls._files.append(cls._agent_conf_path) # Clear out exception record for python 2 support geopmpy.error.exc_clear() cls._config_names = [ 'no_epoch', 'spin_epoch', 'barrier_epoch', 'spin_stride_epoch' ] if not cls._skip_launch: num_node = 1 num_rank = 1 time_limit = 6000 app_conf = AppConf() agent_conf = geopmpy.io.AgentConf(cls._agent_conf_path, 'monitor', {}) for run_config in cls._config_names: report_path = 'test_{}_{}.report'.format( cls._test_name, run_config) trace_path = '{}_{}'.format(cls._trace_path_prefix, run_config) cls._files.append(report_path) # Create the test launcher with the above configuration trace_signals = "EPOCH_RUNTIME,EPOCH_RUNTIME_IGNORE,EPOCH_RUNTIME_NETWORK" launcher = geopm_test_launcher.TestLauncher( app_conf, agent_conf, report_path, trace_path, time_limit=time_limit, trace_signals=trace_signals) launcher.set_num_node(num_node) launcher.set_num_rank(num_rank) # Run the test application geopm_args = [] if run_config == 'spin_epoch': geopm_args = ['--geopm-record-filter', 'proxy_epoch,spin'] elif run_config == 'barrier_epoch': geopm_args = [ '--geopm-record-filter', 'proxy_epoch,all2all' ] elif run_config == 'spin_stride_epoch': geopm_args = [ '--geopm-record-filter', 'proxy_epoch,spin,2' ] launcher.run('test_' + cls._test_name, add_geopm_args=geopm_args)
def setUpClass(cls): """Create launcher, execute benchmark and set up class variables. """ sys.stdout.write('(' + os.path.basename(__file__).split('.')[0] + '.' + cls.__name__ + ') ...') test_name = 'test_scaling_region' cls._report_path = test_name + '.report' cls._trace_path = test_name + '.trace' cls._skip_launch = not util.do_launch() cls._agent_conf_path = test_name + '-agent-config.json' # region_hash() of the sequence: # scaling_region_0, scaling_region_1, ... , scaling_region_30 cls._region_hash = [ geopmpy.hash.crc32_str('scaling_region_{}'.format(idx)) for idx in range(31) ] geopmpy.error.exc_clear() if not cls._skip_launch: num_node = 1 num_rank = 1 # Set up agent configuration so that each region is assigned a different frequency freq_min = geopm_test_launcher.geopmread( "CPUINFO::FREQ_MIN board 0") freq_sticker = geopm_test_launcher.geopmread( "CPUINFO::FREQ_STICKER board 0") freq_step = geopm_test_launcher.geopmread( "CPUINFO::FREQ_STEP board 0") num_step = int((freq_sticker - freq_min) / freq_step + 0.5) agent_conf_dict = {'FREQ_DEFAULT': freq_sticker} cls._region_freq = [ freq_min + idx * freq_step for idx in range(num_step) ] freq_idx = 0 for freq_idx in range(len(cls._region_freq)): agent_conf_dict['HASH_{}'.format( freq_idx)] = cls._region_hash[freq_idx] agent_conf_dict['FREQ_{}'.format( freq_idx)] = cls._region_freq[freq_idx] agent_conf = geopmpy.io.AgentConf(cls._agent_conf_path, 'frequency_map', agent_conf_dict) launcher = geopm_test_launcher.TestLauncher(AppConf(), agent_conf, cls._report_path, cls._trace_path, time_limit=6000) launcher.set_num_node(num_node) launcher.set_num_rank(num_rank) launcher.run(test_name)
""" import sys import unittest import os import glob import pandas import time import geopm_context import geopmpy.io import geopmpy.error import util if util.do_launch(): # Note: this import may be moved outside of do_launch if needed to run # commands on compute nodes such as geopm_test_launcher.geopmread import geopm_test_launcher geopmpy.error.exc_clear() @util.skip_unless_run_long_tests() @util.skip_unless_batch() class TestIntegration_power_balancer(unittest.TestCase): class AppConf(object): """Class that is used by the test launcher in place of a geopmpy.io.BenchConf when running the power_balancer benchmark. """ def write(self):
""" report = geopmpy.io.RawReport(self._report_path) host_names = report.host_names() for host in host_names: for rn in report.region_names(host): if rn.startswith('timed_scaling_region'): region = report.raw_region(host, rn) util.assertNear(self, 1.0, report.get_field(region, 'runtime', 'sec')) @util.skip_unless_do_launch() def test_achieved_frequency(self): """Test that the reports show achieved frequencies near target frequency. """ report = geopmpy.io.RawReport(self._report_path) host_names = report.host_names() for host in host_names: for rn in ['timed_scaling_region_{}'.format(idx) for idx in range(len(self._region_freq))]: region = report.raw_region(host, rn) request_freq = report.get_field(region, 'frequency-map') actual_freq = report.get_field(region, 'frequency', 'Hz') util.assertNear(self, request_freq, actual_freq) if __name__ == '__main__': # Call do_launch to clear non-pyunit command line option util.do_launch() unittest.main()
def setUpClass(cls): """Create launcher, execute benchmark and set up class variables. """ sys.stdout.write('(' + os.path.basename(__file__).split('.')[0] + '.' + cls.__name__ + ') ...') test_name = 'frequency_hint_usage' cls._skip_launch = not util.do_launch() cls._fmap_report_path = 'test_{}_fmap.report'.format(test_name) cls._fmap_trace_path = 'test_{}_fmap.trace'.format(test_name) cls._fmap_agent_conf_path = 'test_' + test_name + '-fmap-agent-config.json' cls._ee_report_path = 'test_{}_ee.report'.format(test_name) cls._ee_trace_path = 'test_{}_ee.trace'.format(test_name) cls._ee_agent_conf_path = 'test_' + test_name + '-ee-agent-config.json' geopmpy.error.exc_clear( ) # Clear out exception record for python 2 support cls._freq_min = geopm_test_launcher.geopmread( "CPUINFO::FREQ_MIN board 0") cls._freq_sticker = geopm_test_launcher.geopmread( "CPUINFO::FREQ_STICKER board 0") cls._freq_step = geopm_test_launcher.geopmread( "FREQUENCY_STEP board 0") cls._freq_default = cls._freq_sticker - cls._freq_step if not cls._skip_launch: # Set the job size parameters num_node = 1 num_rank = 1 time_limit = 6000 # Configure the test application app_conf = AppConf() # Configure the agents agent_conf_dict = {'FREQ_DEFAULT': cls._freq_default} fmap_agent_conf = geopmpy.io.AgentConf(cls._fmap_agent_conf_path, 'frequency_map', agent_conf_dict) agent_conf_dict = { 'FREQ_MIN': cls._freq_min, 'FREQ_MAX': cls._freq_default } ee_agent_conf = geopmpy.io.AgentConf(cls._ee_agent_conf_path, 'energy_efficient', agent_conf_dict) # Fmap run launcher = geopm_test_launcher.TestLauncher(app_conf, fmap_agent_conf, cls._fmap_report_path, cls._fmap_trace_path, time_limit=time_limit) launcher.set_num_node(num_node) launcher.set_num_rank(num_rank) launcher.run('test_' + test_name) # EE run launcher = geopm_test_launcher.TestLauncher(app_conf, ee_agent_conf, cls._ee_report_path, cls._ee_trace_path, time_limit=time_limit) launcher.set_num_node(num_node) launcher.set_num_rank(num_rank) launcher.run(test_name)