![]() |
prime95/gwnum for PRP checking of any number?
Good day! Is it possible to use prime95 program or even better gwnum C library for PRP checking of any number?
Of cause it is usually used for Mersenne numbers 2^p-1, but now I want to use gwnum library to check probable primeness (PRP) of any arbitrary number. I have numbers of totally different sizes, some are of size around 32K bits, some are of size 30M bits. And I need fast PRP check of both K and M ranges. Can anyone suggest which header file from gwnum C library to use and what function to call with what params, if I have just raw number represented as a block of bytes? Sure, if necessary for each number I can call some init or prepare function before. And of cause I need very high performance! Meaning that gwnum should use most optimal algorithm including using SSE2/AVX1/AVX512 if they are available on CPU. Also if it will help gwnum should use all cores of CPU. Even better if I can run separate number PRP check on each core, is it possible (because I have very many numbers to check)? For numbers of size 32K bits I need maximal throughoutput, meaning checking as many different numbers per hour as possible on multi core CPU. For 30M-bit numbers I need performance of checking single number, meaning single number should be checked as fast as possible using all my CPU cores. Am I right that gwnum uses Fermat Primality Test (e.g. with bases 3, 5, 7) for PRP checking? |
Have you tried (GWNUM-based) OpenPFGW 4.0.0 available on sourceforge? :smile:
|
[QUOTE=moytrage;585386]I have numbers of totally different sizes, some are of size around 32K bits, some are of size 30M bits.
if it will help gwnum should use all cores of CPU. Even better if I can run separate number PRP check on each core, is it possible (because I have very many numbers to check)? [/QUOTE] According to my experiences with Prime95, you could run multiple instances ("workers"). One core for each instance is the easiest configuration, but we are now limited by memory bandwidth. So you could run smaller numbers in CPU cache, while simultaneously running bigger numbers in RAM. |
[QUOTE=paulunderwood;585389]Have you tried (GWNUM-based) OpenPFGW 4.0.0 available on sourceforge? :smile:[/QUOTE]
It looks like executable program. It is nice, especially if it is possible to run it as command line. But actually more preferable way for me would be to have C or C++ library that checks PRP-ness of a number, because I want to embed this check as a part of my software. That's why I preferr to use gwnum library if possible. Can anyone suggest what function and what header of gwnum to use and what params to do PRP check? |
[QUOTE=moytrage;585417]It looks like executable program. It is nice, especially if it is possible to run it as command line.
But actually more preferable way for me would be to have C or C++ library that checks PRP-ness of a number, because I want to embed this check as a part of my software. That's why I preferr to use gwnum library if possible. Can anyone suggest what function and what header of gwnum to use and what params to do PRP check?[/QUOTE] Have a look through [URL="https://mersenneforum.org/showthread.php?t=20454&page=5"]this thread[/URL], working backwards. You'll have to write your own Fermat PRP tests and Lucas tests. :smile: Basically, you'll need to compile Prime95/mprime source and the use some of its files to link against for you own program. Have a look at gwnum.h and giants.h for more info and also read up on GMP. |
| All times are UTC. The time now is 13:53. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.