def backup_results(results_path, results, file_name): """ Backs up the test results to a PKL file Parameters ---------- results_path - path to backup file results - the results object file_name - name of back up file. ------- """ io.save_results_to_pkl(results_path, results, file_name) if __name__ == '__main__': benchmark_timestamp = df.get_date() results_path = RESULTS_DIRECTORY + BENCHMARK_DIRECTORY + benchmark_timestamp + "/" functions_under_test = get_functions_under_test() items_pro_dimension = [1000, 2000, 3000, 4000, 5000] number_of_timings_pro_function_and_matrix_dimension = 5 results = run_performance_test(items_pro_dimension, number_of_timings_pro_function_and_matrix_dimension, functions_under_test) backup_results(results_path, results, 'dense_dot_sparse') timings = get_timings_from_results(results) functions_ranked_by_time = rank_functions_by_performance(timings) functions_labels = create_functions_aliases() table_data = tf.TableData(functions_labels, items_pro_dimension, functions_ranked_by_time, results, timings) ranked_times = [ranked_label for time, ranked_label in functions_ranked_by_time]
def test_get_date(self): date = datetime.datetime.now().strftime("%y-%m-%d-%H-%M") self.assertEquals(date[:-2], df.get_date()[:-2])
def create_functions_aliases(): """ Creates aliases to the function names in order to display them in the plots. Returns a dictionary with the function names as keys and aliases as values. ------- """ return {'dot_numpy':'Numpy x Numpy (Referenz)', 'scipy_csc_dot_numpy_with_swap':'Compressed Sparse Column x Numpy', 'scipy_csr_dot_numpy_with_swap':'Compressed Sparse Row x Numpy', 'scipy_bsr_dot_numpy_with_swap':'Block Sparse Row x Numpy'} if __name__ == '__main__': benchmark_timestamp = df.get_date() results_path = RESULTS_DIRECTORY + BENCHMARK_DIRECTORY + benchmark_timestamp + "/" functions_under_test = get_functions_under_test() items_pro_dimension = [500, 1000, 2000, 3000, 4000, 5000] number_of_timings_pro_function_and_matrix_dimension = 5 results = dds.run_performance_test(items_pro_dimension, number_of_timings_pro_function_and_matrix_dimension, functions_under_test) dds.backup_results(results_path, results, FILENAME) timings = dds.get_timings_from_results(results) functions_ranked_by_time = dds.rank_functions_by_performance(timings) functions_labels = create_functions_aliases() table_data = tf.TableData(functions_labels, items_pro_dimension, functions_ranked_by_time, results, timings) ranked_times = [ranked_label for time, ranked_label in functions_ranked_by_time]