def test_scorep_mh_set_up_no_instr(self): s_mh = M.ScorepSystemHelper(self.cfg) self.instr_cfg._is_instrumentation_run = False s_mh.set_up(self.target_cfg, self.instr_cfg, True) self.assertDictEqual({}, s_mh.data) self.assertEqual('', s_mh.cur_mem_size) self.assertEqual('False', s_mh.cur_overwrite_exp_dir) self.assertEqual('', s_mh.cur_base_name) self.assertEqual('', s_mh.cur_exp_directory)
def test_scorep_mh_set_up_instr(self): s_mh = M.ScorepSystemHelper(self.cfg) s_mh.set_up(self.target_cfg, self.instr_cfg, True) self.assertIn('cube_dir', s_mh.data) self.assertEqual('500M', s_mh.cur_mem_size) self.assertEqual('True', s_mh.cur_overwrite_exp_dir) self.assertEqual('item01-flavor01-item01', s_mh.cur_base_name) self.assertEqual('/tmp/where/cube/files/are/item01-item01-flavor01-0', s_mh.cur_exp_directory)
def test_get_no_instr_file_flags(self): s_mh = m.ScorepSystemHelper(self.cfg) s_mh.set_up(self.target_cfg, self.instr_cfg, False) instr_file = 'myFile.filt' ct_filter = False kw_dict = dff.BackendDefaults().get_default_kwargs() cc = kw_dict['CC'] self.assertEqual('\"clang\"', cc) cpp = kw_dict['CXX'] self.assertEqual('\"clang++\"', cpp)
def test_get_instr_file_flags(self): s_mh = m.ScorepSystemHelper(self.cfg) s_mh.set_up(self.target_cfg, self.instr_cfg, True) instr_file = 'myFile.filt' ct_filter = True cc = m.ScorepSystemHelper.get_scorep_compliant_CC_command( instr_file, ct_filter) self.assertEqual( '\"clang -finstrument-functions -finstrument-functions-whitelist-inputfile=' + instr_file + '\"', cc) cpp = m.ScorepSystemHelper.get_scorep_compliant_CXX_command( instr_file, ct_filter) self.assertEqual( '\"clang++ -finstrument-functions -finstrument-functions-whitelist-inputfile=' + instr_file + '\"', cpp)
def do_profile_run(self, target_config: TargetConfiguration, instr_iteration: int, compile_time_filtering: bool = True) -> ms.RunResult: log.get_logger().log( 'LocalRunner::do_profile_run: Received instrumentation file: ' + target_config.get_instr_file(), level='debug') scorep_helper = ms.ScorepSystemHelper(self._config) instrument_config = InstrumentConfig(True, instr_iteration) scorep_helper.set_up(target_config, instrument_config, compile_time_filtering) runtime = .0 if not target_config.has_args_for_invocation(): # This runner only takes into account the first argument string (if not already set) args = self._config.get_args(target_config.get_build(), target_config.get_target()) target_config.set_args_for_invocation(args[0]) for y in range(0, self._num_repetitions): log.get_logger().log( 'LocalRunner::do_profile_run: Running instrumentation iteration ' + str(y), level='debug') runtime = runtime + self.run(target_config, instrument_config, compile_time_filtering) # Enable further processing of the resulting profile self._sink.process(scorep_helper.get_exp_dir(), target_config, instrument_config) run_result = ms.RunResult(runtime, self._num_repetitions) log.get_logger().log('[Instrument][RUNTIME] $' + str(instr_iteration) + '$ ' + str(run_result.get_average()), level='perf') return run_result