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.8 kB

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

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