mersenneforum.org  

Go Back   mersenneforum.org > Great Internet Mersenne Prime Search > Hardware > GPU Computing

Reply
 
Thread Tools
Old 2017-09-29, 02:30   #243
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
"name field"
Jun 2011
Thailand

41×251 Posts
Default

Quote:
Originally Posted by kladner View Post
Please don't put altered, confusing titles on technical threads.
+1. We really appreciate moderators' fine humor (almost) every time when a thread gets renamed, but we thought this goes only for the misc math or lounge...

Last fiddled with by LaurV on 2017-09-29 at 02:32
LaurV is offline   Reply With Quote
Old 2017-09-29, 04:09   #244
VBCurtis
 
VBCurtis's Avatar
 
"Curtis"
Feb 2005
Riverside, CA

2×2,927 Posts
Default

I'm a fan of the RDS ecm-thread renaming, gotta say. This one gave me a smile too!
VBCurtis is offline   Reply With Quote
Old 2017-09-30, 12:48   #245
R. Gerbicz
 
R. Gerbicz's Avatar
 
"Robert Gerbicz"
Oct 2005
Hungary

3·547 Posts
Default

Found a likely new, fast, high reliability error detection algorithm (with some restriction)
for Fermat and LLT test's interim or final residue.

Say we know res=a^e mod N or res'=LLT(x0,N,k) [applied k LL iterations starting from x0], and a non-trivial d divisor of N.

Calculate res2=a^e mod d or res2'=LLT(x0,d,k), then the error check is: the obvious res==res2 mod d [in the LLT case res'==res2' mod d] should be true. Since d is small, usually d<10^200, we can get quickly res2 (or res2') if we update at each iteration res2 or res2' (see later an improvement on this).

Ofcourse in this case we should store the full res (so RES64 is not enough), and you have to know d.
It is useful if we find a divisor of N, and we would like to test N/d, because in this case we are in the above situation, if res!=res2 mod d (or res'!=res2'), then there was an error in computation (or in the database). Or in some cases we are already in this setup, because we wanted to test N/d=(k*b^n+c)/d , say N/3=(2^p+1)/3.

For the Fermat case we can reduce further the problem using Euler-Fermat if gcd(a,d)=1 then a^e==a^(e mod eulerphi(d)) mod d.

Since the computation of res mod d takes at least linear time use the error checking say per 10000 iterations. In Fermat case if you are using the previous trick then it is not needed to store at each iteration a^e mod d, in LLT case update x at each iteration using modulus=d.(though there could be also a shortcut here).

This detects the error with high, roughly 1-(1/d) probability.
R. Gerbicz is offline   Reply With Quote
Old 2017-10-28, 01:03   #246
GP2
 
GP2's Avatar
 
Sep 2003

2×5×7×37 Posts
Default

Quote:
Originally Posted by R. Gerbicz View Post
Found a likely new, fast, high reliability error detection algorithm (with some restriction)
for Fermat and LLT test's interim or final residue.
This post never got any reaction or followup. I wonder if all the program authors simply have enough on their plate already, finishing up the implementation for Mersenne number testing.
GP2 is offline   Reply With Quote
Old 2017-10-28, 05:55   #247
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
"name field"
Jun 2011
Thailand

240638 Posts
Default

Quote:
Originally Posted by GP2 View Post
This post never got any reaction or followup. I wonder if all the program authors simply have enough on their plate already, finishing up the implementation for Mersenne number testing.
That may be exactly the effect of thread title morphing...
Not all people have free time on their hands (like us ) to read all topics regardless of title...

Last fiddled with by LaurV on 2017-10-28 at 05:56
LaurV is offline   Reply With Quote
Old 2017-10-28, 08:44   #248
preda
 
preda's Avatar
 
"Mihai Preda"
Apr 2015

22×3×112 Posts
Default

Quote:
Originally Posted by R. Gerbicz View Post
Found a likely new, fast, high reliability error detection algorithm (with some restriction)
for Fermat and LLT test's interim or final residue.

Say we know res=a^e mod N or res'=LLT(x0,N,k) [applied k LL iterations starting from x0], and a non-trivial d divisor of N.
My observation is this:
In LL testing, we do a^e mod N, where N is the "mersenne candidate", to find out whether N is prime or not.

The proposed check here requires to have a "non-trivial d divisor of N". If I have such a divisor, I don't have to run LL anymore because I already know N is not prime.
preda is offline   Reply With Quote
Old 2017-10-29, 23:29   #249
preda
 
preda's Avatar
 
"Mihai Preda"
Apr 2015

22×3×112 Posts
Default Optimal check freqency

I did a simple analysis to find the optimal frequency of the "Gerbicz check" in presence of errors.

I modeled it like this: I have the "Gerbicz step" L = 1000 fixed, and I can verify at any multiple of L iterations. I want to find out the value k that is optimum for verification at every k*L iterations, given the probability p that one step of L iterations fails.

Assuming p is small, we approximate the prob. of "at least one error in k steps" with k*p.

I call a "block" a sequence of k steps, followed by one more step for verification.

The cost of one block is k*L + L if there is no error. But if there is an error detected at the end of the block, the whole block must be repeated. The probability of a repeat is k*p.

So, the cost of one block is approximated:
block cost = k*L + L + k*p*(k*L + L)
(assuming at most one repeat per block).

Re-defining the "block cost" in multiples of k*L iterations, we have:

block cost = 1 + 1/k + k*p + p

So, the optimum k is reached when 1/k + k*p is minimized, which is reached when 1/k == k*p.

This has an intuitive interpretation: the optimum check frequency is reached when the check overhead (1/k) is equal to the repeat overhead (k*p).

And a small table. The "p" is the probability of having an error in L (=1000) iterations.


Code:
p                           k
-----------------------
1%                10
0.1%              30
0.01%           100
0.0001%      1000

Last fiddled with by preda on 2017-10-29 at 23:35 Reason: format
preda is offline   Reply With Quote
Old 2017-10-30, 15:01   #250
kriesel
 
kriesel's Avatar
 
"TF79LL86GIMPS96gpu17"
Mar 2017
US midwest

24·3·163 Posts
Default Few responses.

Quote:
Originally Posted by LaurV View Post
That may be exactly the effect of thread title morphing...
Not all people have free time on their hands (like us ) to read all topics regardless of title...
That's one factor. Another is it is simply a busy time of year. Another is many other code improvements (of smaller scope) have already been identified; the queue is quite deep. Another, at least for me, and perhaps for other non-mathematicians too, is Mr. Gerbicz's useful and novel posts can be hard to understand and absorb.
kriesel is online now   Reply With Quote
Old 2017-10-30, 15:10   #251
kriesel
 
kriesel's Avatar
 
"TF79LL86GIMPS96gpu17"
Mar 2017
US midwest

24·3·163 Posts
Default What restriction(s)?

Quote:
Originally Posted by R. Gerbicz View Post
Found a likely new, fast, high reliability error detection algorithm (with some restriction)
for Fermat and LLT test's interim or final residue.

Say we know res=a^e mod N or res'=LLT(x0,N,k) [applied k LL iterations starting from x0], and a non-trivial d divisor of N.

Calculate res2=a^e mod d or res2'=LLT(x0,d,k), then the error check is: the obvious res==res2 mod d [in the LLT case res'==res2' mod d] should be true. Since d is small, usually d<10^200, we can get quickly res2 (or res2') if we update at each iteration res2 or res2' (see later an improvement on this).

Ofcourse in this case we should store the full res (so RES64 is not enough), and you have to know d.
It is useful if we find a divisor of N, and we would like to test N/d, because in this case we are in the above situation, if res!=res2 mod d (or res'!=res2'), then there was an error in computation (or in the database). Or in some cases we are already in this setup, because we wanted to test N/d=(k*b^n+c)/d , say N/3=(2^p+1)/3.

For the Fermat case we can reduce further the problem using Euler-Fermat if gcd(a,d)=1 then a^e==a^(e mod eulerphi(d)) mod d.

Since the computation of res mod d takes at least linear time use the error checking say per 10000 iterations. In Fermat case if you are using the previous trick then it is not needed to store at each iteration a^e mod d, in LLT case update x at each iteration using modulus=d.(though there could be also a shortcut here).

This detects the error with high, roughly 1-(1/d) probability.
Please elaborate on what are the restrictions, for the case of an LLT of a mersenne number for which the factorability is unknown. (The usual trial factoring and P-1 factoring attempts have been made and yet the primality vs. factorability is unknown.)
kriesel is online now   Reply With Quote
Old 2017-10-30, 16:53   #252
R. Gerbicz
 
R. Gerbicz's Avatar
 
"Robert Gerbicz"
Oct 2005
Hungary

3×547 Posts
Default

Quote:
Originally Posted by preda View Post
The proposed check here requires to have a "non-trivial d divisor of N". If I have such a divisor, I don't have to run LL anymore because I already know N is not prime.
That is correct.
But it is also a possible case that you discover the d divisor of N after a completed LL/Fermat test, in this case ofcourse you don't need a 2nd test, but with this d you can quickly see if the (stored) full residue was good or not with high probability, hence you can find bad residues/computers.

Not written, but trivially with this algorithm if you know a non-trivial divisor of N, then in the first stage of the P-1 factorization method you have a rather quick error check! (if d<<N then it is a cheap test)


Quote:
Originally Posted by kriesel View Post
Please elaborate on what are the restrictions
The "only" restriction is that you should know a non-trivial divisor of N, you should know this before or after(!) the test.
R. Gerbicz is offline   Reply With Quote
Old 2017-11-01, 16:20   #253
kriesel
 
kriesel's Avatar
 
"TF79LL86GIMPS96gpu17"
Mar 2017
US midwest

11110100100002 Posts
Default

Quote:
Originally Posted by R. Gerbicz View Post
Not written, but trivially with this algorithm if you know a non-trivial divisor of N, then in the first stage of the P-1 factorization method you have a rather quick error check! (if d<<N then it is a cheap test)

The "only" restriction is that you should know a non-trivial divisor of N, you should know this before or after(!) the test.
Re your P-1 comment above, that might be very useful for those seeking multiple factors of known composites, by employing P-1 to seek factors larger than are practical with the fastest available trial division.

Re the restriction, that's a big one, for the common general case of unknown primality LL test. Now, if you found a way to remove the restriction, maybe we would start to call it the Lucas-Lehmer-Gerbicz test!

Thanks, and keep the insights, comments, and clarifications coming!
kriesel is online now   Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Stockfish / Lutefisk game, move 14 poll. Hungry for fish and black pieces. MooMoo2 Other Chess Games 0 2016-11-26 06:52
Redoing factoring work done by unreliable machines tha Lone Mersenne Hunters 23 2016-11-02 08:51
Unreliable AMD Phenom 9850 xilman Hardware 4 2014-08-02 18:08
[new fish check in] heloo mwxdbcr Lounge 0 2009-01-14 04:55
The Happy Fish thread xilman Hobbies 24 2006-08-22 11:44

All times are UTC. The time now is 15:25.


Fri Jul 7 15:25:26 UTC 2023 up 323 days, 12:53, 0 users, load averages: 1.32, 1.16, 1.11

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2023, 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.

≠ ± ∓ ÷ × · − √ ‰ ⊗ ⊕ ⊖ ⊘ ⊙ ≤ ≥ ≦ ≧ ≨ ≩ ≺ ≻ ≼ ≽ ⊏ ⊐ ⊑ ⊒ ² ³ °
∠ ∟ ° ≅ ~ ‖ ⟂ ⫛
≡ ≜ ≈ ∝ ∞ ≪ ≫ ⌊⌋ ⌈⌉ ∘ ∏ ∐ ∑ ∧ ∨ ∩ ∪ ⨀ ⊕ ⊗ 𝖕 𝖖 𝖗 ⊲ ⊳
∅ ∖ ∁ ↦ ↣ ∩ ∪ ⊆ ⊂ ⊄ ⊊ ⊇ ⊃ ⊅ ⊋ ⊖ ∈ ∉ ∋ ∌ ℕ ℤ ℚ ℝ ℂ ℵ ℶ ℷ ℸ 𝓟
¬ ∨ ∧ ⊕ → ← ⇒ ⇐ ⇔ ∀ ∃ ∄ ∴ ∵ ⊤ ⊥ ⊢ ⊨ ⫤ ⊣ … ⋯ ⋮ ⋰ ⋱
∫ ∬ ∭ ∮ ∯ ∰ ∇ ∆ δ ∂ ℱ ℒ ℓ
𝛢𝛼 𝛣𝛽 𝛤𝛾 𝛥𝛿 𝛦𝜀𝜖 𝛧𝜁 𝛨𝜂 𝛩𝜃𝜗 𝛪𝜄 𝛫𝜅 𝛬𝜆 𝛭𝜇 𝛮𝜈 𝛯𝜉 𝛰𝜊 𝛱𝜋 𝛲𝜌 𝛴𝜎𝜍 𝛵𝜏 𝛶𝜐 𝛷𝜙𝜑 𝛸𝜒 𝛹𝜓 𝛺𝜔