mersenneforum.org  

Go Back   mersenneforum.org > Prime Search Projects > Conjectures 'R Us

Reply
 
Thread Tools
Old 2008-12-30, 19:56   #34
mdettweiler
A Sunny Moo
 
mdettweiler's Avatar
 
Aug 2007
USA (GMT-5)

186916 Posts
Default

Quote:
Originally Posted by nuggetprime View Post
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
mdettweiler is offline   Reply With Quote
Old 2008-12-30, 20:14   #35
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

426710 Posts
Default

Quote:
Originally Posted by mdettweiler View Post
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
Mini-Geek is offline   Reply With Quote
Old 2008-12-30, 20:16   #36
nuggetprime
 
nuggetprime's Avatar
 
Mar 2007
Austria

2×151 Posts
Default

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!
nuggetprime is offline   Reply With Quote
Old 2008-12-30, 20:22   #37
mdettweiler
A Sunny Moo
 
mdettweiler's Avatar
 
Aug 2007
USA (GMT-5)

3·2,083 Posts
Default

Quote:
Originally Posted by Mini-Geek View Post
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 View Post
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.
mdettweiler is offline   Reply With Quote
Old 2008-12-30, 20:25   #38
nuggetprime
 
nuggetprime's Avatar
 
Mar 2007
Austria

2×151 Posts
Default

Got the first PRP with PRPnet:
39638582*3^75684-1 is PRP!
nuggetprime is offline   Reply With Quote
Old 2008-12-30, 20:35   #39
mdettweiler
A Sunny Moo
 
mdettweiler's Avatar
 
Aug 2007
USA (GMT-5)

3·2,083 Posts
Default

Quote:
Originally Posted by nuggetprime View Post
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
File Type: zip band-aid fix for prpclient bug.zip (33.1 KB, 85 views)
mdettweiler is offline   Reply With Quote
Old 2008-12-30, 20:40   #40
nuggetprime
 
nuggetprime's Avatar
 
Mar 2007
Austria

2×151 Posts
Default

For me it works without these options.
nuggetprime is offline   Reply With Quote
Old 2008-12-30, 21:24   #41
mdettweiler
A Sunny Moo
 
mdettweiler's Avatar
 
Aug 2007
USA (GMT-5)

186916 Posts
Default

Quote:
Originally Posted by nuggetprime View Post
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.
mdettweiler is offline   Reply With Quote
Old 2008-12-30, 21:54   #42
rogue
 
rogue's Avatar
 
"Mark"
Apr 2003
Between here and the

61·97 Posts
Default

I'll investigate the base 2 issues and post a fix later.
rogue is offline   Reply With Quote
Old 2008-12-30, 23:26   #43
rogue
 
rogue's Avatar
 
"Mark"
Apr 2003
Between here and the

10111000111012 Posts
Default

Quote:
Originally Posted by mdettweiler View Post
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
File Type: zip prpnet.zip (42.4 KB, 89 views)

Last fiddled with by rogue on 2008-12-30 at 23:26
rogue is offline   Reply With Quote
Old 2008-12-30, 23:43   #44
mdettweiler
A Sunny Moo
 
mdettweiler's Avatar
 
Aug 2007
USA (GMT-5)

11000011010012 Posts
Default

Quote:
Originally Posted by rogue View Post
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.
mdettweiler is offline   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
PRPNet 5.4.3 Released rogue Software 163 2020-07-11 14:51
PSP goes prpnet ltd Prime Sierpinski Project 86 2012-06-06 02:30
PRPNet 4.0.0 Released rogue Software 84 2011-11-16 21:20
PRPNet 4.0.1 Released Joe O Sierpinski/Riesel Base 5 1 2010-10-22 20:11
PRPNet 3.0.0 Released rogue Conjectures 'R Us 220 2010-10-12 20:48

All times are UTC. The time now is 16:21.

Sat Sep 26 16:21:59 UTC 2020 up 16 days, 13:32, 1 user, load averages: 1.58, 1.63, 1.71

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, 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.