Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Community > Team MacNN > F@H startup and status scripts

F@H startup and status scripts
Thread Tools
Fresh-Faced Recruit
Join Date: Jun 2000
Location: Cincinnati, OH USA
Status: Offline
Reply With Quote
Nov 13, 2003, 05:52 PM
 
I've developed a few scripts that I use to start and keep track of my Folding@Home processes, and I thought I'd share them.

First, a disclaimer: I know that these scripts work for ME on MY machine, but I can't guarantee the same for you. Use them at your own risk! Also, I'm a "dabbler" in programming, so don't expect the cleanest code around. That being said, any improved versions would be welcomed as long as the original intent stays intact.

OK, first is a script called "gofah" that I use to start both processes on my Dual G4. It should be obvious how to modify these for single-processor machines. Also, don't forget to chmod 755 these scripts so you can run them.

gofah:

[--START--]
#!/bin/csh
source ~/cdfah
pwd
nice -20 ./OSX-3.25 -local -advmethods -forceasm -verbosity 9 &
source ~/cdfah2
nice -20 ./OSX2 -local -advmethods -forceasm -verbosity 9 &
[--END--]

cdfah:

[--START--]
cd /Applications/folding
[--END--]

cdfah2:

[--START--]
cd /Applications/folding2
[--END--]

If I remember correctly, I couldn't cd directly from the csh script, so I had to spawn off the sub-scripts to do it for me. There's got to be an easier way.

The other script is my status script, which is a little more interesting. There's nothing fancy in it, and it only works for Gromacs jobs. You need to be about 2 steps into the protein before the numbers come out right. As in the first script, change the directories to suit your needs:

fstat:

[--START--]
#!/usr/bin/perl
print "\n---------Processor 1----------\n\n";
$head1=`/bin/cat /Applications/folding/FAHlog.txt | grep Protein | tail -n 1`;
$line1=`/bin/cat /Applications/folding/FAHlog.txt | grep Completed | tail -n 2 | head -n 1`;
$line2=`/bin/cat /Applications/folding/FAHlog.txt | grep Completed | tail -n 1`;

# print $line1;
# print $line2;

# Print the header line showing the current protein
print substr($head1,index($head1,"Protein"));

$hour1=substr($line1,1,2);
$min1=substr($line1,4,2);
$sec1=substr($line1,7,2);

$hour2=substr($line2,1,2);
$min2=substr($line2,4,2);
$sec2=substr($line2,7,2);

# Since there are no leading zeros, we use the () delineation to find the current frame #

$frameNumPosStart=index($line2,"\(")+1;
$frameNumPosEnd=index($line2,"\)");
$frameNumLen=$frameNumPosEnd-$frameNumPosStart;
$currentFrame=substr($line2,$frameNumPosStart,$fra meNumLen);

# print "Frame number length is ",$frameNumLen," characters.\n";
# print "The current frame is ",$currentFrame,"\n";

$secsPerFrame=($sec2+$min2*60+$hour2*3600)-($sec1+$min1*60+$hour1*3600);
$remFrames=100-$currentFrame;
$remHours=int(($remFrames*$secsPerFrame)/3600 );
$remMins=int((($remFrames*$secsPerFrame)/3600-$remHours )*60+.5 );

print "Minutes per frame: ",int($secsPerFrame/60+.5),"\n";
print "Frames remaining: ",$remFrames,"\n";
print "Time remaining: ",$remHours," hours ",$remMins," minutes\n";

print "\n---------Processor 2----------\n\n";

$head1=`/bin/cat /Applications/folding2/FAHlog.txt | grep Protein | tail -n 1`;
$line1=`/bin/cat /Applications/folding2/FAHlog.txt | grep Completed | tail -n 2 | head -n 1`;
$line2=`/bin/cat /Applications/folding2/FAHlog.txt | grep Completed | tail -n 1`;

# Print the header line showing the current protein
print substr($head1,index($head1,"Protein"));

$hour1=substr($line1,1,2);
$min1=substr($line1,4,2);
$sec1=substr($line1,7,2);

$hour2=substr($line2,1,2);
$min2=substr($line2,4,2);
$sec2=substr($line2,7,2);

# Since there are no leading zeros, we use the () delineation to find the current frame #

$frameNumPosStart=index($line2,"\(")+1;
$frameNumPosEnd=index($line2,"\)");
$frameNumLen=$frameNumPosEnd-$frameNumPosStart;
$currentFrame=substr($line2,$frameNumPosStart,$fra meNumLen);

# print "Frame number length is ",$frameNumLen," characters.\n";
# print "The current frame is ",$currentFrame,"\n";

$secsPerFrame=($sec2+$min2*60+$hour2*3600)-($sec1+$min1*60+$hour1*3600);
$remFrames=100-$currentFrame;
$remHours=int(($remFrames*$secsPerFrame)/3600 );
$remMins=int((($remFrames*$secsPerFrame)/3600-$remHours )*60+.5 );

print "Minutes per frame: ",int($secsPerFrame/60+.5),"\n";
print "Frames remaining: ",$remFrames,"\n";
print "Time remaining: ",$remHours," hours ",$remMins," minutes\n";
[--END--]

Obviously if you only have one processor, you can delete the entire second half.

Well, I hope someone else can get some use out of this. I suppose I'll keep working on it occasionally, but right now, it suits my needs.

-JS
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 11:26 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2