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_config.sh 2.8 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. function help(){
  20. cat <<-EOF
  21. Usage: ge config [OPTIONS]
  22. update server config for ge, you need input all config info (ip, user, password)
  23. Options:
  24. -i, --ip Config ip config
  25. -u, --user Config user name
  26. -p, --password Config password
  27. -h, --help
  28. Example: ge config -i=121.36.**.** -u=asc**, -p=Asc***\#@\!\$ (Need add escape character \ before special charactor $、#、!)
  29. EOF
  30. }
  31. function write_config_file(){
  32. local IP=$1
  33. local USER=$2
  34. local PASSWORD=$3
  35. if [[ -z "$IP" ]] || [[ -z "$USER" ]] || [[ -z "$USER" ]]; then
  36. echo "You need input all info (ip, user,password)obout server config !!!"
  37. help
  38. exit 1
  39. fi
  40. local PASSWORD=${PASSWORD//!/\\!}
  41. local PASSWORD=${PASSWORD//#/\\#}
  42. local PASSWORD=${PASSWORD/\$/\\\$}
  43. local SERVER_CONFIG_FILE=${PROJECT_HOME}/scripts/config/server_config.sh
  44. [ -n "${SERVER_CONFIG_FILE}" ] && rm -rf "${SERVER_CONFIG_FILE}"
  45. cat>${SERVER_CONFIG_FILE}<<-EOF
  46. SERVER_PATH=http://${IP}/package/etrans
  47. DEP_USER=${USER}
  48. DEP_PASSWORD=${PASSWORD}
  49. EOF
  50. }
  51. function parse_args(){
  52. parsed_args=$(getopt -a -o i::u::p::h --long ip::,user::,password::,help -- "$@") || {
  53. help
  54. exit 1
  55. }
  56. if [ $# -lt 1 ]; then
  57. help
  58. exit 1
  59. fi
  60. local IP=
  61. local USER=
  62. local PASSWORD=
  63. eval set -- "$parsed_args"
  64. while true; do
  65. case "$1" in
  66. -i | --ip)
  67. IP=$2
  68. ;;
  69. -u | --user)
  70. USER=$2
  71. ;;
  72. -p | --password)
  73. PASSWORD=$2
  74. ;;
  75. -h | --help)
  76. help; exit;
  77. ;;
  78. --)
  79. shift; break;
  80. ;;
  81. *)
  82. help; exit 1
  83. ;;
  84. esac
  85. shift 2
  86. done
  87. write_config_file $IP $USER $PASSWORD
  88. }
  89. function main(){
  90. parse_args "$@"
  91. }
  92. main "$@"
  93. set +e

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