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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. # python whl package build support status
  2. * windows build (cpu + gpu)
  3. * linux build (cpu + gpu)
  4. * macos build (cpu only)
  5. # build env prepare
  6. ## linux
  7. ```
  8. 1: enable rootless docker env, refs: https://docs.docker.com/engine/security/rootless/
  9. 2: cd ./scripts/whl/manylinux2010
  10. 3: ./build_image.sh
  11. ```
  12. ## macos
  13. ```
  14. ./scripts/whl/macos/macos_whl_env_prepare.sh
  15. ```
  16. ## windows
  17. ```
  18. 1: refs scripts/cmake-build/BUILD_README.md windows section build for base windows build
  19. 2: install several python or install u care 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: rename 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. ## build for linux
  51. MegBrain delivers `wheel` package with `manylinux2010` tag defined in [PEP-571](https://www.python.org/dev/peps/pep-0571/).
  52. ```
  53. export CUDA_ROOT_DIR=/path/to/cuda
  54. export CUDNN_ROOT_DIR=/path/to/cudnn
  55. export TENSORRT_ROOT_DIR=/path/to/tensorrt
  56. ./scripts/whl/manylinux2010/build_wheel.sh
  57. ```
  58. And you can find all of the outputs in `output` directory.
  59. If you just want to build for a specific Python verison, you can use `ALL_PYTHON` environment variable. eg:
  60. ```
  61. ALL_PYTHON="36m" ./scripts/whl/manylinux2010/build_wheel.sh
  62. ```
  63. If you just want to build with cpu only version, you can set `BUILD_WHL_CPU_ONLY` environment 'ON'. eg:
  64. ```
  65. BUILD_WHL_CPU_ONLY="ON" ALL_PYTHON="36m" ./scripts/whl/manylinux2010/build_wheel.sh
  66. ```
  67. ## build for macos
  68. ```
  69. ./scripts/whl/macos/macos_build_whl.sh
  70. ```
  71. If you just want to build for a specific Python verison, you can use `ALL_PYTHON` environment variable. eg:
  72. ```
  73. ALL_PYTHON="3.7.7" ./scripts/whl/macos/macos_build_whl.sh
  74. ```
  75. ## build for windows
  76. ```
  77. ./scripts/whl/windows/windows_build_whl.sh
  78. ```
  79. If you just want to build for a specific Python verison, you can use `ALL_PYTHON` environment variable. eg:
  80. ```
  81. ALL_PYTHON="3.8.3" ./scripts/whl/windows/windows_build_whl.sh
  82. ```
  83. If you just want to build with cpu only version, you can set `BUILD_WHL_CPU_ONLY` environment 'ON'. eg:
  84. ```
  85. BUILD_WHL_CPU_ONLY="ON" ALL_PYTHON="3.8.3" ./scripts/whl/windows/windows_build_whl.sh
  86. ```

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