mersenneforum.org  

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

Reply
 
Thread Tools
Old 2017-02-08, 11:06   #1
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
Jun 2011
Thailand

72·197 Posts
Default CLLR Bug

I found an interesting bug in CLLR. I have a series of .prp files coming from sieving, all about a thousand lines long, in the right (pfgw) format. They are for different bases and contain different thingies inside, so they can not be combined in a single file. Therefore, I launch cllr with the (dos) command:

> for %p in (*.prp) do cllr64 -d -oStopOnSuccess=1 %p

This works perfectly as long as I do not find any prime (and I am always happy with a single prime per file). The command goes through all files with .prp extension, in sequence; for people who are not fans of old dos batches, it is equivalent with the series of commands (assuming I put all in a batch file):

>cllr64 -d -oStopOnSuccess=1 file1.prp
>cllr64 -d -oStopOnSuccess=1 file2.prp
>cllr64 -d -oStopOnSuccess=1 file3.prp
...etc

but it is more convenient if i have a thousand such files.

The problems start when I find a prime. Because the cllr makes its ini file in which it saves the current line number in the current prp file, when a prime is found (say at line 600 in the file1.prp) than the job is done, and cllr moves to file2.prp, etc., but it continues the second file from line 601 !!!

It took me a while to find out what happens. The "PgenOutputFile=" and "PgenInputFile=" lines (and other lines) in the .ini are rewritten with the new files, but the "PgenLine=" is not, and the beginning of the second file up to the line PgenLine (600 in the example) is skipped.

This doesn't happen if no prime is found in a file; in this case work completed is set to 1, and the ini file is completely rewritten when the base (file) is changes, so the second file is tested from the first line (as it is supposed to be).

At least PFGW is more clever in this direction, as it makes a checksum of the current line, and if there is no match, it starts from scratch. This is very good in case some stupid thing happens (like me editing the file, deleting it, PEBCAK, or whatever). Some work may be doubled if the user doesn't know what he is doing, but no work is skipped, like it just happened to me right now, skipping a prime (2*1487^36432-1) which should have been found few days ago.

Last fiddled with by LaurV on 2017-02-08 at 11:12
LaurV is offline   Reply With Quote
Old 2017-02-08, 16:01   #2
Batalov
 
Batalov's Avatar
 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2

2·47·101 Posts
Default

CLLR likely inherits this bug from LLR.

If plain LLR is started in a folder with existing llr.ini which has PgenLine=63 (for example) and WorkDone=0, then it will continue from line 63 even if you change the name of the file. This should be corrected in both programs.

(Also, if you edit or completely replace the file, a similar thing will happen. This one is a more subtle bug - we can call it a feature. You cannot fix that without checksums.).

Workarounds: One solution is to remove llr.ini after each run. This can be undesirable if you have some special options set (error check or FFTIncrement or other); in this case, you can have a master llr.ini with only persistent options and copy it over from master location before each LLR launch.
Batalov is offline   Reply With Quote
Old 2017-02-09, 02:59   #3
LaurV
Romulan Interpreter
 
LaurV's Avatar
 
Jun 2011
Thailand

72×197 Posts
Default

Quote:
Originally Posted by Batalov View Post
you can have a master llr.ini with only persistent options and copy it over from master location before each LLR launch.
...or use a lot of -oOption=value switches, if you want to keep all in a single line command (like I wanted, to be able to write it down every time, and not put it in a file which I will forget how to call, if it has parameters, etc, hehe, actually you are a genius! You gave me the idea! Thanks!)

I found out that the -o overwrites physically the correspondent lines in the ini file, so I just modified my command line into:

>for %p in (*.prp) do cllr64 -d -oStopOnSuccess=1 -oPgenLine=0 %p

and now it works perfectly, every time a job is finished, with or without success, the incriminated line is overwritten and the next file starts from scratch.

Call it a feature...

Test case (it runs in about 2 minutes all together, you need srsieve.exe and cllr64.exe in the folder or accessible in the path):

Preliminary, a batch file called testsieve.bat (or 3 individual commands):

Code:
srsieve -p 2 -P 1e9 -S 2 -n 2 -N 1e3 -m 1e7 -G "2*67^n-1"
srsieve -p 2 -P 1e9 -S 2 -n 2 -N 1e3 -m 1e7 -G "2*152^n-1"
srsieve -p 2 -P 1e9 -S 2 -n 2 -N 1e3 -m 1e7 -G "2*284^n-1"
Not working (one prime missed):
Code:
for %p in (*.prp) do cllr64 -d -oStopOnSuccess=1 %p
rename lresults.txt into lresults.bad (to avoid overwriting)

Working (no primes missed, correct ini file):
Code:
for %p in (*.prp) do cllr64 -d -oStopOnSuccess=1 -oPgenLine=0 %p
Compare the two lresult files.

edit: of course, in that case you have to take care what files and what lines from the last-worked file you delete when you resume (like when the work was interrupted by electricity break, whatever). Otherwise you will involuntarily do all the work again from scratch (but this is not a problem anymore for me - of course, it should be better if this "little feature" is fixed, but for now, I can handle it).

Last fiddled with by LaurV on 2017-02-09 at 03:13
LaurV is offline   Reply With Quote
Old 2017-02-09, 08:37   #4
pepi37
 
pepi37's Avatar
 
Dec 2011
After milion nines:)

1,451 Posts
Default

Maybe it is not irrelevant, but one option that remove processed candidate from prp file will be good one.I am sure many of us will use such feature and it not be too hard to implement. ( like Prime95 do)
pepi37 is online now   Reply With Quote
Old 2017-02-20, 11:28   #5
Jean Penné
 
Jean Penné's Avatar
 
May 2004
FRANCE

22·5·29 Posts
Default CLLR bug fixed in LLR version 3.8.19

Hi,
Now, if the input file name (PgenInputFile parameter) has changed while working with the same .ini file, the PgenLine parameter is forced to one.
I made this update to fix the "CLLR bug" found by LaurV.
I think it will be satisfactory.
Regards,
Jean
Jean Penné is offline   Reply With Quote
Reply



All times are UTC. The time now is 17:33.


Sun Aug 1 17:33:34 UTC 2021 up 9 days, 12:02, 0 users, load averages: 1.50, 1.52, 1.39

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.