Releases · kimwalisch/primecount
primecount-8.2
This is a bugfix release, it is fully backwards compatible with the previous release.
This release fixes a bug that was introduced in the primecount-8.0 release caused by incomplete/incorrect changes in the CMakeLists.txt file. Due to this bug the version number was missing in the primecount.pc (pkg-config) file. Hence this bug is present in both the primecount-8.0 and primecount-8.1 releases.
primecount.pc.in: Fix missing version in .pc file #104.AC.cpp: Improve loop condition.
primecount-8.1
This is a maintenance release, the C/C++ API and ABI are fully backwards compatible with primecount-8.*. primecount-8.1 runs up to 5% faster due to improved instruction level parallelism in the AC algorithm.
ChangeLog
CMakeLists.txt: FixCMAKE_PROJECT_VERSIONnot defined.AC.cpp: Up to 15% faster due to improved instruction level parallelism.S2_easy.cpp: Fix#pragma omp masterdeprecated in OpenMP 5.1.Sieve_count*.hpp: Improve GCC conditional move code gen.- Automated building Windows binaries using GitHub Actions CI.
primecount-8.0
This is a new major release, both the C and C++ API are not fully backwards compatible with primecount-7.*
Key Improvements
- primecount-8.0 runs up to 15% faster due to improved instruction-level parallelism in the AC algorithm.
- The scalability of the thread load balancers has been improved on systems with a high number of CPU cores.
- The mathematical expression parser in the primecount command-line application now detects and reports integer overflow and underflow.
Why the API changed
primecount-7.0 was released more than five years ago. Since then, the C/C++ API has remained stable; however, redundant API functions and several poor design decisions made the codebase increasingly difficult to maintain. To simplify maintenance, improve performance, and provide better error handling, the API has been cleaned up in this new major release.
Breaking C/C++ API changes
These string-based APIs have been removed in favor of a new 128-bit integer API that provides better performance, stronger type safety, and improved error handling.
-
C++ API: Removed string functions from
<primecount.hpp>
std::string pi(std::string x);
std::string get_max_x(); -
C API: Removed string functions from
<primecount.h>
const char* primecount_pi_str(x);
const char* primecount_get_max_x();
New 128-bit C/C++ API
primecount-8.0 introduces a new 128-bit API without string arguments, offering better performance and improved error handling. The API uses a portable pc_int128_t struct defined in the <primecount.hpp> and <primecount.h> header files and supported on both 64-bit and 32-bit systems (even if the compiler does not support __int128_t).
-
C++ API: New 128-bit functions in
<primecount.hpp>
pc_int128_t pi(pc_int128_t x);
pc_int128_t nth_prime(pc_int128_t n); -
C API: New 128-bit functions in
<primecount.h>
pc_int128_t primecount_pi_128(pc_int128_t x);
pc_int128_t primecount_nth_prime_128(pc_int128_t n);
If you need to support both primecount-7.* and primecount-8.*, then you can use the PRIMECOUNT_VERSION_MAJOR and PRIMECOUNT_VERSION_MINOR macros for conditional compilation. For dynamic languages such as Python, the primecount_version() function allows runtime version detection.
ChangeLog
api.cpp: Fix broken 128-bit nth prime function.util.cpp: Fix undefined behavior into_string().calculator.hpp: Add code to detect integer overflows.LoadBalancerP2.cpp: Faster critical section.LoadBalancerS2.cpp: Faster critical section.LoadBalancerAC.cpp: Faster critical section.nth_prime.cpp: Improve status output.AC.cpp: Improved instruction level parallelism.AC_libdivide.cpp: Improved instruction level parallelism.D.cpp: Refactor runtime dispatch to optimized SIMD algorithm.S2_hard.cpp: Refactor runtime dispatch to optimized SIMD algorithm.pi_lmo_parallel.cpp: Add support for runtime dispatch to optimized SIMD algorithm.- Move
S2_easy_libdivide.cppcode intoS2_easy.cpp. - Move
AC_libdivide.cppcode intoAC.cpp. src/app/test.cpp: Speed up tests.CMakeLists.txt: SetCMAKE_VISIBILITY_INLINES_HIDDEN=ONby default.
primecount-7.20
This is a maintenance release, the C/C++ API and ABI are fully backwards compatible with primecount-7.*
CMakeLists.txt: Support building libprimecount.dll using MinGW.pi_gourdon.cpp: Quickly verify pi(x) results.pi_deleglise_rivat.cpp: Quickly verify pi(x) results.pi_lmo_parallel.cpp: Quickly verify pi(x) results.CmdOptions.cpp: Add --double-check option.build_mingw64_arm64.sh: Enable ARM SVE for Mingw-w64 on ARM64.doc/Easy-Special-Leaves.pdf: Converted Markdown to LaTeX.doc/Hard-Special-Leaves.pdf: Converted Markdown to LaTeX.doc/Partial-Sieve-Function.pdf: Converted Markdown to LaTeX.ci.yml: Add WebAssembly/Emscripten test.BUILD.md: Add WebAssembly/Emscripten build instructions.README.md: Updated Algorithms section.
primecount-7.19
This is a maintenance release, the C/C++ API and ABI are fully backwards compatible with primecount-7.*
This release adds a 128-bit nth prime function, a feature that has been requested several times in the recent past (see #87, #77). Part of the new 128-bit nth prime function is also a new multi-threaded prime sieve which finds the actual nth prime after having computed a close approximation of the nth prime using the inverse Riemann R function and the prime counting function. This new multi-threaded nth prime sieve also significantly speeds up primecount's 64-bit nth prime function since that part of the algorithm was previously single-threaded.
nth_prime.cpp: Add 128-bit nth_prime function.nth_prime_sieve.hpp: New sieving algo for nth_prime(n).primecount.h: Improved 128-bit C API using portablepc_int128_tstruct.primecount.hpp: Improved 128-bit C++ API using portablepc_int128_tstruct.libprimecount.md: Add new 128-bit C/C++ API functions.
primecount-7.18
This is a maintenance release, the C/C++ API and ABI are fully backwards compatible with primecount-7.*
- Add CMake
find_package(primecount)support #85. libprimecount.md: Add CMakefind_package(primecount)section.PhiTiny.cpp: Reduce code bloat #86.- Move private header files from /include to /src #82.
src/CMakeLists.txt: Update for private header files in /src.test/CMakeLists.txt: Update for private header files in /src.Vector.hpp: Get rid ofstd::is_trivialwhich is deprecated in C++26.- Update to latest primesieve-12.9 library.
- Update to latest libdivide-5.2.0 library.
primecount-7.17
This is a maintenance release, the C/C++ API and ABI are fully backwards compatible with primecount-7.*
Sieve_pre_sieve.hpp: Improved pre-sieving using primes ≤ 71. Speeds up the S2_hard and D algorithms by up to 5%.README.md: Fix Markdown math formulas.Hard-Special-Leaves.md: Fix Markdown math formulas.- Update to primesieve-12.8 library.
primecount-7.16
This is a maintenance release, the C/C++ API and ABI are fully backwards compatible with primecount-7.*
The SIMD runtime dispatching has been improved. The CPUID runtime check has been moved outside of the hot loop. All SIMD code is now inlined into the main algorithm which avoids a function call overhead. When using the --status option of the primecount command-line program the name of the SIMD algorithm used (e.g. AVX512, ARM SVE, ...) is printed to the screen.
fast_div.hpp: Fix "Warning: mnemonic suffix used with `div'"libdivide.h: Fix "Warning: mnemonic suffix used with `div'"LoadBalancerS2.cpp: Tune load balancing.LoadBalancerAC.cpp: Tune load balancing.primecount-config.hpp: Update default CPU cache sizes.Sieve.cpp: Improve count balancing.Sieve.cpp: Add multiarch count methods.Sieve.hpp: New multiarch count methods.D.cpp: Runtime dispatching changes.D_multiarch_avx512.cpp: New file.D_multiarch_arm_sve.cpp: New file.S2_hard.cpp: Runtime dispatching changes.S2_hard_multiarch_avx512.cpp: New file.S2_hard_multiarch_arm_sve.cpp: New file.CMakeLists.txt: Add new multiarch cpp files.CMakeLists.txt: Fix broken MSVC OpenMP detection.
primecount-7.15
This release adds ARM SVE runtime dispatching, it is enabled by default on Linux for ARM64 CPUs and it has also been implemented for Windows (but support in Microsoft's Windows.h is still missing). The C/C++ API and ABI of this release are fully backwards compatible with primecount-7.*
Sieve.hpp: Improve ARM SVE bit counting algorithm.multiarch_arm_sve.cmake: Improve ARM SVE detection.src/arch/arm/sve.cpp: Detect ARM SVE instruction set.README.md: Add sponsors section.- Update to libprimesieve-12.7.
Thanks to @AndrewVSutherland and @AlgoWin for being sponsors in this release cycle!
primecount-7.14
This is a maintenance release, the C/C++ API and ABI are fully backwards compatible with primecount-7.*
- Fix
libdivide.hissue with GCC 15 #76. - Move x86 cpuid code from
cpuid.hpptosrc/x86/cpuid.cpp. - Move
generate.hppcode tosrc/generate_primes.cpp. - Move
generate_phi.hppcode tosrc/phi_vector.cpp. int128_t.hpp: Rename namespace port to pstd (portable std namespace).Sieve.hpp: Tune AVX512 and ARM SVE simd code.Sieve.hpp: Branchfree bitmask calculation.cpu_supports_popcnt.hpp: Simplify, move preprocessor checks to newmultiarch_x86_popcnt.cmake.multiarch_avx512_vpopcnt.cmake: Tune AVX512 code.multiarch_x86_popcnt.cmake: Detect x86 POPCNT.CMakeLists.txt: Use CMake list for all compile time definitions.