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.

prepare.sh 4.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. #!/bin/bash -e
  2. cd $(dirname $0)
  3. # force use /usr/bin/sort on windows, /c/Windows/system32/sort do not support -V
  4. OS=$(uname -s)
  5. SORT=sort
  6. if [[ $OS =~ "NT" ]]; then
  7. SORT=/usr/bin/sort
  8. fi
  9. requiredGitVersion="1.8.4"
  10. currentGitVersion="$(git --version | awk '{print $3}')"
  11. if [ "$(printf '%s\n' "$requiredGitVersion" "$currentGitVersion" | ${SORT} -V | head -n1)" = "$currentGitVersion" ]; then
  12. echo "Please update your Git version. (foud version $currentGitVersion, required version >= $requiredGitVersion)"
  13. exit -1
  14. fi
  15. SYNC_LLVM_PROJECT=True
  16. SYNC_GTEST_PROJECT=True
  17. SYNC_DNNL_PROJECT=True
  18. SYNC_HALIDE_PROJECT=True
  19. SYNC_PROTOBUF_PROJECT=True
  20. SYNC_CUTLASS_PROJECT=True
  21. SYNC_IMPERATIVE_RT_PROJECT=True
  22. SYNC_DISTRIBUTED_PROJECT=True
  23. SYNC_OPENBLAS_PROJECT=True
  24. function usage() {
  25. echo "$0 args1 args2 .."
  26. echo "available args detail:"
  27. echo "-a : do not sync llvm-project"
  28. echo "-b : do not sync gtest"
  29. echo "-c : do not sync intel-mkl-dnn"
  30. echo "-d : do not sync Halide"
  31. echo "-e : do not sync protobuf"
  32. echo "-f : do not sync cutlass"
  33. echo "-g : do not sync IMPERATIVE_RT project"
  34. echo "-i : do not sync DISTRIBUTED project"
  35. echo "-j : do not sync OpenBLAS project"
  36. echo "-h : show usage"
  37. exit -1
  38. }
  39. while getopts "abcdefghij" arg
  40. do
  41. case $arg in
  42. a)
  43. echo "do not sync llvm-project"
  44. SYNC_LLVM_PROJECT=False
  45. ;;
  46. b)
  47. echo "do not sync gtest"
  48. SYNC_GTEST_PROJECT=False
  49. ;;
  50. c)
  51. echo "do not sync intel-mkl-dnn"
  52. SYNC_DNNL_PROJECT=False
  53. ;;
  54. d)
  55. echo "do not sync Halide"
  56. SYNC_HALIDE_PROJECT=False
  57. ;;
  58. e)
  59. echo "do not sync protobuf"
  60. SYNC_PROTOBUF_PROJECT=False
  61. ;;
  62. f)
  63. echo "do not sync cutlass"
  64. SYNC_CUTLASS_PROJECT=False
  65. ;;
  66. g)
  67. echo "do not sync IMPERATIVE_RT project"
  68. SYNC_IMPERATIVE_RT_PROJECT=False
  69. ;;
  70. i)
  71. echo "do not sync DISTRIBUTED project"
  72. SYNC_DISTRIBUTED_PROJECT=False
  73. ;;
  74. j)
  75. echo "do not sync OpenBLAS project"
  76. SYNC_OPENBLAS_PROJECT=False
  77. ;;
  78. h)
  79. echo "show usage"
  80. usage
  81. ;;
  82. ?)
  83. echo "unkonw argument"
  84. usage
  85. ;;
  86. esac
  87. done
  88. function git_submodule_update() {
  89. git submodule sync
  90. git submodule update -f --init midout
  91. git submodule update -f --init flatbuffers
  92. git submodule update -f --init Json
  93. git submodule update -f --init gflags
  94. git submodule update -f --init cpuinfo
  95. git submodule update -f --init cpp_redis
  96. git submodule update -f --init tacopie
  97. if [ ${SYNC_DNNL_PROJECT} = "True" ];then
  98. git submodule update -f --init intel-mkl-dnn
  99. fi
  100. if [ ${SYNC_HALIDE_PROJECT} = "True" ];then
  101. git submodule update -f --init Halide
  102. fi
  103. if [ ${SYNC_PROTOBUF_PROJECT} = "True" ];then
  104. git submodule update -f --init protobuf
  105. fi
  106. if [ ${SYNC_GTEST_PROJECT} = "True" ];then
  107. git submodule update -f --init gtest
  108. fi
  109. if [ ${SYNC_CUTLASS_PROJECT} = "True" ];then
  110. git submodule update -f --init cutlass
  111. fi
  112. if [ ${SYNC_LLVM_PROJECT} = "True" ];then
  113. git submodule update -f --init llvm-project
  114. fi
  115. if [ ${SYNC_IMPERATIVE_RT_PROJECT} = "True" ];then
  116. git submodule update -f --init pybind11
  117. git submodule update -f --init range-v3
  118. fi
  119. if [ ${SYNC_DISTRIBUTED_PROJECT} = "True" ];then
  120. git submodule update -f --init libzmq
  121. git submodule update -f --init cppzmq
  122. git submodule update -f --init MegRay
  123. pushd MegRay/third_party >/dev/null
  124. git submodule sync
  125. git submodule update -f --init nccl
  126. git submodule update -f --init gdrcopy
  127. git submodule update -f --init ucx
  128. popd >/dev/null
  129. fi
  130. if [ ${SYNC_OPENBLAS_PROJECT} = "True" ];then
  131. git submodule update -f --init OpenBLAS
  132. fi
  133. }
  134. if [[ -z "${ALREADY_UPDATE_SUBMODULES}" ]]; then
  135. git_submodule_update
  136. fi