diff --git a/mindinsight/backend/profiler/profile_api.py b/mindinsight/backend/profiler/profile_api.py index 3793dc1a51b92ebe8eac63bc0850dc8a53da6fc5..1db32b0b95ba74a8efd705edd07da55dff3b5255 100644 --- a/mindinsight/backend/profiler/profile_api.py +++ b/mindinsight/backend/profiler/profile_api.py @@ -72,6 +72,7 @@ def get_profile_op_info(): validate_condition(search_condition) device_id = search_condition.get("device_id", "0") + to_int(device_id, 'device_id') profiler_dir_abs = os.path.join(settings.SUMMARY_BASE_DIR, train_id, profiler_dir) try: profiler_dir_abs = validate_and_normalize_path(profiler_dir_abs, "profiler") @@ -194,6 +195,7 @@ def get_queue_info(): profile_dir = get_profiler_abs_dir(request) device_id = unquote_args(request, "device_id") + to_int(device_id, 'device_id') queue_type = unquote_args(request, "type") queue_info = {} @@ -220,6 +222,7 @@ def get_time_info(): """ profile_dir = get_profiler_abs_dir(request) device_id = unquote_args(request, "device_id") + to_int(device_id, 'device_id') op_type = unquote_args(request, "type") time_info = { @@ -251,6 +254,7 @@ def get_process_summary(): """ profile_dir = get_profiler_abs_dir(request) device_id = unquote_args(request, "device_id") + to_int(device_id, 'device_id') minddata_analyser = AnalyserFactory.instance().get_analyser( 'minddata', profile_dir, device_id) @@ -305,6 +309,7 @@ def get_profile_summary_proposal(): device_id = get_device_id(request) if not profiler_dir or not train_id: raise ParamValueError("No profiler_dir or train_id.") + to_int(device_id, 'device_id') profiler_dir_abs = os.path.join(settings.SUMMARY_BASE_DIR, train_id, profiler_dir) try: @@ -361,6 +366,7 @@ def get_minddata_pipeline_op_queue_info(): validate_minddata_pipeline_condition(condition) device_id = condition.get("device_id", "0") + to_int(device_id, 'device_id') analyser = AnalyserFactory.instance().get_analyser( 'minddata_pipeline', profiler_dir_abs, device_id ) @@ -398,6 +404,7 @@ def get_minddata_pipeline_queue_info(): raise ParamValueError("Invalid profiler dir.") device_id = request.args.get('device_id', default='0') + to_int(device_id, 'device_id') op_id = request.args.get('op_id', type=int) if op_id is None: raise ParamValueError("Invalid operator id or operator id does not exist.") diff --git a/mindinsight/profiler/analyser/analyser.py b/mindinsight/profiler/analyser/analyser.py index 92738e27a66a3efe0ba4ce20dc99caae9444c8e5..c5d5f6c28b19ac118d2e7c33846dea7cc2575032 100644 --- a/mindinsight/profiler/analyser/analyser.py +++ b/mindinsight/profiler/analyser/analyser.py @@ -99,7 +99,7 @@ class AicoreDetailAnalyser(BaseAnalyser): Raises: ProfilerPathErrorException: If the profiling dir is invalid. """ - _col_names = ['op_name', 'op_type', 'execution_time', 'subgraph', + _col_names = ['op_name', 'op_type', 'avg_execution_time', 'subgraph', 'full_op_name', 'op_info'] _file_name_aicore_detail_time = 'aicore_intermediate_{}_detail.csv' _file_name_framework_info = 'framework_raw_{}.csv' diff --git a/mindinsight/profiler/common/validator/validate.py b/mindinsight/profiler/common/validator/validate.py index 3e4d18d79ec83cccb5a0fcc1adf8e397eab15deb..dad9a2e5a50f151f453bc036f20bf9cd8a1fc354 100644 --- a/mindinsight/profiler/common/validator/validate.py +++ b/mindinsight/profiler/common/validator/validate.py @@ -24,7 +24,7 @@ from mindinsight.profiler.common.exceptions.exceptions import ProfilerParamTypeE from mindinsight.profiler.common.log import logger as log AICORE_TYPE_COL = ["op_type", "execution_time", "execution_frequency", "precent"] -AICORE_DETAIL_COL = ["op_name", "op_type", "execution_time", "subgraph", "full_op_name"] +AICORE_DETAIL_COL = ["op_name", "op_type", "avg_execution_time", "subgraph", "full_op_name"] AICPU_COL = ["serial_number", "op_type", "total_time", "dispatch_time", "run_start", "run_end"] MINDDATA_PIPELINE_COL = [ diff --git a/tests/st/func/profiler/test_op_analyser.py b/tests/st/func/profiler/test_op_analyser.py index 5c069c174cd3c3dcfa919c497c905a8f1fcce7f8..a5a3551ad09d9ce8a269813bf2ea0631a88f5b1e 100644 --- a/tests/st/func/profiler/test_op_analyser.py +++ b/tests/st/func/profiler/test_op_analyser.py @@ -32,7 +32,7 @@ from tests.ut.profiler import RAW_DATA_BASE OP_GATHER_V2_INFO = { 'col_name': [ - 'op_name', 'op_type', 'execution_time', 'subgraph', 'full_op_name', 'op_info' + 'op_name', 'op_type', 'avg_execution_time', 'subgraph', 'full_op_name', 'op_info' ], 'object': [ [ @@ -213,7 +213,7 @@ class TestOpAnalyser: } }, 'sort_condition': { - 'name': 'execution_time', + 'name': 'avg_execution_time', 'type': 'descending' }, 'group_condition': { diff --git a/tests/ut/profiler/analyser/test_analyser_aicore_detail.py b/tests/ut/profiler/analyser/test_analyser_aicore_detail.py index 6b50fd5ce103f7228486e53694453dbc75098b88..d4750bd60d4d89c2e6854b07bdd520b3686ba9d1 100644 --- a/tests/ut/profiler/analyser/test_analyser_aicore_detail.py +++ b/tests/ut/profiler/analyser/test_analyser_aicore_detail.py @@ -21,8 +21,8 @@ from unittest import TestCase from mindinsight.profiler.analyser.analyser_factory import AnalyserFactory from tests.ut.profiler import PROFILER_DIR -COL_NAMES = ['op_name', 'op_type', 'execution_time', 'subgraph', 'full_op_name', - 'op_info'] +COL_NAMES = ['op_name', 'op_type', 'avg_execution_time', 'subgraph', + 'full_op_name', 'op_info'] def get_detail_infos(indexes=None, sort_name=None, sort_type=True): @@ -126,12 +126,12 @@ class TestAicoreDetailAnalyser(TestCase): """Test the success of the querying function.""" expect_result = { 'col_name': COL_NAMES, - 'object': get_detail_infos(sort_name='execution_time', sort_type=True), + 'object': get_detail_infos(sort_name='avg_execution_time', sort_type=True), 'size': 10 } condition = { 'sort_condition': { - 'name': 'execution_time', + 'name': 'avg_execution_time', 'type': 'descending' } } @@ -187,7 +187,7 @@ class TestAicoreDetailAnalyser(TestCase): expect_result = { 'col_name': COL_NAMES, 'object': get_detail_infos( - indexes=[1, 2], sort_name='execution_time', sort_type=True + indexes=[1, 2], sort_name='avg_execution_time', sort_type=True ), 'size': 4 } @@ -198,7 +198,7 @@ class TestAicoreDetailAnalyser(TestCase): } }, 'sort_condition': { - 'name': 'execution_time' + 'name': 'avg_execution_time' }, 'group_condition': { 'limit': 2, @@ -211,7 +211,7 @@ class TestAicoreDetailAnalyser(TestCase): expect_result = { 'col_name': COL_NAMES, 'object': get_detail_infos( - indexes=[0, 1, 2, 8], sort_name='execution_time', sort_type=True + indexes=[0, 1, 2, 8], sort_name='avg_execution_time', sort_type=True ), 'size': 4 } @@ -225,7 +225,7 @@ class TestAicoreDetailAnalyser(TestCase): } }, 'sort_condition': { - 'name': 'execution_time' + 'name': 'avg_execution_time' } } result = self._analyser.query(condition)