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_README.md 5.9 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. # build support status
  2. ## host build
  3. * windows build (cpu + gpu)
  4. * linux build (cpu + gpu)
  5. * macos build (cpu only)
  6. ## cross build
  7. * windows cross build arm-android (ok)
  8. * windows cross build arm-linux (ok)
  9. * linux cross build arm-android (ok)
  10. * linux cross build arm-linux (ok)
  11. * macos cross build arm-android (ok)
  12. * macos cross build arm-linux (ok but experimental)
  13. * macos cross build ios (ok)
  14. # build env prepare
  15. ## package install
  16. ### windows host build
  17. ```
  18. 1: installl Visual Studio (need support LLVM/clang-cl), eg 2019
  19. pls install LLVM-10, VS llvm linker have issue, pls replace lld-link.exe,
  20. download from https://releases.llvm.org/download.html#10.0.0
  21. 2: install extension of VS: python/cmake/LLVM
  22. 3: CUDA env(if enable CUDA), version detail: project_root_dir/README.md
  23. 4: now we support cuda10.1+cudnn7.6+TensorRT6.0 on windows, as windows can
  24. only use dll in fact with cudnn/TensorRT, so please install the same version;
  25. 4a: install cuda10.1 to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1
  26. 4b: install cudnn7.6 to C:\Program Files\NVIDIA GPU Computing Toolkit\cudnn-10.1-windows10-x64-v7.6.5.32
  27. 4c: install TensorRT6.0 to C:\Program Files\NVIDIA GPU Computing Toolkit\TensorRT-6.0.1.5
  28. 4d: add C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin to system Path env
  29. 4e: add C:\Program Files\NVIDIA GPU Computing Toolkit\cudnn-10.1-windows10-x64-v7.6.5.32\cuda\bin to system Path env
  30. 4f: add C:\Program Files\NVIDIA GPU Computing Toolkit\TensorRT-6.0.1.5\lib Path
  31. if u do not do 4d/4e/4f, CUDA runtime can not find dll
  32. 5: install python3 (DFT 3.8.3) to /c/Users/${USER}/mge_whl_python_env/3.8.3 and
  33. put it to PATH env and run python3 -m pip install numpy (if u want to build with training mode or build python whl)
  34. ```
  35. ### linux host build
  36. ```
  37. 1: cmake, which version > 3.15.2
  38. 2: gcc/g++, which version > 6, (gcc/g++ >= 7, if need build training)
  39. 3: install build-essential git git-lfs gfortran libgfortran-6-dev autoconf gnupg flex bison gperf curl
  40. 4: zlib1g-dev gcc-multilib g++-multilib lib32ncurses5-dev libxml2-utils xsltproc unzip libtool:
  41. 5: librdmacm-dev rdmacm-utils python3-dev swig python3-numpy texinfo
  42. 6: CUDA env(if enable CUDA), version detail: project_root_dir/README.md
  43. ```
  44. ### macos host build
  45. ```
  46. 1: cmake, which version > 3.15.2
  47. 2: install brew: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  48. 3: brew install python python3 swig coreutils
  49. 4: install at least xcode command line tool: https://developer.apple.com/xcode/
  50. 5: about cuda: we do not support CUDA on macos
  51. 6: python3 -m pip install numpy (if u want to build with training mode or build python whl)
  52. ```
  53. ### cross build for arm-android
  54. now we support windows/linux/macos cross build to arm-android
  55. ```
  56. 1: install unix-like tools, eg MSYS if you are using windows(recommend)
  57. we also support CMD.exe or powershell on windows
  58. 1: download NDK from https://developer.android.google.cn/ndk/downloads/
  59. for diff OS platform package, suggested NDK20 or NDK21
  60. 2: export NDK_ROOT=NDK_DIR at bash-like env
  61. 3: config NDK_ROOT to PATH env at windows control board if use CMD/powershell
  62. ```
  63. ### cross build for arm-linux
  64. now we support arm-linux on linux and windows fully, also experimental on MACOS
  65. ```
  66. 1: download toolchains on https://releases.linaro.org/components/toolchain/gcc-linaro/
  67. or https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads
  68. if use windows or linux
  69. 2: download https://github.com/thinkski/osx-arm-linux-toolchains if use MACOS
  70. ```
  71. ### cross build for ios
  72. now we only support cross build to ios on MACOS
  73. ```
  74. 1: install full xcode: https://developer.apple.com/xcode/
  75. ```
  76. ## third-party code prepare
  77. ### with bash env(linux/macos/unix-like tools on windows, eg: msys etc)
  78. ```
  79. ./third_party/prepare.sh
  80. ./third_party/install-mkl.sh
  81. ```
  82. ### windows shell env(eg: cmd, powershell etc)
  83. infact if you can use git command on windows, which means you always install
  84. bash.exe at the same dir of git.exe, find it, then you can prepare third-party
  85. code by command:
  86. ```
  87. bash.exe ./third_party/prepare.sh
  88. bash.exe ./third_party/install-mkl.sh
  89. ```
  90. # how to build
  91. ## with bash env(linux/macos/unix-like tools on windows, eg: msys etc)
  92. ```
  93. 1: host build just use scripts:scripts/cmake-build/host_build.sh
  94. 2: cross build to arm-android: scripts/cmake-build/cross_build_android_arm_inference.sh
  95. 3: cross build to arm-linux: scripts/cmake-build/cross_build_linux_arm_inference.sh
  96. 4: cross build to ios: scripts/cmake-build/cross_build_ios_arm_inference.sh
  97. ```
  98. ## windows shell env(eg: cmd, powershell etc)
  99. ```
  100. 1: we do not provide BAT for cmd/powershlel scripts, BUT u can refs for scripts/cmake-build/*.sh
  101. ```
  102. ## Visual Studio GUI(only for windows host)
  103. ```
  104. 1: import megengine src to Visual Studio as a project
  105. 2: right click CMakeLists.txt, choose config 'cmake config'
  106. choose clang_cl_x86 or clang_cl_x64
  107. 3: config other CMAKE config, eg, CUDA ON OR OFF
  108. ```
  109. # other arm-linux-like board support
  110. it`s easy to support other customized arm-linux-like board, example:
  111. 1: HISI 3516/3519, infact u can just use toolchains from arm developer or linaro
  112. then call scripts/cmake-build/cross_build_linux_arm_inference.sh to build a ELF
  113. binary, or if you get HISI official toolschain, you just need modify CMAKE_CXX_COMPILER
  114. and CMAKE_C_COMPILER in toolchains/arm-linux-gnueabi* to a real name
  115. 2: about Raspberry, just use scripts/cmake-build/cross_build_linux_arm_inference.sh

MegEngine 安装包中集成了使用 GPU 运行代码所需的 CUDA 环境,不用区分 CPU 和 GPU 版。 如果想要运行 GPU 程序,请确保机器本身配有 GPU 硬件设备并安装好驱动。 如果你想体验在云端 GPU 算力平台进行深度学习开发的感觉,欢迎访问 MegStudio 平台