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.

option_proc_mindspore.sh 2.3 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. build_option_proc_b()
  18. {
  19. if [[ "X$OPTARG" != "Xge" && "X$OPTARG" != "Xcpu" ]]; then
  20. echo "Invalid value ${OPTARG} for option -b"
  21. usage
  22. exit 1
  23. fi
  24. ENABLE_BACKEND=$(echo "$OPTARG" | tr '[a-z]' '[A-Z]')
  25. if [[ "X$ENABLE_BACKEND" != "XCPU" ]]; then
  26. export ENABLE_CPU="on"
  27. fi
  28. }
  29. build_option_proc_l()
  30. {
  31. check_on_off $OPTARG l
  32. export ENABLE_PYTHON="$OPTARG"
  33. }
  34. build_option_proc_m()
  35. {
  36. if [[ "X$OPTARG" != "Xinfer" && "X$OPTARG" != "Xtrain" ]]; then
  37. echo "Invalid value ${OPTARG} for option -m"
  38. usage
  39. exit 1
  40. fi
  41. export TRAIN_MODE=$(echo "$OPTARG" | tr '[a-z]' '[A-Z]')
  42. }
  43. build_option_proc_s()
  44. {
  45. check_on_off $OPTARG s
  46. if [[ "X$OPTARG" == "Xon" ]]; then
  47. if [[ $USER_ENABLE_DUMP_IR == true ]]; then
  48. echo "enable security, the dump ir is not available"
  49. usage
  50. exit 1
  51. fi
  52. if [[ $USER_ENABLE_DEBUGGER == true ]]; then
  53. echo "enable security, the debugger is not available"
  54. usage
  55. exit 1
  56. fi
  57. export ENABLE_DUMP_IR="off"
  58. export ENABLE_DEBUGGER="off"
  59. fi
  60. export ENABLE_SECURITY="$OPTARG"
  61. echo "enable security"
  62. }
  63. build_option_proc_upper_s()
  64. {
  65. check_on_off $OPTARG S
  66. export ENABLE_GITEE="$OPTARG"
  67. echo "enable download from gitee"
  68. }
  69. build_option_proc_upper_f()
  70. {
  71. check_on_off $OPTARG F
  72. export ENABLE_FAST_HASH_TABLE="$OPTARG"
  73. }
  74. build_option_proc_z()
  75. {
  76. eval ARG=\$\{$OPTIND\}
  77. if [[ -n "$ARG" && "$ARG" != -* ]]; then
  78. OPTARG="$ARG"
  79. check_on_off $OPTARG z
  80. OPTIND=$((OPTIND + 1))
  81. else
  82. OPTARG=""
  83. fi
  84. if [[ "X$OPTARG" == "Xoff" ]]; then
  85. export COMPILE_MINDDATA="off"
  86. fi
  87. }