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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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: install git (Windows GUI)
  20. * download git-install.exe from https://git-scm.com/download/win
  21. * only need choose git-lfs component
  22. * install to default dir: /c/Program\ Files/Git
  23. 2: install visual studio 2019 Enterprise (Windows GUI)
  24. * download install exe from https://visualstudio.microsoft.com
  25. * choose "c++ develop" -> choose cmake/MSVC/clang/cmake/windows-sdk when install
  26. * NOTICE: windows sdk version >=14.28.29910 do not compat with CUDA 10.1, please
  27. choose version < 14.28.29910
  28. * then install choosed components
  29. * after install visual studio 2019 Enterprise, time to replace lld-link.exe
  30. caused by visual studio 2019 lld-link.exe have crash issue
  31. download office exe from https://releases.llvm.org/download.html
  32. install to default: C:\Program Files\LLVM
  33. cd "/c/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/Llvm/bin"
  34. cp /c/Program\ Files/LLVM/bin/lld-link.exe lld-link.exe
  35. 3: install python3 (Windows GUI)
  36. * download python 64-bit install exe (we support python3.5-python3.8 now)
  37. https://www.python.org/ftp/python/3.5.4/python-3.5.4-amd64.exe
  38. https://www.python.org/ftp/python/3.6.8/python-3.6.8-amd64.exe
  39. https://www.python.org/ftp/python/3.7.7/python-3.7.7-amd64.exe
  40. https://www.python.org/ftp/python/3.8.3/python-3.8.3-amd64.exe
  41. * install 3.5.4 to /c/Users/${USER}/mge_whl_python_env/3.5.4
  42. * install 3.6.8 to /c/Users/${USER}/mge_whl_python_env/3.6.8
  43. * install 3.7.7 to /c/Users/${USER}/mge_whl_python_env/3.7.7
  44. * install 3.8.3 to /c/Users/${USER}/mge_whl_python_env/3.8.3
  45. * cp python.exe to python3.exe
  46. loop cd /c/Users/${USER}/mge_whl_python_env/*
  47. copy python.exe to python3.exe
  48. * install python depends components
  49. loop cd /c/Users/${USER}/mge_whl_python_env/*
  50. python3.exe -m pip install --upgrade pip
  51. python3.exe -m pip install -r imperative/python/requires.txt
  52. python3.exe -m pip install -r imperative/python/requires-test.txt
  53. 4: install cuda components (Windows GUI)
  54. * now we support cuda10.1+cudnn7.6+TensorRT6.0 on Windows
  55. * install cuda10.1 to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1
  56. * install cudnn7.6 to C:\Program Files\NVIDIA GPU Computing Toolkit\cudnn-10.1-windows10-x64-v7.6.5.32
  57. * install TensorRT6.0 to C:\Program Files\NVIDIA GPU Computing Toolkit\TensorRT-6.0.1.5
  58. 5: edit system env variables (Windows GUI)
  59. * create new key: "VS_PATH", value: "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise"
  60. * append "Path" env value
  61. C:\Program Files\Git\cmd
  62. C:\Users\build\mge_whl_python_env\3.8.3
  63. C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin
  64. C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\libnvvp
  65. C:\Program Files\NVIDIA GPU Computing Toolkit\cudnn-10.1-windows10-x64-v7.6.5.32\cuda\bin
  66. C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\Llvm\lib\clang\11.0.0\lib\windows
  67. C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\Llvm\x64\lib\clang\11.0.0\lib\windows
  68. ```
  69. ### Linux host build
  70. * commands:
  71. ```
  72. 1: install Cmake, which version >= 3.15.2, ninja-build
  73. 2: install gcc/g++, which version >= 6, (gcc/g++ >= 7, if need build training mode)
  74. 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
  75. 4: CUDA env(if enable CUDA), version detail refer to README.md
  76. ```
  77. ### MacOS host build
  78. * commands:
  79. ```
  80. 1: install Cmake, which version >= 3.15.2
  81. 2: install brew: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  82. 3: brew install python python3 coreutils ninja
  83. 4: install at least xcode command line tool: https://developer.apple.com/xcode/
  84. 5: about cuda: we do not support CUDA on MacOS
  85. 6: python3 -m pip install numpy (if you want to build with training mode)
  86. ```
  87. ### Cross build for ARM-Android
  88. Now we support Windows/Linux/MacOS cross build to ARM-Android
  89. * commands:
  90. ```
  91. 2: download NDK from https://developer.android.google.cn/ndk/downloads/ for diff OS platform package, suggested NDK20 or NDK21
  92. 3: export NDK_ROOT=NDK_DIR at bash-like env
  93. ```
  94. ### Cross build for ARM-Linux
  95. Now we support ARM-Linux on Linux and Windows fully, also experimental on MacOS
  96. * commands:
  97. ```
  98. 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
  99. 2: download toolchains from https://github.com/thinkski/osx-arm-linux-toolchains if use MacOS
  100. ```
  101. ### Cross build for IOS
  102. Now we only support cross build to IOS from MACOS
  103. * commands:
  104. ```
  105. 1: install full xcode: https://developer.apple.com/xcode/
  106. ```
  107. ## Third-party code prepare
  108. With bash env(Linux/MacOS/Unix-Like tools on Windows, eg: msys etc)
  109. * commands:
  110. ```
  111. ./third_party/prepare.sh
  112. ./third_party/install-mkl.sh
  113. ```
  114. Windows shell env(bash from windows-git), 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
  115. * command:
  116. ```
  117. bash.exe ./third_party/prepare.sh
  118. bash.exe ./third_party/install-mkl.sh
  119. ```
  120. # How to build
  121. ## With bash env(Linux/MacOS/Windows-git-bash)
  122. * command:
  123. ```
  124. 1: host build just use scripts:scripts/cmake-build/host_build.sh
  125. 2: cross build to ARM-Android: scripts/cmake-build/cross_build_android_arm_inference.sh
  126. 3: cross build to ARM-Linux: scripts/cmake-build/cross_build_linux_arm_inference.sh
  127. 4: cross build to IOS: scripts/cmake-build/cross_build_ios_arm_inference.sh
  128. ```
  129. ## Visual Studio GUI(only for Windows host)
  130. * command:
  131. ```
  132. 1: import megengine src to Visual Studio as a project
  133. 2: right click CMakeLists.txt, choose config 'cmake config' choose clang_cl_x86 or clang_cl_x64
  134. 3: config other CMAKE config, eg, CUDA ON OR OFF
  135. ```
  136. # Other ARM-Linux-Like board support
  137. It`s easy to support other customized arm-linux-like board, example:
  138. * 1: HISI 3516/3519, infact u can just use toolchains from arm developer or linaro
  139. then call scripts/cmake-build/cross_build_linux_arm_inference.sh to build a ELF
  140. binary, or if you get HISI official toolschain, you just need modify CMAKE_CXX_COMPILER
  141. and CMAKE_C_COMPILER in toolchains/arm-linux-gnueabi* to a real name
  142. * 2: about Raspberry, just use scripts/cmake-build/cross_build_linux_arm_inference.sh

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