[Swift-commit] r6006 - SwiftApps/ParVis/HiRAMTools

wilde at ci.uchicago.edu wilde at ci.uchicago.edu
Sun Nov 4 21:44:51 CST 2012


Author: wilde
Date: 2012-11-04 21:44:51 -0600 (Sun, 04 Nov 2012)
New Revision: 6006

Modified:
   SwiftApps/ParVis/HiRAMTools/README
   SwiftApps/ParVis/HiRAMTools/genpfrepps.sh
   SwiftApps/ParVis/HiRAMTools/pfrepps.swift
   SwiftApps/ParVis/HiRAMTools/runpfrepps.sh
Log:
Update pfrepp scripts and README. Now supports running the generated pfrepp scripts for N realizations in parallel, from a single runpfrepps.sh invocation and a single swift script. The set of generated scripts to run is selectable with a shell scriptlet passed as an argument.

Modified: SwiftApps/ParVis/HiRAMTools/README
===================================================================
--- SwiftApps/ParVis/HiRAMTools/README	2012-11-05 03:42:29 UTC (rev 6005)
+++ SwiftApps/ParVis/HiRAMTools/README	2012-11-05 03:44:51 UTC (rev 6006)
@@ -86,6 +86,8 @@
 
 ===
 
+=== OLD PFREPP 
+
 To run pfrep on a set of realizations, do:
 
 1. Create a list of realizations in a file, starting with a header line, in
@@ -138,7 +140,84 @@
 
 ---
 
+=== NEW PFREPP:
 
+To run pfrep on a set of realizations, do:
+
+1. Create a list of realizations in a file, starting with a header line, in
+   the following format:
+
+--- file pflist --- (next line is first line of file):
+path id
+/full/path/of/annualized_realization/history_dir realizationID
+etc
+---
+
+The header (first) line "path id" should be entered exactly like that; these
+are headers for a swift read() function. Extra spaces are allowed within this
+header line.
+
+For example, to run 4 realizations through pfrepp, file "pflist" could contain
+the lines between the --- lines:
+
+--- Next line is first line of file. "---" is not in file, 5 lines total:
+path                                                          id
+/intrepid-fs0/projects/SU_Climate/post/data/annual/en1eo12Ic1 en1eo12Ic1
+/intrepid-fs0/projects/SU_Climate/post/data/annual/en1eo12Ic2 en1eo12Ic2
+/intrepid-fs0/projects/SU_Climate/post/data/annual/en1eo12Ic3 en1eo12Ic3
+/intrepid-fs0/projects/SU_Climate/post/data/annual/en1eo12Ic4 en1eo12Ic4
+---
+
+2. Run the script:
+
+   mkdir /intrepid-fs0/projects/SU_Climate/post/data/pfrepp/swift
+   cd /intrepid-fs0/projects/SU_Climate/post/data/pfrepp/swift
+   emacs pfset01 # per above format
+   htools=/intrepid-fs0/projects/SU_Climate/post/swift/HiRAMTools
+
+   # syntax: runpfrepps.sh pflistFile outputDir optionalScriptlet optionalRunType   # eg:
+
+   # Dryrun, using 6 atmos scripts:
+
+   $htools/runpfrepps.sh pfset01 /intrepid-fs0/users/wilde/persistent/LZ/pfrepps  "" dryrun
+
+   # Real run, using 6 atmos scripts:
+
+   $htools/runpfrepps.sh pfset01 /intrepid-fs0/users/wilde/persistent/LZ/pfrepps "" realrun
+
+   # Real run, using 5 atmos scripts, omitting the (currently) long daily run:
+
+   $htools/runpfrepps.sh pfset01 /intrepid-fs0/users/wilde/persistent/LZ/pfrepps \
+     "grep pfrepp_script.atmos_* | grep -v atmos_daily" realrun
+
+   # Real run, doing 3 specific atmos scripts:
+
+   $htools/runpfrepps.sh pfset01 /intrepid-fs0/users/wilde/persistent/LZ/pfrepps \
+     "egrep '4xdaily|8xdaily.time|8xdaily_instant'" realrun  # FIXME: verify that '' works!
+
+
+3. Watch the status
+
+   cd run012
+   tail -f swift.out
+
+4. Examine script output:
+
+   # Generated scripts
+
+   /intrepid-fs0/projects/SU_Climate/post/data/pfrepp/en1eo12Ic1/scripts
+
+   # pfrepp output (summary) data:
+
+   /intrepid-fs0/projects/SU_Climate/post/data/pfrepp/en1eo12Ic1/atmos/{ts,???}
+
+
+5. (Manually) promote the accepted output to its final position in the campaign directories:
+
+
+
+---
+
 OPEN ISSUES:
 
 - error handling in the leaf scripts is highly suspect: are errors correctly

Modified: SwiftApps/ParVis/HiRAMTools/genpfrepps.sh
===================================================================
--- SwiftApps/ParVis/HiRAMTools/genpfrepps.sh	2012-11-05 03:42:29 UTC (rev 6005)
+++ SwiftApps/ParVis/HiRAMTools/genpfrepps.sh	2012-11-05 03:44:51 UTC (rev 6006)
@@ -4,6 +4,7 @@
 realdir=$2
 outdir=$3
 scriptlist=$PWD/$4
+scriptfilter=$5
 
 mkdir -p $outdir/$realid/scripts
 cd       $outdir/$realid/scripts
@@ -18,10 +19,41 @@
     -m 12 -n 50 -q \
     -u
 
+echo $0: scriptfilter=$scriptfilter
+
+if [ "_$scriptfilter" != _ ]; then
+  echo $0: using scriptfilter
+  scripts=$(/bin/ls -1 pfrepp_script* | sh -c "$scriptfilter" )
+else
+  scripts=$(/bin/ls -1 pfrepp_script* )
+fi
+
 echo id path >$scriptlist
-for f in pfrepp_script.*; do
-  id=$(echo $f | sed -e 's/pfrepp_script.//')
-  echo $id $PWD/$f >>$scriptlist
+for f in $scripts; do
+  echo $realid $f >>$scriptlist
 done
 
+exit
+
 #    -a /intrepid-fs0/users/lzamboni/persistent/yearly-nco/en1eo12Ic3/run001/run001/ \
+
+# datasets needed by LZ:
+
+Pfrepp-month.time_average
+Pfrepp-month.time_series
+Pfrepp-daily.time_series (4X???)
+Pfrepp-8xdaily.time_series
+Pfrepp-8xdaily_instant.time_series
+Pfrepp-4xdaily.time_series
+
+which means:
+
+pfrepp_script.atmos_month.time_average.1950*
+pfrepp_script.atmos_month.time_series.1950*
+pfrepp_script.atmos_4xdaily.time_series.1950*
+pfrepp_script.atmos_8xdaily.time_series.1950*
+pfrepp_script.atmos_8xdaily_instant.time_series.1950*
+pfrepp_script.atmos_daily.time_series.1950*
+
+pfrepp_script.ice_month.time_average.1950*
+pfrepp_script.ice_month.time_series.1950*

Modified: SwiftApps/ParVis/HiRAMTools/pfrepps.swift
===================================================================
--- SwiftApps/ParVis/HiRAMTools/pfrepps.swift	2012-11-05 03:42:29 UTC (rev 6005)
+++ SwiftApps/ParVis/HiRAMTools/pfrepps.swift	2012-11-05 03:44:51 UTC (rev 6006)
@@ -10,12 +10,14 @@
   string id;
 }
 
-global string outdir = @arg("outdir","/intrepid-fs0/users/wilde/LZ/pfrepps");
-string reallist = @arg("reallist","NO-REALIZATION-LIST-SPECIFIED");
+global string outdir =    @arg("outdir", "");
+       string reallist =  @arg("reallist", "");
+       string scriptfilter = @arg("scriptfilter","grep pfrepp_script.atmos_|grep -v atmos_daily.SKIPME");
+       string dryrun = @arg("dryrun","true");  # default to doing a "dry run"
 
-app (file scripts, file std_out, file std_err) genpfrepps (string realid, string realpath)
+app (file scripts, file std_out, file std_err) genpfrepps (string realid, string realpath, string filter)
 {
-  genpfrepps realid realpath outdir @scripts stdout=@std_out stderr=@std_err;
+  genpfrepps realid realpath outdir @scripts filter stdout=@std_out stderr=@std_err;
 }
 
 app (file std_out, file std_err) sh (string script)
@@ -23,19 +25,36 @@
   sh "-c" script stdout=@std_out stderr=@std_err;
 }
 
-realization reali[] = readData(reallist);
+if(outdir == "") {
+  tracef("pfrepps.swift: ERROR: output directory (swift argument outdir) not specified.");
+}
 
-foreach r,i in reali {
-  tracef("%s %s\n", r.id, r.path);
-  file sofile <single_file_mapper; file=@strcat(outdir,"/",r.id,".gen.out")>;
-  file sefile <single_file_mapper; file=@strcat(outdir,"/",r.id,".gen.err")>;
-  file scriptlist <single_file_mapper; file=@strcat(outdir,"/",r.id,"/scripts/scriptlist")>;
-  (scriptlist,sofile,sefile) = genpfrepps(r.id, r.path);
-  script scripts[] = readData(scriptlist);
-  foreach s in scripts {
-    file ssofile <single_file_mapper; file=@strcat(outdir,"/",r.id,".",s.id,".out")>;
-    file ssefile <single_file_mapper; file=@strcat(outdir,"/",r.id,".",s.id,".err")>;
-    // (ssofile, ssefile) = sh(s.path);
-    tracef("Running script: %s: %s\n", s.id, s.path);
+if(reallist == "") {
+  tracef("pfrepps.swift: ERROR: realization list (swift argument reallist) not specified");
+}
+
+if(reallist != "" && outdir != "") {
+  realization reali[] = readData(reallist);
+  foreach r,i in reali {
+    tracef("%s %s\n", r.id, r.path);
+    file sofile <single_file_mapper; file=@strcat(outdir,"/",r.id,".gen.out")>;
+    file sefile <single_file_mapper; file=@strcat(outdir,"/",r.id,".gen.err")>;
+    file scriptlist <single_file_mapper; file=@strcat(outdir,"/",r.id,"/scripts/scriptlist")>;
+    (scriptlist,sofile,sefile) = genpfrepps(r.id, r.path, scriptfilter);
+    script scripts[] = readData(scriptlist);
+    foreach s in scripts {
+      string cmd = @strcat(outdir,"/",r.id,"/scripts/",s.path);
+      file ssofile <single_file_mapper; file=@strcat(s.path,".out")>;
+      file ssefile <single_file_mapper; file=@strcat(s.path,".err")>;
+      if( dryrun != "true" ) {
+	(ssofile, ssefile) = sh(cmd);
+      }
+      else {
+   	tracef("Running script: %s: %s\n", s.id, s.path);
+      }
+    }
   }
 }
+else {
+  tracef("pfrepps.swift: EXIT: exiting due to argument errors.");
+} 
\ No newline at end of file

Modified: SwiftApps/ParVis/HiRAMTools/runpfrepps.sh
===================================================================
--- SwiftApps/ParVis/HiRAMTools/runpfrepps.sh	2012-11-05 03:42:29 UTC (rev 6005)
+++ SwiftApps/ParVis/HiRAMTools/runpfrepps.sh	2012-11-05 03:44:51 UTC (rev 6006)
@@ -1,17 +1,28 @@
 #! /bin/bash
 
 reallist=$1                   # full pathname of list of realizations to pfrepp
+                              #   reallist must have format:
+                              #   path id (with this header line)
+
 outdir=$2                     # full pathname of output dir
 
-# reallist must have format:
-# path id (with this header line)
+                              # scriptlet to filter lists of generated pfrepp scripts to run:
+scriptfilter=${3:-"grep pfrepp_script.atmos_ | grep -v atmos_daily"}
 
+runtype=${4:-dryrun}          # User should specify dryrun | realrun for this arg
+
+if [ $runtype = dryrun ]; then
+  dryrun=true
+else # dryrun=anything else requests generated scripts to be run ("real run")
+  dryrun=false
+fi
+
 bindir=$(dirname $0)
 bindir=$(cd $bindir; pwd)
 
 echo bindir=$bindir
 
-# Create new runNNN directory
+# Create new runNNN directory below current working dir where this script was run from
 
 rundir=$( echo run??? | sed -e 's/^.*run//' | awk '{ printf("run%03d\n", $1+1)}' )
 mkdir $rundir
@@ -20,8 +31,9 @@
 
 wrapperlog.always.transfer=true
 sitedir.keep=true
-execution.retries=10
-lazy.errors=true
+execution.retries=0
+lazy.errors=false
+use.wrapper.staging=false
 
 END
 
@@ -34,7 +46,7 @@
      <profile namespace="karajan" key="jobThrottle">.01</profile>
      <profile namespace="karajan" key="initialScore">10000</profile>
      <filesystem provider="local"/>
-     <workdirectory>$PWD/swiftwork</workdirectory>
+     <workdirectory>$PWD/$rundir</workdirectory>
    </pool>
 
   <pool handle="cobalt">
@@ -51,12 +63,12 @@
     <!-- <profile namespace="globus"  key="workerLoggingDirectory">/home/jonmon/Workspace/Swift/tests/catsnsleep</profile> -->
     <profile namespace="globus"  key="slots">32</profile>
     <profile namespace="globus"  key="maxTime">28800</profile> <!-- 8hrs -->
-    <profile namespace="globus"  key="maxWallTime">00:20:00</profile>
+    <profile namespace="globus"  key="maxWallTime">07:45:00</profile>
     <profile namespace="globus"  key="lowoverallocation">100</profile>
     <profile namespace="globus"  key="highoverallocation">100</profile>
     <profile namespace="globus"  key="nodeGranularity">1</profile>
     <profile namespace="globus"  key="maxNodes">1</profile>
-    <workdirectory>$PWD/$rundir/swiftwork</workdirectory>
+    <workdirectory>$PWD/$rundir</workdirectory>
   </pool>
 
 </config>
@@ -76,4 +88,14 @@
 echo Running in directory $rundir
 runid=$(basename $rundir)
 
-swift -config cf -tc.file tc -sites.file sites.xml pfrepps.swift -outdir=$outdir -reallist=$reallist  >& swift.out
+echo RUNNING: swift -config cf -tc.file tc -sites.file sites.xml pfrepps.swift \
+      -outdir=$outdir \
+      -reallist=$reallist \
+      -scriptfilter="$scriptfilter" \
+      -dryrun=$dryrun 
+
+swift -config cf -tc.file tc -sites.file sites.xml pfrepps.swift >& swift.out \
+      -outdir=$outdir \
+      -reallist=$reallist \
+      -scriptfilter="$scriptfilter" \
+      -dryrun=$dryrun 




More information about the Swift-commit mailing list