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_PYTHON_WHL_README.md 5.6 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. # Python whl package build support status
  2. * Windows build (cpu and gpu)
  3. * Linux build (cpu and gpu)
  4. * MacOS build (cpu only)
  5. # Build env prepare
  6. ## Linux
  7. ```bash
  8. 1: please refer to: https://docs.docker.com/engine/security/rootless/ to enable rootless docker env
  9. 2: cd ./scripts/whl/manylinux2014
  10. 3: ./build_image.sh
  11. 4: as aarch64-linux python3.5 pip do not provide megengine depends prebuild binary package, which definition
  12. in imperative/python/requires.txt, before install megengine wheel package(just python3.5), you need
  13. do follow step to init python3.5 arrow build env:
  14. 4a: wget https://apache.bintray.com/arrow/debian/apache-arrow-archive-keyring-latest-buster.deb
  15. 4b: sudo apt install ./apache-arrow-archive-keyring-latest-buster.deb
  16. 4c: sudo apt update
  17. 4d: sudo apt install libarrow-dev
  18. 4c: sudo apt install libarrow-python-dev
  19. 4e: sudo ln -s /usr/include/locale.h /usr/include/xlocale.h
  20. ```
  21. ## MacOS
  22. ```bash
  23. ./scripts/whl/macos/macos_whl_env_prepare.sh
  24. ```
  25. ## Windows
  26. ```
  27. 1: refer to scripts/cmake-build/BUILD_README.md Windows section build for base windows build env prepare
  28. 2: install several python or install your care about python version, default install dir: /c/Users/${USER}/mge_whl_python_env
  29. a: mkdir /c/Users/${USER}/mge_whl_python_env
  30. b: download python 64-bit install exe
  31. https://www.python.org/ftp/python/3.5.4/python-3.5.4-amd64.exe
  32. https://www.python.org/ftp/python/3.6.8/python-3.6.8-amd64.exe
  33. https://www.python.org/ftp/python/3.7.7/python-3.7.7-amd64.exe
  34. https://www.python.org/ftp/python/3.8.3/python-3.8.3-amd64.exe
  35. c: install python-3.5.4-amd64.exe to /c/Users/${USER}/mge_whl_python_env/3.5.4 from install gui
  36. d: install python-3.6.8-amd64.exe to /c/Users/${USER}/mge_whl_python_env/3.6.8 from install gui
  37. e: install python-3.7.7-amd64.exe to /c/Users/${USER}/mge_whl_python_env/3.7.7 from install gui
  38. f: install python-3.8.3-amd64.exe to /c/Users/${USER}/mge_whl_python_env/3.8.3 from install gui
  39. 3: cp python.exe to python3.exe
  40. a: mv /c/Users/${USER}/mge_whl_python_env/3.5.4/python.exe /c/Users/${USER}/mge_whl_python_env/3.5.4/python3.exe
  41. b: mv /c/Users/${USER}/mge_whl_python_env/3.6.8/python.exe /c/Users/${USER}/mge_whl_python_env/3.6.8/python3.exe
  42. c: mv /c/Users/${USER}/mge_whl_python_env/3.7.7/python.exe /c/Users/${USER}/mge_whl_python_env/3.7.7/python3.exe
  43. d: mv /c/Users/${USER}/mge_whl_python_env/3.8.3/python.exe /c/Users/${USER}/mge_whl_python_env/3.8.3/python3.exe
  44. 4: install needed package for build python whl package
  45. a0: /c/Users/${USER}/mge_whl_python_env/3.5.4/python3.exe -m pip install --upgrade pip
  46. a1: /c/Users/${USER}/mge_whl_python_env/3.5.4/python3.exe -m pip install -r imperative/python/requires-test.txt
  47. a2: /c/Users/${USER}/mge_whl_python_env/3.5.4/python3.exe -m pip install numpy wheel requests tqdm tabulate
  48. b0: /c/Users/${USER}/mge_whl_python_env/3.6.8/python3.exe -m pip install --upgrade pip
  49. b1: /c/Users/${USER}/mge_whl_python_env/3.6.8/python3.exe -m pip install -r imperative/python/requires-test.txt
  50. b2: /c/Users/${USER}/mge_whl_python_env/3.6.8/python3.exe -m pip install numpy wheel requests tqdm tabulate
  51. c0: /c/Users/${USER}/mge_whl_python_env/3.7.7/python3.exe -m pip install --upgrade pip
  52. c1: /c/Users/${USER}/mge_whl_python_env/3.7.7/python3.exe -m pip install -r imperative/python/requires-test.txt
  53. c2: /c/Users/${USER}/mge_whl_python_env/3.7.7/python3.exe -m pip install numpy wheel requests tqdm tabulate
  54. d0: /c/Users/${USER}/mge_whl_python_env/3.8.3/python3.exe -m pip install --upgrade pip
  55. d1: /c/Users/${USER}/mge_whl_python_env/3.8.3/python3.exe -m pip install -r imperative/python/requires-test.txt
  56. d2: /c/Users/${USER}/mge_whl_python_env/3.8.3/python3.exe -m pip install numpy wheel requests tqdm tabulate
  57. ```
  58. # How to build
  59. Note: Guarantee the git repo is mounted in docker container, do not use `git submodule update --init` in to init Project repo
  60. ## Build for linux
  61. * This Project delivers `wheel` package with `manylinux2014` tag defined in [PEP-571](https://www.python.org/dev/peps/pep-0571/).
  62. commands:
  63. ```bash
  64. export CUDA_ROOT_DIR=/path/to/cuda
  65. export CUDNN_ROOT_DIR=/path/to/cudnn
  66. export TENSORRT_ROOT_DIR=/path/to/tensorrt
  67. ./scripts/whl/manylinux2014/build_wheel_common.sh -sdk cu101
  68. ```
  69. * And you can find all of the outputs in `output` directory.If you just want to build for a specific Python verison, you can use `ALL_PYTHON` environment variable. eg:
  70. ```bash
  71. ALL_PYTHON="36m" ./scripts/whl/manylinux2014/build_wheel_common.sh -sdk cu101
  72. ```
  73. * If you just want to build with cpu only version, you can set `-sdk` environment 'cpu'. eg:
  74. ```bash
  75. ALL_PYTHON="36m" ./scripts/whl/manylinux2014/build_wheel_common.sh -sdk cpu
  76. ```
  77. ## Build for MacOS
  78. * commands:
  79. ```bash
  80. ./scripts/whl/macos/macos_build_whl.sh
  81. ```
  82. * If you just want to build for a specific Python verison, you can use `ALL_PYTHON` environment variable. eg:
  83. ```bash
  84. ALL_PYTHON="3.7.7" ./scripts/whl/macos/macos_build_whl.sh
  85. ```
  86. ## Build for Windows
  87. * commands:
  88. ```bash
  89. ./scripts/whl/windows/windows_build_whl.sh
  90. ```
  91. * If you just want to build for a specific Python verison, you can use `ALL_PYTHON` environment variable. eg:
  92. ```bash
  93. ALL_PYTHON="3.8.3" ./scripts/whl/windows/windows_build_whl.sh
  94. ```
  95. * If you just want to build with cpu only version, you can set `BUILD_WHL_CPU_ONLY` environment 'ON'. eg:
  96. ```
  97. BUILD_WHL_CPU_ONLY="ON" ALL_PYTHON="3.8.3" ./scripts/whl/windows/windows_build_whl.sh
  98. ```

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