提交 3213886e 编写于 作者: M mindspore-ci-bot 提交者: Gitee

!333 UI fix bug of step trace, optimize data-process and profiling-dashboard display

Merge pull request !333 from 黄伟锋/myMaster
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
"lessThan": "小于", "lessThan": "小于",
"applyAllSelectTag": "应用到当前所选标签", "applyAllSelectTag": "应用到当前所选标签",
"placeHolderNumber": "请输入数值", "placeHolderNumber": "请输入数值",
"noSpace":"请勿输入空格", "noSpace": "请勿输入空格",
"sameCompare": "不能有相同的比较运算符", "sameCompare": "不能有相同的比较运算符",
"unreasonable": "逻辑不合理", "unreasonable": "逻辑不合理",
"info": "提示", "info": "提示",
...@@ -318,7 +318,7 @@ ...@@ -318,7 +318,7 @@
"pipelineTopTitle": "算子间队列平均使用率", "pipelineTopTitle": "算子间队列平均使用率",
"pipelineMiddleTitle": "算子间队列关系", "pipelineMiddleTitle": "算子间队列关系",
"deviceQueueOp": "数据发送", "deviceQueueOp": "数据发送",
"deviceQueueOpTip": "前向+向", "deviceQueueOpTip": "前向+向",
"getNext": "取数据算子", "getNext": "取数据算子",
"connectorQuene": "主机队列", "connectorQuene": "主机队列",
"getData": "数据获取", "getData": "数据获取",
...@@ -356,9 +356,12 @@ ...@@ -356,9 +356,12 @@
"queueTip2": "队列为空比例:", "queueTip2": "队列为空比例:",
"totalCapacity": "总容量", "totalCapacity": "总容量",
"averageCapacity": "平均使用容量", "averageCapacity": "平均使用容量",
"FPMessage": "FP起始算子:", "FPMessage": "前向起始算子:",
"BPMessage": "BP终止算子:", "BPMessage": "反向终止算子:",
"approximateTime": "总时长 ≈ " "approximateTime": "总时长 ≈ ",
"stepInputTip": "请输入step值(1~{max}的正整数)",
"inputError": "输入参数异常,请输入一个1~{max}的正整数",
"defaultTip": "默认展示平均值"
}, },
"components": { "components": {
"summaryTitle": "训练选择", "summaryTitle": "训练选择",
......
...@@ -16,6 +16,10 @@ ...@@ -16,6 +16,10 @@
import Vue from 'vue'; import Vue from 'vue';
import Router from 'vue-router'; import Router from 'vue-router';
Vue.use(Router); Vue.use(Router);
const VueRouterPush = Router.prototype.push;
Router.prototype.push = function push(to) {
return VueRouterPush.call(this, to).catch((err) => err);
};
export default new Router({ export default new Router({
base: process.env.BASE_URL, base: process.env.BASE_URL,
...@@ -77,7 +81,8 @@ export default new Router({ ...@@ -77,7 +81,8 @@ export default new Router({
children: [ children: [
{ {
path: 'profiling-dashboard', path: 'profiling-dashboard',
component: () => import('./views/train-manage/profiling-dashboard.vue'), component: () =>
import('./views/train-manage/profiling-dashboard.vue'),
}, },
{ {
path: 'step-trace', path: 'step-trace',
......
...@@ -543,10 +543,13 @@ export default { ...@@ -543,10 +543,13 @@ export default {
}; };
option.dataZoom = [ option.dataZoom = [
{ {
startValue: 0, start: 0,
end: 100,
bottom: 0, bottom: 0,
}, },
{ {
start: 0,
end: 100,
type: 'inside', type: 'inside',
bottom: 0, bottom: 0,
}, },
...@@ -756,11 +759,10 @@ export default { ...@@ -756,11 +759,10 @@ export default {
}, },
], ],
dataZoom: [ dataZoom: [
{start: 0, end: 100, orient: 'vertical', right: 10},
{ {
orient: 'vertical', start: 0,
right: 10, end: 100,
},
{
type: 'inside', type: 'inside',
orient: 'vertical', orient: 'vertical',
right: 10, right: 10,
...@@ -840,13 +842,11 @@ export default { ...@@ -840,13 +842,11 @@ export default {
}, },
dataZoom: [ dataZoom: [
{ {
startValue: 0, start: 0,
bottom: 10, end: 100,
},
{
type: 'inside',
bottom: 10, bottom: 10,
}, },
{start: 0, end: 100, type: 'inside', bottom: 10},
], ],
}; };
echart.setOption(option); echart.setOption(option);
...@@ -1354,15 +1354,14 @@ export default { ...@@ -1354,15 +1354,14 @@ export default {
height: calc(100% - 25px); height: calc(100% - 25px);
} }
} }
.queue-step-wrap.single{ .queue-step-wrap.single {
height: 100%; height: 100%;
.chart-content{ .chart-content {
.chart-wrap{ .chart-wrap {
width: 100%; width: 100%;
} }
} }
} }
} }
.pipeline-wrap { .pipeline-wrap {
height: 100%; height: 100%;
...@@ -1378,6 +1377,7 @@ export default { ...@@ -1378,6 +1377,7 @@ export default {
#average-rate { #average-rate {
height: 100%; height: 100%;
min-height: 180px; min-height: 180px;
overflow: hidden;
} }
} }
} }
...@@ -1441,6 +1441,7 @@ export default { ...@@ -1441,6 +1441,7 @@ export default {
height: 100%; height: 100%;
width: 100%; width: 100%;
min-height: 220px; min-height: 220px;
overflow: hidden;
} }
} }
.right { .right {
......
...@@ -528,6 +528,7 @@ export default { ...@@ -528,6 +528,7 @@ export default {
row.op_sort_condition.type, row.op_sort_condition.type,
); );
} }
this.$refs.expandTable.doLayout();
}); });
} }
}) })
......
...@@ -704,6 +704,21 @@ export default { ...@@ -704,6 +704,21 @@ export default {
rowIndex * this.svg.rowHeight + (this.svg.rowHeight - height) / 2; rowIndex * this.svg.rowHeight + (this.svg.rowHeight - height) / 2;
const g = document.createElementNS(this.svg.namespaceURI, 'g'); const g = document.createElementNS(this.svg.namespaceURI, 'g');
const gChild = document.createElementNS(this.svg.namespaceURI, 'g'); const gChild = document.createElementNS(this.svg.namespaceURI, 'g');
let name = '';
switch (data.name) {
case 'iteration_interval':
name = this.$t('profiling.lterationGap');
break;
case 'fp_and_bp':
name = this.$t('profiling.deviceQueueOpTip');
break;
case 'tail':
name = this.$t('profiling.lterationTail');
break;
default:
name = data.name;
break;
}
const rect = document.createElementNS(this.svg.namespaceURI, 'rect'); const rect = document.createElementNS(this.svg.namespaceURI, 'rect');
rect.setAttribute('x', x1); rect.setAttribute('x', x1);
...@@ -725,10 +740,10 @@ export default { ...@@ -725,10 +740,10 @@ export default {
`overflow:hidden;text-align:center;text-overflow:ellipsis;` + `overflow:hidden;text-align:center;text-overflow:ellipsis;` +
`white-space:nowrap;font-size:12px;line-height:${height}px;color:${color[0]}`, `white-space:nowrap;font-size:12px;line-height:${height}px;color:${color[0]}`,
); );
foreignObject.textContent = `${data.name}: ${data.duration.toFixed(4)}ms`; foreignObject.textContent = `${name}: ${data.duration.toFixed(4)}ms`;
const title = document.createElementNS(this.svg.namespaceURI, 'title'); const title = document.createElementNS(this.svg.namespaceURI, 'title');
title.textContent = `${data.name}: ${data.duration.toFixed(4)}ms`; title.textContent = `${name}: ${data.duration.toFixed(4)}ms`;
gChild.appendChild(rect); gChild.appendChild(rect);
gChild.appendChild(foreignObject); gChild.appendChild(foreignObject);
......
...@@ -16,21 +16,32 @@ limitations under the License. ...@@ -16,21 +16,32 @@ limitations under the License.
<template> <template>
<div class="step-trace"> <div class="step-trace">
<div class="step-trace-title">{{$t('profiling.stepTraceDetail')}} <div class="step-trace-title">{{$t('profiling.stepTraceDetail')}}
<el-tooltip class="item"
effect="light"
:content="$t('profiling.defaultTip')"
placement="top">
<span class="el-icon-question"></span>
</el-tooltip>
<div class="pf-content-right"> <div class="pf-content-right">
<div class="input-wrap"> <div class="input-wrap">
<label>{{$t('profiling.stepSelect')}}</label> <label>{{steps.label}}</label>
<el-select v-model="selectedStep" <el-input ref="step"
filterable v-model.number="steps.step"
:placeholder="$t('profiling.selectStep')" :disabled="steps.disabled"
@change="changeStep"> @keyup.native.enter="changeStep">
<el-option v-for="item in steps" </el-input>
:key="item.value" <el-button @click="changeStep"
:label="item.label" :disabled="steps.disabled">
:value="item.value"> {{$t('public.sure')}}
</el-option> </el-button>
</el-select>
</div> </div>
</div> </div>
<el-button class="show-average"
@click="changeStep(0)"
:disabled="steps.disabled">
{{$t('profiling.showAverage')}}
</el-button>
</div> </div>
<div class="step-message"> <div class="step-message">
<div class="step-left-padding-right"> <div class="step-left-padding-right">
...@@ -137,8 +148,12 @@ export default { ...@@ -137,8 +148,12 @@ export default {
relativePath: this.$route.query.path, relativePath: this.$route.query.path,
fp_start: '--', fp_start: '--',
bp_end: '--', bp_end: '--',
steps: [], steps: {
selectedStep: '', step: null,
max: 0,
disabled: true,
label: this.$t('profiling.stepInputTip'),
},
charts: [], charts: [],
svg: { svg: {
data: [], data: [],
...@@ -172,7 +187,7 @@ export default { ...@@ -172,7 +187,7 @@ export default {
percent: 'iteration_interval_percent', percent: 'iteration_interval_percent',
}, },
{ {
name: 'Fp+bp', name: this.$t('profiling.deviceQueueOpTip'),
id: 'fp-bp', id: 'fp-bp',
timeSummary: {}, timeSummary: {},
rate: 'fp_and_bp', rate: 'fp_and_bp',
...@@ -238,17 +253,33 @@ export default { ...@@ -238,17 +253,33 @@ export default {
val.clear(); val.clear();
}); });
} }
this.setStep(); this.steps = {
step: null,
max: 0,
disabled: true,
label: this.$t('profiling.stepInputTip'),
};
this.getTimeInfo('fp-bp', 'fp_and_bp'); this.getTimeInfo('fp-bp', 'fp_and_bp');
this.getTimeInfo('iter-gap', 'iteration_interval'); this.getTimeInfo('iter-gap', 'iteration_interval');
this.getTimeInfo('tailing', 'tail'); this.getTimeInfo('tailing', 'tail');
this.queryTrainingTrace(0); this.queryTrainingTrace(0);
}, },
changeStep(value) { changeStep(value) {
if (value === this.$t('profiling.showAverage')) { if (value === 0) {
value = 0; this.steps.step = null;
this.queryTrainingTrace(0);
} else if (
/^[0-9]*[1-9][0-9]*$/.test(this.steps.step) &&
this.steps.step <= this.steps.max
) {
this.queryTrainingTrace(this.steps.step);
} else {
this.steps.step = null;
this.$message.error(
this.$t('profiling.inputError').replace('{max}', this.steps.max),
);
} }
this.queryTrainingTrace(value);
}, },
getTimeInfo(id, type) { getTimeInfo(id, type) {
const params = { const params = {
...@@ -270,8 +301,18 @@ export default { ...@@ -270,8 +301,18 @@ export default {
}); });
} }
if (res.data && res.data.info) { if (res.data && res.data.info) {
if (this.steps.length <= 1) { if (res.data.size && !this.steps.max) {
this.setStep(res.data.size); this.steps.max = res.data.size;
this.steps.disabled = false;
this.steps.label = this.steps.label.replace(
'{max}',
this.steps.max,
);
}
const xAxisData = [];
for (let i = 1; i <= this.steps.max; i++) {
xAxisData.push(i);
} }
const timeInfo = []; const timeInfo = [];
Object.keys(res.data.info).forEach((val) => { Object.keys(res.data.info).forEach((val) => {
...@@ -285,9 +326,9 @@ export default { ...@@ -285,9 +326,9 @@ export default {
const option = { const option = {
xAxis: { xAxis: {
type: 'category', type: 'category',
data: this.steps.map((val, index) => index + 1), data: xAxisData,
name: 'step', name: 'step',
max: this.steps.length, max: this.steps.max,
}, },
yAxis: { yAxis: {
type: 'value', type: 'value',
...@@ -321,24 +362,23 @@ export default { ...@@ -321,24 +362,23 @@ export default {
option.yAxis.name = `${this.$t( option.yAxis.name = `${this.$t(
'profiling.iterationGapTime', 'profiling.iterationGapTime',
)}(ms)`; )}(ms)`;
this.tabsArr[0].noData = this.steps.length ? false : true; this.tabsArr[0].noData = this.steps.max ? false : true;
} else if (type === 'fp_and_bp') { } else if (type === 'fp_and_bp') {
option.yAxis.name = `fp+bp${this.$t('profiling.time')}(ms)`; option.yAxis.name = `${this.$t(
this.tabsArr[1].noData = this.steps.length ? false : true; 'profiling.deviceQueueOpTip',
)}${this.$t('profiling.time')}(ms)`;
this.tabsArr[1].noData = this.steps.max ? false : true;
} else if (type === 'tail') { } else if (type === 'tail') {
option.yAxis.name = `tail${this.$t('profiling.time')}(ms)`; option.yAxis.name = `${this.$t(
this.tabsArr[2].noData = this.steps.length ? false : true; 'profiling.lterationTail',
)}${this.$t('profiling.time')}(ms)`;
this.tabsArr[2].noData = this.steps.max ? false : true;
} }
this.initChart(option, id); this.initChart(option, id);
} else {
this.steps = [];
this.selectedStep = '';
} }
} }
}, },
(error) => { (error) => {
this.steps = [];
this.selectedStep = '';
if (type === 'iteration_interval') { if (type === 'iteration_interval') {
this.tabsArr[0].noData = true; this.tabsArr[0].noData = true;
} else if (type === 'fp_and_bp') { } else if (type === 'fp_and_bp') {
...@@ -349,20 +389,6 @@ export default { ...@@ -349,20 +389,6 @@ export default {
}, },
); );
}, },
setStep(step = 0) {
this.steps = [];
this.steps.push({
label: this.$t('profiling.showAverage'),
value: this.$t('profiling.showAverage'),
});
for (let i = 1; i <= step; i++) {
this.steps.push({
label: i,
value: i,
});
}
this.selectedStep = this.$t('profiling.showAverage');
},
initChart(option, id) { initChart(option, id) {
this.$nextTick(() => { this.$nextTick(() => {
const chart = echarts.init(document.getElementById(id)); const chart = echarts.init(document.getElementById(id));
...@@ -485,6 +511,21 @@ export default { ...@@ -485,6 +511,21 @@ export default {
rowIndex * this.svg.rowHeight + (this.svg.rowHeight - height) / 2; rowIndex * this.svg.rowHeight + (this.svg.rowHeight - height) / 2;
const g = document.createElementNS(this.svg.namespaceURI, 'g'); const g = document.createElementNS(this.svg.namespaceURI, 'g');
const gChild = document.createElementNS(this.svg.namespaceURI, 'g'); const gChild = document.createElementNS(this.svg.namespaceURI, 'g');
let name = '';
switch (data.name) {
case 'iteration_interval':
name = this.$t('profiling.lterationGap');
break;
case 'fp_and_bp':
name = this.$t('profiling.deviceQueueOpTip');
break;
case 'tail':
name = this.$t('profiling.lterationTail');
break;
default:
name = data.name;
break;
}
const rect = document.createElementNS(this.svg.namespaceURI, 'rect'); const rect = document.createElementNS(this.svg.namespaceURI, 'rect');
rect.setAttribute('x', x1); rect.setAttribute('x', x1);
...@@ -506,10 +547,10 @@ export default { ...@@ -506,10 +547,10 @@ export default {
`overflow:hidden;text-align:center;text-overflow:ellipsis;` + `overflow:hidden;text-align:center;text-overflow:ellipsis;` +
`white-space:nowrap;font-size:12px;line-height:${height}px;color:${color[0]}`, `white-space:nowrap;font-size:12px;line-height:${height}px;color:${color[0]}`,
); );
foreignObject.textContent = `${data.name}: ${data.duration.toFixed(4)}ms`; foreignObject.textContent = `${name}: ${data.duration.toFixed(4)}ms`;
const title = document.createElementNS(this.svg.namespaceURI, 'title'); const title = document.createElementNS(this.svg.namespaceURI, 'title');
title.textContent = `${data.name}: ${data.duration.toFixed(4)}ms`; title.textContent = `${name}: ${data.duration.toFixed(4)}ms`;
gChild.appendChild(rect); gChild.appendChild(rect);
gChild.appendChild(foreignObject); gChild.appendChild(foreignObject);
...@@ -630,15 +671,36 @@ export default { ...@@ -630,15 +671,36 @@ export default {
padding: 0 15px; padding: 0 15px;
font-size: 16px; font-size: 16px;
font-weight: bold; font-weight: bold;
.el-icon-question {
cursor: pointer;
}
.pf-content-right { .pf-content-right {
display: inline-block; display: inline-block;
margin-left: 35px; margin-left: 35px;
.input-wrap {
font-weight: normal;
label { label {
margin-right: 10px; margin-right: 20px;
} }
.el-input {
width: 150px;
margin-right: 16px;
} }
.input-wrap { }
font-weight: normal; }
.el-button {
border: 1px solid #00a5a7;
border-radius: 2px;
background-color: white;
color: #00a5a7;
padding: 7px 15px;
&:hover {
background: rgb(230, 246, 246);
}
}
.show-average {
float: right;
margin-right: 20px;
} }
} }
.step-message { .step-message {
...@@ -698,6 +760,7 @@ export default { ...@@ -698,6 +760,7 @@ export default {
.chart { .chart {
height: calc(100% - 85px); height: calc(100% - 85px);
min-height: 180px; min-height: 180px;
overflow: hidden;
} }
.title { .title {
margin: 0 0 15px 20px; margin: 0 0 15px 20px;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册