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.

crc32.sh 2.5 kB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #!/bin/bash
  2. # Copyright 2020 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. set -e
  16. SCRIPT_BASEDIR=$(realpath "$(dirname "$0")")
  17. THIRD_PARTY_DIR=$(realpath "$SCRIPT_BASEDIR/../../third_party")
  18. BUILDDIR="$(dirname "$SCRIPT_BASEDIR")/build_securec"
  19. build_securec() {
  20. [ -n "$BUILDDIR" ] && rm -rf "$BUILDDIR"
  21. mkdir "$BUILDDIR"
  22. cd "$BUILDDIR" || exit
  23. if ! command -v cmake; then
  24. command cmake
  25. fi
  26. cmake ../..
  27. make
  28. }
  29. clean_securec() {
  30. [ -n "$BUILDDIR" ] && rm -rf "$BUILDDIR"
  31. }
  32. build_crc32() {
  33. DATAVISUAL_DIR=$(realpath "$SCRIPT_BASEDIR/../../mindinsight/datavisual")
  34. CRC32_SOURCE_DIR="$DATAVISUAL_DIR/utils/crc32"
  35. CRC32_OUTPUT_DIR="$DATAVISUAL_DIR/utils"
  36. CRC32_SO_FILE="crc32$(python3-config --extension-suffix)"
  37. cd "$CRC32_SOURCE_DIR" || exit
  38. if ! command -v c++; then
  39. command c++
  40. fi
  41. if command -v python3; then
  42. PYTHON=python3
  43. elif command -v python; then
  44. PYTHON=python
  45. else
  46. command python3
  47. fi
  48. if ! "$PYTHON" -c 'import sys; assert sys.version_info >= (3, 7)' &>/dev/null; then
  49. echo "Python 3.7 or higher is required. You are running $("$PYTHON" -V)"
  50. exit 1
  51. fi
  52. rm -f "$CRC32_SOURCE_DIR/$CRC32_SO_FILE"
  53. rm -f "$CRC32_OUTPUT_DIR/$CRC32_SO_FILE"
  54. read -ra PYBIND11_INCLUDES <<<"$($PYTHON -m pybind11 --includes)"
  55. c++ -O2 -O3 -shared -std=c++11 -fPIC -fstack-protector-all -D_FORTIFY_SOURCE=2 \
  56. -Wno-maybe-uninitialized -Wno-unused-parameter -Wall -Wl,-z,relro,-z,now,-z,noexecstack \
  57. -I"$THIRD_PARTY_DIR/securec/include" "${PYBIND11_INCLUDES[0]}" "${PYBIND11_INCLUDES[1]}" \
  58. -o "$CRC32_SO_FILE" crc32.cc "$BUILDDIR/libsecurec.a"
  59. if [ ! -f "$CRC32_SO_FILE" ]; then
  60. echo "$CRC32_SO_FILE file does not exist, build failed"
  61. exit 1
  62. fi
  63. mv "$CRC32_SO_FILE" "$CRC32_OUTPUT_DIR"
  64. }
  65. build_securec
  66. build_crc32
  67. clean_securec

MindInsight为MindSpore提供了简单易用的调优调试能力。在训练过程中,可以将标量、张量、图像、计算图、模型超参、训练耗时等数据记录到文件中,通过MindInsight可视化页面进行查看及分析。