-
Notifications
You must be signed in to change notification settings - Fork 227
manywheel: add _GLIBCXX_USE_CXX11_ABI=1 support for linux cpu wheel #990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The target of this commit is to add the support for a new linux cpu pip wheel file built with _GLIBCXX_USE_CXX11_ABI=1. Currently, linux wheels are built in a system based on CentOS7 and devtoolset7, and CXX11_ABI is ignored by the compiler. The same issue with devtoolset8 and devtoolset9, and so we add a Docker file (Dockerfile_cxx11-abi) with Ubuntu 18.04 as base image to support CXX11_ABI=1, by referring the Dockerfile for libtorch. To build the new docker image with CXX11_ABI support, run: GPU_ARCH_TYPE=cpu-cxx11-abi manywheel/build_docker.sh or manywheel/build_all_docker.sh To build a linux cpu pip wheel with CXX11_ABI within this image, run: // the below settings are special for this image export DESIRED_CUDA=cpu-cxx11-abi # change from cpu for wheel name export GPU_ARCH_TYPE=cpu-cxx11-abi # change from cpu for build.sh export DOCKER_IMAGE=pytorch/manylinuxcxx11-abi-builder:cpu-cxx11-abi export DESIRED_DEVTOOLSET=cxx11-abi // the below settings are as usual export BINARY_ENV_FILE=/tmp/env export BUILDER_ROOT=/builder export DESIRED_PYTHON=3.7 # or 3.8, 3.9, etc. export IS_GHA=1 export PACKAGE_TYPE=manywheel export PYTORCH_FINAL_PACKAGE_DIR=/artifacts export PYTORCH_ROOT=/pytorch export GITHUB_WORKSPACE=/your_path_to_workspace // the '-e DESIRED_DEVTOOLSET' below is newly added for this container, // others are as usual set -x mkdir -p artifacts/ container_name=$(docker run \ -e BINARY_ENV_FILE \ -e BUILDER_ROOT \ -e DESIRED_CUDA \ -e DESIRED_PYTHON \ -e GPU_ARCH_TYPE \ -e IS_GHA \ -e PACKAGE_TYPE \ -e PYTORCH_FINAL_PACKAGE_DIR \ -e PYTORCH_ROOT \ -e DOCKER_IMAGE \ -e DESIRED_DEVTOOLSET \ --tty \ --detach \ -v "${GITHUB_WORKSPACE}/pytorch:/pytorch" \ -v "${GITHUB_WORKSPACE}/builder:/builder" \ -v "${RUNNER_TEMP}/artifacts:/artifacts" \ -w / \ "${DOCKER_IMAGE}" ) // build pip wheel as usual, // and the built wheel file name looks like: torch-1.12.0.dev20220312+cpu.cxx11.abi-cp37-cp37m-linux_x86_64.whl docker exec -t -w "${PYTORCH_ROOT}" "${container_name}" bash -c "bash .circleci/scripts/binary_populate_env.sh" docker exec -t "${container_name}" bash -c "source ${BINARY_ENV_FILE} && bash /builder/manywheel/build.sh" // to verify the built wheel file, we'll see 'True' $ pip install torch-1.12.0.dev20220312+cpu.cxx11.abi-cp37-cp37m-linux_x86_64.whl $ python -c 'import torch; print(torch._C._GLIBCXX_USE_CXX11_ABI)' True Co-authored-by: Guo Yejun <[email protected]> Co-authored-by: Zhu Hong <[email protected]>
Hi @zhuhong61! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
any comment? thanks. |
@malfet any comment? thanks. |
there is error to "Build manywheel docker images / build-docker-cuda (11.3) (pull_request) Failing after 1m " I checked the log, and looks that this issue is not caused by this PR.
|
@guoyejun yeah, NVIDIA is having an outage today, see pytorch/pytorch#74968 |
thanks @malfet and looks that we can add a new check (build-docker-cpu-cxx11-abi) in the CI system once this PR is accepted. :) |
@malfet possible to add new checks in CI system for github/pytorch/pytorch to verify the built linux pip wheel with cxx11-abi? thanks. And we also need to build the cxx11-abi wheel file nightly and at release time. Take nightly as an example, to provide the pip cxx11 wheel file at https://download.pytorch.org/whl/nightly/cpu, and also mention the install commands at https://pytorch.org/get-started/locally/ (Preview (Nightly)--Linux--Pip--python--CPU) |
looks that glibc version is a bit high with ubuntu 18.04 as base image in this PR, we'll try to see if centos8 (with lower glibc version) as base image works, want to know your comment, @malfet , we may create the change if you do not object, thanks |
@guoyejun feel free to propose the PR that does that (binary build matrix is defined in https://github.com/pytorch/pytorch/blob/master/.github/scripts/generate_binary_build_matrix.py ) |
got it, thanks. We'll look at it after the base image is done. |
Hi @malfet, we add new checks for build-docker-cpu-cxx11-abi in CI system, and the work-flowchecks in our PR https://github.com/pytorch/pytorch/pull/79409 has regenerated the .github/workflows/generated-linux-binary-manywheel-nightly.yml. How can we make sure the jobs in generated-linux-binary-manywheel-nightly.yml has been truly triggered, and whether the cpu-cxx-abi docker has been built? Is there any other works needed? Thanks! |
…cpu-cxx11-abi (#79409) We added the linux pip wheel with cpu-cxx11-abi in pytorch/builder, see: pytorch/builder#990 and pytorch/builder#1023 The purpose of this PR is to add new checks in pytorch CI system to verify the linux pip wheel with cpu-cxx11-abi. Co-authored-by: Zhu Hong <[email protected]> Co-authored-by: Guo Yejun <[email protected]> Pull Request resolved: #79409 Approved by: https://github.com/malfet
The target of this commit is to add the support for a new linux
cpu pip wheel file built with _GLIBCXX_USE_CXX11_ABI=1.
Currently, linux wheels are built in a system based on CentOS7
and devtoolset7, and CXX11_ABI is ignored by the compiler. The
same issue with devtoolset8 and devtoolset9, and so we add a Docker
file (Dockerfile_cxx11-abi) with Ubuntu 18.04 as base image to
support CXX11_ABI=1, by referring the Dockerfile for libtorch.
To build the new docker image with CXX11_ABI support, run:
GPU_ARCH_TYPE=cpu-cxx11-abi manywheel/build_docker.sh
or
manywheel/build_all_docker.sh
To build a linux cpu pip wheel with CXX11_ABI within this image, run:
// the below settings are special for this image
export DESIRED_CUDA=cpu-cxx11-abi # change from cpu for wheel name
export GPU_ARCH_TYPE=cpu-cxx11-abi # change from cpu for build.sh
export DOCKER_IMAGE=pytorch/manylinuxcxx11-abi-builder:cpu-cxx11-abi
export DESIRED_DEVTOOLSET=cxx11-abi
// the below settings are as usual
export BINARY_ENV_FILE=/tmp/env
export BUILDER_ROOT=/builder
export DESIRED_PYTHON=3.7 # or 3.8, 3.9, etc.
export IS_GHA=1
export PACKAGE_TYPE=manywheel
export PYTORCH_FINAL_PACKAGE_DIR=/artifacts
export PYTORCH_ROOT=/pytorch
export GITHUB_WORKSPACE=/your_path_to_workspace
// the '-e DESIRED_DEVTOOLSET' below is newly added for this container,
// others are as usual
set -x
mkdir -p artifacts/
container_name=$(docker run
-e BINARY_ENV_FILE
-e BUILDER_ROOT
-e DESIRED_CUDA
-e DESIRED_PYTHON
-e GPU_ARCH_TYPE
-e IS_GHA
-e PACKAGE_TYPE
-e PYTORCH_FINAL_PACKAGE_DIR
-e PYTORCH_ROOT
-e DOCKER_IMAGE
-e DESIRED_DEVTOOLSET
--tty
--detach
-v "${GITHUB_WORKSPACE}/pytorch:/pytorch"
-v "${GITHUB_WORKSPACE}/builder:/builder"
-v "${RUNNER_TEMP}/artifacts:/artifacts"
-w /
"${DOCKER_IMAGE}"
)
// build pip wheel as usual,
// and the built wheel file name looks like: torch-1.12.0.dev20220312+cpu.cxx11.abi-cp37-cp37m-linux_x86_64.whl
docker exec -t -w "${PYTORCH_ROOT}" "${container_name}" bash -c "bash .circleci/scripts/binary_populate_env.sh"
docker exec -t "${container_name}" bash -c "source ${BINARY_ENV_FILE} && bash /builder/manywheel/build.sh"
// to verify the built wheel file, we'll see 'True'
$ pip install torch-1.12.0.dev20220312+cpu.cxx11.abi-cp37-cp37m-linux_x86_64.whl
$ python -c 'import torch; print(torch._C._GLIBCXX_USE_CXX11_ABI)'
True
Co-authored-by: Guo Yejun [email protected]
Co-authored-by: Zhu Hong [email protected]