conda-forge / ctng-compilers-feedstock

A conda-smithy repository for ctng-compilers.
BSD 3-Clause "New" or "Revised" License
12 stars 26 forks source link

old glibc forcing syscall #109

Open brendene opened 1 year ago

brendene commented 1 year ago

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

isuruf commented 1 year ago

See https://conda-forge.org/docs/maintainer/knowledge_base.html#using-centos-7

apmorton commented 7 months ago

+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 commented 7 months ago

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

h-vetinari commented 7 months ago

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 commented 5 months ago

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 https://github.com/conda-forge/ctng-compilers-feedstock/commit/845b9c62143c4c2b2af8e35736e64aa29d8c3e05

If the change is in fact due to gcc changing from 13.1 to 13.2, then this this commit (https://github.com/gcc-mirror/gcc/commit/1e3e6c700f04fe6992b9077541e434172c1cbdae) 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