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

conda-forge (linux): primecount fails to install #33054

Closed
mkoeppe opened this issue Dec 20, 2021 · 23 comments
Closed

conda-forge (linux): primecount fails to install #33054

mkoeppe opened this issue Dec 20, 2021 · 23 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented Dec 20, 2021

Both with conda-forge-standard and conda-forge-minimal on Linux

https://github.com/sagemath/sage/runs/4497392130?check_suite_focus=true

In file included from /sage/local/var/tmp/sage/build/primecount-7.1/src/src/deleglise-rivat/S2_easy_libdivide.cpp:28:
/sage/local/var/tmp/sage/build/primecount-7.1/src/include/min.hpp: In instantiation of 'B {anonymous}::min(A, B) [with A = __int128 unsigned; B = long unsigned int]':
/sage/local/var/tmp/sage/build/primecount-7.1/src/src/deleglise-rivat/S2_easy_libdivide.cpp:107:29:   required from 'T {anonymous}::S2_easy_128(T, uint64_t, uint64_t, uint64_t, uint64_t, const Primes&, const primecount::PiTable&) [with T = __int128 unsigned; Primes = std::vector<unsigned int, std::allocator<unsigned int> >; uint64_t = long unsigned int]'
/sage/local/var/tmp/sage/build/primecount-7.1/src/src/deleglise-rivat/S2_easy_libdivide.cpp:183:25:   required from 'T {anonymous}::S2_easy_OpenMP(T, int64_t, int64_t, int64_t, const Primes&, int, bool) [with T = __int128 unsigned; Primes = std::vector<unsigned int, std::allocator<unsigned int> >; int64_t = long int]'
/sage/local/var/tmp/sage/build/primecount-7.1/src/src/deleglise-rivat/S2_easy_libdivide.cpp:244:75:   required from here
/sage/local/var/tmp/sage/build/primecount-7.1/src/include/min.hpp:47:38: error: static assertion failed: min(A, B): Cannot compare types A and B
   47 |   static_assert(is_comparable<A, B>::value,
      |                                      ^~~~~
make[5]: *** [CMakeFiles/libprimecount.dir/build.make:625: CMakeFiles/libprimecount.dir/src/deleglise-rivat/S2_easy_libdivide.cpp.o] Error 1

CI for upstream primecount: kimwalisch/primecount#52

Upstream fix: kimwalisch/primecount#52 (comment)

Upstream: Fixed upstream, but not in a stable release.

CC: @dimpase @isuruf @orlitzky

Component: packages: standard

Author: Matthias Koeppe

Branch/Commit: a633c80

Reviewer: Michael Orlitzky

Issue created by migration from https://trac.sagemath.org/ticket/33054

@mkoeppe mkoeppe added this to the sage-9.5 milestone Dec 20, 2021
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Dec 20, 2021

comment:1

An upgrade to primecount 7.2 does not fix the problem.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe changed the title conda-forge-standard (linux): primecount fails to install conda-forge (linux): primecount fails to install Dec 21, 2021
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Dec 21, 2021

comment:4

With #32894, which adds the conda package information, at least the conda-forge-standard configuration can be built, so we can defer this issue to the Sage 9.6 series.

@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 21, 2021
@mkoeppe
Copy link
Contributor Author

mkoeppe commented Dec 27, 2021

Upstream: Fixed upstream, but not in a stable release.

@mkoeppe

This comment has been minimized.

@sheerluck
Copy link
Contributor

comment:6
wget https://github.com/kimwalisch/primecount/compare/v7.2...ab54277.patch 

v7.2...ab54277.patch applies to primecount-7.2.tar.gz just fine

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Dec 27, 2021

Dependencies: #33082

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Dec 27, 2021

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Dec 27, 2021

Author: Matthias Koeppe

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Dec 27, 2021

comment:9

I have instead modified our build script


New commits:

6f1679dbuild/pkgs/primecount/spkg-install.in: Use WITH_POPCNT=OFF unconditionally
71e3587build/pkgs/primecount/spkg-install.in: Expand comment
afb575dMerge #33082
a633c80build/pkgs/primecount/spkg-install.in: Use std=gnu++...

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Dec 27, 2021

Commit: a633c80

@orlitzky
Copy link
Contributor

orlitzky commented Feb 7, 2022

comment:10

It might be better to backport the upstream patch for this one release. Not every compiler that supports std=c++ will support std=gnu++.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Feb 18, 2022

comment:11

We are using this in other packages too. All compilers on all supported platforms support this.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Feb 18, 2022

comment:12

Note that the upstream fix just disables 128 bit support when "std=c++.." is in use. So this is not what we want.

Needs review.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Feb 18, 2022

Changed dependencies from #33082 to none

@orlitzky
Copy link
Contributor

comment:14

Replying to @mkoeppe:

Note that the upstream fix just disables 128 bit support when "std=c++.." is in use. So this is not what we want.

Yes, but this branch already does,

sed "s/-std=c++/-std=gnu++/g"

and that could just as easily be

sed "s/-std=c++//g"

I was also thinking that this ticket was responsible for -DWITH_POPCNT=OFF, but it looks like that came from elsewhere. Nevertheless, there's an upstream fix for it that doesn't cause a performance degradation:

kimwalisch/primecount@b5a8286

The CMakeLists.txt says "POPCNT instruction is very important for performance", so using the upstream patch would be an improvement over the unconditional OFF.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Feb 18, 2022

comment:15

Replying to @orlitzky:

Replying to @mkoeppe:

Note that the upstream fix just disables 128 bit support when "std=c++.." is in use. So this is not what we want.

Yes, but this branch already does,

sed "s/-std=c++/-std=gnu++/g"

and that could just as easily be

sed "s/-std=c++//g"

No, this doesn't work because the compiler without the -std flag may not be using a sufficiently new standard.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Feb 18, 2022

comment:16

Replying to @orlitzky:

I was also thinking that this ticket was responsible for -DWITH_POPCNT=OFF, but it looks like that came from elsewhere.

Yes, #33082.

Nevertheless, there's an upstream fix for it that doesn't cause a performance degradation:

kimwalisch/primecount@b5a8286

The CMakeLists.txt says "POPCNT instruction is very important for performance", so using the upstream patch would be an improvement over the unconditional OFF.

#33082 comment:4 explains that our fix also does not lead to performance degradation.

@orlitzky
Copy link
Contributor

Reviewer: Michael Orlitzky

@orlitzky
Copy link
Contributor

comment:17

Replying to @mkoeppe:

#33082 comment:4 explains that our fix also does not lead to performance degradation.

...when __GNUC__ is defined. Now that there's a proper upstream fix, that too is unnecessarily compiler-specific. Moreover if we used the upstream patches, we'd be forced to remove these hacks for the next version of primecount; as it is, they may linger for years.

But okay. This isn't a ticket worth arguing over all night.

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Feb 19, 2022

comment:18

Thanks!

@vbraun
Copy link
Member

vbraun commented Feb 21, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants