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 6.2 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. 6: install swig from install gui (if u want to build with training mode or build python whl)
  35. a: download swig: https://nchc.dl.sourceforge.net/project/swig/swigwin/swigwin-4.0.2/swigwin-4.0.2.zip
  36. b: install swig to /c/Users/${USER}/swigwin-4.0.2
  37. c: apply scripts/whl/windows/fix-ptr-define-issue.patch to c/Users/${USER}/swigwin-4.0.2
  38. ```
  39. ### linux host build
  40. ```
  41. 1: cmake, which version > 3.14.4
  42. 2: gcc/g++, which version > 6, (gcc/g++ >= 7, if need build training)
  43. 3: install build-essential git git-lfs gfortran libgfortran-6-dev autoconf gnupg flex bison gperf curl
  44. 4: zlib1g-dev gcc-multilib g++-multilib lib32ncurses5-dev libxml2-utils xsltproc unzip libtool:
  45. 5: librdmacm-dev rdmacm-utils python3-dev swig python3-numpy texinfo
  46. 6: CUDA env(if enable CUDA), version detail: project_root_dir/README.md
  47. ```
  48. ### macos host build
  49. ```
  50. 1: cmake, which version > 3.14.4
  51. 2: install brew: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  52. 3: brew install python python3 swig coreutils
  53. 4: install at least xcode command line tool: https://developer.apple.com/xcode/
  54. 5: about cuda: we do not support CUDA on macos
  55. 6: python3 -m pip install numpy (if u want to build with training mode or build python whl)
  56. ```
  57. ### cross build for arm-android
  58. now we support windows/linux/macos cross build to arm-android
  59. ```
  60. 1: install unix-like tools, eg MSYS if you are using windows(recommend)
  61. we also support CMD.exe or powershell on windows
  62. 1: download NDK from https://developer.android.google.cn/ndk/downloads/
  63. for diff OS platform package, suggested NDK20 or NDK21
  64. 2: export NDK_ROOT=NDK_DIR at bash-like env
  65. 3: config NDK_ROOT to PATH env at windows control board if use CMD/powershell
  66. ```
  67. ### cross build for arm-linux
  68. now we support arm-linux on linux and windows fully, also experimental on MACOS
  69. ```
  70. 1: download toolchains on https://releases.linaro.org/components/toolchain/gcc-linaro/
  71. or https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-a/downloads
  72. if use windows or linux
  73. 2: download https://github.com/thinkski/osx-arm-linux-toolchains if use MACOS
  74. ```
  75. ### cross build for ios
  76. now we only support cross build to ios on MACOS
  77. ```
  78. 1: install full xcode: https://developer.apple.com/xcode/
  79. ```
  80. ## third-party code prepare
  81. ### with bash env(linux/macos/unix-like tools on windows, eg: msys etc)
  82. ```
  83. ./third_party/prepare.sh
  84. ./third_party/install-mkl.sh
  85. ```
  86. ### windows shell env(eg: cmd, powershell etc)
  87. infact if you can use git command on windows, which means you always install
  88. bash.exe at the same dir of git.exe, find it, then you can prepare third-party
  89. code by command:
  90. ```
  91. bash.exe ./third_party/prepare.sh
  92. bash.exe ./third_party/install-mkl.sh
  93. ```
  94. # how to build
  95. ## with bash env(linux/macos/unix-like tools on windows, eg: msys etc)
  96. ```
  97. 1: host build just use scripts:scripts/cmake-build/host_build.sh
  98. 2: cross build to arm-android: scripts/cmake-build/cross_build_android_arm_inference.sh
  99. 3: cross build to arm-linux: scripts/cmake-build/cross_build_linux_arm_inference.sh
  100. 4: cross build to ios: scripts/cmake-build/cross_build_ios_arm_inference.sh
  101. ```
  102. ## windows shell env(eg: cmd, powershell etc)
  103. ```
  104. 1: we do not provide BAT for cmd/powershlel scripts, BUT u can refs for scripts/cmake-build/*.sh
  105. ```
  106. ## Visual Studio GUI(only for windows host)
  107. ```
  108. 1: import megengine src to Visual Studio as a project
  109. 2: right click CMakeLists.txt, choose config 'cmake config'
  110. choose clang_cl_x86 or clang_cl_x64
  111. 3: config other CMAKE config, eg, CUDA ON OR OFF
  112. ```
  113. # other arm-linux-like board support
  114. it`s easy to support other customized arm-linux-like board, example:
  115. 1: HISI 3516/3519, infact u can just use toolchains from arm developer or linaro
  116. then call scripts/cmake-build/cross_build_linux_arm_inference.sh to build a ELF
  117. binary, or if you get HISI official toolschain, you just need modify CMAKE_CXX_COMPILER
  118. and CMAKE_C_COMPILER in toolchains/arm-linux-gnueabi* to a real name
  119. 2: about Raspberry, just use scripts/cmake-build/cross_build_linux_arm_inference.sh

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