def main(): benchmark_dir = os.path.join(os.getcwd(), 'results') os.makedirs(benchmark_dir) pull_request_id = os.environ.get('PULL_REQUEST_NUMBER') commit_hash = get_commit_hash() #[:8] info = BenchmarksInfo(pull_request_id, commit_hash) info.datetime.append(datatime_with_format()) #start time print(f'pull_request_id = {pull_request_id}') print(f'commit_hash = {commit_hash}') for arch in benchmark_archs: #init & run suites = BenchmarkSuites(arch) suites.run() #save result suites.save(benchmark_dir) #add benchmark info info.add_suites_info(arch, suites) info.datetime.append(datatime_with_format()) #end time #save commit and benchmark info info_path = os.path.join(benchmark_dir, '_info.json') info_str = dump2json(info) with open(info_path, 'w') as f: print(info_str, file=f)
def _save_cases_as_json(self, arch, arch_dir='./'): for case in self._info[arch]: case_path = os.path.join(arch_dir, (case + '.json')) case_results = self._results[arch][case] with open(case_path, 'w') as f: case_str = dump2json(case_results) print(case_str, file=f)
def print_info(self): # remove 'results' in self._suites_result, then print info_dict = deepcopy(self._suites_result) for suite_name in info_dict: for arch in info_dict[suite_name]: for case in info_dict[suite_name][arch]: info_dict[suite_name][arch][case].pop('results') print(dump2json(info_dict))
def _save_cases_info_as_json(self, suite_path='./'): for case in self.test_cases: #for case [fill,saxpy,reduction] results_dict = {} for impl in self._cases_impl: #find [ti.i32, ti.i64, ti.f32, ti.f64] if impl._name != case.__name__: continue result_name = dtype2str(impl._test_dtype) results_dict[result_name] = impl.get_results_dict() case_path = os.path.join(suite_path, (case.__name__ + '.json')) with open(case_path, 'w') as f: case_str = dump2json(results_dict) print(case_str, file=f)
def _save_suite_info_as_json(self, suite_path='./'): info_dict = { 'cases': [func.__name__ for func in self.test_cases], 'dtype': [dtype2str(dtype) for dtype in self.test_dtype_list], 'dsize': [size for size in self.test_dsize_list], 'repeat': [ scaled_repeat_times(self._arch, size, self.basic_repeat_times) for size in self.test_dsize_list ], 'evaluator': [func.__name__ for func in self.evaluator] } info_path = os.path.join(suite_path, '_info.json') with open(info_path, 'w') as f: print(dump2json(info_dict), file=f)
def main(): benchmark_dir = os.path.join(os.getcwd(), 'results') os.makedirs(benchmark_dir, exist_ok=True) #init & run info = BenchmarkInfo() suites = BenchmarkSuites() suites.run() #save benchmark results & info suites.save(benchmark_dir) info.suites = suites.get_suites_info() info_path = os.path.join(benchmark_dir, '_info.json') info_str = dump2json(info) with open(info_path, 'w') as f: print(info_str, file=f)
def _save_info_as_json(self, arch, arch_dir='./'): info_path = os.path.join(arch_dir, '_info.json') with open(info_path, 'w') as f: print(dump2json(self._info[arch]), file=f)
def save_results_as_json(self, costomized_dir=None): file_path = os.path.join(self._file_path, 'results.json') if costomized_dir != None: file_path = os.path.join(costomized_dir, 'results.json') with open(file_path, 'w') as f: print(dump2json(self._suites_result), file=f)