mersenneforum.org How to use prime95 for stage 1 & GMP-ECM for stage 2
 User Name Remember Me? Password
 Register FAQ Search Today's Posts Mark Forums Read

2015-03-03, 17:16   #12
philmoore

"Phil"
Sep 2002
Tracktown, U.S.A.

25·5·7 Posts

Quote:
 Originally Posted by axn MB or GB?
GB.

2015-03-03, 17:18   #13
YuL

Feb 2012
Paris, France

16210 Posts

Quote:
 Originally Posted by axn I think you need to give both B1 and B2, like so: Code:  ecm -v -resume work.txt 1 11e6-30e9 i.e. B1=1, and B2=11e6 to 30e9

You could do this:

Code:
# use default B2
ecm -v -resume results.txt 11e6-11e6
# use B2=11e8
ecm -v -resume results.txt 11e6-11e6 11e8
At least that's what I do when I run stage 1 with Prime95 and stage 2 with gmp-ecm
because I prefer to have B1 value in the output:

Code:
GMP-ECM 6.4.4 [configured with GMP 6.0.0, --enable-asm-redc] [ECM]
Resuming ECM residue saved with Prime95
Input number is 0x16F9A1369338819B52EBC62EFD7B6CA .... 33DB13E1B5331 (148 digits)
[Thu Feb 26 14:29:35 2015]
Using MODMULN [mulredc:0, sqrredc:0]
Using B1=15000000-15000000, B2=46847553490, polynomial Dickson(12), sigma=690944836466098
dF=32768, k=4, d=324870, d2=11, i0=36
Expected number of curves to find a factor of n digits:
35    40    45    50    55    60    65    70    75    80
102    543    3391    23969    191190    1675913    1.6e+007    1.7e+008    1.9e+009    2.2e+010
Step 1 took 16ms
Using 19 small primes for NTT
Estimated memory usage: 104M
Initializing tables of differences for F took 62ms
...

Last fiddled with by YuL on 2015-03-03 at 17:19 Reason: Added quote from axn

 2015-03-03, 19:09 #14 VBCurtis     "Curtis" Feb 2005 Riverside, CA 2×2,819 Posts Lycorn- You are correct, in that some mistake in command/flag/etc caused GMP-ECM to re-run stage 1, wasting time. You can calculate the time for the prime95/GMP combo by taking the stage 1 time from Prime95 and the stage2 time from GMP-ECM as the time per curve. You discovered just how much faster Prime95 is at Stage 1! Once you get the commands figured out, try using B1 = 21M and B2 = GMP-ECM default. See what -v output predicts for the time to complete t45. I've found this choice of B1 more efficient for smaller numbers, am curious for ones this large. Note this will cause stage 2 to use twice the memory, just fitting in your 6GB envelope. Also, note default t50 B1 of 43/44M will use the same memory as 21M that I suggest- so, we can conclude that GMP-ECM is useful for this exponent size up to t50 for 8GB machines, and up to t55 for 16GB machines. Not bad! I think memory use scales roughly with exponent size, so t45 B1 = 11M tests should work on an 8GB machine for exponent sizes up to 23,000 or so, and 16GB machines up to nearly 50,000.
 2015-03-03, 19:18 #15 VBCurtis     "Curtis" Feb 2005 Riverside, CA 2×2,819 Posts Also, the -k option can arrange stage 2 to use half the memory at a small loss in efficiency. Part of your -v output lists a k-value, which is the number of chunks stage 2 is split into (2 minimum, I've used k over 20 for really large B1 runs). B1 = 11M uses a default k of 3. If you issue the flag -k 12 in your command, stage 2 will use half the memory, but take 12 runs through most of stage 2 processes. The stage 2 "blocks" increase by factors of 4, so setting -k 6 won't split the difference; the program will adjust B2 to be efficient given your request for 6 blocks. Your run used a B2 of 30G, and k = 3. If you used k = 4, B2 would be set to 40G. If you use k = 2, I don't know if B2 would reduce to 20G and keep the same block & memory size, or jump to the next block size of 40G for a B2 of 80G. There are lots of options available! For long runs, minimizing the expected time to complete the level of interest is wise. That said, for two settings that have similar expected times to complete, the settings with higher B1 or B2 will have a higher chance to get lucky with a bigger factor. Different chip architectures and even different machine setups (memory bandwidth, OS, whatever) can respond differently to various settings, so a little experimentation can save you 10% of runtime if you're lucky.
 2015-03-03, 20:39 #16 lorgix     Sep 2010 Scandinavia 3·5·41 Posts With some simplifications and assumptions, here's how to optimize it: Set the highest -maxmem you are comfortable with. Time stage2 with a reasonable B2. Divide the time taken by ~0.7 (0.695?) to get the time you should spend in stage1. Find the B1 that brings you there. Time usually scales quite linearly with B1. This should be close to a optimal B2/B1 ratio for the given circumstances. If that B1-B2-combo brings the needed number of curves too high or too low for your preference, just change B2 and start over from the third sentence of this paragraph.
 2015-03-03, 21:13 #17 bloodIce     Feb 2010 Sweden 173 Posts GMP-ECM could be a program of choice for small exponents. However, is it possible to report the ECM-curves to GIMPS? I am not aware how to do it and to me it seems loss of time to do GMP-ECM, since another person needs to do it for GIMPS too. It is a private effort.
 2015-03-03, 22:38 #18 lycorn     "GIMFS" Sep 2002 Oeiras, Portugal 1,571 Posts That got me wondering as well. Thanks to all those who answered my previous post, I have just managed to run only the Stage 2, and the time for the combined run Prime95-Stage 1+ GMP-ECM-Stage 2 is ~23 minutes. More or less the same as for Prime95 only, but with the advantage that only 4630 curves are necessary, instead of 9700. So yes, it would be nice to use GMP-ECM for these range of exponents and factor sizes. The thing is, how do I report the results to Primenet? The file obtained by using the -save switch is huge, and contains a residue, incomprehensible to the server. And this was for just one curve. If one runs 500 or more curves on a given exponent, the size of the save files containing Stage 1 and 2 residues will be ridiculously large. Is it supposed to be that way? Connection to the server for reporting is something I deem essential.
2015-03-03, 23:20   #19
VictordeHolland

"Victor de Hollander"
Aug 2011
the Netherlands

100100110112 Posts

Quote:
 Originally Posted by lycorn The thing is, how do I report the results to Primenet?
In the past you could mail your GMP-ECM efforts to George and he would manually add curves to the database, so no work is duplicated. But keep in mind he is a busy man.\

edit:
Could a mod maybe move the posts about Prime95 stage 1 and GMP-ECM stage 2 to a new thread?

Last fiddled with by VictordeHolland on 2015-03-03 at 23:27

2015-03-03, 23:25   #20
lorgix

Sep 2010
Scandinavia

3×5×41 Posts

Quote:
 Originally Posted by lycorn That got me wondering as well. Thanks to all those who answered my previous post, I have just managed to run only the Stage 2, and the time for the combined run Prime95-Stage 1+ GMP-ECM-Stage 2 is ~23 minutes. More or less the same as for Prime95 only, but with the advantage that only 4630 curves are necessary, instead of 9700. So yes, it would be nice to use GMP-ECM for these range of exponents and factor sizes. The thing is, how do I report the results to Primenet? The file obtained by using the -save switch is huge, and contains a residue, incomprehensible to the server. And this was for just one curve. If one runs 500 or more curves on a given exponent, the size of the save files containing Stage 1 and 2 residues will be ridiculously large. Is it supposed to be that way? Connection to the server for reporting is something I deem essential.
Did you try optimizing it like I suggested in #930?

And yes, the output from Prime95 gets large with large numbers. It prints the entire number in hexadecimal.

2015-03-03, 23:37   #21
lycorn

"GIMFS"
Sep 2002
Oeiras, Portugal

1,571 Posts

Quote:
 Originally Posted by lorgix Did you try optimizing it like I suggested in #930?
As I understood it, your post seemed to refer to work done entirely (Stage 1 + 2) with GMP-ECM. I am doing Stage 1 with Prime95, so the choice of B1 is as prescribed in the Primenet pages. I will probably fiddle with B2, and then I´ll report back. Thanks for your posts.

As for logging and reporting results, it´s a pain we can´t do it the Prime95 way. That makes me doubt I will ever use GMP-ECM on a regular basis. Let´s see.

2015-03-03, 23:47   #22
lorgix

Sep 2010
Scandinavia

3×5×41 Posts

Quote:
 Originally Posted by lycorn As I understood it, your post seemed to refer to work done entirely (Stage 1 + 2) with GMP-ECM. I am doing Stage 1 with Prime95, so the choice of B1 is as prescribed in the Primenet pages. I will probably fiddle with B2, and then I´ll report back. Thanks for your posts. As for logging and reporting results, it´s a pain we can´t do it the Prime95 way. That makes me doubt I will ever use GMP-ECM on a regular basis. Let´s see.
Regardless of Prime95/GMP-ECM or specific B1/B2, the relationship (in time requirement) should be B1:B2::1:0.7.
So if Prime95 takes 10 minutes to complete one stage1, you should have GMP-ECM use a B2 such that stage2 takes 7 minutes.

Yes, it would be very nice if this speedup could be incorporated into Prime95.

 Thread Tools

 Similar Threads Thread Thread Starter Forum Replies Last Post Gordon GMP-ECM 3 2016-01-08 12:44 D. B. Staple Factoring 2 2007-12-14 00:21 jasong GMP-ECM 9 2007-10-25 22:32 Angular Hardware 18 2004-11-15 07:04 Matthias C. Noc PrimeNet 5 2004-08-25 15:42

All times are UTC. The time now is 09:27.

Sat Feb 4 09:27:52 UTC 2023 up 170 days, 6:56, 1 user, load averages: 0.90, 0.92, 0.92

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.

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