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.2 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. elif [[ "X$DEVICE" == "Xd" || "X$DEVICE" == "Xascend" ]]; then
  41. # version default 910
  42. if [[ "X$DEVICE_VERSION" == "X" ]]; then
  43. DEVICE_VERSION=910
  44. fi
  45. # building 310 package by giving specific -V 310 instruction
  46. if [[ "X$DEVICE_VERSION" == "X310" ]]; then
  47. ENABLE_ACL="on"
  48. # universal ascend package
  49. elif [[ "X$DEVICE_VERSION" == "X910" ]]; then
  50. export ENABLE_D="on"
  51. export ENABLE_ACL="on"
  52. ENABLE_CPU="on"
  53. export ENABLE_MPI="on"
  54. else
  55. echo "Invalid value ${DEVICE_VERSION} for option -V"
  56. usage
  57. exit 1
  58. fi
  59. elif [[ "X$DEVICE" == "Xcpu" ]]; then
  60. export ENABLE_CPU="on"
  61. elif [[ "X$DEVICE" == "X" ]]; then
  62. :
  63. else
  64. echo "Invalid value ${DEVICE} for option -e"
  65. usage
  66. exit 1
  67. fi
  68. }