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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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/linux/manylinux2010
  10. 3: ./build_image.sh cpu
  11. 4: ./build_image.sh cuda
  12. ```
  13. ## macos
  14. ```
  15. ./scripts/whl/macos/macos_whl_env_prepare.sh
  16. ```
  17. ## windows
  18. ```
  19. 1: refs scripts/cmake-build/BUILD_README.md windows section build for base windows build
  20. 2: install several python or install u care python version, default install dir: /c/Users/${USER}/mge_whl_python_env
  21. a: mkdir /c/Users/${USER}/mge_whl_python_env
  22. b: download python 64-bit install exe
  23. https://www.python.org/ftp/python/3.5.4/python-3.5.4-amd64.exe
  24. https://www.python.org/ftp/python/3.6.8/python-3.6.8-amd64.exe
  25. https://www.python.org/ftp/python/3.7.7/python-3.7.7-amd64.exe
  26. https://www.python.org/ftp/python/3.8.3/python-3.8.3-amd64.exe
  27. c: install python-3.5.4-amd64.exe to /c/Users/${USER}/mge_whl_python_env/3.5.4 from install gui
  28. d: install python-3.6.8-amd64.exe to /c/Users/${USER}/mge_whl_python_env/3.6.8 from install gui
  29. e: install python-3.7.7-amd64.exe to /c/Users/${USER}/mge_whl_python_env/3.7.7 from install gui
  30. f: install python-3.8.3-amd64.exe to /c/Users/${USER}/mge_whl_python_env/3.8.3 from install gui
  31. 3: rename python.exe to python3.exe
  32. 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
  33. 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
  34. 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
  35. 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
  36. 4: install needed package for build python whl package
  37. a0: /c/Users/${USER}/mge_whl_python_env/3.5.4/python3.exe -m pip install --upgrade pip
  38. a1: /c/Users/${USER}/mge_whl_python_env/3.5.4/python3.exe -m pip install -r python_module/requires-test.txt
  39. a2: /c/Users/${USER}/mge_whl_python_env/3.5.4/python3.exe -m pip install numpy wheel requests tqdm tabulate
  40. b0: /c/Users/${USER}/mge_whl_python_env/3.6.8/python3.exe -m pip install --upgrade pip
  41. b1: /c/Users/${USER}/mge_whl_python_env/3.6.8/python3.exe -m pip install -r python_module/requires-test.txt
  42. b2: /c/Users/${USER}/mge_whl_python_env/3.6.8/python3.exe -m pip install numpy wheel requests tqdm tabulate
  43. c0: /c/Users/${USER}/mge_whl_python_env/3.7.7/python3.exe -m pip install --upgrade pip
  44. c1: /c/Users/${USER}/mge_whl_python_env/3.7.7/python3.exe -m pip install -r python_module/requires-test.txt
  45. c2: /c/Users/${USER}/mge_whl_python_env/3.7.7/python3.exe -m pip install numpy wheel requests tqdm tabulate
  46. d0: /c/Users/${USER}/mge_whl_python_env/3.8.3/python3.exe -m pip install --upgrade pip
  47. d1: /c/Users/${USER}/mge_whl_python_env/3.8.3/python3.exe -m pip install -r python_module/requires-test.txt
  48. d2: /c/Users/${USER}/mge_whl_python_env/3.8.3/python3.exe -m pip install numpy wheel requests tqdm tabulate
  49. 5: install swig from install gui
  50. a: download swig: https://nchc.dl.sourceforge.net/project/swig/swigwin/swigwin-4.0.2/swigwin-4.0.2.zip
  51. b: install swig to /c/Users/${USER}/swigwin-4.0.2
  52. c: apply scripts/whl/windows/fix-ptr-define-issue.patch to c/Users/${USER}/swigwin-4.0.2
  53. ```
  54. # how to build
  55. ## build for linux
  56. MegBrain delivers `wheel` package with `manylinux2010` tag defined in [PEP-571](https://www.python.org/dev/peps/pep-0571/).
  57. ```
  58. ./build_wheel.sh cpu
  59. CUDA_ROOT_DIR=/path/to/cuda \
  60. CUDNN_ROOT_DIR=/path/to/cudnn \
  61. TENSORRT_ROOT_DIR=/path/to/tensorrt \
  62. ./build_wheel.sh cuda
  63. ```
  64. And you can find all of the outputs in `output` directory.
  65. If you just want to build for a specific Python verison, you can use `ALL_PYTHON` environment variable. eg:
  66. ```
  67. ALL_PYTHON=35m ./build_wheel.sh cpu
  68. ```
  69. Please append `imperative` to `build_wheel.sh` to use the new runtime, e.g., `./build_wheel.sh cpu imperative`.
  70. ## build for macos
  71. ```
  72. ./scripts/whl/macos/macos_build_whl.sh
  73. ```
  74. If you just want to build for a specific Python verison, you can use `ALL_PYTHON` environment variable. eg:
  75. ```
  76. ALL_PYTHON=3.5.9 ./scripts/whl/macos/macos_build_whl.sh
  77. ```
  78. ## build for windows
  79. ```
  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. ```
  84. ALL_PYTHON=3.5.4 ./scripts/whl/windows/windows_build_whl.sh
  85. ```

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