mersenneforum.org PRPNet released!
 Register FAQ Search Today's Posts Mark Forums Read

2008-12-30, 19:56   #34
mdettweiler
A Sunny Moo

Aug 2007
USA (GMT-5)

3·2,083 Posts

Quote:
 Originally Posted by nuggetprime The "Res64 not found" error also happened to me,also with composite candidates.
Ah-ha! After looking through the source code to PRPnet a bit, I think I know what's going on here.

I found this block of code in Work.cpp:
Code:
   if (useLLR)
{
if (strstr(line, "is a probable prime"))
{
strcpy(w_WorkUnit[i_CompletedWorkUnits].s_Residue, "PRP");
prpFound = 1;
return true;
}

ptr = strstr(line, "RES64:");
if (ptr)
{
ptr += 7;
endOfResidue = strchr(ptr, '.');
if (!endOfResidue)
{
m_Log->LogMessage("%s: Could not find '.' terminator in [%s].  Is llr broken?", s_WorkSuffix, fileName);
exit(0);
}
*endOfResidue = 0;

strcpy(w_WorkUnit[i_CompletedWorkUnits].s_Residue, ptr);
}
else
{
m_Log->LogMessage("%s: Could not find RES64 residue [%s].  Is llr broken?", s_WorkSuffix, fileName);
exit(0);
}
}
It seems that PRPnet is using the character "." to find the end of the Res64 in lresults.txt. However, for power-of-2 numbers, LLR does not output that character after the residue. The following are examples of typical LLR outputs for composite numbers:
Code:
3*2^54323-1 is not prime.  LLR Res64: CAF8C7B1A533B371  Time : 5.736 sec.
3*2^54324+1 is not prime.  Proth RES64: 630878F508F488B0  Time : 5.925 sec.
3*3^54324+1 is not prime.  RES64: A87CCA3A88CF549B.  OLD64: DCA13E0E801D9166  Time : 74.396 sec.
As you can see, only when LLR does a PRP test (for non-power-of-2 bases, which PRPnet uses Phrot for anyway) does it place a period after the Res64. Thus, PRPnet will not be able to read the Res64 from lresults.txt properly for such numbers.

There is also a similar bug regarding primes found on power-of-2 bases with LLR. PRPnet, as can be seen in the following selection from Work.cpp, looks for the text "is a probable prime" in lresults.txt to determine primality:
Code:
      if (strstr(line, "is a probable prime"))
{
strcpy(w_WorkUnit[i_CompletedWorkUnits].s_Residue, "PRP");
prpFound = 1;
return true;
}
However, LLR only outputs "is a probable prime" if it's performed a PRP test--again, only for non-power-of-2 numbers. For power-of-2 numbers, it just says "k*2^n-1 is prime! Time: x sec."

I'll see if I can come up with a band-aid fix, though it will probably be very kludgy since I don't know C++. (Or I guess I could just wait for Rogue to fix it. )

Max

Last fiddled with by mdettweiler on 2008-12-30 at 19:56 Reason: typo

2008-12-30, 20:14   #35
Mini-Geek
Account Deleted

"Tim Sorbera"
Aug 2006
San Antonio, TX USA

102538 Posts

Quote:
 Originally Posted by mdettweiler As you can see, only when LLR does a PRP test (for non-power-of-2 bases, which PRPnet uses Phrot for anyway) does it place a period after the Res64. Thus, PRPnet will not be able to read the Res64 from lresults.txt properly for such numbers.
I don't recall where it says so or if the documentation is even correct on this point, but I think that if you specify an llrexe but not a phrotexe, it uses LLR for PRP, non-power-of-2 base, tests as well as power-of-2 base primality tests.
Edit: Ah, here it is, the readme.txt file in the client folder:
Code:
       llrexe=      This is the LLR executable that will be used to perform
a PRP test.
phrotexe=    This is the Phrot execuate that will be used to perform
a PRP test.

If both llrexe and phrotexe are specified, then llrexe will be used when
the base is a power of 2 and prp will be used for all other bases.

Last fiddled with by Mini-Geek on 2008-12-30 at 20:17

 2008-12-30, 20:16 #36 nuggetprime     Mar 2007 Austria 12E16 Posts The fix: In Work.cpp: 1) Change line #394 to: if (strstr(line, "is prime!")) 2) Change line #401 to: ptr = strstr(line, "LLR Res64:"); 3)Change line #405 to: endOfResidue = strstr(ptr, " Time :"); Edit:still problems: server doesn't get residue. nugget Last fiddled with by nuggetprime on 2008-12-30 at 20:24 Reason: Changed fix!
2008-12-30, 20:22   #37
mdettweiler
A Sunny Moo

Aug 2007
USA (GMT-5)

3×2,083 Posts

Quote:
 Originally Posted by Mini-Geek I don't recall where it says so or if the documentation is even correct on this point, but I think that if you specify an llrexe but not a phrotexe, it uses LLR for PRP, non-power-of-2 base, tests as well as power-of-2 base primality tests. Edit: Ah, here it is, the readme.txt file in the client folder: Code:  llrexe= This is the LLR executable that will be used to perform a PRP test. phrotexe= This is the Phrot execuate that will be used to perform a PRP test. If both llrexe and phrotexe are specified, then llrexe will be used when the base is a power of 2 and prp will be used for all other bases.
Quote:
 Originally Posted by nuggetprime The fix: In Work.cpp: 1) Change line #394 to: if (strstr(line, "is prime!")) 2) Change line #401 to: ptr = strstr(line, "LLR Res64:"); 3)Change line #405 to: endOfResidue = strstr(ptr, " Time :"); That should work. nugget
@Nugget: as Mini-Geek said, if you don't specify a Phrot executable to PRPnet, it will use LLR for PRP tests. Also, the output for Proth tests (k*2^n+1) is slightly different than that for LLR tests (k*2^n-1), so a complete fix would have to account for all of those.

I've put together a fix that I *think* is complete for all possible scenarios; I'll post it here after I've tested it a bit more.

 2008-12-30, 20:25 #38 nuggetprime     Mar 2007 Austria 2·151 Posts Got the first PRP with PRPnet: 39638582*3^75684-1 is PRP!
2008-12-30, 20:35   #39
mdettweiler
A Sunny Moo

Aug 2007
USA (GMT-5)

624910 Posts

Quote:
 Originally Posted by nuggetprime Got the first PRP with PRPnet: 39638582*3^75684-1 is PRP!
Congratulations! I'll go check the server shortly now to see exactly how it outputs results when it finds a PRP, so I know how I need to write my Perl script. I've already checked this using my local server setup, but I'd like to see it in a "real" environment for confirmation.

In other news, I've tested my kludgy fix to Work.cpp and it seems to work fine, for Riesel numbers at least. (I haven't tested it with Proth or non-power-of-2 numbers.) I've attached the fixed prpclient binary to this message, along with the source. (Note: if you want to compile the source yourself, be sure to run "make" with the -k and -i command line flags. Otherwise it will refuse to build due to my terrible C++ code. )
Attached Files
 band-aid fix for prpclient bug.zip (33.1 KB, 75 views)

 2008-12-30, 20:40 #40 nuggetprime     Mar 2007 Austria 2×151 Posts For me it works without these options.
2008-12-30, 21:24   #41
mdettweiler
A Sunny Moo

Aug 2007
USA (GMT-5)

11000011010012 Posts

Quote:
 Originally Posted by nuggetprime For me it works without these options.
Hmm...I guess your system's make must be a little more lenient than mine. Out of curiosity, what distro are you using?

In other news: I've just about completed my PRPnet-to-LLRnet results converter script. It awaits final testing...after lunch.

 2008-12-30, 21:54 #42 rogue     "Mark" Apr 2003 Between here and the 22×1,429 Posts I'll investigate the base 2 issues and post a fix later.
2008-12-30, 23:26   #43
rogue

"Mark"
Apr 2003
Between here and the

22×1,429 Posts

Quote:
 Originally Posted by mdettweiler Code: ABC $a*$b^\$c-1 745 2
This is a bug in LLR. The PRPNet client does not write to the work*.out file.

I have attached PRPNet 1.0.1. It now correctly handles base 2 results from LLR. Of note phrot base 2 residues do not match up to LLR base 2 residues. I will have to see how LLR does base 2 tests and see if I can get phrot to do the same. I make no promises.

Here is what I've added to history.txt
Code:
Version 1.0.1:  December 2008 - Patch Release
prpclient:  LLR output for base 2 tests differs from other bases, thus it has
to be parsed differently.
LLR for Proth numbers (k*2^n+1) performs a primality test, thus
check for primality and report the number as prime instead of
as a PRP.
prpserver:  Check for numbers marked as Prime by LLR.
Attached Files
 prpnet.zip (42.4 KB, 80 views)

Last fiddled with by rogue on 2008-12-30 at 23:26

2008-12-30, 23:43   #44
mdettweiler
A Sunny Moo

Aug 2007
USA (GMT-5)

3×2,083 Posts

Quote:
 Originally Posted by rogue This is a bug in LLR. The PRPNet client does not write to the work*.out file. I have attached PRPNet 1.0.1. It now correctly handles base 2 results from LLR. Of note phrot base 2 residues do not match up to LLR base 2 residues. I will have to see how LLR does base 2 tests and see if I can get phrot to do the same. I make no promises. Here is what I've added to history.txt Code: Version 1.0.1: December 2008 - Patch Release prpclient: LLR output for base 2 tests differs from other bases, thus it has to be parsed differently. LLR for Proth numbers (k*2^n+1) performs a primality test, thus check for primality and report the number as prime instead of as a PRP. prpserver: Check for numbers marked as Prime by LLR.
Okay, thanks. Oh, and as to why the residuals don't match up between LLR's base 2 tests and Phrot's: that's because whereas Phrot does PRP tests for everything, LLR does an LLR test (for k*2^n-1) or a Proth test (for k*2^n+1) on base 2 numbers. The LLR and Proth tests are both faster than PRP tests for base 2, and give a definite answer regarding primality, not just "probably prime". The residuals are different from that produced by running a PRP test on the same base 2 numbers.

For example, if you run the PRP program (the predecessor to LLR), which does PRP tests on everything, including base 2 (like Phrot), the residuals it produces will be identical to Phrot's.

 Similar Threads Thread Thread Starter Forum Replies Last Post rogue Software 152 2020-03-30 17:01 ltd Prime Sierpinski Project 86 2012-06-06 02:30 rogue Software 84 2011-11-16 21:20 Joe O Sierpinski/Riesel Base 5 1 2010-10-22 20:11 rogue Conjectures 'R Us 220 2010-10-12 20:48

All times are UTC. The time now is 00:49.

Fri Jun 5 00:49:06 UTC 2020 up 71 days, 22:22, 0 users, load averages: 1.54, 1.26, 1.20