Primecount Versions Save

🚀 Fast prime counting function implementations

v7.13

6 days ago

This release adds runtime dispatching to AVX512 and ARM SVE for CPUs that support it. Runtime dispatching to AVX512 (x64 CPUs) is now enabled by default when compiling using GCC and Clang on all operating systems.

  • CMakeLists.txt: New WITH_MULTIARCH option (default ON).
  • Sieve.hpp: New AVX512 popcount algorithm for x86 CPUs.
  • Sieve.hpp: New ARM SVE popcount algorithm.
  • int128.cmake: Improve int128_t support for Windows.
  • OpenMP.cmake: Improve LLVM/Clang OpenMP detection.
  • Add preliminary MSVC 128-bit support.
  • Deleted ci-sage.yml, it has not been updated in 3 years.

v7.12

3 weeks ago

This is a bug-fix release, the previous primecount-7.11 may cause an infinite loop when calculating the logarithmic integral on the i386 CPU architecture (x86 32-bit CPU using Linux and GNU glibc). The C/C++ API and ABI of this release are backwards compatible with the previous release.

  • LogarithmicIntegral.cpp: Fix infinite loop on Linux i386 #66.
  • RiemannR.cpp: Fix infinite loop on Linux i386 #66.
  • CMakeLists.txt: Remove WITH_POPCNT=OFF option used to build a portable primecount binary. primecount is now portable by default (on x86 CPUs primecount now checks using CPUID if the CPU supports the POPCNT instruction before using it).
  • popcnt.hpp: On x86 & x64 CPUs enable CPUID POPCNT runtime check by default (unless the user compiles with -mpopcnt).
  • LoadBalancerAC.cpp: New dynamic adaptive load balancing #67.
  • RiemannR.cpp: Faster and simpler RiemannR_inverse(x).
  • test/Li.cpp: Add more tests.
  • test/Riemann_R.cpp: Add more tests.
  • fast_div.hpp: Get rid of make_smaller<T>::type hack.

v7.11

1 month ago

This is a new maintenance release, the C/C++ API and ABI are fully backwards compatible with the previous release.

  • CMakeLists.txt: Detect Apple Silicon CPUs at build time (on Apples OSes only) and disable libdivide since Apple Silicon CPUs have very fast integer division instructions that are usually faster than libdivide. This speeds up the computation of the easy special leaves algorithms (--S2-easy & --AC) by up to 10%.
  • Faster RiemannR(x) and RiemannR_inverse(x) implementations: https://github.com/kimwalisch/primesieve/pull/144.
  • test/iroot.cpp: Fix musl libc issue: https://github.com/kimwalisch/primesieve/issues/147.
  • test/Li.cpp: Speed up test.
  • CmdOptions.cpp: Detect incompatible options.
  • PiTable.cpp: Increase cache size to 2 KiB.
  • Renamed command-line option --Ri to -R or --RiemannR.
  • Renamed command-line option --Ri-inverse to --RiemannR-inverse.
  • Improve status output on Windows.
  • Update to latest primesieve-12.1 library.

v7.10

3 months ago

This is a new maintenance release, it is fully backwards compatible with the previous release. This release contains a CMake bug fix, tests have been ported to GitHub Actions and the nth prime code has been cleaned up.

  • cmake/OpenMP.cmake: Improve libatomic detection: https://github.com/kimwalisch/primesieve/issues/141
  • .github/workflows/ci.yml: Port AppVeyor CI tests to GitHub Actions.
  • RiemannR.cpp: Fix potential integer overflows in Li_inverse(x) & Ri_inverse(x).
  • nth_prime.cpp: Use new nth_prime_approx(n).
  • Vector.hpp: Rename pod_vector to Vector and pod_array to Array.
  • README.md: Add C & C++ API badges.
  • Update to latest primesieve-11.2 library.

Thanks to @sethtroisi and Sven S. for being sponsors in this release cycle!

v7.9

9 months ago

The focus of this release has been to improve primecount's test suite. Before this release there were e.g. no unit tests for most of the algorithms used in the pi_gourdon(x) prime counting function. Now virtually everything is unit tested!

  • test/README.md: Add debug mode + GCC/Clang sanitizers documentation.
  • doc/BUILD.md: Add link to detailed test information.
  • test/pi_lehmer.cpp: Add new test.
  • test/pi_*.cpp: Add large pi(x) computation tests.
  • test/gourdon/AC.cpp: Add new test.
  • test/gourdon/B.cpp: Add new test.
  • test/gourdon/D.cpp: Add new test.
  • test/gourdon/Phi0.cpp: Add new test.
  • test/gourdon/Sigma.cpp: Add new test.
  • test/gourdon/alpha_y.cpp: Add 128-bit tests.
  • test/gourdon/alpha_z.cpp: Add 128-bit tests.
  • test/deleglise-rivat/S2_trivial.cpp: Add large computation tests.
  • test/deleglise-rivat/S2_easy.cpp: Add large computation tests.
  • test/deleglise-rivat/S2_hard.cpp: Add large computation tests.
  • test/deleglise-rivat/alpha_deleglise_rivat.cpp: Add 128-bit tests.
  • test/lmo/alpha.cpp: Add more tests.
  • test/api/nth_prime.cpp: Add large computation tests.

Thanks to @entersoftone for being a sponsor in this release cycle!

v7.8

1 year ago

I fixed the pi(-n) crash for 64-bit integers two days ago. Unfortunately I forgot to fix the same issue for 128-bit integers. Hence this release fixes the same issue for 128-bit integers.

  • api.cpp: Add missing check for negative numbers in pi(int128_t x), pi_deleglise_rivat(int128_t x), pi_gourdon(int128_t x).
  • test/api.cpp: Add more pi(-n) tests.
  • test/api_c.cpp: Add more primecount_pi(-n) tests.
  • test/pi_cache.cpp: Add new test.
  • test/pi_deleglise_rivat.cpp: Add new test.
  • test/pi_gourdon.cpp: Add new test.
  • test/pi_legendre.cpp: Add new test.
  • test/pi_lmo5.cpp: Add new test.
  • test/pi_lmo_parallel.cpp: Add new test.
  • test/pi_meissel.cpp: Add new test.
  • CMakeLists.txt: Disable building libprimesieve examples.

v7.7

1 year ago

This is a bug fix release.

  • api.cpp: Fix pi(-1) crash #64. Now pi(-1) returns 0 without reporting any error. (Same behavior for all other negative numbers i.e. pi(-n) = 0)
  • test/api.cpp: Add pi(-1) test.
  • test/api_c.c: Add primecount_pi(-1) test. Convert api_c.cpp to api_c.c.
  • test/nthprime.cpp: Add new test.
  • primecount.h: Fix -Wstrict-prototypes warning.

v7.6

1 year ago

This is a bug fix release.

There is a missing header include in primecount-7.5 (in print.hpp) which may cause the build to fail when compiling with C++17 or later. This e.g. caused the build of primecount-7.5 to fail on Fedora-39 i686. This issue has been fixed in primecount-7.6, there are no other changes. The API and ABI of primecount-7.6 are backwards compatible with primecount-7.*

ChangeLog

  • print.hpp: Add missing <string_view> header.

v7.5

1 year ago

The C/C++ API and ABI of primecount-7.5 are backwards compatible but primecount-7.5 now requires ≥ libprimesieve.so.11. The previous primecount-7.4 requried ≥ libprimesieve.so.10.

ChangeLog

  • Update to the latest libprimesieve-11.0.
  • phi.cpp: 10% phi(x, a) speedup.
  • pi_gourdon.cpp: Reduce context switches and cpu migrations by up to 2x.
  • LoadBalancerP2.cpp: Improve load balancing for high CPU core count servers.
  • S2_hard.cpp: Improve load balancing for high CPU core count servers.
  • S2_easy.cpp: Improve load balancing for high CPU core count servers.
  • AC.cpp: Improve load balancing for high CPU core count servers.
  • D.cpp: Improve load balancing for high CPU core count servers.
  • P3.cpp: Improve load balancing for high CPU core count servers.
  • Sieve.cpp: Simplify COUNT_UNSET_BIT() macro.
  • pod_vector.hpp: Added support for types with destructors.
  • CMakeLists.txt: Use WITH_DIV32=OFF when using the Clang compiler.
  • Hard-Special-Leaves.md: Convert formulas to MathJax.
  • Easy-Special-Leaves.md: Convert formulas to MathJax.
  • Partial-Sieve-Function.md: Convert formulas to MathJax.

v7.4

1 year ago

This is a new minor release, the API and ABI of primecount are backwards compatible. However, this release requires the latest primesieve-8.* library, it won't work with primesieve-7.*.

ChangeLog

  • CMakeLists.txt: primecount now requires primesieve-8.0 or later.
  • CMakeLists.txt: Simplify, split up into multiple *.cmake files.
  • primecount.pc.in: primecount now requires primesieve-8.0 or later.
  • Sieve.cpp: Reduce branch mispredictions.
  • B.cpp: Faster counting of primes.
  • P2.cpp: Faster counting of primes.
  • isqrt.cpp: Improve code gen for 128-bit integers.
  • Update to latest libprimesieve-8.0 with AVX512 support.