20040825, 03:26  #1 
Mar 2004
3·167 Posts 
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.) 
20040825, 09:30  #2 
Oct 2003
Australia, Brisbane
2×5×47 Posts 
That much RAM is only used during stage 2 of p1 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 p1 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 p1 tests in mersennearies. 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. 
20040825, 10:04  #3  
Banned
"Luigi"
Aug 2002
Team Italia
11272_{8} Posts 
Quote:
Luigi 

20040825, 16:01  #4  
Nov 2003
3·5·11 Posts 
Quote:


20040825, 16:19  #5 
Mar 2004
3·167 Posts 
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.

20040825, 16:38  #6 
Oct 2003
Australia, Brisbane
726_{8} Posts 
The time taken to do a p1 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.

20040825, 18:50  #7 
"Patrik Johansson"
Aug 2002
Uppsala, Sweden
425_{10} Posts 
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.

20040825, 19:51  #8 
Aug 2002
Termonfeckin, IE
3×919 Posts 
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 P1 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. 
20040827, 19:59  #9 
Mar 2004
111110101_{2} Posts 
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[x1,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^[rq]), so it just has to calculate x^[rq] and multiply (x^q)*(x^[rq]). Then for the next prime s it just has to calculate (x^r)*(x^[sr]), then (x^s)*(x^[ts]), 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 20040827 at 20:01 Reason: Just formatting a bit 
20040827, 20:56  #10  
Mar 2004
3×167 Posts 
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:


20040828, 18:33  #11 
Jun 2003
2·5^{2}·97 Posts 
Actually, the RAM is used for a different purpose. It is used to store the deltas, i.e., x^[rq], x^[sr], x^[ts] 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 precalculated 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 20040828 at 18:35 
Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Sieve reallocation in PFGW  carpetpool  Information & Answers  1  20170302 13:50 
Memory allocation  pjaj  Information & Answers  7  20110212 02:57 
Time allocation  Primeinator  Software  3  20060118 23:18 
Memory Allocation.  A_Pryme  Software  7  20050212 02:28 
Improving the RAM allocation for Prime 95  Matthias C. Noc  Software  3  20040212 19:34 