Skip to content
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

old glibc forcing syscall #109

Open
brendene opened this issue Mar 12, 2023 · 5 comments
Open

old glibc forcing syscall #109

brendene opened this issue Mar 12, 2023 · 5 comments
Labels
question Further information is requested

Comments

@brendene
Copy link

Comment:

Are there any plans to bump the glibc version this package compiles against to 2.17? Or possibly adding the compile flag: --enable-libstdcxx-time

When libstdc++ is compiled against a glibc older than 2.17 there is a compatibility defines set (_GLIBCXX_USE_CLOCK_GETTIME_SYSCALL) in the header so that the built libstdc++ library forces std::chrono::system_clock::now() to use the syscall version of clock_gettime instead of one that can be accelerated by vdso. (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59177)

The effect of this any code built in an environment using this package has a fairly large performance penalty when running querying the system clock this way.

From https://gcc.gnu.org/onlinedocs/libstdc++/manual/configure.html

For Linux targets, if clock_gettime is not used then the [time.clock] implementation
will use a system call to access the realtime and monotonic clocks, which is
significantly slower than the C library's clock_gettime function.

To see if it is set:

$ grep _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL pkgs/libstdcxx-devel_linux-64-12.2.0-h3b97bd3_19/x86_64-conda-linux-gnu/include/c++/12.2.0/x86_64-conda-linux-gnu/bits/c++config.h
#define _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL 1

Thank you

@brendene brendene added the question Further information is requested label Mar 12, 2023
@isuruf

This comment was marked as outdated.

@apmorton
Copy link

+1 on this issue.

I think to work around this we need to add "gcc built with sysroot 2.17 or higher for linux64" to the compiler build matrix.

@brendene
Copy link
Author

It looks like once conda forge is switched to alma 8 the default glibc will be 2.28 (conda-forge/conda-forge.github.io#1941) Does this feedstock plan to follow the glibc update as well or will it still be pinned at 2.12?

@h-vetinari
Copy link
Member

It looks like once conda forge is switched to alma 8 the default glibc will be 2.28 (conda-forge/conda-forge.github.io#1941)

That issue is for introducing the Alma 8 glibc, but we're very far from making that the default. We've announced to increase the default glibc to 2.17 this July, though there's still ongoing work to enable that transition.

@brendene
Copy link
Author

brendene commented May 7, 2024

Something changed between the release on 2023-06-03 and 2023-09-16 that fixed the #define, its not clear to me which commit it is, possibly 845b9c6

If the change is in fact due to gcc changing from 13.1 to 13.2, then this this commit (gcc-mirror/gcc@1e3e6c7) from Nov 2020 might change the behavior but I am not sure why it wasn't pulled in earier.

https://anaconda.org/conda-forge/libstdcxx-devel_linux-64/12.3.0/download/linux-64/libstdcxx-devel_linux-64-12.3.0-h8bca6fd_0.conda

$ grep _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL ./x86_64-conda-linux-gnu/include/c++/12.3.0/x86_64-conda-linux-gnu/bits/c++config.h
#define _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL 1

https://anaconda.org/conda-forge/libstdcxx-devel_linux-64/12.3.0/download/linux-64/libstdcxx-devel_linux-64-12.3.0-h8bca6fd_1.conda

$ grep _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL ./x86_64-conda-linux-gnu/include/c++/12.3.0/x86_64-conda-linux-gnu/bits/c++config.h
/* #undef _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL */

This is actually the only difference between the c++config.h

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants