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

wilde at ci.uchicago.edu wilde at ci.uchicago.edu
Wed Oct 10 09:42:25 CDT 2012


Author: wilde
Date: 2012-10-10 09:42:25 -0500 (Wed, 10 Oct 2012)
New Revision: 5960

Modified:
   SwiftApps/ParVis/HiRAMTools/combine.sh
   SwiftApps/ParVis/HiRAMTools/combine.swift
   SwiftApps/ParVis/HiRAMTools/combine_realization.sh
Log:
Add direct mode, support for handling nodes with problems on /scratch, handling of stdout/err, and change rundir to outdir on swift script.

Modified: SwiftApps/ParVis/HiRAMTools/combine.sh
===================================================================
--- SwiftApps/ParVis/HiRAMTools/combine.sh	2012-10-10 13:58:01 UTC (rev 5959)
+++ SwiftApps/ParVis/HiRAMTools/combine.sh	2012-10-10 14:42:25 UTC (rev 5960)
@@ -1,29 +1,62 @@
 #! /bin/bash
 
-set -x 
+set -x
 
-mkdir -p /scratch/wilde
-tmp=$(mktemp -d /scratch/wilde/combine_XXXX)
-cd $tmp
-
 outdir=$1
 inpattern=$2
 date=$(basename $(dirname $inpattern))
 basepattern=$(basename $inpattern)
 
 infiles="$2*"
-for f in $infiles; do
-  dd if=$f of=$(basename $f) bs=4M
-done
 
-/home/ckerr/bin/fms/tools/x86_64/bin/mppnccombine.exe out.nc ${basepattern}*
+mppncombine=/home/ckerr/bin/fms/tools/x86_64/bin/mppnccombine.exe
+mode=scratch # default
 
-mkdir -p $outdir/$date
-dd if=out.nc of=$outdir/$date/$basepattern.trans bs=4M
-mv $outdir/$date/$basepattern.trans $outdir/$date/$basepattern
+badnodes="loginx"
+thisnode=$(hostname)
+if echo $badnodes | grep -q $thisnode ; then
+  echo Running on node $thisnode - is in badnode list $badnodes. Will run in direct mode.
+  mode=direct
+else
+  # Try to make a temporary work dir under /scratch - this can fail on bad nodes
+  mkdir -p /scratch/$USER
+  tmp=$(mktemp -d /scratch/$USER/combine_XXXXXX)
+  if [ $? != 0 ]; then
+    echo Failed to create tmp dir on /scratch/$USER. Will run in direct mode.
+    mode=direct
+  fi
+fi
 
-cd ..
-rm -rf $tmp
+set -o errexit # Set this after we know if tmp dir was created ok
 
+export PATH=/soft/apps/nco-3.9.2/bin:$PATH
+export LD_LIBRARY_PATH=/soft/apps/intel-fc-11.0.074/lib/intel64:/soft/apps/intel-cc-11.0.074/lib/intel64:/soft/apps/netcdf-3.6.3/lib:/usr/lib:/usr/X11R6/lib:/usr/local/lib
+  
+if [ $mode = scratch ]; then
+  
+  cd $tmp
+  
+  for f in $infiles; do
+    dd if=$f of=$(basename $f) bs=4M
+  done
+  
+  # Add nco tools to PATH and Intel compiler v11 libs to LD_LIBRARY_PATH # FIXME: this is precautionary and can likely be removed.
+  
+  # FIXME: ^^^ end precaution
+  
+  $mppncombine out.nc ${basepattern}*
+  
+  mkdir -p $outdir/$date
+  dd if=out.nc of=$outdir/$date/$basepattern.trans bs=4M
+  mv $outdir/$date/$basepattern.trans $outdir/$date/$basepattern
+  
+  cd ..
+  rm -rf $tmp
+  
+else # $mode = direct
 
+  mkdir -p $outdir/$date
+  $mppncombine $outdir/$date/$basepattern $infiles
+  
+fi
 

Modified: SwiftApps/ParVis/HiRAMTools/combine.swift
===================================================================
--- SwiftApps/ParVis/HiRAMTools/combine.swift	2012-10-10 13:58:01 UTC (rev 5959)
+++ SwiftApps/ParVis/HiRAMTools/combine.swift	2012-10-10 14:42:25 UTC (rev 5960)
@@ -1,16 +1,18 @@
 
 type file;
 
-string rundir=@arg("rundir","NO-OUTDIR-SPECIFIED");
+string outdir=@arg("outdir","NO-OUTDIR-SPECIFIED");
 string groupfile=@arg("groupfile","groups");
 
-app combine (string dir, string pattern)
+app (file sout, file serr) combine (string dir, string pattern)
 {
-  combine dir pattern;
+  combine dir pattern stdout=@sout stderr=@serr;
 }
 
 string group[] = readData(groupfile);
 
-foreach g in group {
-  combine(rundir,g);
+foreach g, i in group {
+  file so<single_file_mapper; file=@strcat("stdlog/stdout.",i)>;
+  file se<single_file_mapper; file=@strcat("stdlog/stderr.",i)>;
+  (so,se) = combine(outdir,g);
 }

Modified: SwiftApps/ParVis/HiRAMTools/combine_realization.sh
===================================================================
--- SwiftApps/ParVis/HiRAMTools/combine_realization.sh	2012-10-10 13:58:01 UTC (rev 5959)
+++ SwiftApps/ParVis/HiRAMTools/combine_realization.sh	2012-10-10 14:42:25 UTC (rev 5960)
@@ -1,17 +1,35 @@
 #! /bin/bash
 
-hdir=$1
-outdir=$2
+realdir=$1                    # full pathname of realization dir
+outdir=$2                     # full pathname of output dir
+realname=$(basename $realdir) # realization name (eg en1eo12Ic1)
+outdir=$outdir/$realname
 
-/bin/ls -1 -d ${hdir}* >dirs
+bindir=$(dirname $0)
+bindir=$(cd $bindir; pwd)
 
-echo '=== ' $(basename $0) doing dirs:
-cat dirs
+echo bindir=$bindir
 
-for d in $(cat dirs); do
-  find $d | grep .nc.[0-9][0-9][0-9][0-9]  | sed -e 's/.....$//' | sort | uniq
-done >groups
+# patterns for filename matching
 
+yyyy="[0-9][0-9][0-9][0-9]"
+yyyymmdd="${yyyy}[0-9][0-9][0-9][0-9]"
+
+#find $realdir/history/$yyyymmdd  |
+find $realdir/history/19????01  |
+  grep .nc.$yyyy      |
+  sed -e 's/.....$//' | sort | uniq > groups
+echo Created $real.groups
+
+# /bin/ls -1 -d ${hdir}* >dirs
+# 
+# echo '=== ' $(basename $0) doing dirs:
+# cat dirs
+# 
+# for d in $(cat dirs); do
+#   find $d | grep .nc.[0-9][0-9][0-9][0-9]  | sed -e 's/.....$//' | sort | uniq
+# done >groups
+
 # Create new runNNN directory
 
 rundir=$( echo run??? | sed -e 's/^.*run//' | awk '{ printf("run%03d\n", $1+1)}' )
@@ -42,7 +60,8 @@
     <execution provider="coaster" jobmanager="local:cobalt" url="eureka.alcf.anl.gov" />
     <filesystem provider="local" />
     <!-- <profile namespace="globus"key="internalHostname">172.17.3.11</profile> -->
-    <!-- <profile namespace="globus"  key="project">MTCScienceApps</profile> -->
+    <!-- <profile namespace="globus"  key="project">SU_Climate</profile> -->
+    <profile namespace="globus"  key="project">MTCScienceApps</profile>
     <profile namespace="globus"  key="queue">default</profile>
     <profile namespace="karajan" key="jobthrottle">2.56</profile>
     <profile namespace="karajan" key="initialScore">10000</profile>
@@ -65,18 +84,17 @@
 
 cat >$rundir/tc <<END
 
-#local  combine $PWD/combine.sh
-cobalt  combine $PWD/combine.chk.sh
+cobalt  combine $bindir/combine.sh
 
 END
 
-cp groups combine.swift $rundir
+cp groups $bindir/combine.swift $rundir
 
 cd $rundir
 echo Running in directory $rundir
 runid=$(basename $rundir)
 mkdir -p $outdir/$runid
 
-swift -config cf -tc.file tc -sites.file sites.xml combine.swift -rundir=$outdir/$runid -groupfile=groups >& swift.out
+swift -config cf -tc.file tc -sites.file sites.xml combine.swift -outdir=$outdir/$runid -groupfile=groups >& swift.out
 
 




More information about the Swift-commit mailing list