mersenneforum.org  

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

Reply
 
Thread Tools
Old 2004-08-25, 03:26   #1
JuanTutors
 
JuanTutors's Avatar
 
Mar 2004

3·167 Posts
Default Ram allocation

[pre]
Exponent Minimum Reasonable Desirable
-------- ------- ---------- ---------
6000000 12MB 23MB 33MB
10000000 19MB 36MB 53MB
33000000 65MB 125MB 185MB
[/pre]
Is this based on that funny equation to decide how far to factor, "factoring_cost < chance_of_finding_factor * 2 * primality_test_cost" or something else? I am trying to figure out how much ram to allocate. (Please answer if you know the answer. It doesn't make sense to speculate here.)
JuanTutors is offline   Reply With Quote
Old 2004-08-25, 09:30   #2
dave_0273
 
dave_0273's Avatar
 
Oct 2003
Australia, Brisbane

2×5×47 Posts
Default

That much RAM is only used during stage 2 of p-1 testing. If you are doing LL testing, that will only be once a month roughly. Therefore, I would give everything you can to prime95. For example, if you have 512mb of RAM on your computer, work out how much you use normally and give the rest to prime95. I would be suggesting around the 250mb to 300mb. The more RAM that you allocate, the larger the bounds that will be run during p-1 factoring and the better the change for finding a prime.

I have a gig of RAM on both of my computers, and I do soley p-1 tests in mersenne-aries. I give 800mb of RAM to prime95 and i don't have any problems with slow down. I sometimes stop prime95 when I am playing a demanding game, but that is it.
dave_0273 is offline   Reply With Quote
Old 2004-08-25, 10:04   #3
ET_
Banned
 
ET_'s Avatar
 
"Luigi"
Aug 2002
Team Italia

112728 Posts
Default

Quote:
Originally Posted by dave_0273
I have a gig of RAM on both of my computers, and I do soley p-1 tests in mersenne-aries. I give 800mb of RAM to prime95 and i don't have any problems with slow down. I sometimes stop prime95 when I am playing a demanding game, but that is it.
I have 1 GB of RAM on my P-1 devoted computer, and gave Prime95 896 MB of RAM as I only use it for factoring. It tends to swap a bit for 3/5 of his work (stage 2) iff I try to open other programs. Windows XP runs with 128 MB of RAM.

Luigi
ET_ is offline   Reply With Quote
Old 2004-08-25, 16:01   #4
nfortino
 
nfortino's Avatar
 
Nov 2003

3·5·11 Posts
Default

Quote:
Originally Posted by dominicanpapi82
[pre]
Exponent Minimum Reasonable Desirable
-------- ------- ---------- ---------
6000000 12MB 23MB 33MB
10000000 19MB 36MB 53MB
33000000 65MB 125MB 185MB
[/pre]
Is this based on that funny equation to decide how far to factor, "factoring_cost < chance_of_finding_factor * 2 * primality_test_cost" or something else? I am trying to figure out how much ram to allocate. (Please answer if you know the answer. It doesn't make sense to speculate here.)
These numbers come from the FFT size required for each exponent. However, these numbers should not concern you unless you are specifically looking to do p-1 work. In general, you should allocate as much memory as you are comfortable with as long as that does not cause thrashing. If you experience thrashing with 60 MB assigned to prime95, you most certainly should NOT assign 65 MB because that is the minimum for a 10M-digit exponent. Also keep in mind this memory will only be used in stage 2 of the p-1 test.
nfortino is offline   Reply With Quote
Old 2004-08-25, 16:19   #5
JuanTutors
 
JuanTutors's Avatar
 
Mar 2004

3·167 Posts
Default

The thing is, the probability of finding a factor obviously goes up as you raise the ram allocation. But the amount of time it takes to do the whole test obviously also goes up. What I want to know is, whether I will save TIME by allocating so much extra ram. Saving time is my ultimate goal.
JuanTutors is offline   Reply With Quote
Old 2004-08-25, 16:38   #6
dave_0273
 
dave_0273's Avatar
 
Oct 2003
Australia, Brisbane

7268 Posts
Default

The time taken to do a p-1 test does not change. If you allocate a small amount or gigs of RAM, the test still takes the same amount of time. That is why we always say to allocate as much as you can. You aren't going to get through the test any quicker, but you are more likely to find a factor.
dave_0273 is offline   Reply With Quote
Old 2004-08-25, 18:50   #7
patrik
 
patrik's Avatar
 
"Patrik Johansson"
Aug 2002
Uppsala, Sweden

42510 Posts
Default

The time is roughly the same, but I think it can change slightly since Prime95 may choose other limits B1 and B2 if you change the memory settings. The increase in probability of finding a factor is also very small, so dominicanpapi82, your question makes sense. I don't know the answer myself, but hopefully George or someone else figured out the optimal values to use for saving time for the project.
patrik is offline   Reply With Quote
Old 2004-08-25, 19:51   #8
garo
 
garo's Avatar
 
Aug 2002
Termonfeckin, IE

3×919 Posts
Default

the program automatically figures out the optimal values based on the memory available. The objective of the program is to maximize project throughput which essentially boils down to finding more factors per unit time. So even though the P-1 test takes longer, the increased probability of finding a factor compensates for it.

But as George has mentioned several times, this increase in the throughput is so minimal that it doesn't really matter in the long run so you should allocate whatever you are comfortable with and the three figures above are just that: minimum, reasonable, desirable.
garo is offline   Reply With Quote
Old 2004-08-27, 19:59   #9
JuanTutors
 
JuanTutors's Avatar
 
Mar 2004

1111101012 Posts
Default

I am speculating on how stage 2 works because the theory on stage 2 is more a programming thing and not separate from stage 1, and I can't find a description of the code. But this is what I gather:

1. Stage 1 calculates x := 3^(2*E*p), and calculates GCD[x-1,Mp]. (Here E is the product of all primes below that bound B1.) If it fails it goes to stage 2.

2. Stage 2 works how? (Please respond if I'm wrong) It starts from x, and with lower bound B1 and upper bound B2, it calculates and stores x^q for each prime q between B1 and B2. It goes fast, since it can calculate x^q, and then for the next prime r we have x^r = (x^q)*(x^[r-q]), so it just has to calculate x^[r-q] and multiply (x^q)*(x^[r-q]). Then for the next prime s it just has to calculate (x^r)*(x^[s-r]), then (x^s)*(x^[t-s]), etc. Then it calculates GCD[output - 1,Mp].

PLEASE let me know if I'm wrong, because I am just speculating here. If this is so fast, then why bother with stopping when the amount of ram allocated is filled? i.e. why not just run stage 2 until all the allocated ram is filled, check the GCD, clear the ram, run it again until the allocated ram is filled, check GCD again, etc until the benefit of doing this exceeds the cost?

Judging from when I try different amounts of ram allocation, the probability of finding a factor goes up pretty quickly. Here's my data for M33798607. "Chance" is what Prime95 said the chance of finding a factor is.
[pre]
Ram Allocated (MB) B1 B2 Chance (%) Time
------------------ ------- -------- ---------- -------
50 1000000 1000000 7.92 NO CLUE
100 425000 7225000 11.2
150 420000 9765000 11.8
200 430000 13437500 12.4
250 430000 14835000 12.5
300 425000 15725000 12.6
350 425000 16681250 12.7
400 425000 17212500 12.8
[/pre]

Last fiddled with by JuanTutors on 2004-08-27 at 20:01 Reason: Just formatting a bit
JuanTutors is offline   Reply With Quote
Old 2004-08-27, 20:56   #10
JuanTutors
 
JuanTutors's Avatar
 
Mar 2004

3×167 Posts
Default

In case I wasn't clear, what I meant was run it until the allocated ram is filled, check GCD, and IF NO FACTOR IS FOUND, clear the ram, CONTINUE WITH THE NEXT PRIME, etc until the benefit of doing this exceeds the cost.

Quote:
Originally Posted by dominicanpapi82
...i.e. why not just run stage 2 until all the allocated ram is filled, check the GCD, clear the ram, run it again until the allocated ram is filled, check GCD again, etc until the benefit of doing this exceeds the cost?
JuanTutors is offline   Reply With Quote
Old 2004-08-28, 18:33   #11
axn
 
axn's Avatar
 
Jun 2003

2·52·97 Posts
Default

Actually, the RAM is used for a different purpose. It is used to store the deltas, i.e., x^[r-q], x^[s-r], x^[t-s] etc..., not the actual x^r,x^s...

Remeber, the differences between consecutive primes will be even numbers, usually small, like 2,4,6,8, etc... So prime95 calculates x^2, x^4, x^6, x^8, etc... upto the available memory. If the delta between two prime numbers is not available in this pre-calculated list, a combination of two or more of these deltas have to be used. That's why more memory means faster Stage 2 (or alternatively, deeper Stage 2 with same runtime)

EDIT:- Since the deltas are needed all the way till the end of calculation, you can't clear them

Last fiddled with by axn on 2004-08-28 at 18:35
axn is online now   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sieve re-allocation in PFGW carpetpool Information & Answers 1 2017-03-02 13:50
Memory allocation pjaj Information & Answers 7 2011-02-12 02:57
Time allocation Primeinator Software 3 2006-01-18 23:18
Memory Allocation. A_Pryme Software 7 2005-02-12 02:28
Improving the RAM allocation for Prime 95 Matthias C. Noc Software 3 2004-02-12 19:34

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

Thu Jan 28 09:41:06 UTC 2021 up 56 days, 5:52, 0 users, load averages: 2.50, 2.59, 2.35

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.