You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

run.sh 4.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. #!/bin/bash
  2. # Copyright 2021 Huawei Technologies Co., Ltd
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # ============================================================================
  16. stage=0
  17. days=7
  18. iter=5
  19. device_id=0
  20. n_worker=128
  21. work_dir="/opt/npu/me_monitor"
  22. me_report_path=$work_dir/logs/ME_report_daily.xlsx
  23. log_dir=logs_$(date "+%m%d-%H%M")
  24. log_path=$work_dir/logs/$log_dir
  25. ms_master="https://gitee.com/mindspore/mindspore.git"
  26. log_data="data.json"
  27. ci_mode=true
  28. set -e
  29. set -o pipefail
  30. # parse arguments from command line
  31. while getopts "s:d:i:l:" args
  32. do
  33. case $args in
  34. s)
  35. stage=$OPTARG
  36. ;;
  37. d)
  38. days=$OPTARG
  39. ;;
  40. i)
  41. iter=$OPTARG
  42. ;;
  43. l)
  44. log_dir=$OPTARG
  45. log_path=$work_dir/logs/$log_dir
  46. ;;
  47. ?)
  48. echo "unknown argument"
  49. exit 1
  50. ;;
  51. esac
  52. done
  53. source env.sh
  54. export DEVICE_ID=$device_id
  55. echo "Args: days=$days, iter=$iter, log_path=$log_path"
  56. cd $work_dir
  57. echo $WORKSPACE
  58. WORKSPACE=/home/jenkins-slave/workspace/MindSpore_Network_reid_compile_performance
  59. echo $WORKSPACE
  60. if [ $stage -le 1 ]; then
  61. echo ""
  62. echo "===========Stage 1: Fetching latest mindspore from master==========="
  63. if [ -d mindspore ]; then
  64. rm -rf mindspore
  65. fi
  66. git clone $ms_master
  67. fi
  68. if [ $stage -le 2 ]; then
  69. echo ""
  70. echo "===========Stage 2: Building mindspore==========="
  71. cd $work_dir/mindspore
  72. bash build.sh -e ascend -j $n_worker -p on
  73. fi
  74. if [ $stage -le 3 ]; then
  75. echo ""
  76. echo "===========Stage 3: Compiling networks==========="
  77. cd $work_dir
  78. mkdir -p $log_path
  79. # Compiling ReID-8
  80. # split resource-consuming task from others
  81. for count in $(seq 1 $iter); do
  82. echo "[INFO] Compiling ReID-8p, iteration $count"
  83. if [ -d reid$count ]; then
  84. rm -rf reid$count
  85. fi
  86. mkdir reid$count
  87. cd reid$count
  88. bash $work_dir/faceReidToMe/dist_env/env_26/dist_env_26.sh
  89. for num in {0..7}; do
  90. cp device_$num/test_reid_stage123_1024node_graphdata_dynamiclossscale_log$num.log $log_path/reid_${count}_${num}.log
  91. done
  92. cd $work_dir
  93. mv reid$count $log_path
  94. done
  95. # Compiling BERT
  96. cd $work_dir
  97. for count in $(seq 1 $iter); do
  98. echo "[INFO] Compiling BERT, iteration $count"
  99. pytest -s mindspore/tests/perf_test/bert/test_bert_train.py::test_bert_train | tee $log_path/bert$count.log
  100. done
  101. # Compiling ResNet50
  102. for count in $(seq 1 $iter); do
  103. echo "[INFO] Compiling ResNet50, iteration $count"
  104. pytest -s mindspore/tests/perf_test/test_resnet_train.py::test_train_step | tee $log_path/resnet$count.log
  105. done
  106. # Compiling GPT
  107. for count in $(seq 1 $iter); do
  108. echo "[INFO] Compiling GPT, iteration $count"
  109. cd gpt
  110. bash scripts/run_standalone_train.sh 0 1 $work_dir/gpt_data | tee $log_path/gpt$count.log
  111. done
  112. fi
  113. if [ $stage -le 4 ]; then
  114. echo ""
  115. echo "===========Stage 4: Processing log files==========="
  116. cd $work_dir
  117. python process_data.py $me_report_path $log_path $iter $log_path/$log_data
  118. fi
  119. if [ $stage -le 5 ]; then
  120. echo ""
  121. echo "===========Stage 5: Generating reports==========="
  122. if [ ! -d $log_path/reports ]; then
  123. mkdir $log_path/reports
  124. fi
  125. python generate_report.py $log_path $log_path/$log_data $me_report_path $days
  126. if [ $ci_mode ]; then
  127. echo "copying file to artifacts"
  128. mkdir -p ${WORKSPACE}/archive
  129. cp $log_path/reports/* ${WORKSPACE}/archive
  130. fi
  131. fi