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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. ```
  12. ## MacOS
  13. ```bash
  14. ./scripts/whl/macos/macos_whl_env_prepare.sh
  15. ```
  16. ## Windows
  17. ```
  18. 1: refer to scripts/cmake-build/BUILD_README.md Windows section build for base windows build env prepare
  19. 2: install several python or install your care about python version, default install dir: /c/Users/${USER}/mge_whl_python_env
  20. a: mkdir /c/Users/${USER}/mge_whl_python_env
  21. b: download python 64-bit install exe
  22. https://www.python.org/ftp/python/3.5.4/python-3.5.4-amd64.exe
  23. https://www.python.org/ftp/python/3.6.8/python-3.6.8-amd64.exe
  24. https://www.python.org/ftp/python/3.7.7/python-3.7.7-amd64.exe
  25. https://www.python.org/ftp/python/3.8.3/python-3.8.3-amd64.exe
  26. c: install python-3.5.4-amd64.exe to /c/Users/${USER}/mge_whl_python_env/3.5.4 from install gui
  27. d: install python-3.6.8-amd64.exe to /c/Users/${USER}/mge_whl_python_env/3.6.8 from install gui
  28. e: install python-3.7.7-amd64.exe to /c/Users/${USER}/mge_whl_python_env/3.7.7 from install gui
  29. f: install python-3.8.3-amd64.exe to /c/Users/${USER}/mge_whl_python_env/3.8.3 from install gui
  30. 3: cp python.exe to python3.exe
  31. 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
  32. 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
  33. 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
  34. 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
  35. 4: install needed package for build python whl package
  36. a0: /c/Users/${USER}/mge_whl_python_env/3.5.4/python3.exe -m pip install --upgrade pip
  37. a1: /c/Users/${USER}/mge_whl_python_env/3.5.4/python3.exe -m pip install -r imperative/python/requires-test.txt
  38. a2: /c/Users/${USER}/mge_whl_python_env/3.5.4/python3.exe -m pip install numpy wheel requests tqdm tabulate
  39. b0: /c/Users/${USER}/mge_whl_python_env/3.6.8/python3.exe -m pip install --upgrade pip
  40. b1: /c/Users/${USER}/mge_whl_python_env/3.6.8/python3.exe -m pip install -r imperative/python/requires-test.txt
  41. b2: /c/Users/${USER}/mge_whl_python_env/3.6.8/python3.exe -m pip install numpy wheel requests tqdm tabulate
  42. c0: /c/Users/${USER}/mge_whl_python_env/3.7.7/python3.exe -m pip install --upgrade pip
  43. c1: /c/Users/${USER}/mge_whl_python_env/3.7.7/python3.exe -m pip install -r imperative/python/requires-test.txt
  44. c2: /c/Users/${USER}/mge_whl_python_env/3.7.7/python3.exe -m pip install numpy wheel requests tqdm tabulate
  45. d0: /c/Users/${USER}/mge_whl_python_env/3.8.3/python3.exe -m pip install --upgrade pip
  46. d1: /c/Users/${USER}/mge_whl_python_env/3.8.3/python3.exe -m pip install -r imperative/python/requires-test.txt
  47. d2: /c/Users/${USER}/mge_whl_python_env/3.8.3/python3.exe -m pip install numpy wheel requests tqdm tabulate
  48. ```
  49. # How to build
  50. Note: Guarantee the git repo is mounted in docker container, do not use `git submodule update --init` in to init megbrain repo
  51. ## Build for linux
  52. * MegBrain delivers `wheel` package with `manylinux2014` tag defined in [PEP-571](https://www.python.org/dev/peps/pep-0571/).
  53. commands:
  54. ```bash
  55. export CUDA_ROOT_DIR=/path/to/cuda
  56. export CUDNN_ROOT_DIR=/path/to/cudnn
  57. export TENSORRT_ROOT_DIR=/path/to/tensorrt
  58. ./scripts/whl/manylinux2014/build_wheel_common.sh -sdk cu101
  59. ```
  60. * 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:
  61. ```bash
  62. ALL_PYTHON="36m" ./scripts/whl/manylinux2014/build_wheel_common.sh -sdk cu101
  63. ```
  64. * If you just want to build with cpu only version, you can set `BUILD_WHL_CPU_ONLY` environment 'ON'. eg:
  65. ```bash
  66. BUILD_WHL_CPU_ONLY="ON" ALL_PYTHON="36m" ./scripts/whl/manylinux2014/build_wheel_common.sh -sdk cu101
  67. ```
  68. ## Build for MacOS
  69. * commands:
  70. ```bash
  71. ./scripts/whl/macos/macos_build_whl.sh
  72. ```
  73. * If you just want to build for a specific Python verison, you can use `ALL_PYTHON` environment variable. eg:
  74. ```bash
  75. ALL_PYTHON="3.7.7" ./scripts/whl/macos/macos_build_whl.sh
  76. ```
  77. ## Build for Windows
  78. * commands:
  79. ```bash
  80. ./scripts/whl/windows/windows_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.8.3" ./scripts/whl/windows/windows_build_whl.sh
  85. ```
  86. * If you just want to build with cpu only version, you can set `BUILD_WHL_CPU_ONLY` environment 'ON'. eg:
  87. ```
  88. BUILD_WHL_CPU_ONLY="ON" ALL_PYTHON="3.8.3" ./scripts/whl/windows/windows_build_whl.sh
  89. ```

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