20210521, 20:03  #1 
"David Kirkby"
Jan 2021
Althorne, Essex, UK
448_{10} Posts 
Optimal bounds on B1/B2 factoring and Max mem utilization.
Looking at the active assignments on GIMPS, it's clear different people have different interests, so do different worktypes. Some do mainly PRP tests, others do mainly factorisation etc. There are many worktypes to fit different peoples interest. My own personal interest is in trying to find the next Mersenne Prime. I don't care how I do this  whether its a P1 factoring followed by a PRP test, or just do a PRP test. If ones interest is only trying to find the next Mersenne Prime, and not in any factor that may be found by P1 factorisation, is it counterproductive to give a lot of RAM to mprime, so it uses different bounds for B1 and B2 during P1 factoring? I believe the larger B2 has more chance of finding a factor, so avoiding a long PRP test, but I suspect it also uses more CPU time. The page describing the mathematics of GIMPS, and in particular P1 factoring. https://www.mersenne.org/various/math.php#p1_factoring says So how does GIMPS intelligently choose B1 and B2? We use a variation of the formula used in trial factoring. We must maximize: chance_of_finding_factor * primality_test_cost  factoring_cost Is that exactly what is done in the very latest code by default  particularly if you give mprime hundreds of GB of RAM? There's a calculator at https://www.mersenne.ca/prob.php with a link right at the bottom of the page for more information after you click "Calculate" once. Reading that is interesting, as it says the minimum bounds on B1 and B2, assume no residual value in the any factor found.
I am wondering if I am shooting myself in the foot, as we say in England, by letting mprime use several hundred GB of RAM during P1 factoring. Can I use the calculator at https://www.mersenne.ca/prob.php to chose optimal bounds on B1 and B2 for finding a prime, ignoring any value in knowing a factor? If so, can I tweak the line in worktodo.txt to use those optimal settings? Dave Last fiddled with by drkirkby on 20210521 at 20:04 Reason: Remove those annoying spaces I forgot to in preview 
20210522, 02:58  #2 
Jun 2003
5·29·37 Posts 
The calculator on mersenne.ca is not quite uptodate.
P95 (all versions) calculate optimal B1/B2 that increases overall GIMPS thruput, as explained in the math page. If larger memory allocation uses larger B1/B2, rest assured, the program has calculated that, in the long run, this will minimize the overall time spent in P1 + PRP. I'll reiterate my advice from previous thread: give the program the maximum amount of RAM you can spare and let it do its thing. 
20210522, 10:35  #3  
"David Kirkby"
Jan 2021
Althorne, Essex, UK
1C0_{16} Posts 
Quote:
I believe there's an option to set the maximum memory mprime will use. I guess I should set that too, but I doubt it will ever be an issue. Dave 

20210522, 11:20  #4 
"Vincent"
Apr 2010
Over the rainbow
2×7^{2}×29 Posts 
If I remember right there is an option to pause stage 2 while you lack memory.

20210522, 15:11  #5 
1976 Toyota Corona years forever!
"Wayne"
Nov 2006
Saskatchewan, Canada
12075_{8} Posts 
From undoc.txt ... there may be other parms of interest
Some options in prime.txt can be configured to have different values
at different times of the day using this syntax: Option=setting where setting is defined as value OR value during listoftimes else setting At present, only Memory, MaxHighMemWorkers, PauseWhileRunning, LowMemWhileRunning, and PauseCheckInterval support this during/else syntax. Also note you can no longer edit these options from the user interface. To use this feature, you must manually edit the prime.txt/local.txt file. An example in local.txt: Memory=500 during 15/17:3024:00,15/0:008:30,67/0:0024:00 else 200 The 15 and 67 refer to days of the week, with Monday=1 and Sunday=7. The time portion refers to the hours of the day based on a 24hour clock. You do not need to specify days of the week (e.g. 17/0:008:00 is the same as 0:008:00). The above example lets the program use 500MB during the week from 5:30PM to 8:30AM and all day on weekends. Otherwise (weekdays from 8:30AM to 5:30PM), the program can use only 200MB. In rare cases, users have reported the program can interfere with the performance of some programs such as disk defragmenters and some games. You can pause the program automatically when these programs are running by adding this line to prime.txt: PauseWhileRunning=prog1[n1],prog2[n2],etc The [n1], [n2] values are optional and indicate the number of worker threads to pause when prog1 and prog2 are running. The default value for n1 and n2 is to pause all worker threads. Note that the program will pause if the program name matches any part of the running program's file name. That is "foobar" will match "c:\foobar.exe", "C:\FOOBAR\name.exe", and even "C:\myfoobarprog.exe". Also, if prog1 is "*" the program will pause no matter what. Examples: PauseWhileRunning=*[1] during 67/2:003:00 PauseWhileRunning=* during 23:0024:00 else decomp[1],mygame[2] The first example pauses one worker thread on Saturday and Sunday between 2AM and 3AM. The second example pauses all workers between 11PM and 12AM and pauses 1 worker if decomp is running and 2 if mygame is running. LowMemWhileRunning is similar to PauseWhileRunning. This option does not allow workers to use a lot of memory. This example in prime.txt will make sure the program is using the minimum amount of memory possible while photoshop is running: LowMemWhileRunning=Photoshop Since P1 stage 2 runs faster with more memory available you can have the program only run stage 2 at night when more memory is available. In prime.txt set: OnlyRunStage2WithMaxMemory=1 The Memory=n setting in local.txt refers to the total amount of memory the program can use. You can also put this in the [Worker #n] section to place a maximum amount of memory that one particular worker can use. You can set MaxHighMemWorkers=n in local.txt. This tells the program how wany workers are allowed to use lots of memory. This occurs doing stage 2 of P1 or ECM on mediumtolarge numbers. Default is available memory / 1GB. You can set a threshold for what is considered lots of memory in MaxHighMemWorkers calculations. In local.txt, set: HighMemThreshold=n (default is 50) The value n is in MB. 
20210522, 17:16  #6  
"David Kirkby"
Jan 2021
Althorne, Essex, UK
2^{6}·7 Posts 
Quote:
I think there's the option to limit the amount of RAM a worker can use. If I could limit the amount of RAM a worker can use to be 340 GB, and the amount for P1 factoring to be 350 GB, then if both workers try to do stage2 at the same time, the second one would only have 10 GB. With only one workstation having much memory and lots of cores, and each exponent taking around 2 days to complete a task, I can manually keep an eye on what is happening. If I had lots of computers that would not be possible to do, but all the other computers I have access to don't have enough cores to make it worthwhile running more than one worker. 

20210522, 17:27  #7  
"David Kirkby"
Jan 2021
Althorne, Essex, UK
2^{6}×7 Posts 
Quote:
Since each exponent is taking about 48 hours to test, as long as one exponent is about 50% complete whilst the other is doing its P1 factoring, both workers should not want to do P1 factoring at the same time. But that does require me to keep an eye on the progress. But with only one workstation, that is not too difficult. Dave 

20210522, 17:41  #8 
"Vincent"
Apr 2010
Over the rainbow
2×7^{2}×29 Posts 
citing 'undoc'
Code:
You can set MaxHighMemWorkers=n in local.txt. This tells the program how wany workers are allowed to use lots of memory. This occurs doing stage 2 of P1, P+1, or ECM on mediumtolarge numbers. Default is available memory / 1GB. You can set a threshold for what is considered lots of memory in MaxHighMemWorkers calculations. In local.txt, set: HighMemThreshold=n (default is 50) The value n is in MB. 
20210525, 16:22  #9 
"David Kirkby"
Jan 2021
Althorne, Essex, UK
2^{6}×7 Posts 
Why can't I set RAM limit for P1 factoring higher?
I have a workstation with 384 GB RAM. The maximum memory I can set in mprime for P1 factoring is 339.799988 GB, I could give mprime 370 GB, as 14 GB is more than enough for the rest of the system most of the time. It's only when running electromagnetic simulation software that I use a lot of RAM. Is the 339.799988 GB the maximum mprime could use, or is the program making a decision based on what it thinks is reasonable for the computer & operating system?
Dave Last fiddled with by drkirkby on 20210525 at 16:25 
20210525, 18:12  #10 
"Jacob"
Sep 2006
Brussels, Belgium
3·5·11^{2} Posts 
I suppose the program uses a percentage to compute the minimum quantity of memory not to use. In your system the percentage is too high, but is not an ordinary system memorywise. On 16 GiB system that percentage would reserve about 2 GiB.
Jacob 
20210525, 19:12  #11  
"David Kirkby"
Jan 2021
Althorne, Essex, UK
2^{6}×7 Posts 
Quote:
Dave 

Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
How to put the optimal cores for factoring numbers in Pari Droid...  rockzur  Factoring  0  20200809 04:54 
What Bounds to choose, and what are Bounds  144  Information & Answers  5  20170315 13:36 
Optimal ECM bounds  henryzz  GMPECM  14  20110609 17:04 
Hyperthreading and CPU utilization.  drew  Hardware  19  20060415 15:46 
Question about factoring bounds  drew  Software  4  20051122 03:23 