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.

parse_device.sh 2.4 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. parse_device()
  19. {
  20. if [[ "X$RUN_TESTCASES" == "Xon" && "X$DEVICE" != "X" ]]; then
  21. echo "WARNING:Option -e can't be set while option -t on/ut is set, reset device to empty."
  22. DEVICE=""
  23. fi
  24. # Parse device
  25. # Process build option
  26. if [[ "X$DEVICE" == "Xgpu" ]]; then
  27. export ENABLE_GPU="on"
  28. ENABLE_CPU="on"
  29. ENABLE_MPI="on"
  30. # version default 10.1
  31. if [[ "X$DEVICE_VERSION" == "X" ]]; then
  32. DEVICE_VERSION=10.1
  33. fi
  34. if [[ "X$DEVICE_VERSION" != "X11.1" && "X$DEVICE_VERSION" != "X10.1" ]]; then
  35. echo "Invalid value ${DEVICE_VERSION} for option -V"
  36. usage
  37. exit 1
  38. fi
  39. export CUDA_VERSION="$DEVICE_VERSION"
  40. export ENABLE_AKG="on"
  41. elif [[ "X$DEVICE" == "Xd" || "X$DEVICE" == "Xascend" ]]; then
  42. # version default 910
  43. if [[ "X$DEVICE_VERSION" == "X" ]]; then
  44. DEVICE_VERSION=910
  45. fi
  46. # building 310 package by giving specific -V 310 instruction
  47. if [[ "X$DEVICE_VERSION" == "X310" ]]; then
  48. ENABLE_ACL="on"
  49. # universal ascend package
  50. elif [[ "X$DEVICE_VERSION" == "X910" ]]; then
  51. export ENABLE_D="on"
  52. export ENABLE_ACL="on"
  53. ENABLE_CPU="on"
  54. export ENABLE_MPI="on"
  55. export ENABLE_AKG="on"
  56. else
  57. echo "Invalid value ${DEVICE_VERSION} for option -V"
  58. usage
  59. exit 1
  60. fi
  61. elif [[ "X$DEVICE" == "Xcpu" ]]; then
  62. export ENABLE_CPU="on"
  63. export ENABLE_AKG="on"
  64. elif [[ "X$DEVICE" == "X" ]]; then
  65. :
  66. else
  67. echo "Invalid value ${DEVICE} for option -e"
  68. usage
  69. exit 1
  70. fi
  71. if [[ "X$ENABLE_AKG" == "Xon" && "X$ENABLE_D" != "Xon" ]]; then
  72. # check llvm version for akg
  73. export USE_LLVM=`bash ${BASEPATH}/scripts/build/akg_find_llvm.sh`
  74. fi
  75. }