diff --git a/mindinsight/backend/profiler/profile_api.py b/mindinsight/backend/profiler/profile_api.py index 5253d84b..e9c184d9 100644 --- a/mindinsight/backend/profiler/profile_api.py +++ b/mindinsight/backend/profiler/profile_api.py @@ -489,13 +489,14 @@ def get_timeline_detail(): device_id = request.args.get("device_id", default='0') _ = to_int(device_id, 'device_id') device_type = request.args.get("device_type", default='ascend') + scope_name_num = request.args.get("scope_name_num", default='0') if device_type not in ['gpu', 'ascend']: logger.info("Invalid device_type, device_type should be gpu or ascend.") raise ParamValueError("Invalid device_type.") analyser = AnalyserFactory.instance().get_analyser( 'timeline', profiler_dir_abs, device_id) - timeline = analyser.get_display_timeline(device_type) + timeline = analyser.get_display_timeline(device_type, scope_name_num) return jsonify(timeline) diff --git a/mindinsight/profiler/analyser/timeline_analyser.py b/mindinsight/profiler/analyser/timeline_analyser.py index 80fecedb..e7a83cf9 100644 --- a/mindinsight/profiler/analyser/timeline_analyser.py +++ b/mindinsight/profiler/analyser/timeline_analyser.py @@ -43,7 +43,7 @@ class TimelineAnalyser(BaseAnalyser): filter_condition (dict): The filter condition. """ - def get_display_timeline(self, device_type): + def get_display_timeline(self, device_type, scope_name_num): """ Get timeline data for UI display. @@ -67,6 +67,11 @@ class TimelineAnalyser(BaseAnalyser): try: with open(file_path, 'r') as f_obj: timeline = json.load(f_obj) + for idx, time_item in enumerate(timeline): + if time_item["tid"] == "Name Scope" and \ + time_item["scope_level"] >= scope_name_num: + timeline[idx] = None + timeline = list(filter(lambda x: x, timeline)) except (IOError, OSError, json.JSONDecodeError) as err: logger.error('Error occurred when read timeline display file: %s', err) raise ProfilerIOException diff --git a/mindinsight/ui/src/locales/en-us.json b/mindinsight/ui/src/locales/en-us.json index 85d6d23d..4648d194 100644 --- a/mindinsight/ui/src/locales/en-us.json +++ b/mindinsight/ui/src/locales/en-us.json @@ -438,6 +438,7 @@ "content11": "- Device(AI CPU or AI core) to which an operator is allocated for execution.", "content12": "- Flow tiling policy of MindSpore on the network.", "content13": "- Execution sequence and duration of an operator on a device.", + "content14": "- Scope Name of Operator. For example, the full name of one operator is `Default/network/lenet5/Conv2D-op11`, the first scope of this operator is `Default`, the second scope is `network`. ", "title2": "How to view the timeline details?", "content21": { "part1": "Click ", @@ -520,7 +521,8 @@ "fpStart": "Forward", "bpEnd": "Backward" }, - "isHeterogeneous": "Heterogeneous training scenarios are not supported temporarily." + "isHeterogeneous": "Heterogeneous training scenarios are not supported temporarily.", + "scopeNameNum": "ScopeName Layer Counts: " }, "profilingGPU": { "minddata_get_next_queue": { diff --git a/mindinsight/ui/src/locales/zh-cn.json b/mindinsight/ui/src/locales/zh-cn.json index 78aaa55b..836efc9e 100644 --- a/mindinsight/ui/src/locales/zh-cn.json +++ b/mindinsight/ui/src/locales/zh-cn.json @@ -436,7 +436,8 @@ "title1": "时间线功能可以帮您对训练过程进行分析,它可以展示:", "content11": "- 算子分配到哪个设备 (AI CPU/AI Core) 执行;", "content12": "- MindSpore对该网络的流切分策略;", - "content13": "- 算子在Device上的执行序列和执行时长。", + "content13": "- 算子在Device上的执行序列和执行时长;", + "content14": "- 算子ScopeName信息,例如算子Conv2D-op11的全名为:Default/network/lenet5/Conv2D-op11,该算子的第一层ScopeName为Default、第二层为network。", "title2": "如何查看时间线:", "content21": { "part1": "要查看时间线的详细信息,您可以点击 \"", @@ -519,7 +520,8 @@ "fpStart": "前向", "bpEnd": "后向" }, - "isHeterogeneous":"暂不支持异构训练场景" + "isHeterogeneous":"暂不支持异构训练场景", + "scopeNameNum":"展示算子ScopeName层数: " }, "profilingGPU": { "minddata_get_next_queue": { diff --git a/mindinsight/ui/src/services/request-service.js b/mindinsight/ui/src/services/request-service.js index bd8bae79..c1228b77 100644 --- a/mindinsight/ui/src/services/request-service.js +++ b/mindinsight/ui/src/services/request-service.js @@ -247,7 +247,7 @@ export default { }, }); }, - queryTimlineInfo(params) { + queryTimelineInfo(params) { return axios({ method: 'get', url: 'v1/mindinsight/profile/timeline-summary', diff --git a/mindinsight/ui/src/views/profiling-gpu/profiling-dashboard.vue b/mindinsight/ui/src/views/profiling-gpu/profiling-dashboard.vue index d5cc275b..cf705d36 100644 --- a/mindinsight/ui/src/views/profiling-gpu/profiling-dashboard.vue +++ b/mindinsight/ui/src/views/profiling-gpu/profiling-dashboard.vue @@ -16,7 +16,7 @@ limitations under the License.