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.

ge_update.sh 3.5 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. set -e
  17. PROJECT_HOME=${PROJECT_HOME:-$(dirname "$0")/../../}
  18. PROJECT_HOME=$(cd $PROJECT_HOME || return; pwd)
  19. DOWNLOAD_PATH=${PROJECT_HOME}/deps
  20. DEP_LIB_DIR=./lib
  21. DEP_TMP_DIR=./tmp
  22. function extract_deps_so()
  23. {
  24. echo "begin to extract .run file ........."
  25. chmod 777 ./${DRIVER_RUN_NAME}
  26. unzip ${DEV_TOOLS_PACKAGE}.zip
  27. chmod -R 777 ${DEV_TOOLS_PACKAGE}
  28. [ -n "${DEP_TMP_DIR}" ] && rm -rf "${DEP_TMP_DIR}"
  29. ./${DRIVER_RUN_NAME} --noexec --extract=${DEP_TMP_DIR}/driver
  30. ./${DEV_TOOLS_PACKAGE}/${ATC_RUN_NAME} --noexec --extract=${DEP_TMP_DIR}/atc
  31. ./${DEV_TOOLS_PACKAGE}/${ACL_RUN_NAME} --noexec --extract=${DEP_TMP_DIR}/acllib
  32. ./${DEV_TOOLS_PACKAGE}/${FWKACL_RUN_NAME} --noexec --extract=${DEP_TMP_DIR}/fwkacllib
  33. }
  34. function copy_so_to_target_dir()
  35. {
  36. mkdir -p $DEP_LIB_DIR
  37. mv ${DEP_TMP_DIR}/driver/driver $DEP_LIB_DIR/driver
  38. mv ${DEP_TMP_DIR}/atc/atc $DEP_LIB_DIR/atc
  39. mv ${DEP_TMP_DIR}/acllib/acllib $DEP_LIB_DIR/acllib
  40. mv ${DEP_TMP_DIR}/fwkacllib/fwkacllib $DEP_LIB_DIR/fwkacllib
  41. }
  42. function clear_libs()
  43. {
  44. [ -n "${DOWNLOAD_PATH}" ] && rm -rf "${DOWNLOAD_PATH}"
  45. }
  46. function download_runs()
  47. {
  48. source scripts/update/deps_config.sh
  49. echo "begin to download .run file ........."
  50. clear_libs
  51. mkdir -p ./ ${DOWNLOAD_PATH}
  52. pushd "${DOWNLOAD_PATH}" >/dev/null
  53. cd ${DOWNLOAD_PATH}
  54. wget --user=${DEP_USER} --password=${DEP_PASSWORD} ${DRIVER_URL}
  55. wget --user=${DEP_USER} --password=${DEP_PASSWORD} ${DEV_TOOLS_URL}
  56. popd >/dev/null
  57. }
  58. function install_deps()
  59. {
  60. source scripts/update/deps_config.sh
  61. mkdir -p ./ ${DOWNLOAD_PATH}
  62. pushd "${DOWNLOAD_PATH}" >/dev/null
  63. cd ${DOWNLOAD_PATH}
  64. extract_deps_so
  65. copy_so_to_target_dir
  66. popd >/dev/null
  67. }
  68. function help(){
  69. cat <<-EOF
  70. Usage: ge update [OPTIONS]
  71. update dependencies of build and test
  72. Options:
  73. -d, --download Download dependencies
  74. -i, --install Install dependencies
  75. -c, --clear Clear dependencies
  76. -h, --help
  77. EOF
  78. }
  79. function parse_args(){
  80. parsed_args=$(getopt -a -o dich --long download,install,clear,help -- "$@") || {
  81. help
  82. exit 1
  83. }
  84. if [ $# -lt 1 ]; then
  85. download_runs
  86. install_deps
  87. exit 1
  88. fi
  89. eval set -- "$parsed_args"
  90. while true; do
  91. case "$1" in
  92. -d | --download)
  93. download_runs
  94. ;;
  95. -i | --install)
  96. install_deps
  97. ;;
  98. -c | --clear)
  99. clear_libs
  100. ;;
  101. -h | --help)
  102. help; exit 1;
  103. ;;
  104. --)
  105. shift; break;
  106. ;;
  107. *)
  108. help; exit 1
  109. ;;
  110. esac
  111. shift
  112. done
  113. }
  114. function main(){
  115. parse_args "$@"
  116. }
  117. main "$@"
  118. set +e

图引擎模块(GE)是MindSpore的一个子模块,其代码由C++实现,位于前端模块ME和底层硬件之间,起到承接作用。图引擎模块以ME下发的图作为输入,然后进行一系列的深度图优化操作,最后输出一张可以在底层硬件上高效运行的图。GE针对昇腾AI处理器的硬件结构特点,做了特定的优化工作,以此来充分发挥出昇腾AI处理器的强大算力。在进行模型训练/推理时,GE会被自动调用而用户并不感知。GE主要由GE API和GE Core两部分组成,详细的架构图如下所示