mersenneforum.org

mersenneforum.org (https://www.mersenneforum.org/index.php)
-   Math (https://www.mersenneforum.org/forumdisplay.php?f=8)
-   -   Predicting the Amount of CPU Power Needed to LL Test Exponent p (https://www.mersenneforum.org/showthread.php?t=2731)

marc 2004-11-30 18:26

Um use elif.

If your bounds are say 1,5,10,20 then you'd write:

if x < 1: blah
elif x < 5: blah2
elif x < 10: blah3
elif x < 20: blah4

And you don't need to declare secs before you use it.

If you just want to see less code you could do something like:

if blah: mul = 0.xxx
elif blah: mul = 1.xxx

return exp * mul / 31536000

leifbk 2004-11-30 18:57

There are surely a hundred ways to write this code, but that's a little beside the point. If I wanted to write a pure Python program, I could for instance have used one of Python's list constructs, stuffed the threshold values and coefficients into it, and run a foreach ... on it. However, I wanted to write a program that's easy to understand by a casual programmer, and that might easily be ported into Perl, PHP, C, Basic or whatever.

As I've already suggested, I'm more interested in if the results matches the values that people get in their reports, or if anyone can spot an error in the actual numbers.

But thanks for your response anyway :banana:

-Leif.

James Heinrich 2004-12-19 20:41

Thanks for the LL -> P90 code, just what I was looking for :)

Next question: What would the equivalent code look like for calculating P90 time for trial factoring and P-1?

leifbk 2004-12-20 08:34

Don't know about TF, but the P-1 testing seems to get a credit of 0.001 P90 year regardless of size.

I've just got one more thing to say about this code: The reports from mersenne.org that write CPU P90 years with 3 decimals, seem to do the intermediates with 4 decimals internally. I discovered it by summing up this row:

[CODE]
24373073 3.299 3.299
12798427 0.830 4.129
23643479 3.200 7.329
23207629 3.141 10.470
11783371 0.764 11.234
25936913 4.225 15.459
25988381 4.233 19.692
25028371 3.387 23.079
23913157 3.236 26.315
23153183 3.133 29.448
[/CODE]

However, the sum came out as 29.449 in the reports. The same series written with 4 decimals reveals why:

[CODE]
24373073 3.2986 3.2986
12798427 0.8303 4.1289
23643479 3.1998 7.3287
23207629 3.1409 10.4696
11783371 0.7645 11.2341
25936913 4.2249 15.4590
25988381 4.2333 19.6923
25028371 3.3873 23.0796
23913157 3.2363 26.3159
23153183 3.1335 29.4494
[/CODE]

With 5 decimals the sum is 29.44950, and with 6 decimals it's 29.449505, both of which should have been rounded to 29.450 using 3 decimals.

regards, Leif.

James Heinrich 2004-12-20 16:23

[QUOTE=leifbk]Don't know about TF, but the P-1 testing seems to get a credit of 0.001 P90 year regardless of size.[/QUOTE]What it gets credited as doesn't concern me, I'm interested in calculating how much P90 CPU time it actually takes to do the work. I assume TF would be calculated based on the exponent and the bits, whereas P-1 depends on the exponent and B1/B2, and I suppose whether or not stage 2 was run at all (if a factor was found in stage 1, then no time was spent doing stage 2). Are there any benchmark numbers out there for TF and/or P-1, similar to [url]http://www.mersenne.org/bench.htm[/url] ?

James Heinrich 2005-02-06 14:14

If anyone out there wants to help me build a database of trial factoring time, you can do so by adding this line into [i]worktodo.ini[/i]:[code]Factor=1000003,32[/code]and (important!) set [i]Options|Preferences|Iterations between screen ouputs[/i] to 5000. That will give you output similar to this:
[img]http://mersenne-aries.sili.net/temp/factor_1000003-32.gif[/img]
Then please email or PM me the times for each iteration (better yet just send me a screenshot) and I'll add it to my database. Of course, please also tell me what kind of CPU it is, stock clock speed, actual clock speed if overclocked, HyperThreading enabled/disabled (if appropriate).

marc 2005-02-06 18:34

[code]
Mersenne number primality test program version 24.6
Starting factoring M1000003 to 2^62
[Feb 6 18:27] Factoring M1000003 to 2^54 is 54.54% complete. Time: 78.946 sec.
[Feb 6 18:28] Factoring M1000003 to 2^55 is 27.27% complete. Time: 51.302 sec.
[Feb 6 18:28] Factoring M1000003 to 2^55 is 54.54% complete. Time: 28.003 sec.
[Feb 6 18:29] Factoring M1000003 to 2^55 is 81.80% complete. Time: 27.718 sec.
[Feb 6 18:29] Factoring M1000003 to 2^56 is 13.64% complete. Time: 45.614 sec.
[Feb 6 18:30] Factoring M1000003 to 2^56 is 27.28% complete. Time: 27.247 sec.
[Feb 6 18:30] Factoring M1000003 to 2^56 is 40.92% complete. Time: 27.295 sec.
[Feb 6 18:31] Factoring M1000003 to 2^56 is 54.56% complete. Time: 27.270 sec.
[Feb 6 18:31] Factoring M1000003 to 2^56 is 68.20% complete. Time: 27.386 sec.
[Feb 6 18:32] Factoring M1000003 to 2^56 is 81.84% complete. Time: 27.335 sec.
[Feb 6 18:32] Factoring M1000003 to 2^56 is 95.48% complete. Time: 27.237 sec.
[/code]

This is an Athlon XP 2500+ which runs at 1830MHz.

JuanTutors 2005-02-07 01:54

[QUOTE=James Heinrich][...]set [i]Options|Preferences|Iterations between screen ouputs[/i] to 5000.[...][/QUOTE]

Wouldn't it work to just set [i]Options|Preferences|Iterations between results file ouputs[/i] to 5000 and then just copy and paste?

James Heinrich 2005-02-07 02:52

Sure, whatever works for you, as long as you can give me the numbers as [i]marc[/i] did above is perfect.


All times are UTC. The time now is 23:20.

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