-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Fix compilation with gcc < 5 #2956
Conversation
When the user defines _GLIBCXX_USE_CXX11_ABI=0 to force the pre-c++11 ABI, numpy.h assumes that is_trivially_copyable is available. It is not necessarily the case. This patch uses clang's feature detection instead.
Howdy @mvoelkle-cern! Do you have a theory as to why our present CI coverage doesn't already check this case? pybind11/.github/workflows/ci.yml Lines 565 to 574 in 114be7f
Also, I believe these CI errors are caused by your PR - can you fix those? |
The workaround is for certain libstdc++ versions, so the test should target these particular versions.
Hi, sorry my fix didn't compile outside of clang, I had wrongly assumed that preprocessor boolean expressions would short-circuit. Here is an other approach that targets libstdc++ specifically. |
The issue is when using 4.8 AND the user defines _GLIBCXX_USE_CXX11_ABI=0. The CI coverage doesn't define it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't state w/ 100% confidence that I can verify, but will trust testing on your side as well as our CI (and of course, Henry's review as well). Thanks!
Signed-off-by: daquexian <daquexian566@gmail.com>
* move tensor to c++ Signed-off-by: daquexian <daquexian566@gmail.com> * align with master and fix export error Signed-off-by: daquexian <daquexian566@gmail.com> * reformat Signed-off-by: daquexian <daquexian566@gmail.com> * rename some functions Signed-off-by: daquexian <daquexian566@gmail.com> * refine Signed-off-by: daquexian <daquexian566@gmail.com> * remove unused header Signed-off-by: daquexian <daquexian566@gmail.com> * restore device repr and str Signed-off-by: daquexian <daquexian566@gmail.com> * upgrade pybind11 to 2.7.0 for pybind/pybind11#2956 Signed-off-by: daquexian <daquexian566@gmail.com> * impl parameter in c++, remove determine() call Signed-off-by: daquexian <daquexian566@gmail.com> * let parameter derive from TensorIf to own a separate grad_fn_node, add missing get_device method, remove out-dated methods in docs Signed-off-by: daquexian <daquexian566@gmail.com> * add test_parameter.py, fix requires_grad_ and get_device Signed-off-by: daquexian <daquexian566@gmail.com> * use oneflow cast instead of numpy cast Signed-off-by: daquexian <daquexian566@gmail.com> * restore format changes Signed-off-by: daquexian <daquexian566@gmail.com> * auto format by CI * fix tests involving _local_or_consistent_tensor Signed-off-by: daquexian <daquexian566@gmail.com> Co-authored-by: oneflow-ci-bot <ci-bot@oneflow.org>
Description
When the user defines _GLIBCXX_USE_CXX11_ABI=0 to force the pre-c++11 ABI, numpy.h assumes that is_trivially_copyable is available.
It is not necessarily the case. This patch uses clang's feature detection instead.
Suggested changelog entry:
Fixed compilation with GCC < 5 when the user defines ``_GLIBCXX_USE_CXX11_ABI``.