mersenneforum.org  

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

Reply
 
Thread Tools
Old 2010-03-21, 22:41   #34
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
You can do the same thing, but with much less code and more readability, like this:
Code:
  print OUTFILE $usernameLine.$datetimeLine.$justRead;
Yeah, I wrote that script a while back, when I was still getting the hang of Perl. Needless to say, my more recent creations are a bit less messy. When I eventually get around to cleaning up my results-processing suite and integrating it into one software package for public release, I'll probably end up re-doing much of it.

Last fiddled with by mdettweiler on 2010-03-21 at 22:42
mdettweiler is offline   Reply With Quote
Old 2010-04-11, 14:22   #35
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

17·251 Posts
Default

It's not in an entirely finished state (only works right with purely composite results; a prime will probably have a composite-like output but with PRIME as the residue), but here's a script I wrote to recreate (as best as possible with drawing only from the CandidateTest table; the only thing wrong is that the timestamps show the reservation date, not the finishing date) the completed_tests.log file from the DB. To use it, first export the wanted results (an example SQL query is given that does it for all results in the DB, but you might want to add other limitations e.g. "candidatename like '%*192^%'") to a tab-separated file (MySQL's default) containing, in this order:
CandidateName,TestID,PRPingProgram,Residue,EmailID,UserID,ClientID
Then, assuming the script is saved as recover-results.pl and the DB data is in DB-out.txt and you want the output in completed_tests.log, run this:
Code:
perl recover-results.pl DB-out.txt > completed_tests.log
Code:
#  select CandidateName,TestID,PRPingProgram,Residue,EmailID,UserID,ClientID
#   from CandidateTest where residue != 'null' order by TestID into outfile 'completed_tests.log';
use POSIX qw(strftime);

while (<>) {
  chomp;
  ($num, $timestamp, $prog, $res, $email, $user, $client) = split(/\t/);
  @time = gmtime($timestamp);
  $timestr = strftime("%Y-%m-%d %H:%M:%S", @time);
  print "[$timestr GMT] $num received by Email: $email  User: $user  Client: $client Program: $prog  Residue: $res  \n";
}

Last fiddled with by Mini-Geek on 2010-04-11 at 14:25
Mini-Geek is offline   Reply With Quote
Old 2010-04-11, 16:10   #36
rogue
 
rogue's Avatar
 
"Mark"
Apr 2003
Between here and the

18D016 Posts
Default

Quote:
Originally Posted by Mini-Geek View Post
It's not in an entirely finished state (only works right with purely composite results; a prime will probably have a composite-like output but with PRIME as the residue), but here's a script I wrote to recreate (as best as possible with drawing only from the CandidateTest table; the only thing wrong is that the timestamps show the reservation date, not the finishing date) the completed_tests.log file from the DB. To use it, first export the wanted results (an example SQL query is given that does it for all results in the DB, but you might want to add other limitations e.g. "candidatename like '%*192^%'") to a tab-separated file (MySQL's default) containing, in this order:
CandidateName,TestID,PRPingProgram,Residue,EmailID,UserID,ClientID
Then, assuming the script is saved as recover-results.pl and the DB data is in DB-out.txt and you want the output in completed_tests.log, run this:
Code:
perl recover-results.pl DB-out.txt > completed_tests.log
Code:
#  select CandidateName,TestID,PRPingProgram,Residue,EmailID,UserID,ClientID
#   from CandidateTest where residue != 'null' order by TestID into outfile 'completed_tests.log';
use POSIX qw(strftime);

while (<>) {
  chomp;
  ($num, $timestamp, $prog, $res, $email, $user, $client) = split(/\t/);
  @time = gmtime($timestamp);
  $timestr = strftime("%Y-%m-%d %H:%M:%S", @time);
  print "[$timestr GMT] $num received by Email: $email  User: $user  Client: $client Program: $prog  Residue: $res  \n";
}
Is is possible for a test to have the residue of "PRP" instead of "PRIME". This would happen in the case that phrot was used (non-x86) or an older version or LLR was used without pfgw. If you join with the Candidate table, then the LastUpdateTime would be when the result was finished. You could then use the IsPRP and IsPrime columns instead of looking directly at the residue.
rogue is offline   Reply With Quote
Old 2010-06-21, 19:48   #37
10metreh
 
10metreh's Avatar
 
Nov 2008

232210 Posts
Default

There is a bug in remove_ks.pl: when the prime file is large, egrep gives the error "Regular expression too big", and the script then wipes the sieve file and the file with ks remaining. This has caused me a big problem on Riesel base 51 because I didn't back up the file of ks remaining. The effort to solve that problem is being "coordinated" in the Bases 33-100 thread.
10metreh is offline   Reply With Quote
Old 2010-10-13, 13:49   #38
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

17·251 Posts
Default

http://www.mersenneforum.org/showthr...311#post233311
Quote:
Originally Posted by Mini-Geek View Post
The odds of prime spreadsheet is very useful, but when the n (or, to a lesser extent, the k) varies greatly, (as is common in CRUS work, or over large areas of any work) it is hard to choose the right average n to get accurate results.
I've made a simple command line Java app that has the same function as the odds of prime spreadsheet, but instead of making you pick the average k and n, it reads each k/n pair and works off of that. It reports relevant numbers for primes and twin primes (not triplet or quadruplet).
It is attached as a .jar, along with the source (it's not commented, and it includes some other code unused here, but I figured better messy source than no source ). Run it without any arguments (or with -h or whatever) to get help on how to use it ("java -jar calcPrimes.jar" will do it).
Note that it is pretty picky with the sieve depth and sieve file. The sieve depth parser is extremely simple: first replace "G" with 9 zeroes and "T" with 12 zeroes, then use Java's Long.parseLong (e.g. 1.5*10^12, 1.5T, and 15M are all invalid, while 1T, 1500G, and 15000000 are valid). And the sieve file must be in NewPGen format ("k n" on each line) with no header of any sort, just the k and n.
This has had very little testing, but I've checked it against the spreadsheet on one file, and the results seems to be accurate.
calcPrimes.zip
Mini-Geek is offline   Reply With Quote
Old 2011-01-23, 17:05   #39
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

17·251 Posts
Default

Quote:
Originally Posted by Puzzle-Peter View Post
I am not sure about the "algebraic factors" which are mentioned in the software thread though.
See this post:
http://www.mersenneforum.org/showthr...690#post248690
And the script here (also linked up there):
http://www.mersenneforum.org/showthr...045#post209045

Last fiddled with by Mini-Geek on 2011-01-23 at 17:05
Mini-Geek is offline   Reply With Quote
Old 2011-01-23, 17:08   #40
Puzzle-Peter
 
Puzzle-Peter's Avatar
 
Jun 2009

10101011002 Posts
Default

Quote:
Originally Posted by Mini-Geek View Post
Wow, that's a quick answer!
Thanks!

EDIT: is this made for linux? /usr/bin/perl does not sound like windows.

EDIT2: srsieve gives warnings for algebraic factors for k=324, 900, 1296, 4356, 5184, 5776, 9409, 11449, 14884. Does that mean I should remove these k's from the sieve file?

Last fiddled with by Puzzle-Peter on 2011-01-23 at 17:21
Puzzle-Peter is online now   Reply With Quote
Old 2011-01-23, 18:38   #41
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

102538 Posts
Default

Quote:
Originally Posted by Puzzle-Peter View Post
EDIT: is this made for linux? /usr/bin/perl does not sound like windows.
It was made for Windows, but should also work on Linux with little to no modification. The /usr/bin/perl you mention is something that's usually at the start of all Perl files. If I'm not mistaken, that's for Unix systems to know what binary file to execute the script with. Windows has file association that can take care of that. Of course, you'll need some version of Perl installed to run the script.
Quote:
Originally Posted by Puzzle-Peter View Post
EDIT2: srsieve gives warnings for algebraic factors for k=324, 900, 1296, 4356, 5184, 5776, 9409, 11449, 14884. Does that mean I should remove these k's from the sieve file?
I think MyDogBuster's answer is correct. I'll also note that the script will remove all numbers that need to be removed, which can include removing entire k's, so that's an easy no-confusing-math way to deal with this.

Last fiddled with by Mini-Geek on 2011-01-23 at 18:39
Mini-Geek is offline   Reply With Quote
Old 2011-01-23, 19:25   #42
Puzzle-Peter
 
Puzzle-Peter's Avatar
 
Jun 2009

22·32·19 Posts
Default

I downloaded and installed strawberryperl for windows. I try to start the script with

hiddenPowers.pl pl_remain.txt sr_228.pfgw

and I get

Use of uninitialized value in open at C:\...\hiddenPowers.pl line 8
readline() on closed filehandle IN at C:\...\hiddenPowers.pl line 11

What's wrong?
Puzzle-Peter is online now   Reply With Quote
Old 2011-01-23, 19:59   #43
Mini-Geek
Account Deleted
 
Mini-Geek's Avatar
 
"Tim Sorbera"
Aug 2006
San Antonio, TX USA

17·251 Posts
Default

Quote:
Originally Posted by Puzzle-Peter View Post
I downloaded and installed strawberryperl for windows. I try to start the script with

hiddenPowers.pl pl_remain.txt sr_228.pfgw

and I get

Use of uninitialized value in open at C:\...\hiddenPowers.pl line 8
readline() on closed filehandle IN at C:\...\hiddenPowers.pl line 11

What's wrong?
I'm not entirely sure what the problem is. Does pl_remain.txt exist in the folder you're in (and double check it's spelled/typed right, and isn't really .txt.txt or anything else)? If not, of course, that's your problem; if so, what is your Perl version? Maybe something changed that I need to fix for it to work with the newest versions. The version I've got is v5.10.0.
If a solution isn't apparent soon, you can just ignore it like gd_barnes said, since it doesn't make a huge difference, especially when working with small numbers.

Last fiddled with by Mini-Geek on 2011-01-23 at 20:00
Mini-Geek is offline   Reply With Quote
Old 2011-01-23, 20:40   #44
Puzzle-Peter
 
Puzzle-Peter's Avatar
 
Jun 2009

22×32×19 Posts
Default

Quote:
Originally Posted by Mini-Geek View Post
I'm not entirely sure what the problem is. Does pl_remain.txt exist in the folder you're in (and double check it's spelled/typed right, and isn't really .txt.txt or anything else)? If not, of course, that's your problem; if so, what is your Perl version? Maybe something changed that I need to fix for it to work with the newest versions. The version I've got is v5.10.0.
If a solution isn't apparent soon, you can just ignore it like gd_barnes said, since it doesn't make a huge difference, especially when working with small numbers.
I typed only the first characters and hit tab to auto-complete the file names, so they should be correct. I couldn't see any spelling errors either.
My perl version is 5.12.2.0 and I'm running WinXP 32bit.

EDIT: I just changed the second and third code line to

open(IN, "pl_remain.txt");
$file = "sr_228.pfgw";

and it started working, but every output line telling me which k is worked on is followed by "Removed 0 line(s)" and two "Syntax error" messages. Is abc a valid format for the script? I tried switching to NewPGen format using srfile -g, but I ended up with one file for each k...
Puzzle-Peter is online now   Reply With Quote
Reply

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
Scripts thread bsquared YAFU 4 2012-10-21 19:45
Escape sequences in bash scripts? CRGreathouse Software 16 2009-03-26 08:42
Perl scripts for result file conversion nuggetprime No Prime Left Behind 5 2009-01-02 19:44
Tracking GIMPS progress with scripts jasong jasong 21 2008-03-25 00:47
DPGraph 2D/3D scripts nibble4bits Lounge 0 2008-01-16 17:05

All times are UTC. The time now is 10:32.


Tue Jul 27 10:32:55 UTC 2021 up 4 days, 5:01, 0 users, load averages: 2.78, 2.10, 1.95

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.