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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. * Android(termux) build (cpu only)
  6. # Build env prepare
  7. ## Linux
  8. * refer to [BUILD_README.md](../cmake-build/BUILD_README.md) Linux host build(CUDA env) section to init CUDA environment
  9. ```bash
  10. 1: please refer to https://docs.docker.com/engine/security/rootless/ to enable rootless docker env
  11. 2: cd ./scripts/whl/manylinux2014
  12. 3: ./build_image.sh
  13. ```
  14. ## MacOS
  15. * refer to [BUILD_README.md](../cmake-build/BUILD_README.md) MacOS section to init base build environment
  16. * init other wheel build depends env by command:
  17. ```bash
  18. ./scripts/whl/macos/macos_whl_env_prepare.sh
  19. ```
  20. ## Android
  21. * install [termux](https://termux.com/) apk on Android Device
  22. * at least 8G DDR
  23. * at least Android 7
  24. * init wheel build-dependent env by command:
  25. ```bash
  26. ./scripts/whl/android/android_whl_env_prepare.sh
  27. ```
  28. ## Windows
  29. * refer to [BUILD_README.md](../cmake-build/BUILD_README.md) Windows section to init base build environment
  30. # How to build
  31. Note: Guarantee the git repo is mounted in docker container, do not use `git submodule update --init` in to init Project repo
  32. ## Build for linux
  33. * This Project delivers `wheel` package with `manylinux2014` tag defined in [PEP-571](https://www.python.org/dev/peps/pep-0571/).
  34. commands:
  35. ```bash
  36. ./scripts/whl/manylinux2014/build_wheel_common.sh -sdk cu101
  37. ```
  38. * 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. such as:
  39. ```bash
  40. ALL_PYTHON="36m" ./scripts/whl/manylinux2014/build_wheel_common.sh -sdk cu101
  41. ```
  42. * If you just want to build with cpu only version, you can set `-sdk` environment 'cpu'. such as:
  43. ```bash
  44. ALL_PYTHON="36m" ./scripts/whl/manylinux2014/build_wheel_common.sh -sdk cpu
  45. ```
  46. ## Build for MacOS
  47. * commands:
  48. ```bash
  49. ./scripts/whl/macos/macos_build_whl.sh
  50. ```
  51. * If you just want to build for a specific Python verison, you can use `ALL_PYTHON` environment variable. such as:
  52. ```bash
  53. ALL_PYTHON="3.7.7" ./scripts/whl/macos/macos_build_whl.sh
  54. ```
  55. ## Build for Windows
  56. * commands:
  57. ```bash
  58. ./scripts/whl/windows/windows_build_whl.sh
  59. ```
  60. * If you just want to build for a specific Python verison, you can use `ALL_PYTHON` environment variable. such as:
  61. ```bash
  62. ALL_PYTHON="3.8.3" ./scripts/whl/windows/windows_build_whl.sh
  63. ```
  64. * If you just want to build with cpu only version, you can set `BUILD_WHL_CPU_ONLY` environment 'ON'. such as:
  65. ```
  66. BUILD_WHL_CPU_ONLY="ON" ALL_PYTHON="3.8.3" ./scripts/whl/windows/windows_build_whl.sh
  67. ```
  68. ## Build for Android
  69. * commands:
  70. ```bash
  71. scripts/whl/android/android_build_whl.sh
  72. ```
  73. * If you just want to build for a specific Python verison, you can use `ALL_PYTHON` environment variable. such as:
  74. ```bash
  75. ALL_PYTHON="3.10.1" ./scripts/whl/android/android_build_whl.sh
  76. ```
  77. ## Do not create whl file
  78. If you do not want to create whl file when debug Python3 binding, you can call `host_build.sh` with flag `-t` manually, Python3 binding also need build with `Debug`(O0 build Optimization level: run slowly but friendly for debugger) or `RelWithDebInfo`.
  79. * cuda with `Debug` mode: `scripts/cmake-build/host_build.sh -d -c -t`
  80. * cpu only with `Debug` mode: `scripts/cmake-build/host_build.sh -d -t`
  81. * cuda with `RelWithDebInfo` mode: `EXTRA_CMAKE_ARGS="-DCMAKE_BUILD_TYPE=RelWithDebInfo" scripts/cmake-build/host_build.sh -c -t`
  82. * cpu only with `RelWithDebInfo` mode: `EXTRA_CMAKE_ARGS="-DCMAKE_BUILD_TYPE=RelWithDebInfo" scripts/cmake-build/host_build.sh -t`
  83. Start `Python3 ` with env for support `MegEngine` after build: `PYTHONPATH=imperative/python:$PYTHONPATH python3 `