[Swift-commit] r6451 - in demo/cray: . bin data part01 part02 part03 part04 part05 part06 part07 part08 part08/data

wilde at ci.uchicago.edu wilde at ci.uchicago.edu
Tue Apr 16 15:54:50 CDT 2013


Author: wilde
Date: 2013-04-16 15:54:50 -0500 (Tue, 16 Apr 2013)
New Revision: 6451

Added:
   demo/cray/README
   demo/cray/SwiftRCCTutorial.2013.0409.pptx
   demo/cray/bin/
   demo/cray/bin/avg.sh
   demo/cray/bin/cleanup
   demo/cray/bin/getlanduse.pl
   demo/cray/bin/highest.sh
   demo/cray/bin/lowest.sh
   demo/cray/bin/makeinput
   demo/cray/bin/myapp
   demo/cray/bin/random.sh
   demo/cray/bin/random2.sh
   demo/cray/bin/random3.sh
   demo/cray/bin/random4.sh
   demo/cray/bin/random5.sh
   demo/cray/data/
   demo/cray/data/data.txt
   demo/cray/part01/
   demo/cray/part01/README
   demo/cray/part01/p1.swift
   demo/cray/part01/tc
   demo/cray/part02/
   demo/cray/part02/README
   demo/cray/part02/p2.swift
   demo/cray/part02/p2b.swift
   demo/cray/part02/tc
   demo/cray/part03/
   demo/cray/part03/README
   demo/cray/part03/p3.swift
   demo/cray/part03/tc
   demo/cray/part04/
   demo/cray/part04/README
   demo/cray/part04/p4.swift
   demo/cray/part04/tc
   demo/cray/part05/
   demo/cray/part05/README
   demo/cray/part05/p5.swift
   demo/cray/part05/tc
   demo/cray/part06/
   demo/cray/part06/README
   demo/cray/part06/p6.swift
   demo/cray/part06/tc
   demo/cray/part07/
   demo/cray/part07/README
   demo/cray/part07/p7.swift
   demo/cray/part07/sites.xml
   demo/cray/part07/tc
   demo/cray/part08/
   demo/cray/part08/README
   demo/cray/part08/cf
   demo/cray/part08/cray.xml
   demo/cray/part08/data/
   demo/cray/part08/data/bias.dat
   demo/cray/part08/dm
   demo/cray/part08/p8.swift
   demo/cray/part08/pbs.xml
   demo/cray/part08/tc
   demo/cray/setup.csh
   demo/cray/setup.sh
Log:
Initial Cray demo version, based on latest RCC demo/tutorial.

Added: demo/cray/README
===================================================================
--- demo/cray/README	                        (rev 0)
+++ demo/cray/README	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,52 @@
+
+INTRODUCTION TO SWIFT
+
+SETUP
+
+Obtain the tutorial package
+
+Change directory into the created directory called "tutorial"
+
+This directory contains:
+
+bin:     script tools for the tutorial
+scripts: Swift scripts for the tutorial
+
+TO START, do:
+
+$ source setup.sh # to add tutorial programs to your PATH
+
+...and then verify:
+
+$ random.sh # should be found in your PATH now
+
+
+
+The tutorial is arranged in parts.  To begin:
+
+$ cd part01
+$ cat README
+
+When finished:
+
+$ cd ../part02  # etc
+
+In each part, you can type "cleanup" after running a few swift scripts
+to remove the old logs that build up, and (usually) the output files.
+
+
+The topics of the tutorial parts are:
+
+part01: First Swift script - run a "simulation" program, random.sh
+
+part02: Specifying the output filenames
+
+part03: Run many instances of a "simulation" program in a foreach() loop
+
+part04: run a program in a foreach() loop with explicitly named output files.
+
+part05: Add a program that "analyzes" the output the parallel simulations
+
+part06: Add arguments to the "simulation" program
+
+part07: Run the "simulations" on the parallel cluster

Added: demo/cray/SwiftRCCTutorial.2013.0409.pptx
===================================================================
(Binary files differ)


Property changes on: demo/cray/SwiftRCCTutorial.2013.0409.pptx
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: demo/cray/bin/avg.sh
===================================================================
--- demo/cray/bin/avg.sh	                        (rev 0)
+++ demo/cray/bin/avg.sh	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,9 @@
+#! /bin/sh
+
+awk '
+
+{ sum += $1}
+
+END { print sum/NR }
+' $*
+


Property changes on: demo/cray/bin/avg.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: demo/cray/bin/cleanup
===================================================================
--- demo/cray/bin/cleanup	                        (rev 0)
+++ demo/cray/bin/cleanup	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,17 @@
+#! /bin/sh
+
+echo Removing:
+echo
+ls -ltd *log *.d swiftwork _concurrent output *.kml *.swiftx swift.log 2>/dev/null
+echo
+echo Enter y to proceed:
+read ok
+if [ _$ok = _y -o _$ok = _Y -o _$ok = _yes ]; then
+  echo
+  set -x
+  rm -rf *log *.d swiftwork _concurrent output *.kml *.swiftx swift.log
+else
+  echo
+  echo No files removed.
+fi
+


Property changes on: demo/cray/bin/cleanup
___________________________________________________________________
Added: svn:executable
   + *

Added: demo/cray/bin/getlanduse.pl
===================================================================
--- demo/cray/bin/getlanduse.pl	                        (rev 0)
+++ demo/cray/bin/getlanduse.pl	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,33 @@
+#!/usr/bin/perl -w
+
+# Input to this program should be a raw, greyscale RGB file
+# Usage: rgb_histogram.pl myfile.rgb
+
+if($#ARGV != 1) {
+  die "usage $0: imageFile runTime"
+}
+
+my $image_filename = shift;
+my $runtime = shift;
+
+open(IMAGEFILE, "$image_filename") || die "$0: Unable to open $image_filename!\n";
+binmode IMAGEFILE;
+
+my @pixelcount;
+foreach my $count (0..255) { $pixelcount[$count] = 0; }
+
+# Read values, three bytes at a time
+$/ = \3; 
+foreach(<IMAGEFILE>) {
+   $pixelcount[unpack('C', $_)]++;
+}
+close(IMAGEFILE);
+
+ at sortedcount = sort {$b <=> $a} @pixelcount;
+
+foreach my $count (0..255) {
+   if($sortedcount[$count] == 0) { next; }
+   printf("%d %d\n", $sortedcount[$count], $count);
+}
+
+sleep($runtime);


Property changes on: demo/cray/bin/getlanduse.pl
___________________________________________________________________
Added: svn:executable
   + *

Added: demo/cray/bin/highest.sh
===================================================================
--- demo/cray/bin/highest.sh	                        (rev 0)
+++ demo/cray/bin/highest.sh	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,2 @@
+#! /bin/sh
+sort -nr | head -$1


Property changes on: demo/cray/bin/highest.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: demo/cray/bin/lowest.sh
===================================================================
--- demo/cray/bin/lowest.sh	                        (rev 0)
+++ demo/cray/bin/lowest.sh	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,2 @@
+#! /bin/sh
+sort -n | head -$1


Property changes on: demo/cray/bin/lowest.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: demo/cray/bin/makeinput
===================================================================
--- demo/cray/bin/makeinput	                        (rev 0)
+++ demo/cray/bin/makeinput	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,22 @@
+#! /bin/sh
+
+nfiles=${1:-10}
+
+rm -rf input
+mkdir input
+cp ../data/sat/t? input/
+( cd input
+  n=0
+  for h in $(seq -w 00 99); do
+    for v in $(seq -w 00 99); do
+      n=$((n+1))
+      if [ $n -gt $nfiles ]; then
+        break;
+      else
+        f=t$(($RANDOM%10))
+        ln $f h${h}v${v}.rgb
+      fi
+    done
+  done
+  rm t?
+)


Property changes on: demo/cray/bin/makeinput
___________________________________________________________________
Added: svn:executable
   + *

Added: demo/cray/bin/myapp
===================================================================
--- demo/cray/bin/myapp	                        (rev 0)
+++ demo/cray/bin/myapp	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,6 @@
+#! /bin/sh
+
+hostname -f
+date
+sleep 3
+ps -u $USER -H -f


Property changes on: demo/cray/bin/myapp
___________________________________________________________________
Added: svn:executable
   + *

Added: demo/cray/bin/random.sh
===================================================================
--- demo/cray/bin/random.sh	                        (rev 0)
+++ demo/cray/bin/random.sh	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,2 @@
+#! /bin/sh
+echo $RANDOM


Property changes on: demo/cray/bin/random.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: demo/cray/bin/random2.sh
===================================================================
--- demo/cray/bin/random2.sh	                        (rev 0)
+++ demo/cray/bin/random2.sh	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+runtime=${1:-0}
+
+sleep $runtime
+
+echo $(($RANDOM))


Property changes on: demo/cray/bin/random2.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: demo/cray/bin/random3.sh
===================================================================
--- demo/cray/bin/random3.sh	                        (rev 0)
+++ demo/cray/bin/random3.sh	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+runtime=${1:-0}
+range=$2
+
+sleep $runtime
+
+echo $(($RANDOM%range))
+
+


Property changes on: demo/cray/bin/random3.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: demo/cray/bin/random4.sh
===================================================================
--- demo/cray/bin/random4.sh	                        (rev 0)
+++ demo/cray/bin/random4.sh	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,12 @@
+#! /bin/sh
+
+runtime=${1:-0}
+range=$2
+n=$3
+
+sleep $runtime
+
+for ((i=0;i<n;i++)); do
+  echo $(($RANDOM%range))
+done
+


Property changes on: demo/cray/bin/random4.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: demo/cray/bin/random5.sh
===================================================================
--- demo/cray/bin/random5.sh	                        (rev 0)
+++ demo/cray/bin/random5.sh	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,14 @@
+#! /bin/sh
+
+runtime=${1:-0}
+range=$2
+biasfile=$3
+n=$4
+
+sleep $runtime
+
+read scale offset <$biasfile
+
+for ((i=0;i<n;i++)); do
+  echo $(( ($RANDOM%range)*scale+offset))
+done


Property changes on: demo/cray/bin/random5.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: demo/cray/data/data.txt
===================================================================
--- demo/cray/data/data.txt	                        (rev 0)
+++ demo/cray/data/data.txt	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1 @@
+Hi Swift!

Added: demo/cray/part01/README
===================================================================
--- demo/cray/part01/README	                        (rev 0)
+++ demo/cray/part01/README	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,40 @@
+
+TOPIC: First Swift script - run a "simulation" program, random.sh
+
+
+Verify that random.sh is in your path, and that it works:
+
+$ which random.sh
+$ random.sh
+
+Study the Swift program:
+
+$ cat p1.swift
+
+Examine the tool catalog file:
+
+$ cat tc
+
+Run the program:
+
+$ swift -tc.file tc p1.swift
+
+Look at the output:
+
+$ cat _concurrent/*
+
+Look at the other files generated:
+
+$ ls -l
+
+We'll talk more about these files later
+
+$ cleanup
+
+Then test the sript a few more times.
+
+$ swift -tc.file tc p1.swift; cat _concurrent/*
+
+$ swift -tc.file tc p1.swift; cat _concurrent/*
+
+$ swift -tc.file tc p1.swift; cat _concurrent/*

Added: demo/cray/part01/p1.swift
===================================================================
--- demo/cray/part01/p1.swift	                        (rev 0)
+++ demo/cray/part01/p1.swift	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,8 @@
+type file;
+
+app (file o) mysim ()
+{
+  random stdout=@filename(o);
+}
+
+file f = mysim();

Added: demo/cray/part01/tc
===================================================================
--- demo/cray/part01/tc	                        (rev 0)
+++ demo/cray/part01/tc	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1 @@
+localhost random random.sh

Added: demo/cray/part02/README
===================================================================
--- demo/cray/part02/README	                        (rev 0)
+++ demo/cray/part02/README	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,33 @@
+
+TOPIC: specifying the output filenames
+
+Study the Swift program:
+
+$ cat p2.swift
+
+Examine the tool catalog file:
+
+$ cat tc
+
+Run the program:
+
+$ swift -tc.file tc p2.swift
+
+Look at the output:
+
+$ cat sim.out
+
+Then test the sript a few more times.
+
+$ swift -tc.file tc p1.swift; cat sim.out
+
+$ swift -tc.file tc p1.swift; cat sim.out
+
+$ swift -tc.file tc p1.swift; cat sim.out
+
+Things to try:
+
+- change the output filename
+
+- add a dir component to the output filename
+

Added: demo/cray/part02/p2.swift
===================================================================
--- demo/cray/part02/p2.swift	                        (rev 0)
+++ demo/cray/part02/p2.swift	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,9 @@
+type file;
+
+app (file o) mysim ()
+{
+  random stdout=@filename(o);
+}
+
+file f<"sim.out">;
+f = mysim();

Added: demo/cray/part02/p2b.swift
===================================================================
--- demo/cray/part02/p2b.swift	                        (rev 0)
+++ demo/cray/part02/p2b.swift	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,9 @@
+type file;
+
+app (file o) mysim ()
+{
+  random stdout=@filename(o);
+}
+
+file f<"output/sim.out">;
+f = mysim();

Added: demo/cray/part02/tc
===================================================================
--- demo/cray/part02/tc	                        (rev 0)
+++ demo/cray/part02/tc	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1 @@
+localhost random random.sh

Added: demo/cray/part03/README
===================================================================
--- demo/cray/part03/README	                        (rev 0)
+++ demo/cray/part03/README	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,20 @@
+
+TOPIC: run many instances of a "simulation" program in a foreach() loop
+
+
+Run the program:
+
+$ swift -tc.file tc p3.swift
+
+Look at the output:
+
+$ cd _concurrent
+$ ls -l
+$ cat *
+
+Look at the order in which the files were written:
+
+$ ls -lt
+
+We'll come back to this...
+

Added: demo/cray/part03/p3.swift
===================================================================
--- demo/cray/part03/p3.swift	                        (rev 0)
+++ demo/cray/part03/p3.swift	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,11 @@
+type file;
+
+app (file o) mysim ()
+{
+  random stdout=@filename(o);
+}
+
+foreach i in [0:9] {
+  file f = mysim();
+}
+

Added: demo/cray/part03/tc
===================================================================
--- demo/cray/part03/tc	                        (rev 0)
+++ demo/cray/part03/tc	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1 @@
+localhost random random.sh

Added: demo/cray/part04/README
===================================================================
--- demo/cray/part04/README	                        (rev 0)
+++ demo/cray/part04/README	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,42 @@
+
+TOPIC: run a program in a foreach() loop with explicitly named output files.
+
+
+Study the program:
+
+- @strcat() is a Swift builtin function (the @name() form is used for many but not all builtins)
+
+- Note that @strcat() coerces numeric args to strings 
+
+- <"filename"> was a shorthand for <single_file_mapper;...> but the latter is more flexible.
+
+Run the program:
+
+$ swift -tc.file tc p4.swift
+
+Look at the output:
+
+$ cd output
+$ ls -l
+$ cat *
+
+
+Try:
+
+- Adjust the script to take the number of simulations to do from the command line
+
+  @arg("argname") returns arguments after the .swift script on the swift command line:
+
+    swift -tc.file tc p4.swift -myarg1=value1 ...
+
+  @arg("argname","default") returns "default" if the argname is not given on the command line
+
+  @toInt() converts strings to integers:
+
+    @toInt(@arg("myArg1"))
+
+
+- trace(expr1,...) traces expressions on stdout.
+
+  Try inserting a few traces.  But remember: Swift is *very* concurrent!
+

Added: demo/cray/part04/p4.swift
===================================================================
--- demo/cray/part04/p4.swift	                        (rev 0)
+++ demo/cray/part04/p4.swift	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,12 @@
+type file;
+
+app (file o) mysim ()
+{
+  random stdout=@filename(o);
+}
+
+foreach i in [0:9] {
+  file f <single_file_mapper; file=@strcat("output/sim_",i,".out")>;
+  f = mysim();
+}
+

Added: demo/cray/part04/tc
===================================================================
--- demo/cray/part04/tc	                        (rev 0)
+++ demo/cray/part04/tc	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1 @@
+localhost random random.sh

Added: demo/cray/part05/README
===================================================================
--- demo/cray/part05/README	                        (rev 0)
+++ demo/cray/part05/README	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,51 @@
+
+
+TOPIC: Add a program that "analyzes" the output the parallel simulations
+
+
+Study the program:
+
+We added a new app to "analyze" all the simulation outputs:
+
+app (file o) analyze (file s[])
+{
+  average @filenames(s) stdout=@filename(o);
+}
+
+Nots that it expects an array of files as its input, and that
+it uses @filenames() to place the names of all the files on 
+the command line to the "average" program.
+
+Average does:  
+--------------------
+#! /bin/sh
+
+awk '
+
+{ sum += $1}
+
+END { print sum/NR }
+' $*
+-------------------
+
+
+At the end of the script we insert:
+
+file stats<"output/average.out">;
+stats = analyze(sims);
+
+...which runs the analysis *after* all the simulations complete.
+
+
+Run the program:
+
+$ swift -tc.file tc p5.swift
+
+Look at the output:
+
+$ cd output
+$ ls -l
+$ cat sim*.out
+$ cat average.out
+
+

Added: demo/cray/part05/p5.swift
===================================================================
--- demo/cray/part05/p5.swift	                        (rev 0)
+++ demo/cray/part05/p5.swift	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,24 @@
+type file;
+
+app (file o) mysim ()
+{
+  random stdout=@filename(o);
+}
+
+app (file o) analyze (file s[])
+{
+  average @filenames(s) stdout=@filename(o);
+}
+
+file sims[];
+
+int nsim = @toInt(@arg("nsim","10"));
+
+foreach i in [0:nsim-1] {
+  file simout <single_file_mapper; file=@strcat("output/sim_",i,".out")>;
+  simout = mysim();
+  sims[i] = simout;
+}
+
+file stats<"output/average.out">;
+stats = analyze(sims);

Added: demo/cray/part05/tc
===================================================================
--- demo/cray/part05/tc	                        (rev 0)
+++ demo/cray/part05/tc	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,2 @@
+localhost random  random.sh
+localhost average avg.sh

Added: demo/cray/part06/README
===================================================================
--- demo/cray/part06/README	                        (rev 0)
+++ demo/cray/part06/README	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,28 @@
+
+TOPIC: add arguments to the "simulation" program
+(to control number of steps, range of output, and number of output lines)
+
+
+Test new versions of the "simulation" program:
+
+  random.sh                            # original
+  random2.sh [runtime]                 # runtime in seconds; defaults to 1 sec
+  random3.sh [runtime] [range]         # requests random numbers in {0:range-1}
+  random4.sh [runtime] [range] [count] # requests "count" random numbers in {0:range}
+
+p6.swift changes to random2 for the simulation program and adds an argument.
+
+Run the program:
+
+$ swift -tc.file tc p6.swift -steps=3  # each simulation takes 3 seconds
+
+Next we need to use the parallel cluster for our simulations!
+
+Try:
+
+- change to random3.sh and add the extra argument "range"
+
+- change to random4.sh and add yet another argument "count"
+
+
+

Added: demo/cray/part06/p6.swift
===================================================================
--- demo/cray/part06/p6.swift	                        (rev 0)
+++ demo/cray/part06/p6.swift	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,25 @@
+type file;
+
+app (file o) mysim2 (int timesteps)
+{
+  random2 timesteps stdout=@filename(o);
+}
+
+app (file o) analyze (file s[])
+{
+  average @filenames(s) stdout=@filename(o);
+}
+
+file sims[];
+int  nsim = @toInt(@arg("nsim","10"));
+
+int steps = @toInt(@arg("steps","1"));
+
+foreach i in [0:nsim-1] {
+  file simout <single_file_mapper; file=@strcat("output/sim_",i,".out")>;
+  simout = mysim2(steps);
+  sims[i] = simout;
+}
+
+file stats<"output/average.out">;
+stats = analyze(sims);

Added: demo/cray/part06/tc
===================================================================
--- demo/cray/part06/tc	                        (rev 0)
+++ demo/cray/part06/tc	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,2 @@
+localhost random2  random2.sh
+localhost average avg.sh

Added: demo/cray/part07/README
===================================================================
--- demo/cray/part07/README	                        (rev 0)
+++ demo/cray/part07/README	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,81 @@
+
+TOPIC: Run the "simulations" on the parallel cluster
+
+
+Til now we've been running our "simulations" on the local login host.
+
+Now we'll run them on the parallel cluster.
+
+The script will be the same as previous, but we change the tool catalog to
+indicate that our "simulation app" (random4.sh) should be run on the
+"westmere" partition of the Midway cluster using the "slurm" scheduler:
+
+We changed file "tc" from:
+
+localhost random4  random4.sh
+localhost average  avg.sh
+
+to:
+
+westmere  random4  random4.sh
+localhost average  avg.sh
+
+And we added the "sites.xml" file which specifies two "pools" of resources,
+the "local host" pool (which we've been using till now) and the "westmere" pool.
+
+To run, we now add the sites.xml file to the swift command line:
+
+$ swift -tc.file tc -sites.file sites.xml p7.swift -steps=10 -range=1000 -count=6 -nsim=100
+
+Note that we're now asking for 100 simulations to be run, each of which
+is to run for 10 steps (ie 10 seconds).
+
+The sites file looks like this:
+
+<config>
+
+  <pool handle="localhost">
+    <execution provider="local"/>
+    <filesystem provider="local"/>
+    <workdirectory>/scratch/midway/{env.USER}/swiftwork</workdirectory>
+  </pool>
+
+  <pool handle="westmere">
+    <execution provider="coaster" jobmanager="local:slurm"/>
+
+    <!-- Set partition and account here: -->
+    <profile namespace="globus" key="queue">westmere</profile>
+    <profile namespace="globus" key="ppn">12</profile>
+    <!-- <profile namespace="globus" key="project">pi-wilde</profile> -->
+
+    <!-- Set number of jobs and nodes per job here: -->
+    <profile namespace="globus" key="slots">1</profile>
+    <profile namespace="globus" key="maxnodes">1</profile>
+    <profile namespace="globus" key="nodegranularity">1</profile>
+    <profile namespace="globus" key="jobsPerNode">12</profile> <!-- apps per node! -->
+    <profile namespace="karajan" key="jobThrottle">.11</profile> <!-- eg .11 -> 12 -->
+
+    <!-- Set estimated app time (maxwalltime) and requested job time (maxtime) here: -->
+    <profile namespace="globus" key="maxWalltime">00:15:00</profile>
+    <profile namespace="globus" key="maxtime">1800</profile>  <!-- in seconds! -->
+
+    <!-- Set data staging model and work dir here: -->
+    <filesystem provider="local"/>
+    <workdirectory>/scratch/midway/{env.USER}/swiftwork</workdirectory>
+
+    <!-- Typically leave these constant: -->
+    <profile namespace="globus" key="slurm.exclusive">false</profile>
+    <profile namespace="globus" key="highOverAllocation">100</profile>
+    <profile namespace="globus" key="lowOverAllocation">100</profile>
+    <profile namespace="karajan" key="initialScore">10000</profile>
+  </pool>
+
+</config>
+
+Try:
+
+- running more app() calls at once:  change jobsPerNode and jobThrottle
+
+- requesting more than 1 slurm job at once: change slots
+
+- requesting nodes in units greater than 1: change maxnodes and nodeGranularity

Added: demo/cray/part07/p7.swift
===================================================================
--- demo/cray/part07/p7.swift	                        (rev 0)
+++ demo/cray/part07/p7.swift	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,27 @@
+type file;
+
+app (file o) mysim4 (int timesteps, int range, int count)
+{
+  random4 timesteps range count stdout=@filename(o);
+}
+
+app (file o) analyze (file s[])
+{
+  average @filenames(s) stdout=@filename(o);
+}
+
+file sims[];
+int  nsim  = @toInt(@arg("nsim",  "10"));
+
+int  steps = @toInt(@arg("steps", "1"));
+int  range = @toInt(@arg("range", "100"));
+int  count = @toInt(@arg("count", "10"));
+
+foreach i in [0:nsim-1] {
+  file simout <single_file_mapper; file=@strcat("output/sim_",i,".out")>;
+  simout = mysim4(steps,range,count);
+  sims[i] = simout;
+}
+
+file stats<"output/average.out">;
+stats = analyze(sims);

Added: demo/cray/part07/sites.xml
===================================================================
--- demo/cray/part07/sites.xml	                        (rev 0)
+++ demo/cray/part07/sites.xml	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,39 @@
+<config>
+
+  <pool handle="localhost">
+    <execution provider="local"/>
+    <filesystem provider="local"/>
+    <workdirectory>/scratch/midway/{env.USER}/swiftwork</workdirectory>
+  </pool>
+
+  <pool handle="westmere">
+    <execution provider="coaster" jobmanager="local:slurm"/>
+
+    <!-- Set partition and account here: -->
+    <profile namespace="globus" key="queue">westmere</profile>
+    <profile namespace="globus" key="ppn">12</profile>
+    <!-- <profile namespace="globus" key="project">pi-wilde</profile> -->
+
+    <!-- Set number of jobs and nodes per job here: -->
+    <profile namespace="globus" key="slots">1</profile>
+    <profile namespace="globus" key="maxnodes">1</profile>
+    <profile namespace="globus" key="nodegranularity">1</profile>
+    <profile namespace="globus" key="jobsPerNode">12</profile> <!-- apps per node! -->
+    <profile namespace="karajan" key="jobThrottle">.11</profile> <!-- eg .11 -> 12 -->
+
+    <!-- Set estimated app time (maxwalltime) and requested job time (maxtime) here: -->
+    <profile namespace="globus" key="maxWalltime">00:15:00</profile>
+    <profile namespace="globus" key="maxtime">1800</profile>  <!-- in seconds! -->
+
+    <!-- Set data staging model and work dir here: -->
+    <filesystem provider="local"/>
+    <workdirectory>/scratch/midway/{env.USER}/swiftwork</workdirectory>
+
+    <!-- Typically leave these constant: -->
+    <profile namespace="globus" key="slurm.exclusive">false</profile>
+    <profile namespace="globus" key="highOverAllocation">100</profile>
+    <profile namespace="globus" key="lowOverAllocation">100</profile>
+    <profile namespace="karajan" key="initialScore">10000</profile>
+  </pool>
+
+</config>

Added: demo/cray/part07/tc
===================================================================
--- demo/cray/part07/tc	                        (rev 0)
+++ demo/cray/part07/tc	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,2 @@
+westmere  random4  random4.sh
+localhost average  avg.sh

Added: demo/cray/part08/README
===================================================================
--- demo/cray/part08/README	                        (rev 0)
+++ demo/cray/part08/README	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,81 @@
+
+TOPIC: Run the "simulations" on the parallel cluster
+
+
+Til now we've been running our "simulations" on the local login host.
+
+Now we'll run them on the parallel cluster.
+
+The script will be the same as previous, but we change the tool catalog to
+indicate that our "simulation app" (random4.sh) should be run on the
+"westmere" partition of the Midway cluster using the "slurm" scheduler:
+
+We changed file "tc" from:
+
+localhost random4  random4.sh
+localhost average  avg.sh
+
+to:
+
+westmere  random4  random4.sh
+localhost average  avg.sh
+
+And we added the "sites.xml" file which specifies two "pools" of resources,
+the "local host" pool (which we've been using till now) and the "westmere" pool.
+
+To run, we now add the sites.xml file to the swift command line:
+
+$ swift -tc.file tc -sites.file sites.xml p7.swift -steps=10 -range=1000 -count=6 -nsim=100
+
+Note that we're now asking for 100 simulations to be run, each of which
+is to run for 10 steps (ie 10 seconds).
+
+The sites file looks like this:
+
+<config>
+
+  <pool handle="localhost">
+    <execution provider="local"/>
+    <filesystem provider="local"/>
+    <workdirectory>/scratch/midway/{env.USER}/swiftwork</workdirectory>
+  </pool>
+
+  <pool handle="westmere">
+    <execution provider="coaster" jobmanager="local:slurm"/>
+
+    <!-- Set partition and account here: -->
+    <profile namespace="globus" key="queue">westmere</profile>
+    <profile namespace="globus" key="ppn">12</profile>
+    <!-- <profile namespace="globus" key="project">pi-wilde</profile> -->
+
+    <!-- Set number of jobs and nodes per job here: -->
+    <profile namespace="globus" key="slots">1</profile>
+    <profile namespace="globus" key="maxnodes">1</profile>
+    <profile namespace="globus" key="nodegranularity">1</profile>
+    <profile namespace="globus" key="jobsPerNode">12</profile> <!-- apps per node! -->
+    <profile namespace="karajan" key="jobThrottle">.11</profile> <!-- eg .11 -> 12 -->
+
+    <!-- Set estimated app time (maxwalltime) and requested job time (maxtime) here: -->
+    <profile namespace="globus" key="maxWalltime">00:15:00</profile>
+    <profile namespace="globus" key="maxtime">1800</profile>  <!-- in seconds! -->
+
+    <!-- Set data staging model and work dir here: -->
+    <filesystem provider="local"/>
+    <workdirectory>/scratch/midway/{env.USER}/swiftwork</workdirectory>
+
+    <!-- Typically leave these constant: -->
+    <profile namespace="globus" key="slurm.exclusive">false</profile>
+    <profile namespace="globus" key="highOverAllocation">100</profile>
+    <profile namespace="globus" key="lowOverAllocation">100</profile>
+    <profile namespace="karajan" key="initialScore">10000</profile>
+  </pool>
+
+</config>
+
+Try:
+
+- running more app() calls at once:  change jobsPerNode and jobThrottle
+
+- requesting more than 1 slurm job at once: change slots
+
+- requesting nodes in units greater than 1: change maxnodes and nodeGranularity

Added: demo/cray/part08/cf
===================================================================
--- demo/cray/part08/cf	                        (rev 0)
+++ demo/cray/part08/cf	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,9 @@
+user.home=/lustre/beagle/wilde
+wrapperlog.always.transfer=true
+sitedir.keep=true
+execution.retries=0
+lazy.errors=false
+status.mode=provider
+use.wrapper.staging=false
+use.provider.staging=false
+provider.staging.pin.swiftfiles=false

Added: demo/cray/part08/cray.xml
===================================================================
--- demo/cray/part08/cray.xml	                        (rev 0)
+++ demo/cray/part08/cray.xml	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,31 @@
+<config>
+
+  <pool handle="localhost">
+    <execution provider="local"/>
+    <filesystem provider="local"/>
+    <workdirectory>/scratch/midway/{env.USER}/swiftwork</workdirectory>
+  </pool>
+
+  <pool handle="cray">
+    <execution provider="coaster" jobmanager="local:pbs"/>
+    <!-- <profile namespace="globus" key="project">CI-CCR000013</profile> -->
+
+    <profile namespace="globus" key="providerAttributes">pbs.aprun;pbs.mpp;depth=24</profile>
+    <!-- <profile namespace="globus" key="queue">scalability</profile> -->
+    <profile namespace="globus" key="queue">batch</profile>
+
+    <profile namespace="globus" key="jobsPerNode">24</profile>
+    <profile namespace="globus" key="maxTime">1800</profile>
+
+    <profile namespace="globus" key="slots">1</profile>
+    <profile namespace="globus" key="nodeGranularity">1</profile>
+    <profile namespace="globus" key="maxNodes">1</profile>
+
+    <profile namespace="karajan" key="jobThrottle">12</profile>
+    <profile namespace="karajan" key="initialScore">10000</profile>
+
+    <filesystem provider="local"/>
+    <workdirectory>/lustre/beagle/wilde/swift/lab/swiftwork</workdirectory>
+  </pool>
+
+</config>

Added: demo/cray/part08/data/bias.dat
===================================================================
--- demo/cray/part08/data/bias.dat	                        (rev 0)
+++ demo/cray/part08/data/bias.dat	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1 @@
+1000000 123

Added: demo/cray/part08/dm
===================================================================
--- demo/cray/part08/dm	                        (rev 0)
+++ demo/cray/part08/dm	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1 @@
+rule .*/data.* DIRECT /lustre/beagle/wilde/swift/demo/cray/svn/part08

Added: demo/cray/part08/p8.swift
===================================================================
--- demo/cray/part08/p8.swift	                        (rev 0)
+++ demo/cray/part08/p8.swift	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,29 @@
+type file;
+
+app (file o) mysim5 (int timesteps, int range, file bias, int count)
+{
+  random5 timesteps range @filename(bias) count stdout=@filename(o);
+}
+
+app (file o) analyze (file s[])
+{
+  average @filenames(s) stdout=@filename(o);
+}
+
+file sims[];
+int  nsim  = @toInt(@arg("nsim",  "10"));
+
+int  steps = @toInt(@arg("steps", "1"));
+int  range = @toInt(@arg("range", "100"));
+int  count = @toInt(@arg("count", "10"));
+
+file bias<"data/bias.dat">;
+
+foreach i in [0:nsim-1] {
+  file simout <single_file_mapper; file=@strcat("data/sim_",i,".out")>;
+  simout = mysim5(steps,range,bias,count);
+  sims[i] = simout;
+}
+
+file stats<"output/average.out">;
+stats = analyze(sims);

Added: demo/cray/part08/pbs.xml
===================================================================
--- demo/cray/part08/pbs.xml	                        (rev 0)
+++ demo/cray/part08/pbs.xml	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,23 @@
+<config>
+  <pool handle="pbs">
+    <execution provider="coaster" jobmanager="local:pbs"/>
+    <!-- <profile namespace="globus" key="project">CI-CCR000013</profile> -->
+
+    <profile namespace="globus" key="providerAttributes">pbs.aprun;pbs.mpp;depth=24</profile>
+    <!-- <profile namespace="globus" key="queue">scalability</profile> -->
+    <profile namespace="globus" key="queue">batch</profile>
+
+    <profile namespace="globus" key="jobsPerNode">24</profile>
+    <profile namespace="globus" key="maxTime">1800</profile>
+
+    <profile namespace="globus" key="slots">1</profile>
+    <profile namespace="globus" key="nodeGranularity">1</profile>
+    <profile namespace="globus" key="maxNodes">1</profile>
+
+    <profile namespace="karajan" key="jobThrottle">12</profile>
+    <profile namespace="karajan" key="initialScore">10000</profile>
+
+    <filesystem provider="local"/>
+    <workdirectory>/lustre/beagle/wilde/swift/lab/swiftwork</workdirectory>
+  </pool>
+</config>

Added: demo/cray/part08/tc
===================================================================
--- demo/cray/part08/tc	                        (rev 0)
+++ demo/cray/part08/tc	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,2 @@
+cray random5  /lustre/beagle/wilde/swift/demo/cray/svn/bin/random5.sh
+cray average  /lustre/beagle/wilde/swift/demo/cray/svn/bin/avg.sh

Added: demo/cray/setup.csh
===================================================================
--- demo/cray/setup.csh	                        (rev 0)
+++ demo/cray/setup.csh	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,35 @@
+
+module load swift
+
+setenv SBATCH_RESERVATION swift
+
+set DIR=`dirname ${0}`
+cd $DIR
+set DIR=`pwd`
+
+echo Adding $DIR/bin to PATH:
+setenv PATH $DIR/bin:$PATH
+
+mkdir -p $HOME/.swift
+
+if ( -f $HOME/.swift/swift.properties ) then
+  echo Adding properties to end of $HOME/.swift/swift.properties
+else
+  echo creating $HOME/.swift/swift.properties
+endif
+
+cat >>$HOME/.swift/swift.properties <<END
+
+# Properties for Swift Tutorial
+
+status.mode=provider
+use.provider.staging=false
+use.wrapper.staging=false
+wrapperlog.always.transfer=true
+execution.retries=0
+lazy.errors=false
+provider.staging.pin.swiftfiles=false
+sitedir.keep=true
+file.gc.enabled=false
+tcp.port.range=50000,51000
+END

Added: demo/cray/setup.sh
===================================================================
--- demo/cray/setup.sh	                        (rev 0)
+++ demo/cray/setup.sh	2013-04-16 20:54:50 UTC (rev 6451)
@@ -0,0 +1,36 @@
+
+module load swift
+
+export SBATCH_RESERVATION=swift
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+
+echo Adding $DIR/bin to PATH:
+
+PATH=$DIR/bin:$PATH
+
+echo $PATH
+
+mkdir -p $HOME/.swift
+
+if [ -f $HOME/.swift/swift.properties ]; then
+  echo Adding properties to end of $HOME/.swift/swift.properties
+else
+  echo creating $HOME/.swift/swift.properties
+fi
+
+cat >>$HOME/.swift/swift.properties <<END
+
+# Properties for Swift Tutorial 
+
+status.mode=provider
+use.provider.staging=false
+use.wrapper.staging=false
+wrapperlog.always.transfer=true
+execution.retries=0
+lazy.errors=false
+provider.staging.pin.swiftfiles=false
+sitedir.keep=true
+file.gc.enabled=false
+tcp.port.range=50000,51000
+END




More information about the Swift-commit mailing list