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.

build_mindspore.sh 4.2 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. # Create building path
  18. build_mindspore()
  19. {
  20. echo "start build mindspore project."
  21. mkdir -pv "${BUILD_PATH}/mindspore"
  22. cd "${BUILD_PATH}/mindspore"
  23. CMAKE_ARGS="-DDEBUG_MODE=$DEBUG_MODE -DBUILD_PATH=$BUILD_PATH"
  24. if [[ "X$ENABLE_COVERAGE" = "Xon" ]]; then
  25. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_COVERAGE=ON"
  26. fi
  27. if [[ "X$RUN_TESTCASES" = "Xon" ]]; then
  28. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_TESTCASES=ON"
  29. fi
  30. if [[ "X$RUN_CPP_ST_TESTS" = "Xon" ]]; then
  31. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_CPP_ST=ON"
  32. fi
  33. if [[ -n "$ENABLE_BACKEND" ]]; then
  34. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_${ENABLE_BACKEND}=ON"
  35. fi
  36. if [[ "X$ENABLE_SYM_FILE" = "Xon" ]]; then
  37. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_SYM_FILE=ON"
  38. fi
  39. if [[ "X$ENABLE_ASAN" = "Xon" ]]; then
  40. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_ASAN=ON"
  41. fi
  42. if [[ "X$ENABLE_PROFILE" = "Xon" ]]; then
  43. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_PROFILE=ON"
  44. fi
  45. if [[ "X$ENABLE_SECURITY" = "Xon" ]]; then
  46. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_SECURITY=ON"
  47. fi
  48. if [[ "X$ENABLE_TIMELINE" = "Xon" ]]; then
  49. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_TIMELINE=ON"
  50. fi
  51. if [[ "X$ENABLE_DUMP2PROTO" = "Xon" ]]; then
  52. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_DUMP_PROTO=ON"
  53. fi
  54. if [[ "X$ENABLE_GITEE" = "Xon" ]]; then
  55. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_GITEE=ON"
  56. fi
  57. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_DUMP_IR=${ENABLE_DUMP_IR}"
  58. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_PYTHON=${ENABLE_PYTHON}"
  59. if [[ "X$ENABLE_MPI" = "Xon" ]]; then
  60. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_MPI=ON"
  61. fi
  62. if [[ "X$ENABLE_D" = "Xon" ]]; then
  63. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_D=ON"
  64. fi
  65. if [[ "X$ENABLE_GPU" = "Xon" ]]; then
  66. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_GPU=ON -DUSE_CUDA=ON -DCUDA_PATH=$CUDA_PATH -DMS_REQUIRE_CUDA_VERSION=${CUDA_VERSION}"
  67. fi
  68. if [[ "X$ENABLE_CPU" = "Xon" ]]; then
  69. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_CPU=ON -DX86_64_SIMD=${X86_64_SIMD} -DARM_SIMD=${ARM_SIMD}"
  70. fi
  71. if [[ "X$COMPILE_MINDDATA" = "Xon" ]]; then
  72. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_MINDDATA=ON"
  73. fi
  74. if [[ "X$USE_GLOG" = "Xon" ]]; then
  75. CMAKE_ARGS="${CMAKE_ARGS} -DUSE_GLOG=ON"
  76. fi
  77. if [[ "X$ENABLE_AKG" = "Xon" ]]; then
  78. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_AKG=ON"
  79. if [[ "X$USE_LLVM" = "Xon" ]]; then
  80. CMAKE_ARGS="${CMAKE_ARGS} -DUSE_LLVM=ON"
  81. fi
  82. fi
  83. if [[ "X$ENABLE_ACL" = "Xon" ]]; then
  84. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_ACL=ON"
  85. fi
  86. if [[ "X$ENABLE_DEBUGGER" = "Xon" ]]; then
  87. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_DEBUGGER=ON"
  88. fi
  89. if [[ "X$ENABLE_IBVERBS" = "Xon" ]]; then
  90. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_IBVERBS=ON"
  91. fi
  92. if [[ "X$ENABLE_HIDDEN" = "Xoff" ]]; then
  93. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_HIDDEN=OFF"
  94. fi
  95. if [[ "X$ENABLE_TRT" == "Xon" ]]; then
  96. CMAKE_ARGS="${CMAKE_ARGS} -DTENSORRT_HOME=${TENSORRT_HOME}"
  97. fi
  98. if [[ "X$ENABLE_FAST_HASH_TABLE" == "Xon" ]]; then
  99. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_FAST_HASH_TABLE=ON"
  100. else
  101. CMAKE_ARGS="${CMAKE_ARGS} -DENABLE_FAST_HASH_TABLE=OFF"
  102. fi
  103. echo "${CMAKE_ARGS}"
  104. if [[ "X$INC_BUILD" = "Xoff" ]]; then
  105. cmake ${CMAKE_ARGS} ${BASEPATH}
  106. fi
  107. if [[ -n "$VERBOSE" ]]; then
  108. CMAKE_VERBOSE="--verbose"
  109. fi
  110. cmake --build . --target package ${CMAKE_VERBOSE} -j$THREAD_NUM
  111. echo "success building mindspore project!"
  112. }