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.

process_options.sh 3.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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. # check and set options
  18. process_options()
  19. {
  20. # Process the options
  21. while getopts 'drvj:c:t:hb:s:a:g:p:ie:m:l:I:RP:D:zM:V:K:B:En:A:S:k:W:H:L:y' opt
  22. do
  23. CASE_SENSIVE_ARG=${OPTARG}
  24. OPTARG=$(echo ${OPTARG} | tr '[A-Z]' '[a-z]')
  25. case "${opt}" in
  26. d)
  27. DEBUG_MODE="on" ;;
  28. n)
  29. build_option_proc_n ;;
  30. y)
  31. export ENABLE_SYM_FILE="on" ;;
  32. r)
  33. export DEBUG_MODE="off" ;;
  34. v)
  35. build_option_proc_v ;;
  36. j)
  37. export THREAD_NUM=$OPTARG ;;
  38. c)
  39. build_option_proc_c ;;
  40. t)
  41. build_option_proc_t ;;
  42. g)
  43. build_option_proc_g ;;
  44. h)
  45. build_option_proc_h ;;
  46. b)
  47. build_option_proc_b ;;
  48. a)
  49. build_option_proc_a ;;
  50. p)
  51. build_option_proc_p ;;
  52. l)
  53. build_option_proc_l ;;
  54. i)
  55. export INC_BUILD="on" ;;
  56. m)
  57. build_option_proc_m ;;
  58. s)
  59. build_option_proc_s ;;
  60. R)
  61. export ENABLE_TIMELINE="on"
  62. echo "enable time_line record" ;;
  63. S)
  64. build_option_proc_upper_s ;;
  65. k)
  66. check_on_off $OPTARG k
  67. export ENABLE_MAKE_CLEAN="$OPTARG"
  68. echo "enable make clean" ;;
  69. e)
  70. export DEVICE=$OPTARG ;;
  71. M)
  72. check_on_off $OPTARG M
  73. export ENABLE_MPI="$OPTARG" ;;
  74. V)
  75. export DEVICE_VERSION=$OPTARG ;;
  76. P)
  77. check_on_off $OPTARG p
  78. export ENABLE_DUMP2PROTO="$OPTARG"
  79. echo "enable dump anf graph to proto file" ;;
  80. D)
  81. build_option_proc_upper_d ;;
  82. z)
  83. build_option_proc_z ;;
  84. I)
  85. build_option_proc_upper_i ;;
  86. K)
  87. export ENABLE_AKG="on"
  88. echo "enable compile with akg" ;;
  89. B)
  90. build_option_proc_upper_b ;;
  91. E)
  92. export ENABLE_IBVERBS="on"
  93. echo "enable IBVERBS for parameter server" ;;
  94. A)
  95. build_option_proc_upper_a ;;
  96. W)
  97. build_option_proc_upper_w ;;
  98. H)
  99. check_on_off $OPTARG H
  100. export ENABLE_HIDDEN="$OPTARG"
  101. echo "${OPTARG} hidden" ;;
  102. L)
  103. export ENABLE_TRT="on"
  104. export TENSORRT_HOME="$CASE_SENSIVE_ARG"
  105. echo "Link Tensor-RT library. Path: ${CASE_SENSIVE_ARG}" ;;
  106. *)
  107. echo "Unknown option ${opt}!"
  108. usage
  109. exit 1
  110. esac
  111. done
  112. }