NVIDIA / NVIDIA/apex

-D_GLIBCXX_USE_CXX11_ABI=0 cflags?

Open
#212 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

extension build
Dominant language
Python
Stars
9k
Forks
1.5k
Avg merge
2d 4h
Merged PRs (30d)
3

Description

Hi, I wonder how to set -D_GLIBCXX_USE_CXX11_ABI=1 when building apex. I got this error when using syncbn:

Warning:  using Python fallback for SyncBatchNorm, possibly because apex was installed without --cuda_ext.  The exception raised when attempting t
o import the cuda backend was:  /usr/lib/python3.7/site-packages/syncbn.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZN3c105ErrorC1ENS_14So
urceLocationERKSs

and then I got:

$ c++filt _ZN3c105ErrorC1ENS_14SourceLocationERKSs
c10::Error::Error(c10::SourceLocation, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)

It is said related to -D_GLIBCXX_USE_CXX11_ABI according to this post.
Also, I check ABI by:

$ strings /usr/lib/python3.7/site-packages/torch/lib/libtorch.so|grep ABI
CXXABI_1.3.8
CXXABI_1.3.5
CXXABI_1.3.7
CXXABI_1.3.3
CXXABI_1.3

$ strings /usr/lib/python3.7/site-packages/syncbn.cpython-37m-x86_64-linux-gnu.so|grep ABI
CXXABI_1.3
CXXABI_1.3.3
CXXABI_1.3.5

A solution to this is compile apex with -D_GLIBCXX_USE_CXX11_ABI=1. So, how could I do that?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the apex installation/build entry point and the --cuda_ext option mentioned in the report, then trace how compiler flags are passed to the extension. Reproduce the syncbn import failure and verify that the resulting extension loads without the reported C++ ABI symbol error.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, python, pytorch
Domain
build-system, machine-learning
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.