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

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

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