Skip to content

Use fabi-version=11 to ensure compatibility between gcc7 and gcc9 binaries#81058

Closed
atalman wants to merge 6 commits intopytorch:masterfrom
atalman:testing_fabi_11
Closed

Use fabi-version=11 to ensure compatibility between gcc7 and gcc9 binaries#81058
atalman wants to merge 6 commits intopytorch:masterfrom
atalman:testing_fabi_11

Conversation

@atalman
Copy link
Copy Markdown
Contributor

@atalman atalman commented Jul 7, 2022

Fixes: #80489

Test using cuda 11.3 manywheel binary:

import torch
print(torch.__version__)
print(torch._C._PYBIND11_BUILD_ABI)

Output

1.13.0.dev20220707+cu113
_cxxabi1011

Functorch test torch : 1.13.0.dev20220707+cu113, functorch with cu102

import torch
print(torch.__version__)
print(torch._C._PYBIND11_BUILD_ABI)
from functorch import vmap
x = torch.randn(2, 3, 5)
vmap(lambda x: x, out_dims=3)(x)

Output

1.13.0.dev20220707+cu113
_cxxabi1011
/home/atalman/temp/testc1.py:5: UserWarning: Failed to initialize NumPy: No module named 'numpy' (Triggered internally at ../torch/csrc/utils/tensor_numpy.cpp:73.)
  x = torch.randn(2, 3, 5)
Traceback (most recent call last):
  File "/home/atalman/temp/testc1.py", line 6, in <module>
    vmap(lambda x: x, out_dims=3)(x)
  File "/home/atalman/conda/lib/python3.9/site-packages/functorch/_src/vmap.py", line 361, in wrapped
    return _flat_vmap(
  File "/home/atalman/conda/lib/python3.9/site-packages/functorch/_src/vmap.py", line 488, in _flat_vmap
    return _unwrap_batched(batched_outputs, out_dims, vmap_level, batch_size, func)
  File "/home/atalman/conda/lib/python3.9/site-packages/functorch/_src/vmap.py", line 165, in _unwrap_batched
    flat_outputs = [
  File "/home/atalman/conda/lib/python3.9/site-packages/functorch/_src/vmap.py", line 166, in <listcomp>
    _remove_batch_dim(batched_output, vmap_level, batch_size, out_dim)
IndexError: Dimension out of range (expected to be in range of [-3, 2], but got 3)

Related Builder PR: pytorch/builder#1083

Test PR: #81232

@facebook-github-bot
Copy link
Copy Markdown
Contributor

facebook-github-bot commented Jul 7, 2022

🔗 Helpful links

✅ No Failures (0 Pending)

As of commit b03cacd (more details on the Dr. CI page):

Expand to see more

💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

@atalman atalman added ciflow/binaries_wheel Trigger binary build and upload jobs for wheel on the PR ciflow/binaries_conda labels Jul 7, 2022
@atalman atalman changed the title [WIP] Testing use fabi-version=11 Use fabi-version=11 to ensure compatibility between gcc7 and gcc9 binaries Jul 8, 2022
Copy link
Copy Markdown
Contributor

@malfet malfet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a wrong location to put this constraint, as it has nothing to do with generic PyTorch builds, but specific to how we are packaging it for release

Copy link
Copy Markdown
Contributor

@malfet malfet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to add

if(${GLIBCXX_USE_CXX11_ABI} EQUAL 0)
 string(APPEND CMAKE_CXX_FLAGS " -fabi-version=11")
endif()

to

message(STATUS "Determined _GLIBCXX_USE_CXX11_ABI=${GLIBCXX_USE_CXX11_ABI}")

@atalman
Copy link
Copy Markdown
Contributor Author

atalman commented Jul 11, 2022

You need to add

if(${GLIBCXX_USE_CXX11_ABI} EQUAL 0)
 string(APPEND CMAKE_CXX_FLAGS " -fabi-version=11")
endif()

to

message(STATUS "Determined _GLIBCXX_USE_CXX11_ABI=${GLIBCXX_USE_CXX11_ABI}")

in 28776c4

As discussed will not be doing this change in this PR, but refactor in pytorch/builder#1084

@atalman
Copy link
Copy Markdown
Contributor Author

atalman commented Jul 12, 2022

@pytorchbot merge

@pytorchmergebot
Copy link
Copy Markdown
Collaborator

@pytorchbot successfully started a merge job. Check the current status here

@pytorchmergebot
Copy link
Copy Markdown
Collaborator

Merge failed due to Refusing to merge as mandatory check(s) pull failed for rule superuser
Raised by https://github.com/pytorch/pytorch/actions/runs/2656739238

@atalman
Copy link
Copy Markdown
Contributor Author

atalman commented Jul 12, 2022

@pytorchbot merge

@pytorchmergebot
Copy link
Copy Markdown
Collaborator

@pytorchbot successfully started a merge job. Check the current status here

@atalman
Copy link
Copy Markdown
Contributor Author

atalman commented Jul 12, 2022

@pytorchbot merge

@pytorchmergebot
Copy link
Copy Markdown
Collaborator

@pytorchbot successfully started a merge job. Check the current status here

@github-actions
Copy link
Copy Markdown
Contributor

Hey @atalman.
You've committed this PR, but it does not have both a 'release notes: ...' and 'topics: ...' label. Please add one of each to the PR. The 'release notes: ...' label should represent the part of PyTorch that this PR changes (fx, autograd, distributed, etc) and the 'topics: ...' label should represent the kind of PR it is (not user facing, new feature, bug fix, perf improvement, etc). The list of valid labels can be found here for the 'release notes: ...' and here for the 'topics: ...'.
For changes that are 'topic: not user facing' there is no need for a release notes label.

@JackCaoG
Copy link
Copy Markdown
Collaborator

@malfet can we revert this one? It breaks both ci and internal build for pytorch/xla. We are trying to figure out how to build with this option. @yeounoh FYI

facebook-github-bot pushed a commit that referenced this pull request Jul 13, 2022
…aries (#81058) (#81058)

Summary:
Fixes: #80489

Test using cuda 11.3 manywheel binary:
```
import torch
print(torch.__version__)
print(torch._C._PYBIND11 (d55b25a633b7e2e6122becf6dbdf0528df6e8b13)_BUILD_ABI)
````

Output
```
1.13.0.dev20220707+cu113
_cxxabi1011
```

Functorch test torch : 1.13.0.dev20220707+cu113, functorch with cu102
```
import torch
print(torch.__version__)
print(torch._C._PYBIND11 (d55b25a633b7e2e6122becf6dbdf0528df6e8b13)_BUILD_ABI)
from functorch import vmap
x = torch.randn(2, 3, 5)
vmap(lambda x: x, out_dims=3)(x)
```

Output
```
1.13.0.dev20220707+cu113
_cxxabi1011
/home/atalman/temp/testc1.py:5: UserWarning: Failed to initialize NumPy: No module named 'numpy' (Triggered internally at ../torch/csrc/utils/tensor_numpy.cpp:73.)
  x = torch.randn(2, 3, 5)
Traceback (most recent call last):
  File "/home/atalman/temp/testc1.py", line 6, in <module>
    vmap(lambda x: x, out_dims=3)(x)
  File "/home/atalman/conda/lib/python3.9/site-packages/functorch/_src/vmap.py", line 361, in wrapped
    return _flat_vmap(
  File "/home/atalman/conda/lib/python3.9/site-packages/functorch/_src/vmap.py", line 488, in _flat_vmap
    return _unwrap_batched(batched_outputs, out_dims, vmap_level, batch_size, func)
  File "/home/atalman/conda/lib/python3.9/site-packages/functorch/_src/vmap.py", line 165, in _unwrap_batched
    flat_outputs = [
  File "/home/atalman/conda/lib/python3.9/site-packages/functorch/_src/vmap.py", line 166, in <listcomp>
    _remove_batch_dim(batched_output, vmap_level, batch_size, out_dim)
IndexError: Dimension out of range (expected to be in range of [-3, 2], but got 3)
```

Related Builder  PR: pytorch/builder#1083

Test PR: #81232

Pull Request resolved: #81058
Approved by: https://github.com/zou3519, https://github.com/malfet

Test Plan: contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/d552ba3b4f53da9b6a5f6e0463111e43b367ef8a

Reviewed By: DanilBaibak

Differential Revision: D37813240

Pulled By: atalman

fbshipit-source-id: 94d94e777b0e9d5da106173c06117b3019ba71c4
@JackCaoG
Copy link
Copy Markdown
Collaborator

OK CI is actually OK, it is our internal build failed. I will try to look into it this afternoon.

@JackCaoG
Copy link
Copy Markdown
Collaborator

this seems to break our setup when using gcc8. I run into errors like

Building wheel torch-1.13.0a0+gitc657c3d
-- Building version 1.13.0a0+gitc657c3d
cmake -DBUILD_PYTHON=True -DBUILD_TEST=True -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/pytorch/torch -DCMAKE_PREFIX_PATH=/root/anaconda3/envs/pytorch/lib/python3.7/site-packages -DGLIBCXX_USE_CXX11_ABI=0 -DNUMPY_INCLUDE_DIR=/root/anaconda3/envs/pytorch/lib/python3.7/site-packages/numpy/core/include -DPYTHON_EXECUTABLE=/root/anaconda3/envs/pytorch/bin/python -DPYTHON_INCLUDE_DIR=/root/anaconda3/envs/pytorch/include/python3.7m -DPYTHON_LIBRARY=/root/anaconda3/envs/pytorch/lib/libpython3.7m.so.1.0 -DTORCH_BUILD_VERSION=1.13.0a0+gitc657c3d -DUSE_CUDA=0 -DUSE_NUMPY=True /pytorch
-- The CXX compiler identification is Clang 8.0.1
-- The C compiler identification is Clang 8.0.1
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/clang++-8 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/clang-8 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Not forcing any particular BLAS to be found
-- Could not find ccache. Consider installing ccache to speed up compilation.
-- Performing Test COMPILER_WORKS
-- Performing Test COMPILER_WORKS - Success
-- Performing Test SUPPORT_GLIBCXX_USE_C99
-- Performing Test SUPPORT_GLIBCXX_USE_C99 - Failed
CMake Error at cmake/MiscCheck.cmake:63 (message):
  The C++ compiler does not support required functions.  This is very likely
  due to a known bug in GCC 5 (and maybe other versions) on Ubuntu 17.10 and
  newer.  For more information, see:
  https://github.com/pytorch/pytorch/issues/5229
Call Stack (most recent call first):
  CMakeLists.txt:695 (include)
(pytorch) root@803de85a4f7e:/# gcc --version
gcc (Debian 8.3.0-6) 8.3.0

any insight?

@JackCaoG
Copy link
Copy Markdown
Collaborator

I guess pytorch/xla would just always enable GLIBCXX_USE_CXX11_ABI which seems to solve the issue. We have been doing this for the release wheel and ci anyway

atalman added a commit to atalman/pytorch that referenced this pull request Jul 21, 2022
…aries (pytorch#81058) (pytorch#81058)

Summary:
Fixes: pytorch#80489

Test using cuda 11.3 manywheel binary:
```
import torch
print(torch.__version__)
print(torch._C._PYBIND11 (pytorch@d55b25a633b7e2e6122becf6dbdf0528df6e8b13)_BUILD_ABI)
````

Output
```
1.13.0.dev20220707+cu113
_cxxabi1011
```

Functorch test torch : 1.13.0.dev20220707+cu113, functorch with cu102
```
import torch
print(torch.__version__)
print(torch._C._PYBIND11 (pytorch@d55b25a633b7e2e6122becf6dbdf0528df6e8b13)_BUILD_ABI)
from functorch import vmap
x = torch.randn(2, 3, 5)
vmap(lambda x: x, out_dims=3)(x)
```

Output
```
1.13.0.dev20220707+cu113
_cxxabi1011
/home/atalman/temp/testc1.py:5: UserWarning: Failed to initialize NumPy: No module named 'numpy' (Triggered internally at ../torch/csrc/utils/tensor_numpy.cpp:73.)
  x = torch.randn(2, 3, 5)
Traceback (most recent call last):
  File "/home/atalman/temp/testc1.py", line 6, in <module>
    vmap(lambda x: x, out_dims=3)(x)
  File "/home/atalman/conda/lib/python3.9/site-packages/functorch/_src/vmap.py", line 361, in wrapped
    return _flat_vmap(
  File "/home/atalman/conda/lib/python3.9/site-packages/functorch/_src/vmap.py", line 488, in _flat_vmap
    return _unwrap_batched(batched_outputs, out_dims, vmap_level, batch_size, func)
  File "/home/atalman/conda/lib/python3.9/site-packages/functorch/_src/vmap.py", line 165, in _unwrap_batched
    flat_outputs = [
  File "/home/atalman/conda/lib/python3.9/site-packages/functorch/_src/vmap.py", line 166, in <listcomp>
    _remove_batch_dim(batched_output, vmap_level, batch_size, out_dim)
IndexError: Dimension out of range (expected to be in range of [-3, 2], but got 3)
```

Related Builder  PR: pytorch/builder#1083

Test PR: pytorch#81232

Pull Request resolved: pytorch#81058
Approved by: https://github.com/zou3519, https://github.com/malfet

Test Plan: contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/d552ba3b4f53da9b6a5f6e0463111e43b367ef8a

Reviewed By: DanilBaibak

Differential Revision: D37813240

Pulled By: atalman

fbshipit-source-id: 94d94e777b0e9d5da106173c06117b3019ba71c4
atalman added a commit that referenced this pull request Jul 21, 2022
…aries (#81058) (#81058) (#81884)

Summary:
Fixes: #80489

Test using cuda 11.3 manywheel binary:
```
import torch
print(torch.__version__)
print(torch._C._PYBIND11 (d55b25a633b7e2e6122becf6dbdf0528df6e8b13)_BUILD_ABI)
````

Output
```
1.13.0.dev20220707+cu113
_cxxabi1011
```

Functorch test torch : 1.13.0.dev20220707+cu113, functorch with cu102
```
import torch
print(torch.__version__)
print(torch._C._PYBIND11 (d55b25a633b7e2e6122becf6dbdf0528df6e8b13)_BUILD_ABI)
from functorch import vmap
x = torch.randn(2, 3, 5)
vmap(lambda x: x, out_dims=3)(x)
```

Output
```
1.13.0.dev20220707+cu113
_cxxabi1011
/home/atalman/temp/testc1.py:5: UserWarning: Failed to initialize NumPy: No module named 'numpy' (Triggered internally at ../torch/csrc/utils/tensor_numpy.cpp:73.)
  x = torch.randn(2, 3, 5)
Traceback (most recent call last):
  File "/home/atalman/temp/testc1.py", line 6, in <module>
    vmap(lambda x: x, out_dims=3)(x)
  File "/home/atalman/conda/lib/python3.9/site-packages/functorch/_src/vmap.py", line 361, in wrapped
    return _flat_vmap(
  File "/home/atalman/conda/lib/python3.9/site-packages/functorch/_src/vmap.py", line 488, in _flat_vmap
    return _unwrap_batched(batched_outputs, out_dims, vmap_level, batch_size, func)
  File "/home/atalman/conda/lib/python3.9/site-packages/functorch/_src/vmap.py", line 165, in _unwrap_batched
    flat_outputs = [
  File "/home/atalman/conda/lib/python3.9/site-packages/functorch/_src/vmap.py", line 166, in <listcomp>
    _remove_batch_dim(batched_output, vmap_level, batch_size, out_dim)
IndexError: Dimension out of range (expected to be in range of [-3, 2], but got 3)
```

Related Builder  PR: pytorch/builder#1083

Test PR: #81232

Pull Request resolved: #81058
Approved by: https://github.com/zou3519, https://github.com/malfet

Test Plan: contbuild & OSS CI, see https://hud.pytorch.org/commit/pytorch/pytorch/d552ba3b4f53da9b6a5f6e0463111e43b367ef8a

Reviewed By: DanilBaibak

Differential Revision: D37813240

Pulled By: atalman

fbshipit-source-id: 94d94e777b0e9d5da106173c06117b3019ba71c4
vanbasten23 added a commit to pytorch/xla that referenced this pull request Oct 27, 2022
vanbasten23 added a commit to pytorch/xla that referenced this pull request Oct 28, 2022
#4137)

* Added pytorch patch file to revert pytorch/pytorch#81058

* updated the diff file.
steventk-g added a commit to pytorch/xla that referenced this pull request Feb 20, 2023
steventk-g added a commit to pytorch/xla that referenced this pull request Feb 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ciflow/binaries_wheel Trigger binary build and upload jobs for wheel on the PR cla signed Merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CPU-only c++ extension libraries (functorch, torchtext) built against PyTorch wheels are not fully compatible with PyTorch wheels

6 participants