mersenneforum.org  

Go Back   mersenneforum.org > Great Internet Mersenne Prime Search > Software

Reply
 
Thread Tools
Old 2017-06-14, 17:26   #1
ET_
Banned
 
ET_'s Avatar
 
"Luigi"
Aug 2002
Team Italia

32·5·107 Posts
Default GWNUM issue

I am working with LLR Version 3.8.20, using Gwnum Library Version 28.13 and would like to discuss a somewhat annoying issue (not a real bug).

I am testing double Mersenne numbers' possible factors of the type 2k(2^p-1)+1 using the alternate form 2k*2^p - 2k +1 (k=600,000-2,000,000) using an ABC file like this one:

Code:
ABC $a*2^$b+$c
1202106 859433-1202105
1202296 859433-1202295
...
...
3999792 859433-3999791
For the first values the program chooses the following setup:

Code:
Starting probable prime test of 1202106*2^859433-1202105
Using zero-padded type-1 FFT length 84K, Pass1=112, Pass2=768, 2 threads, a = 3
While for the last it chooses the following setup:

Code:
Starting probable prime test of 3999792*2^859433-3999791
Using generic reduction Pentium4 FFT length 80K, Pass1=320, Pass2=256, 2 threads, a = 3
The second setup is about three times slower.

A similar behaviour has been noticed with pfgw 3.7.10, so I consider it a "feature" of the GWnum library. It seems that somewhere between k = 600,000 and k=2,000,000 a limit is reached that switches the algorithm used to compute the element.

Question (especially to George): is this change in behaviour due to avoid an overflow of a "double" typed variable when the number to be tested grows up? Is it a "safe limit" that can be overridden? If so, how?

Luigi
ET_ is offline   Reply With Quote
Old 2017-06-14, 20:22   #2
Prime95
P90 years forever!
 
Prime95's Avatar
 
Aug 2002
Yeehaw, FL

2×53×71 Posts
Default

This is a feature.

The algorithm for selecting the FFT to test k*b^n+c is gruesomely complex. If you're curious, look at the gwinfo routine in gwnum.c. In short, increasing k and/or c decreases the number of bits I can stuff into an FFT word without getting a roundoff error. If k and c are too big, then it either "can't be done" or "can't be done without rewriting the carry propagation code to spread carries over more FFT words which is just too hard to do and may not even be possible using the current memory layout which would require even more code changes than are worth considering".

There is a gwnum entry called safety_margin which can be used to "be more aggressive", but that would only buy you a few more lines in ABC file.
Prime95 is offline   Reply With Quote
Old 2017-06-15, 09:34   #3
ET_
Banned
 
ET_'s Avatar
 
"Luigi"
Aug 2002
Team Italia

113178 Posts
Default

Quote:
Originally Posted by Prime95 View Post
This is a feature.

The algorithm for selecting the FFT to test k*b^n+c is gruesomely complex. If you're curious, look at the gwinfo routine in gwnum.c. In short, increasing k and/or c decreases the number of bits I can stuff into an FFT word without getting a roundoff error. If k and c are too big, then it either "can't be done" or "can't be done without rewriting the carry propagation code to spread carries over more FFT words which is just too hard to do and may not even be possible using the current memory layout which would require even more code changes than are worth considering".

There is a gwnum entry called safety_margin which can be used to "be more aggressive", but that would only buy you a few more lines in ABC file.
Thank you George.

This means that using the ABC file

Code:
ABC 2*$a*(2^859433-1)+1
601053
601148
601149
601205
601293
601296
allowed by pfgw I should be able to gain some more loops of the faster routine thanks to the smaller k? Or, being the number just the same, the behaviour of both pfgw and llr will be just the same?

Luigi
ET_ is offline   Reply With Quote
Old 2017-06-15, 09:42   #4
axn
 
axn's Avatar
 
Jun 2003

116758 Posts
Default

Quote:
Originally Posted by ET_ View Post
This means that using the ABC file

Code:
ABC 2*$a*(2^859433-1)+1
601053
601148
601149
601205
601293
601296
allowed by pfgw I should be able to gain some more loops of the faster routine thanks to the smaller k? Or, being the number just the same, the behaviour of both pfgw and llr will be just the same?

Luigi
It will be worse! This form [2*k*(2^p-1)+1] is not at all usable for the faster transform, and i don't think PFGW will automatically simplify it to k*2^(p+1)-(2k-1). So your best bet is to give the input in same format as LLR, with the same performance.
axn is online now   Reply With Quote
Old 2017-06-15, 09:52   #5
ET_
Banned
 
ET_'s Avatar
 
"Luigi"
Aug 2002
Team Italia

481510 Posts
Default

Quote:
Originally Posted by axn View Post
It will be worse! This form [2*k*(2^p-1)+1] is not at all usable for the faster transform, and i don't think PFGW will automatically simplify it to k*2^(p+1)-(2k-1). So your best bet is to give the input in same format as LLR, with the same performance.
Great! Thank you axn.

It looks like after juggling with Mersenne numbers factorization algorithm, I should learn something about LL, Riesel and Sierpinski numbers' primality test theory.
ET_ is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
GWNUM program paulunderwood Programming 54 2021-02-10 12:46
A possible bug in LLR/PFGW while using GWNUM (no bug in P95) Batalov Software 77 2015-04-14 09:01
LLR V3.8.2 using gwnum 26.2 is available! Jean Penné Software 25 2010-11-01 15:18
GWNUM? Unregistered Information & Answers 3 2010-09-12 19:52
GWNUM as DLL? Cyclamen Persicum Software 1 2007-01-02 20:53

All times are UTC. The time now is 12:07.


Sat Jul 17 12:07:13 UTC 2021 up 50 days, 9:54, 1 user, load averages: 1.54, 1.54, 1.40

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.

This forum has received and complied with 0 (zero) government requests for information.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.
A copy of the license is included in the FAQ.