Skip to content

Files

Latest commit

e63e853 · Apr 26, 2023

History

History
executable file
·
102 lines (84 loc) · 3.69 KB

BUILD_PYTHON_WHL_README.md

File metadata and controls

executable file
·
102 lines (84 loc) · 3.69 KB

Python whl package build support status

  • Windows build (cpu and gpu)
  • Linux build (cpu and gpu)
  • MacOS build (cpu only)
  • Android(termux) build (cpu only)

Build env prepare

Linux

  • refer to BUILD_README.md Linux host build(CUDA env) section to init CUDA environment
1: please refer to https://docs.docker.com/engine/security/rootless/ to enable rootless docker env
2: cd ./scripts/whl/manylinux2014
3: ./build_image.sh

MacOS

  • refer to BUILD_README.md MacOS section to init base build environment
  • init other wheel build depends env by command:
./scripts/whl/macos/macos_whl_env_prepare.sh

Android

  • install termux apk on Android Device
    • at least 8G DDR
    • at least Android 7
  • init wheel build-dependent env by command:
./scripts/whl/android/android_whl_env_prepare.sh

Windows

How to build

Note: Guarantee the git repo is mounted in docker container, do not use git submodule update --init in to init Project repo

Build for linux

  • This Project delivers wheel package with manylinux2014 tag defined in PEP-571.

commands:

./scripts/whl/manylinux2014/build_wheel_common.sh -sdk cu101
  • 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:
ALL_PYTHON="36m" ./scripts/whl/manylinux2014/build_wheel_common.sh -sdk cu101
  • If you just want to build with cpu only version, you can set -sdk to 'cpu'. such as:
ALL_PYTHON="36m" ./scripts/whl/manylinux2014/build_wheel_common.sh -sdk cpu

Build for MacOS

  • commands:
./scripts/whl/macos/macos_build_whl.sh
  • If you just want to build for a specific Python verison, you can use ALL_PYTHON environment variable. such as:
ALL_PYTHON="3.7.7" ./scripts/whl/macos/macos_build_whl.sh

Build for Windows

  • commands:
./scripts/whl/windows/windows_build_whl.sh
  • If you just want to build for a specific Python verison, you can use ALL_PYTHON environment variable. such as:
ALL_PYTHON="3.8.3" ./scripts/whl/windows/windows_build_whl.sh -sdk cu118
  • If you just want to build with cpu only version, you can set -sdk to cpu. such as:
ALL_PYTHON="3.8.3" ./scripts/whl/windows/windows_build_whl.sh -sdk cpu

Build for Android

  • commands:
scripts/whl/android/android_build_whl.sh
  • If you just want to build for a specific Python verison, you can use ALL_PYTHON environment variable. such as:
ALL_PYTHON="3.10.1" ./scripts/whl/android/android_build_whl.sh

Do not create whl file

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.

  • cuda with Debug mode: scripts/cmake-build/host_build.sh -d -c -t
  • cpu only with Debug mode: scripts/cmake-build/host_build.sh -d -t
  • cuda with RelWithDebInfo mode: EXTRA_CMAKE_ARGS="-DCMAKE_BUILD_TYPE=RelWithDebInfo" scripts/cmake-build/host_build.sh -c -t
  • cpu only with RelWithDebInfo mode: EXTRA_CMAKE_ARGS="-DCMAKE_BUILD_TYPE=RelWithDebInfo" scripts/cmake-build/host_build.sh -t

Start Python3 with env for support MegEngine after build: PYTHONPATH=imperative/python:$PYTHONPATH python3 Start Python3 with env for support MegEngineLite after build: PYTHONPATH=lite/pylite:$PYTHONPATH python3