This reverts commit a828f6681c.
tags/v0.6.0-beta
| @@ -34,8 +34,6 @@ class AicoreTypeAnalyser(BaseAnalyser): | |||||
| ProfilerPathErrorException: If the profiling dir is invalid. | ProfilerPathErrorException: If the profiling dir is invalid. | ||||
| """ | """ | ||||
| _col_names = ['op_type', 'execution_time', 'execution_frequency', 'percent'] | _col_names = ['op_type', 'execution_time', 'execution_frequency', 'percent'] | ||||
| _col_names_in_result = ['op_type', 'execution_time (ms)', | |||||
| 'execution_frequency', 'percent'] | |||||
| _file_name_aicore_type_time = 'aicore_intermediate_{}_type.csv' | _file_name_aicore_type_time = 'aicore_intermediate_{}_type.csv' | ||||
| def _load(self): | def _load(self): | ||||
| @@ -74,7 +72,6 @@ class AicoreTypeAnalyser(BaseAnalyser): | |||||
| """ | """ | ||||
| for item in self._result: | for item in self._result: | ||||
| item[1] = float(format(item[1], '.6f')) | item[1] = float(format(item[1], '.6f')) | ||||
| self._display_col_names = self._col_names_in_result[:] | |||||
| return super()._organize_query_result() | return super()._organize_query_result() | ||||
| def _convert_field_type(self, row): | def _convert_field_type(self, row): | ||||
| @@ -104,8 +101,6 @@ class AicoreDetailAnalyser(BaseAnalyser): | |||||
| """ | """ | ||||
| _col_names = ['op_name', 'op_type', 'avg_execution_time', 'subgraph', | _col_names = ['op_name', 'op_type', 'avg_execution_time', 'subgraph', | ||||
| 'full_op_name', 'op_info'] | 'full_op_name', 'op_info'] | ||||
| _col_names_in_result = ['op_name', 'op_type', 'avg_execution_time (ms)', | |||||
| 'subgraph', 'full_op_name', 'op_info'] | |||||
| _file_name_aicore_detail_time = 'aicore_intermediate_{}_detail.csv' | _file_name_aicore_detail_time = 'aicore_intermediate_{}_detail.csv' | ||||
| _file_name_framework_info = 'framework_raw_{}.csv' | _file_name_framework_info = 'framework_raw_{}.csv' | ||||
| @@ -231,11 +226,11 @@ class AicoreDetailAnalyser(BaseAnalyser): | |||||
| is_display_full_op_name (bool): Whether to display the operator full | is_display_full_op_name (bool): Whether to display the operator full | ||||
| name. | name. | ||||
| """ | """ | ||||
| self._display_col_names = self._col_names_in_result[0:4] | |||||
| self._display_col_names = self._col_names[0:4] | |||||
| if is_display_full_op_name: | if is_display_full_op_name: | ||||
| self._display_col_names.append(self._col_names_in_result[4]) | |||||
| self._display_col_names.append(self._col_names[4]) | |||||
| if is_display_detail: | if is_display_detail: | ||||
| self._display_col_names.append(self._col_names_in_result[5]) | |||||
| self._display_col_names.append(self._col_names[5]) | |||||
| def _convert_framework_field_type(self, row): | def _convert_framework_field_type(self, row): | ||||
| """ | """ | ||||
| @@ -280,8 +275,6 @@ class AicpuAnalyser(BaseAnalyser): | |||||
| """ | """ | ||||
| _col_names = ['serial_number', 'op_type', 'total_time', 'dispatch_time', | _col_names = ['serial_number', 'op_type', 'total_time', 'dispatch_time', | ||||
| 'run_start', 'run_end'] | 'run_start', 'run_end'] | ||||
| _col_names_in_result = ['serial_number', 'op_type', 'total_time (ms)', | |||||
| 'dispatch_time (ms)', 'run_start', 'run_end'] | |||||
| _file_name_aicpu_time = 'aicpu_intermediate_{}.csv' | _file_name_aicpu_time = 'aicpu_intermediate_{}.csv' | ||||
| def _load(self): | def _load(self): | ||||
| @@ -312,16 +305,6 @@ class AicpuAnalyser(BaseAnalyser): | |||||
| return self._default_filter(item, filter_condition) | return self._default_filter(item, filter_condition) | ||||
| self._result = list(filter(_inner_filter, self._data)) | self._result = list(filter(_inner_filter, self._data)) | ||||
| def _organize_query_result(self): | |||||
| """ | |||||
| Organize the query result. | |||||
| Returns: | |||||
| dict, the query result. | |||||
| """ | |||||
| self._display_col_names = self._col_names_in_result[:] | |||||
| return super()._organize_query_result() | |||||
| def _convert_field_type(self, row): | def _convert_field_type(self, row): | ||||
| """ | """ | ||||
| Convert the field type to the specific type. | Convert the field type to the specific type. | ||||
| @@ -32,8 +32,7 @@ from tests.ut.profiler import RAW_DATA_BASE | |||||
| OP_GATHER_V2_INFO = { | OP_GATHER_V2_INFO = { | ||||
| 'col_name': [ | 'col_name': [ | ||||
| 'op_name', 'op_type', 'avg_execution_time (ms)', 'subgraph', 'full_op_name', | |||||
| 'op_info' | |||||
| 'op_name', 'op_type', 'avg_execution_time', 'subgraph', 'full_op_name', 'op_info' | |||||
| ], | ], | ||||
| 'object': [ | 'object': [ | ||||
| [ | [ | ||||
| @@ -125,7 +124,7 @@ class TestOpAnalyser: | |||||
| def test_query_aicore_type_1(self): | def test_query_aicore_type_1(self): | ||||
| """Test the function of querying AICORE operator type infomation.""" | """Test the function of querying AICORE operator type infomation.""" | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': ['op_type', 'execution_time (ms)', 'execution_frequency', 'percent'], | |||||
| 'col_name': ['op_type', 'execution_time', 'execution_frequency', 'percent'], | |||||
| 'object': [ | 'object': [ | ||||
| ['UnsortedSegmentSum', 44.607826, 2, 35.28], | ['UnsortedSegmentSum', 44.607826, 2, 35.28], | ||||
| ['GatherV2', 43.155441, 2, 34.13], | ['GatherV2', 43.155441, 2, 34.13], | ||||
| @@ -177,7 +176,7 @@ class TestOpAnalyser: | |||||
| def test_query_aicore_type_2(self): | def test_query_aicore_type_2(self): | ||||
| """Test the function of querying AICORE operator type infomation.""" | """Test the function of querying AICORE operator type infomation.""" | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': ['op_type', 'execution_time (ms)', 'execution_frequency', 'percent'], | |||||
| 'col_name': ['op_type', 'execution_time', 'execution_frequency', 'percent'], | |||||
| 'object': [ | 'object': [ | ||||
| ['MatMul', 1.936681, 15, 1.53], | ['MatMul', 1.936681, 15, 1.53], | ||||
| ['Mul', 1.902949, 32, 1.51] | ['Mul', 1.902949, 32, 1.51] | ||||
| @@ -23,8 +23,6 @@ from tests.ut.profiler import PROFILER_DIR | |||||
| COL_NAMES = ['op_name', 'op_type', 'avg_execution_time', 'subgraph', | COL_NAMES = ['op_name', 'op_type', 'avg_execution_time', 'subgraph', | ||||
| 'full_op_name', 'op_info'] | 'full_op_name', 'op_info'] | ||||
| COL_NAMES_IN_RESULT = ['op_name', 'op_type', 'avg_execution_time (ms)', | |||||
| 'subgraph', 'full_op_name', 'op_info'] | |||||
| def get_detail_infos(indexes=None, sort_name=None, sort_type=True): | def get_detail_infos(indexes=None, sort_name=None, sort_type=True): | ||||
| @@ -77,7 +75,7 @@ class TestAicoreDetailAnalyser(TestCase): | |||||
| def test_query_success_1(self): | def test_query_success_1(self): | ||||
| """Test the success of the querying function.""" | """Test the success of the querying function.""" | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT, | |||||
| 'col_name': COL_NAMES, | |||||
| 'object': get_detail_infos(), | 'object': get_detail_infos(), | ||||
| 'size': 10 | 'size': 10 | ||||
| } | } | ||||
| @@ -90,7 +88,7 @@ class TestAicoreDetailAnalyser(TestCase): | |||||
| def test_query_success_2(self): | def test_query_success_2(self): | ||||
| """Test the success of the querying function.""" | """Test the success of the querying function.""" | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT, | |||||
| 'col_name': COL_NAMES, | |||||
| 'object': get_detail_infos(indexes=[9]), | 'object': get_detail_infos(indexes=[9]), | ||||
| 'size': 1 | 'size': 1 | ||||
| } | } | ||||
| @@ -127,7 +125,7 @@ class TestAicoreDetailAnalyser(TestCase): | |||||
| def test_query_success_3(self): | def test_query_success_3(self): | ||||
| """Test the success of the querying function.""" | """Test the success of the querying function.""" | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT, | |||||
| 'col_name': COL_NAMES, | |||||
| 'object': get_detail_infos(sort_name='avg_execution_time', sort_type=True), | 'object': get_detail_infos(sort_name='avg_execution_time', sort_type=True), | ||||
| 'size': 10 | 'size': 10 | ||||
| } | } | ||||
| @@ -141,7 +139,7 @@ class TestAicoreDetailAnalyser(TestCase): | |||||
| self.assertDictEqual(expect_result, result) | self.assertDictEqual(expect_result, result) | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT, | |||||
| 'col_name': COL_NAMES, | |||||
| 'object': get_detail_infos(sort_name='op_name', sort_type=False), | 'object': get_detail_infos(sort_name='op_name', sort_type=False), | ||||
| 'size': 10 | 'size': 10 | ||||
| } | } | ||||
| @@ -157,7 +155,7 @@ class TestAicoreDetailAnalyser(TestCase): | |||||
| def test_query_success_4(self): | def test_query_success_4(self): | ||||
| """Test the success of the querying function.""" | """Test the success of the querying function.""" | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT, | |||||
| 'col_name': COL_NAMES, | |||||
| 'object': get_detail_infos(indexes=[2, 3]), | 'object': get_detail_infos(indexes=[2, 3]), | ||||
| 'size': 10 | 'size': 10 | ||||
| } | } | ||||
| @@ -171,7 +169,7 @@ class TestAicoreDetailAnalyser(TestCase): | |||||
| self.assertDictEqual(expect_result, result) | self.assertDictEqual(expect_result, result) | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT, | |||||
| 'col_name': COL_NAMES, | |||||
| 'object': [], | 'object': [], | ||||
| 'size': 10 | 'size': 10 | ||||
| } | } | ||||
| @@ -187,7 +185,7 @@ class TestAicoreDetailAnalyser(TestCase): | |||||
| def test_query_success_5(self): | def test_query_success_5(self): | ||||
| """Test the success of the querying function.""" | """Test the success of the querying function.""" | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT, | |||||
| 'col_name': COL_NAMES, | |||||
| 'object': get_detail_infos( | 'object': get_detail_infos( | ||||
| indexes=[1, 2], sort_name='avg_execution_time', sort_type=True | indexes=[1, 2], sort_name='avg_execution_time', sort_type=True | ||||
| ), | ), | ||||
| @@ -211,7 +209,7 @@ class TestAicoreDetailAnalyser(TestCase): | |||||
| self.assertDictEqual(expect_result, result) | self.assertDictEqual(expect_result, result) | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT, | |||||
| 'col_name': COL_NAMES, | |||||
| 'object': get_detail_infos( | 'object': get_detail_infos( | ||||
| indexes=[0, 1, 2, 8], sort_name='avg_execution_time', sort_type=True | indexes=[0, 1, 2, 8], sort_name='avg_execution_time', sort_type=True | ||||
| ), | ), | ||||
| @@ -238,7 +236,7 @@ class TestAicoreDetailAnalyser(TestCase): | |||||
| detail_infos = get_detail_infos(indexes=[9]) | detail_infos = get_detail_infos(indexes=[9]) | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT[0:5], | |||||
| 'col_name': COL_NAMES[0:5], | |||||
| 'object': [item[0:5] for item in detail_infos], | 'object': [item[0:5] for item in detail_infos], | ||||
| 'size': 1 | 'size': 1 | ||||
| } | } | ||||
| @@ -254,7 +252,7 @@ class TestAicoreDetailAnalyser(TestCase): | |||||
| self.assertDictEqual(expect_result, result) | self.assertDictEqual(expect_result, result) | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT[0:4], | |||||
| 'col_name': COL_NAMES[0:4], | |||||
| 'object': [item[0:4] for item in detail_infos], | 'object': [item[0:4] for item in detail_infos], | ||||
| 'size': 1 | 'size': 1 | ||||
| } | } | ||||
| @@ -274,7 +272,7 @@ class TestAicoreDetailAnalyser(TestCase): | |||||
| """Test the success of the querying and sorting function by operator type.""" | """Test the success of the querying and sorting function by operator type.""" | ||||
| detail_infos = get_detail_infos(indexes=[9, 0, 2, 1, 5, 3, 4]) | detail_infos = get_detail_infos(indexes=[9, 0, 2, 1, 5, 3, 4]) | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT[0:4], | |||||
| 'col_name': COL_NAMES[0:4], | |||||
| 'object': [item[0:4] for item in detail_infos] | 'object': [item[0:4] for item in detail_infos] | ||||
| } | } | ||||
| @@ -296,7 +294,7 @@ class TestAicoreDetailAnalyser(TestCase): | |||||
| """Test the success of the querying and sorting function by operator type.""" | """Test the success of the querying and sorting function by operator type.""" | ||||
| detail_infos = get_detail_infos(indexes=[9, 0, 2, 1, 3, 4, 8, 6]) | detail_infos = get_detail_infos(indexes=[9, 0, 2, 1, 3, 4, 8, 6]) | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT[0:4], | |||||
| 'col_name': COL_NAMES[0:4], | |||||
| 'object': [item[0:4] for item in detail_infos] | 'object': [item[0:4] for item in detail_infos] | ||||
| } | } | ||||
| @@ -21,8 +21,6 @@ from mindinsight.profiler.analyser.analyser_factory import AnalyserFactory | |||||
| from tests.ut.profiler import PROFILER_DIR | from tests.ut.profiler import PROFILER_DIR | ||||
| COL_NAMES = ['op_type', 'execution_time', 'execution_frequency', 'percent'] | COL_NAMES = ['op_type', 'execution_time', 'execution_frequency', 'percent'] | ||||
| COL_NAMES_IN_RESULT = ['op_type', 'execution_time (ms)', 'execution_frequency', | |||||
| 'percent'] | |||||
| def get_type_infos(indexes=None, sort_name=None, sort_type=True): | def get_type_infos(indexes=None, sort_name=None, sort_type=True): | ||||
| @@ -74,7 +72,7 @@ class TestAicoreTypeAnalyser(TestCase): | |||||
| def test_query_success_1(self): | def test_query_success_1(self): | ||||
| """Test the success of the querying function.""" | """Test the success of the querying function.""" | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT, | |||||
| 'col_name': COL_NAMES, | |||||
| 'object': get_type_infos(), | 'object': get_type_infos(), | ||||
| 'size': 5 | 'size': 5 | ||||
| } | } | ||||
| @@ -88,7 +86,7 @@ class TestAicoreTypeAnalyser(TestCase): | |||||
| def test_query_success_2(self): | def test_query_success_2(self): | ||||
| """Test the success of the querying function.""" | """Test the success of the querying function.""" | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT, | |||||
| 'col_name': COL_NAMES, | |||||
| 'object': get_type_infos(indexes=[1]), | 'object': get_type_infos(indexes=[1]), | ||||
| 'size': 1 | 'size': 1 | ||||
| } | } | ||||
| @@ -103,7 +101,7 @@ class TestAicoreTypeAnalyser(TestCase): | |||||
| self.assertDictEqual(expect_result, result) | self.assertDictEqual(expect_result, result) | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT, | |||||
| 'col_name': COL_NAMES, | |||||
| 'object': get_type_infos(indexes=[0, 2, 3, 4]), | 'object': get_type_infos(indexes=[0, 2, 3, 4]), | ||||
| 'size': 4 | 'size': 4 | ||||
| } | } | ||||
| @@ -118,7 +116,7 @@ class TestAicoreTypeAnalyser(TestCase): | |||||
| self.assertDictEqual(expect_result, result) | self.assertDictEqual(expect_result, result) | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT, | |||||
| 'col_name': COL_NAMES, | |||||
| 'object': get_type_infos(indexes=[0, 1, 3]), | 'object': get_type_infos(indexes=[0, 1, 3]), | ||||
| 'size': 3 | 'size': 3 | ||||
| } | } | ||||
| @@ -135,7 +133,7 @@ class TestAicoreTypeAnalyser(TestCase): | |||||
| def test_query_success_3(self): | def test_query_success_3(self): | ||||
| """Test the success of the querying function.""" | """Test the success of the querying function.""" | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT, | |||||
| 'col_name': COL_NAMES, | |||||
| 'object': get_type_infos(indexes=[1, 3]), | 'object': get_type_infos(indexes=[1, 3]), | ||||
| 'size': 2 | 'size': 2 | ||||
| } | } | ||||
| @@ -150,7 +148,7 @@ class TestAicoreTypeAnalyser(TestCase): | |||||
| self.assertDictEqual(expect_result, result) | self.assertDictEqual(expect_result, result) | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT, | |||||
| 'col_name': COL_NAMES, | |||||
| 'object': get_type_infos(indexes=[0, 2, 4]), | 'object': get_type_infos(indexes=[0, 2, 4]), | ||||
| 'size': 3 | 'size': 3 | ||||
| } | } | ||||
| @@ -165,7 +163,7 @@ class TestAicoreTypeAnalyser(TestCase): | |||||
| self.assertDictEqual(expect_result, result) | self.assertDictEqual(expect_result, result) | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT, | |||||
| 'col_name': COL_NAMES, | |||||
| 'object': get_type_infos(indexes=[2, 3]), | 'object': get_type_infos(indexes=[2, 3]), | ||||
| 'size': 2 | 'size': 2 | ||||
| } | } | ||||
| @@ -182,7 +180,7 @@ class TestAicoreTypeAnalyser(TestCase): | |||||
| def test_query_success_4(self): | def test_query_success_4(self): | ||||
| """Test the success of the querying function.""" | """Test the success of the querying function.""" | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT, | |||||
| 'col_name': COL_NAMES, | |||||
| 'object': get_type_infos(sort_name='op_type', sort_type=True), | 'object': get_type_infos(sort_name='op_type', sort_type=True), | ||||
| 'size': 5} | 'size': 5} | ||||
| condition = { | condition = { | ||||
| @@ -195,7 +193,7 @@ class TestAicoreTypeAnalyser(TestCase): | |||||
| self.assertDictEqual(expect_result, result) | self.assertDictEqual(expect_result, result) | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT, | |||||
| 'col_name': COL_NAMES, | |||||
| 'object': get_type_infos(sort_name='execution_time', sort_type=False), | 'object': get_type_infos(sort_name='execution_time', sort_type=False), | ||||
| 'size': 5 | 'size': 5 | ||||
| } | } | ||||
| @@ -211,7 +209,7 @@ class TestAicoreTypeAnalyser(TestCase): | |||||
| def test_query_success_5(self): | def test_query_success_5(self): | ||||
| """Test the success of the querying function.""" | """Test the success of the querying function.""" | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT, | |||||
| 'col_name': COL_NAMES, | |||||
| 'object': get_type_infos(indexes=[0, 1]), | 'object': get_type_infos(indexes=[0, 1]), | ||||
| 'size': 5 | 'size': 5 | ||||
| } | } | ||||
| @@ -225,7 +223,7 @@ class TestAicoreTypeAnalyser(TestCase): | |||||
| self.assertDictEqual(expect_result, result) | self.assertDictEqual(expect_result, result) | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT, | |||||
| 'col_name': COL_NAMES, | |||||
| 'object': get_type_infos(indexes=[3, 4]), | 'object': get_type_infos(indexes=[3, 4]), | ||||
| 'size': 5 | 'size': 5 | ||||
| } | } | ||||
| @@ -241,7 +239,7 @@ class TestAicoreTypeAnalyser(TestCase): | |||||
| def test_query_success_6(self): | def test_query_success_6(self): | ||||
| """Test the success of the querying function.""" | """Test the success of the querying function.""" | ||||
| expect_result = { | expect_result = { | ||||
| 'col_name': COL_NAMES_IN_RESULT, | |||||
| 'col_name': COL_NAMES, | |||||
| 'object': get_type_infos( | 'object': get_type_infos( | ||||
| indexes=[1, 3], sort_name='execution_time', sort_type=True | indexes=[1, 3], sort_name='execution_time', sort_type=True | ||||
| ), | ), | ||||