[Swift-commit] r7055 - in SwiftApps/tryswift: . scripts

davidk at ci.uchicago.edu davidk at ci.uchicago.edu
Wed Sep 11 13:25:05 CDT 2013


Author: davidk
Date: 2013-09-11 13:25:03 -0500 (Wed, 11 Sep 2013)
New Revision: 7055

Added:
   SwiftApps/tryswift/scripts/build_docs.sh
   SwiftApps/tryswift/scripts/p1.html
   SwiftApps/tryswift/scripts/p2.html
   SwiftApps/tryswift/scripts/p3.html
   SwiftApps/tryswift/scripts/p4.html
   SwiftApps/tryswift/scripts/p5.html
   SwiftApps/tryswift/scripts/p6.html
   SwiftApps/tryswift/scripts/part1.txt
   SwiftApps/tryswift/scripts/part2.txt
   SwiftApps/tryswift/scripts/part3.txt
   SwiftApps/tryswift/scripts/part4.txt
   SwiftApps/tryswift/scripts/part5.txt
   SwiftApps/tryswift/scripts/part6.txt
Modified:
   SwiftApps/tryswift/index.php
Log:
Add html documention for each tutorial script (in it's current form, which is cray specific)
Dynamically add link to script documentation, if it exists


Modified: SwiftApps/tryswift/index.php
===================================================================
--- SwiftApps/tryswift/index.php	2013-09-11 17:47:27 UTC (rev 7054)
+++ SwiftApps/tryswift/index.php	2013-09-11 18:25:03 UTC (rev 7055)
@@ -38,7 +38,14 @@
 
                sort($scriptFiles);
                foreach($scriptFiles as $script) {
-                  echo "<li><input type=\"radio\" name=\"existingApplications\" value=\"scripts/$script\" onclick=\"addtext()\">$script</li>\n";
+                  echo "<li><input type=\"radio\" name=\"existingApplications\" value=\"scripts/$script\" onclick=\"addtext()\">$script\n";
+
+                  $html_filename="scripts/" . basename($script, ".swift") . ".html";
+                  if(file_exists($html_filename)) {
+                     echo "<a href=\"$html_filename\" target=\"_blank\">(info)</a>\n";
+                  }   
+
+                  echo "</li>\n";    
                }
             ?>
             </ul>

Added: SwiftApps/tryswift/scripts/build_docs.sh
===================================================================
--- SwiftApps/tryswift/scripts/build_docs.sh	                        (rev 0)
+++ SwiftApps/tryswift/scripts/build_docs.sh	2013-09-11 18:25:03 UTC (rev 7055)
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+asciidoc -a icons -a stylesheet=$PWD/asciidoc.css -a max-width=800px -o p1.html part1.txt
+asciidoc -a icons -a stylesheet=$PWD/asciidoc.css -a max-width=800px -o p2.html part2.txt
+asciidoc -a icons -a stylesheet=$PWD/asciidoc.css -a max-width=800px -o p3.html part3.txt
+asciidoc -a icons -a stylesheet=$PWD/asciidoc.css -a max-width=800px -o p4.html part4.txt 
+asciidoc -a icons -a stylesheet=$PWD/asciidoc.css -a max-width=800px -o p5.html part5.txt 
+asciidoc -a icons -a stylesheet=$PWD/asciidoc.css -a max-width=800px -o p6.html part6.txt 


Property changes on: SwiftApps/tryswift/scripts/build_docs.sh
___________________________________________________________________
Added: svn:executable
   + *

Added: SwiftApps/tryswift/scripts/p1.html
===================================================================
--- SwiftApps/tryswift/scripts/p1.html	                        (rev 0)
+++ SwiftApps/tryswift/scripts/p1.html	2013-09-11 18:25:03 UTC (rev 7055)
@@ -0,0 +1,631 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
+<meta name="generator" content="AsciiDoc 8.6.4" />
+<title>Part 1: Run a single application under Swift</title>
+<style type="text/css">
+/* Sans-serif font. */
+h1, h2, h3, h4, h5, h6,
+div.title, caption.title,
+thead, p.table.header,
+div#toctitle,
+span#author, span#revnumber, span#revdate, span#revremark,
+div#footer {
+  font-family: Arial,Helvetica,sans-serif;
+}
+
+/* Serif font. */
+div.sectionbody {
+  font-family: Georgia,"Times New Roman",Times,serif;
+}
+
+/* Monospace font. */
+tt {
+  font-size: inherit;
+}
+
+body {
+  margin: 1em 5% 1em 5%;
+}
+
+a {
+  color: blue;
+  text-decoration: underline;
+}
+a:visited {
+  color: fuchsia;
+}
+
+em {
+  font-style: italic;
+  color: navy;
+}
+
+strong {
+  font-weight: bold;
+  color: #083194;
+}
+
+tt {
+  font-size: inherit;
+  color: navy;
+}
+
+h1, h2, h3, h4, h5, h6 {
+  color: #527bbd;
+  margin-top: 1.2em;
+  margin-bottom: 0.5em;
+  line-height: 1.3;
+}
+
+h1, h2, h3 {
+  border-bottom: 2px solid silver;
+}
+h2 {
+  padding-top: 0.5em;
+}
+h3 {
+  float: left;
+}
+h3 + * {
+  clear: left;
+}
+
+div.sectionbody {
+  margin-left: 0;
+}
+
+hr {
+  border: 1px solid silver;
+}
+
+p {
+  margin-top: 0.5em;
+  margin-bottom: 0.5em;
+}
+
+ul, ol, li > p {
+  margin-top: 0;
+}
+ul > li     { color: #aaa; }
+ul > li > * { color: black; }
+
+pre {
+  padding: 0;
+  margin: 0;
+}
+
+span#author {
+  color: #527bbd;
+  font-weight: bold;
+  font-size: 1.1em;
+}
+span#email {
+}
+span#revnumber, span#revdate, span#revremark {
+}
+
+div#footer {
+  font-size: small;
+  border-top: 2px solid silver;
+  padding-top: 0.5em;
+  margin-top: 4.0em;
+}
+div#footer-text {
+  float: left;
+  padding-bottom: 0.5em;
+}
+div#footer-badges {
+  float: right;
+  padding-bottom: 0.5em;
+}
+
+div#preamble {
+  margin-top: 1.5em;
+  margin-bottom: 1.5em;
+}
+div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
+div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
+div.admonitionblock {
+  margin-top: 1.0em;
+  margin-bottom: 1.5em;
+}
+div.admonitionblock {
+  margin-top: 2.0em;
+  margin-bottom: 2.0em;
+  margin-right: 10%;
+  color: #606060;
+}
+
+div.content { /* Block element content. */
+  padding: 0;
+}
+
+/* Block element titles. */
+div.title, caption.title {
+  color: #527bbd;
+  font-weight: bold;
+  text-align: left;
+  margin-top: 1.0em;
+  margin-bottom: 0.5em;
+}
+div.title + * {
+  margin-top: 0;
+}
+
+td div.title:first-child {
+  margin-top: 0.0em;
+}
+div.content div.title:first-child {
+  margin-top: 0.0em;
+}
+div.content + div.title {
+  margin-top: 0.0em;
+}
+
+div.sidebarblock > div.content {
+  background: #ffffee;
+  border: 1px solid #dddddd;
+  border-left: 4px solid #f0f0f0;
+  padding: 0.5em;
+}
+
+div.listingblock > div.content {
+  border: 1px solid #dddddd;
+  border-left: 5px solid #f0f0f0;
+  background: #f8f8f8;
+  padding: 0.5em;
+}
+
+div.quoteblock, div.verseblock {
+  padding-left: 1.0em;
+  margin-left: 1.0em;
+  margin-right: 10%;
+  border-left: 5px solid #f0f0f0;
+  color: #777777;
+}
+
+div.quoteblock > div.attribution {
+  padding-top: 0.5em;
+  text-align: right;
+}
+
+div.verseblock > pre.content {
+  font-family: inherit;
+  font-size: inherit;
+}
+div.verseblock > div.attribution {
+  padding-top: 0.75em;
+  text-align: left;
+}
+/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
+div.verseblock + div.attribution {
+  text-align: left;
+}
+
+div.admonitionblock .icon {
+  vertical-align: top;
+  font-size: 1.1em;
+  font-weight: bold;
+  text-decoration: underline;
+  color: #527bbd;
+  padding-right: 0.5em;
+}
+div.admonitionblock td.content {
+  padding-left: 0.5em;
+  border-left: 3px solid #dddddd;
+}
+
+div.exampleblock > div.content {
+  border-left: 3px solid #dddddd;
+  padding-left: 0.5em;
+}
+
+div.imageblock div.content { padding-left: 0; }
+span.image img { border-style: none; }
+a.image:visited { color: white; }
+
+dl {
+  margin-top: 0.8em;
+  margin-bottom: 0.8em;
+}
+dt {
+  margin-top: 0.5em;
+  margin-bottom: 0;
+  font-style: normal;
+  color: navy;
+}
+dd > *:first-child {
+  margin-top: 0.1em;
+}
+
+ul, ol {
+    list-style-position: outside;
+}
+ol.arabic {
+  list-style-type: decimal;
+}
+ol.loweralpha {
+  list-style-type: lower-alpha;
+}
+ol.upperalpha {
+  list-style-type: upper-alpha;
+}
+ol.lowerroman {
+  list-style-type: lower-roman;
+}
+ol.upperroman {
+  list-style-type: upper-roman;
+}
+
+div.compact ul, div.compact ol,
+div.compact p, div.compact p,
+div.compact div, div.compact div {
+  margin-top: 0.1em;
+  margin-bottom: 0.1em;
+}
+
+div.tableblock > table {
+  border: 3px solid #527bbd;
+}
+thead, p.table.header {
+  font-weight: bold;
+  color: #527bbd;
+}
+tfoot {
+  font-weight: bold;
+}
+td > div.verse {
+  white-space: pre;
+}
+p.table {
+  margin-top: 0;
+}
+/* Because the table frame attribute is overriden by CSS in most browsers. */
+div.tableblock > table[frame="void"] {
+  border-style: none;
+}
+div.tableblock > table[frame="hsides"] {
+  border-left-style: none;
+  border-right-style: none;
+}
+div.tableblock > table[frame="vsides"] {
+  border-top-style: none;
+  border-bottom-style: none;
+}
+
+
+div.hdlist {
+  margin-top: 0.8em;
+  margin-bottom: 0.8em;
+}
+div.hdlist tr {
+  padding-bottom: 15px;
+}
+dt.hdlist1.strong, td.hdlist1.strong {
+  font-weight: bold;
+}
+td.hdlist1 {
+  vertical-align: top;
+  font-style: normal;
+  padding-right: 0.8em;
+  color: navy;
+}
+td.hdlist2 {
+  vertical-align: top;
+}
+div.hdlist.compact tr {
+  margin: 0;
+  padding-bottom: 0;
+}
+
+.comment {
+  background: yellow;
+}
+
+.footnote, .footnoteref {
+  font-size: 0.8em;
+}
+
+span.footnote, span.footnoteref {
+  vertical-align: super;
+}
+
+#footnotes {
+  margin: 20px 0 20px 0;
+  padding: 7px 0 0 0;
+}
+
+#footnotes div.footnote {
+  margin: 0 0 5px 0;
+}
+
+#footnotes hr {
+  border: none;
+  border-top: 1px solid silver;
+  height: 1px;
+  text-align: left;
+  margin-left: 0;
+  width: 20%;
+  min-width: 100px;
+}
+
+div.colist td {
+  padding-right: 0.5em;
+  padding-bottom: 0.3em;
+  vertical-align: top;
+}
+div.colist td img {
+  margin-top: 0.3em;
+}
+
+ at media print {
+  div#footer-badges { display: none; }
+}
+
+div#toc {
+  margin-bottom: 2.5em;
+}
+
+div#toctitle {
+  color: #527bbd;
+  font-size: 1.1em;
+  font-weight: bold;
+  margin-top: 1.0em;
+  margin-bottom: 0.1em;
+}
+
+div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
+  margin-top: 0;
+  margin-bottom: 0;
+}
+div.toclevel2 {
+  margin-left: 2em;
+  font-size: 0.9em;
+}
+div.toclevel3 {
+  margin-left: 4em;
+  font-size: 0.9em;
+}
+div.toclevel4 {
+  margin-left: 6em;
+  font-size: 0.9em;
+}
+
+span.aqua { color: aqua; }
+span.black { color: black; }
+span.blue { color: blue; }
+span.fuchsia { color: fuchsia; }
+span.gray { color: gray; }
+span.green { color: green; }
+span.lime { color: lime; }
+span.maroon { color: maroon; }
+span.navy { color: navy; }
+span.olive { color: olive; }
+span.purple { color: purple; }
+span.red { color: red; }
+span.silver { color: silver; }
+span.teal { color: teal; }
+span.white { color: white; }
+span.yellow { color: yellow; }
+
+span.aqua-background { background: aqua; }
+span.black-background { background: black; }
+span.blue-background { background: blue; }
+span.fuchsia-background { background: fuchsia; }
+span.gray-background { background: gray; }
+span.green-background { background: green; }
+span.lime-background { background: lime; }
+span.maroon-background { background: maroon; }
+span.navy-background { background: navy; }
+span.olive-background { background: olive; }
+span.purple-background { background: purple; }
+span.red-background { background: red; }
+span.silver-background { background: silver; }
+span.teal-background { background: teal; }
+span.white-background { background: white; }
+span.yellow-background { background: yellow; }
+
+span.big { font-size: 2em; }
+span.small { font-size: 0.6em; }
+a:link { color:navy; }
+a:visited { color:navy; }
+
+.monospaced, code, pre {
+  font-family: "Courier New", Courier, monospace;
+  font-size: medium; /* inherit; */
+  color: black;
+  padding: 0;
+  margin: 0;
+}
+
+/*
+  background: #f8f8f8;
+  border: 1px solid #dddddd;
+  border-left: 5px solid #f0f0f0;
+  margin-right: 10%;
+*/
+
+div.listingblock > div.content {
+  padding: 0.5em;
+  background: none;
+  border: none;
+  border-left: none;
+  margin-right: none;
+}
+
+</style>
+<script type="text/javascript">
+/*<![CDATA[*/
+window.onload = function(){asciidoc.footnotes();}
+var asciidoc = {  // Namespace.
+
+/////////////////////////////////////////////////////////////////////
+// Table Of Contents generator
+/////////////////////////////////////////////////////////////////////
+
+/* Author: Mihai Bazon, September 2002
+ * http://students.infoiasi.ro/~mishoo
+ *
+ * Table Of Content generator
+ * Version: 0.4
+ *
+ * Feel free to use this script under the terms of the GNU General Public
+ * License, as long as you do not remove or alter this notice.
+ */
+
+ /* modified by Troy D. Hanson, September 2006. License: GPL */
+ /* modified by Stuart Rackham, 2006, 2009. License: GPL */
+
+// toclevels = 1..4.
+toc: function (toclevels) {
+
+  function getText(el) {
+    var text = "";
+    for (var i = el.firstChild; i != null; i = i.nextSibling) {
+      if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
+        text += i.data;
+      else if (i.firstChild != null)
+        text += getText(i);
+    }
+    return text;
+  }
+
+  function TocEntry(el, text, toclevel) {
+    this.element = el;
+    this.text = text;
+    this.toclevel = toclevel;
+  }
+
+  function tocEntries(el, toclevels) {
+    var result = new Array;
+    var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
+    // Function that scans the DOM tree for header elements (the DOM2
+    // nodeIterator API would be a better technique but not supported by all
+    // browsers).
+    var iterate = function (el) {
+      for (var i = el.firstChild; i != null; i = i.nextSibling) {
+        if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
+          var mo = re.exec(i.tagName);
+          if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
+            result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
+          }
+          iterate(i);
+        }
+      }
+    }
+    iterate(el);
+    return result;
+  }
+
+  var toc = document.getElementById("toc");
+  var entries = tocEntries(document.getElementById("content"), toclevels);
+  for (var i = 0; i < entries.length; ++i) {
+    var entry = entries[i];
+    if (entry.element.id == "")
+      entry.element.id = "_toc_" + i;
+    var a = document.createElement("a");
+    a.href = "#" + entry.element.id;
+    a.appendChild(document.createTextNode(entry.text));
+    var div = document.createElement("div");
+    div.appendChild(a);
+    div.className = "toclevel" + entry.toclevel;
+    toc.appendChild(div);
+  }
+  if (entries.length == 0)
+    toc.parentNode.removeChild(toc);
+},
+
+
+/////////////////////////////////////////////////////////////////////
+// Footnotes generator
+/////////////////////////////////////////////////////////////////////
+
+/* Based on footnote generation code from:
+ * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
+ */
+
+footnotes: function () {
+  var cont = document.getElementById("content");
+  var noteholder = document.getElementById("footnotes");
+  var spans = cont.getElementsByTagName("span");
+  var refs = {};
+  var n = 0;
+  for (i=0; i<spans.length; i++) {
+    if (spans[i].className == "footnote") {
+      n++;
+      // Use [\s\S] in place of . so multi-line matches work.
+      // Because JavaScript has no s (dotall) regex flag.
+      note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
+      noteholder.innerHTML +=
+        "<div class='footnote' id='_footnote_" + n + "'>" +
+        "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
+        n + "</a>. " + note + "</div>";
+      spans[i].innerHTML =
+        "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
+        "' title='View footnote' class='footnote'>" + n + "</a>]";
+      var id =spans[i].getAttribute("id");
+      if (id != null) refs["#"+id] = n;
+    }
+  }
+  if (n == 0)
+    noteholder.parentNode.removeChild(noteholder);
+  else {
+    // Process footnoterefs.
+    for (i=0; i<spans.length; i++) {
+      if (spans[i].className == "footnoteref") {
+        var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
+        href = href.match(/#.*/)[0];  // Because IE return full URL.
+        n = refs[href];
+        spans[i].innerHTML =
+          "[<a href='#_footnote_" + n +
+          "' title='View footnote' class='footnote'>" + n + "</a>]";
+      }
+    }
+  }
+}
+
+}
+/*]]>*/
+</script>
+</head>
+<body class="article" style="max-width:800px">
+<div id="header">
+<h1>Part 1: Run a single application under Swift</h1>
+</div>
+<div id="content">
+<div id="preamble">
+<div class="sectionbody">
+<div class="paragraph"><p>The first swift script, p1.swift, runs simulate.sh to generate a
+single random number. It writes the number to a file.</p></div>
+<div class="imageblock" style="text-align:center;">
+<div class="content">
+<img src="part01.png" alt="p1 workflow" />
+</div>
+</div>
+<div class="listingblock">
+<div class="title">p1.swift</div>
+<div class="content">
+<pre><tt>type file;
+
+app (file o) simulation ()
+{
+  simulate stdout=@filename(o);
+}
+
+file f <"sim.out">;
+f = simulation();</tt></pre>
+</div></div>
+</div>
+</div>
+</div>
+<div id="footnotes"><hr /></div>
+<div id="footer">
+<div id="footer-text">
+Last updated 2013-09-11 13:12:25 CDT
+</div>
+</div>
+</body>
+</html>

Added: SwiftApps/tryswift/scripts/p2.html
===================================================================
--- SwiftApps/tryswift/scripts/p2.html	                        (rev 0)
+++ SwiftApps/tryswift/scripts/p2.html	2013-09-11 18:25:03 UTC (rev 7055)
@@ -0,0 +1,656 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
+<meta name="generator" content="AsciiDoc 8.6.4" />
+<title></title>
+<style type="text/css">
+/* Sans-serif font. */
+h1, h2, h3, h4, h5, h6,
+div.title, caption.title,
+thead, p.table.header,
+div#toctitle,
+span#author, span#revnumber, span#revdate, span#revremark,
+div#footer {
+  font-family: Arial,Helvetica,sans-serif;
+}
+
+/* Serif font. */
+div.sectionbody {
+  font-family: Georgia,"Times New Roman",Times,serif;
+}
+
+/* Monospace font. */
+tt {
+  font-size: inherit;
+}
+
+body {
+  margin: 1em 5% 1em 5%;
+}
+
+a {
+  color: blue;
+  text-decoration: underline;
+}
+a:visited {
+  color: fuchsia;
+}
+
+em {
+  font-style: italic;
+  color: navy;
+}
+
+strong {
+  font-weight: bold;
+  color: #083194;
+}
+
+tt {
+  font-size: inherit;
+  color: navy;
+}
+
+h1, h2, h3, h4, h5, h6 {
+  color: #527bbd;
+  margin-top: 1.2em;
+  margin-bottom: 0.5em;
+  line-height: 1.3;
+}
+
+h1, h2, h3 {
+  border-bottom: 2px solid silver;
+}
+h2 {
+  padding-top: 0.5em;
+}
+h3 {
+  float: left;
+}
+h3 + * {
+  clear: left;
+}
+
+div.sectionbody {
+  margin-left: 0;
+}
+
+hr {
+  border: 1px solid silver;
+}
+
+p {
+  margin-top: 0.5em;
+  margin-bottom: 0.5em;
+}
+
+ul, ol, li > p {
+  margin-top: 0;
+}
+ul > li     { color: #aaa; }
+ul > li > * { color: black; }
+
+pre {
+  padding: 0;
+  margin: 0;
+}
+
+span#author {
+  color: #527bbd;
+  font-weight: bold;
+  font-size: 1.1em;
+}
+span#email {
+}
+span#revnumber, span#revdate, span#revremark {
+}
+
+div#footer {
+  font-size: small;
+  border-top: 2px solid silver;
+  padding-top: 0.5em;
+  margin-top: 4.0em;
+}
+div#footer-text {
+  float: left;
+  padding-bottom: 0.5em;
+}
+div#footer-badges {
+  float: right;
+  padding-bottom: 0.5em;
+}
+
+div#preamble {
+  margin-top: 1.5em;
+  margin-bottom: 1.5em;
+}
+div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
+div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
+div.admonitionblock {
+  margin-top: 1.0em;
+  margin-bottom: 1.5em;
+}
+div.admonitionblock {
+  margin-top: 2.0em;
+  margin-bottom: 2.0em;
+  margin-right: 10%;
+  color: #606060;
+}
+
+div.content { /* Block element content. */
+  padding: 0;
+}
+
+/* Block element titles. */
+div.title, caption.title {
+  color: #527bbd;
+  font-weight: bold;
+  text-align: left;
+  margin-top: 1.0em;
+  margin-bottom: 0.5em;
+}
+div.title + * {
+  margin-top: 0;
+}
+
+td div.title:first-child {
+  margin-top: 0.0em;
+}
+div.content div.title:first-child {
+  margin-top: 0.0em;
+}
+div.content + div.title {
+  margin-top: 0.0em;
+}
+
+div.sidebarblock > div.content {
+  background: #ffffee;
+  border: 1px solid #dddddd;
+  border-left: 4px solid #f0f0f0;
+  padding: 0.5em;
+}
+
+div.listingblock > div.content {
+  border: 1px solid #dddddd;
+  border-left: 5px solid #f0f0f0;
+  background: #f8f8f8;
+  padding: 0.5em;
+}
+
+div.quoteblock, div.verseblock {
+  padding-left: 1.0em;
+  margin-left: 1.0em;
+  margin-right: 10%;
+  border-left: 5px solid #f0f0f0;
+  color: #777777;
+}
+
+div.quoteblock > div.attribution {
+  padding-top: 0.5em;
+  text-align: right;
+}
+
+div.verseblock > pre.content {
+  font-family: inherit;
+  font-size: inherit;
+}
+div.verseblock > div.attribution {
+  padding-top: 0.75em;
+  text-align: left;
+}
+/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
+div.verseblock + div.attribution {
+  text-align: left;
+}
+
+div.admonitionblock .icon {
+  vertical-align: top;
+  font-size: 1.1em;
+  font-weight: bold;
+  text-decoration: underline;
+  color: #527bbd;
+  padding-right: 0.5em;
+}
+div.admonitionblock td.content {
+  padding-left: 0.5em;
+  border-left: 3px solid #dddddd;
+}
+
+div.exampleblock > div.content {
+  border-left: 3px solid #dddddd;
+  padding-left: 0.5em;
+}
+
+div.imageblock div.content { padding-left: 0; }
+span.image img { border-style: none; }
+a.image:visited { color: white; }
+
+dl {
+  margin-top: 0.8em;
+  margin-bottom: 0.8em;
+}
+dt {
+  margin-top: 0.5em;
+  margin-bottom: 0;
+  font-style: normal;
+  color: navy;
+}
+dd > *:first-child {
+  margin-top: 0.1em;
+}
+
+ul, ol {
+    list-style-position: outside;
+}
+ol.arabic {
+  list-style-type: decimal;
+}
+ol.loweralpha {
+  list-style-type: lower-alpha;
+}
+ol.upperalpha {
+  list-style-type: upper-alpha;
+}
+ol.lowerroman {
+  list-style-type: lower-roman;
+}
+ol.upperroman {
+  list-style-type: upper-roman;
+}
+
+div.compact ul, div.compact ol,
+div.compact p, div.compact p,
+div.compact div, div.compact div {
+  margin-top: 0.1em;
+  margin-bottom: 0.1em;
+}
+
+div.tableblock > table {
+  border: 3px solid #527bbd;
+}
+thead, p.table.header {
+  font-weight: bold;
+  color: #527bbd;
+}
+tfoot {
+  font-weight: bold;
+}
+td > div.verse {
+  white-space: pre;
+}
+p.table {
+  margin-top: 0;
+}
+/* Because the table frame attribute is overriden by CSS in most browsers. */
+div.tableblock > table[frame="void"] {
+  border-style: none;
+}
+div.tableblock > table[frame="hsides"] {
+  border-left-style: none;
+  border-right-style: none;
+}
+div.tableblock > table[frame="vsides"] {
+  border-top-style: none;
+  border-bottom-style: none;
+}
+
+
+div.hdlist {
+  margin-top: 0.8em;
+  margin-bottom: 0.8em;
+}
+div.hdlist tr {
+  padding-bottom: 15px;
+}
+dt.hdlist1.strong, td.hdlist1.strong {
+  font-weight: bold;
+}
+td.hdlist1 {
+  vertical-align: top;
+  font-style: normal;
+  padding-right: 0.8em;
+  color: navy;
+}
+td.hdlist2 {
+  vertical-align: top;
+}
+div.hdlist.compact tr {
+  margin: 0;
+  padding-bottom: 0;
+}
+
+.comment {
+  background: yellow;
+}
+
+.footnote, .footnoteref {
+  font-size: 0.8em;
+}
+
+span.footnote, span.footnoteref {
+  vertical-align: super;
+}
+
+#footnotes {
+  margin: 20px 0 20px 0;
+  padding: 7px 0 0 0;
+}
+
+#footnotes div.footnote {
+  margin: 0 0 5px 0;
+}
+
+#footnotes hr {
+  border: none;
+  border-top: 1px solid silver;
+  height: 1px;
+  text-align: left;
+  margin-left: 0;
+  width: 20%;
+  min-width: 100px;
+}
+
+div.colist td {
+  padding-right: 0.5em;
+  padding-bottom: 0.3em;
+  vertical-align: top;
+}
+div.colist td img {
+  margin-top: 0.3em;
+}
+
+ at media print {
+  div#footer-badges { display: none; }
+}
+
+div#toc {
+  margin-bottom: 2.5em;
+}
+
+div#toctitle {
+  color: #527bbd;
+  font-size: 1.1em;
+  font-weight: bold;
+  margin-top: 1.0em;
+  margin-bottom: 0.1em;
+}
+
+div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
+  margin-top: 0;
+  margin-bottom: 0;
+}
+div.toclevel2 {
+  margin-left: 2em;
+  font-size: 0.9em;
+}
+div.toclevel3 {
+  margin-left: 4em;
+  font-size: 0.9em;
+}
+div.toclevel4 {
+  margin-left: 6em;
+  font-size: 0.9em;
+}
+
+span.aqua { color: aqua; }
+span.black { color: black; }
+span.blue { color: blue; }
+span.fuchsia { color: fuchsia; }
+span.gray { color: gray; }
+span.green { color: green; }
+span.lime { color: lime; }
+span.maroon { color: maroon; }
+span.navy { color: navy; }
+span.olive { color: olive; }
+span.purple { color: purple; }
+span.red { color: red; }
+span.silver { color: silver; }
+span.teal { color: teal; }
+span.white { color: white; }
+span.yellow { color: yellow; }
+
+span.aqua-background { background: aqua; }
+span.black-background { background: black; }
+span.blue-background { background: blue; }
+span.fuchsia-background { background: fuchsia; }
+span.gray-background { background: gray; }
+span.green-background { background: green; }
+span.lime-background { background: lime; }
+span.maroon-background { background: maroon; }
+span.navy-background { background: navy; }
+span.olive-background { background: olive; }
+span.purple-background { background: purple; }
+span.red-background { background: red; }
+span.silver-background { background: silver; }
+span.teal-background { background: teal; }
+span.white-background { background: white; }
+span.yellow-background { background: yellow; }
+
+span.big { font-size: 2em; }
+span.small { font-size: 0.6em; }
+a:link { color:navy; }
+a:visited { color:navy; }
+
+.monospaced, code, pre {
+  font-family: "Courier New", Courier, monospace;
+  font-size: medium; /* inherit; */
+  color: black;
+  padding: 0;
+  margin: 0;
+}
+
+/*
+  background: #f8f8f8;
+  border: 1px solid #dddddd;
+  border-left: 5px solid #f0f0f0;
+  margin-right: 10%;
+*/
+
+div.listingblock > div.content {
+  padding: 0.5em;
+  background: none;
+  border: none;
+  border-left: none;
+  margin-right: none;
+}
+
+</style>
+<script type="text/javascript">
+/*<![CDATA[*/
+window.onload = function(){asciidoc.footnotes();}
+var asciidoc = {  // Namespace.
+
+/////////////////////////////////////////////////////////////////////
+// Table Of Contents generator
+/////////////////////////////////////////////////////////////////////
+
+/* Author: Mihai Bazon, September 2002
+ * http://students.infoiasi.ro/~mishoo
+ *
+ * Table Of Content generator
+ * Version: 0.4
+ *
+ * Feel free to use this script under the terms of the GNU General Public
+ * License, as long as you do not remove or alter this notice.
+ */
+
+ /* modified by Troy D. Hanson, September 2006. License: GPL */
+ /* modified by Stuart Rackham, 2006, 2009. License: GPL */
+
+// toclevels = 1..4.
+toc: function (toclevels) {
+
+  function getText(el) {
+    var text = "";
+    for (var i = el.firstChild; i != null; i = i.nextSibling) {
+      if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
+        text += i.data;
+      else if (i.firstChild != null)
+        text += getText(i);
+    }
+    return text;
+  }
+
+  function TocEntry(el, text, toclevel) {
+    this.element = el;
+    this.text = text;
+    this.toclevel = toclevel;
+  }
+
+  function tocEntries(el, toclevels) {
+    var result = new Array;
+    var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
+    // Function that scans the DOM tree for header elements (the DOM2
+    // nodeIterator API would be a better technique but not supported by all
+    // browsers).
+    var iterate = function (el) {
+      for (var i = el.firstChild; i != null; i = i.nextSibling) {
+        if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
+          var mo = re.exec(i.tagName);
+          if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
+            result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
+          }
+          iterate(i);
+        }
+      }
+    }
+    iterate(el);
+    return result;
+  }
+
+  var toc = document.getElementById("toc");
+  var entries = tocEntries(document.getElementById("content"), toclevels);
+  for (var i = 0; i < entries.length; ++i) {
+    var entry = entries[i];
+    if (entry.element.id == "")
+      entry.element.id = "_toc_" + i;
+    var a = document.createElement("a");
+    a.href = "#" + entry.element.id;
+    a.appendChild(document.createTextNode(entry.text));
+    var div = document.createElement("div");
+    div.appendChild(a);
+    div.className = "toclevel" + entry.toclevel;
+    toc.appendChild(div);
+  }
+  if (entries.length == 0)
+    toc.parentNode.removeChild(toc);
+},
+
+
+/////////////////////////////////////////////////////////////////////
+// Footnotes generator
+/////////////////////////////////////////////////////////////////////
+
+/* Based on footnote generation code from:
+ * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
+ */
+
+footnotes: function () {
+  var cont = document.getElementById("content");
+  var noteholder = document.getElementById("footnotes");
+  var spans = cont.getElementsByTagName("span");
+  var refs = {};
+  var n = 0;
+  for (i=0; i<spans.length; i++) {
+    if (spans[i].className == "footnote") {
+      n++;
+      // Use [\s\S] in place of . so multi-line matches work.
+      // Because JavaScript has no s (dotall) regex flag.
+      note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
+      noteholder.innerHTML +=
+        "<div class='footnote' id='_footnote_" + n + "'>" +
+        "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
+        n + "</a>. " + note + "</div>";
+      spans[i].innerHTML =
+        "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
+        "' title='View footnote' class='footnote'>" + n + "</a>]";
+      var id =spans[i].getAttribute("id");
+      if (id != null) refs["#"+id] = n;
+    }
+  }
+  if (n == 0)
+    noteholder.parentNode.removeChild(noteholder);
+  else {
+    // Process footnoterefs.
+    for (i=0; i<spans.length; i++) {
+      if (spans[i].className == "footnoteref") {
+        var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
+        href = href.match(/#.*/)[0];  // Because IE return full URL.
+        n = refs[href];
+        spans[i].innerHTML =
+          "[<a href='#_footnote_" + n +
+          "' title='View footnote' class='footnote'>" + n + "</a>]";
+      }
+    }
+  }
+}
+
+}
+/*]]>*/
+</script>
+</head>
+<body class="article" style="max-width:800px">
+<div id="header">
+</div>
+<div id="content">
+<div class="sect2">
+<h3 id="_part_2_running_an_ensemble_of_many_apps_in_parallel_with_a_foreach_loop">Part 2: Running an ensemble of many apps in parallel with a "foreach" loop</h3>
+<div class="paragraph"><p>The <tt>p2.swift</tt> script introduces the <tt>foreach</tt> parallel iteration
+construct to run many concurrent simulations.</p></div>
+<div class="imageblock" style="text-align:center;">
+<div class="content">
+<img src="part02.png" alt="part02.png" />
+</div>
+</div>
+<div class="listingblock">
+<div class="title">p2.swift</div>
+<div class="content">
+<pre><tt>type file;
+
+app (file o) simulation ()
+{
+  simulate stdout=@filename(o);
+}
+
+foreach i in [0:9] {
+  file f <single_file_mapper; file=@strcat("output/sim_",i,".out")>;
+  f = simulation();
+}</tt></pre>
+</div></div>
+<div class="paragraph"><p>The script also shows an
+example of naming the output files of an ensemble run. In this case, the output files will be named
+<tt>output/sim_N.out</tt>.</p></div>
+<div class="paragraph"><p>To run the script and view the output:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ cd ../part02
+$ swift p2.swift
+$ ls output
+sim_0.out  sim_1.out  sim_2.out  sim_3.out  sim_4.out  sim_5.out  sim_6.out  sim_7.out  sim_8.out  sim_9.out
+$ more output/*
+::::::::::::::
+output/sim_0.out
+::::::::::::::
+      44
+::::::::::::::
+output/sim_1.out
+::::::::::::::
+      55
+...
+::::::::::::::
+output/sim_9.out
+::::::::::::::
+      82</tt></pre>
+</div></div>
+</div>
+</div>
+<div id="footnotes"><hr /></div>
+<div id="footer">
+<div id="footer-text">
+Last updated 2013-09-11 13:05:49 CDT
+</div>
+</div>
+</body>
+</html>

Added: SwiftApps/tryswift/scripts/p3.html
===================================================================
--- SwiftApps/tryswift/scripts/p3.html	                        (rev 0)
+++ SwiftApps/tryswift/scripts/p3.html	2013-09-11 18:25:03 UTC (rev 7055)
@@ -0,0 +1,740 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
+<meta name="generator" content="AsciiDoc 8.6.4" />
+<title>Part 3: Analyzing results of a parallel ensemble</title>
+<style type="text/css">
+/* Sans-serif font. */
+h1, h2, h3, h4, h5, h6,
+div.title, caption.title,
+thead, p.table.header,
+div#toctitle,
+span#author, span#revnumber, span#revdate, span#revremark,
+div#footer {
+  font-family: Arial,Helvetica,sans-serif;
+}
+
+/* Serif font. */
+div.sectionbody {
+  font-family: Georgia,"Times New Roman",Times,serif;
+}
+
+/* Monospace font. */
+tt {
+  font-size: inherit;
+}
+
+body {
+  margin: 1em 5% 1em 5%;
+}
+
+a {
+  color: blue;
+  text-decoration: underline;
+}
+a:visited {
+  color: fuchsia;
+}
+
+em {
+  font-style: italic;
+  color: navy;
+}
+
+strong {
+  font-weight: bold;
+  color: #083194;
+}
+
+tt {
+  font-size: inherit;
+  color: navy;
+}
+
+h1, h2, h3, h4, h5, h6 {
+  color: #527bbd;
+  margin-top: 1.2em;
+  margin-bottom: 0.5em;
+  line-height: 1.3;
+}
+
+h1, h2, h3 {
+  border-bottom: 2px solid silver;
+}
+h2 {
+  padding-top: 0.5em;
+}
+h3 {
+  float: left;
+}
+h3 + * {
+  clear: left;
+}
+
+div.sectionbody {
+  margin-left: 0;
+}
+
+hr {
+  border: 1px solid silver;
+}
+
+p {
+  margin-top: 0.5em;
+  margin-bottom: 0.5em;
+}
+
+ul, ol, li > p {
+  margin-top: 0;
+}
+ul > li     { color: #aaa; }
+ul > li > * { color: black; }
+
+pre {
+  padding: 0;
+  margin: 0;
+}
+
+span#author {
+  color: #527bbd;
+  font-weight: bold;
+  font-size: 1.1em;
+}
+span#email {
+}
+span#revnumber, span#revdate, span#revremark {
+}
+
+div#footer {
+  font-size: small;
+  border-top: 2px solid silver;
+  padding-top: 0.5em;
+  margin-top: 4.0em;
+}
+div#footer-text {
+  float: left;
+  padding-bottom: 0.5em;
+}
+div#footer-badges {
+  float: right;
+  padding-bottom: 0.5em;
+}
+
+div#preamble {
+  margin-top: 1.5em;
+  margin-bottom: 1.5em;
+}
+div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
+div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
+div.admonitionblock {
+  margin-top: 1.0em;
+  margin-bottom: 1.5em;
+}
+div.admonitionblock {
+  margin-top: 2.0em;
+  margin-bottom: 2.0em;
+  margin-right: 10%;
+  color: #606060;
+}
+
+div.content { /* Block element content. */
+  padding: 0;
+}
+
+/* Block element titles. */
+div.title, caption.title {
+  color: #527bbd;
+  font-weight: bold;
+  text-align: left;
+  margin-top: 1.0em;
+  margin-bottom: 0.5em;
+}
+div.title + * {
+  margin-top: 0;
+}
+
+td div.title:first-child {
+  margin-top: 0.0em;
+}
+div.content div.title:first-child {
+  margin-top: 0.0em;
+}
+div.content + div.title {
+  margin-top: 0.0em;
+}
+
+div.sidebarblock > div.content {
+  background: #ffffee;
+  border: 1px solid #dddddd;
+  border-left: 4px solid #f0f0f0;
+  padding: 0.5em;
+}
+
+div.listingblock > div.content {
+  border: 1px solid #dddddd;
+  border-left: 5px solid #f0f0f0;
+  background: #f8f8f8;
+  padding: 0.5em;
+}
+
+div.quoteblock, div.verseblock {
+  padding-left: 1.0em;
+  margin-left: 1.0em;
+  margin-right: 10%;
+  border-left: 5px solid #f0f0f0;
+  color: #777777;
+}
+
+div.quoteblock > div.attribution {
+  padding-top: 0.5em;
+  text-align: right;
+}
+
+div.verseblock > pre.content {
+  font-family: inherit;
+  font-size: inherit;
+}
+div.verseblock > div.attribution {
+  padding-top: 0.75em;
+  text-align: left;
+}
+/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
+div.verseblock + div.attribution {
+  text-align: left;
+}
+
+div.admonitionblock .icon {
+  vertical-align: top;
+  font-size: 1.1em;
+  font-weight: bold;
+  text-decoration: underline;
+  color: #527bbd;
+  padding-right: 0.5em;
+}
+div.admonitionblock td.content {
+  padding-left: 0.5em;
+  border-left: 3px solid #dddddd;
+}
+
+div.exampleblock > div.content {
+  border-left: 3px solid #dddddd;
+  padding-left: 0.5em;
+}
+
+div.imageblock div.content { padding-left: 0; }
+span.image img { border-style: none; }
+a.image:visited { color: white; }
+
+dl {
+  margin-top: 0.8em;
+  margin-bottom: 0.8em;
+}
+dt {
+  margin-top: 0.5em;
+  margin-bottom: 0;
+  font-style: normal;
+  color: navy;
+}
+dd > *:first-child {
+  margin-top: 0.1em;
+}
+
+ul, ol {
+    list-style-position: outside;
+}
+ol.arabic {
+  list-style-type: decimal;
+}
+ol.loweralpha {
+  list-style-type: lower-alpha;
+}
+ol.upperalpha {
+  list-style-type: upper-alpha;
+}
+ol.lowerroman {
+  list-style-type: lower-roman;
+}
+ol.upperroman {
+  list-style-type: upper-roman;
+}
+
+div.compact ul, div.compact ol,
+div.compact p, div.compact p,
+div.compact div, div.compact div {
+  margin-top: 0.1em;
+  margin-bottom: 0.1em;
+}
+
+div.tableblock > table {
+  border: 3px solid #527bbd;
+}
+thead, p.table.header {
+  font-weight: bold;
+  color: #527bbd;
+}
+tfoot {
+  font-weight: bold;
+}
+td > div.verse {
+  white-space: pre;
+}
+p.table {
+  margin-top: 0;
+}
+/* Because the table frame attribute is overriden by CSS in most browsers. */
+div.tableblock > table[frame="void"] {
+  border-style: none;
+}
+div.tableblock > table[frame="hsides"] {
+  border-left-style: none;
+  border-right-style: none;
+}
+div.tableblock > table[frame="vsides"] {
+  border-top-style: none;
+  border-bottom-style: none;
+}
+
+
+div.hdlist {
+  margin-top: 0.8em;
+  margin-bottom: 0.8em;
+}
+div.hdlist tr {
+  padding-bottom: 15px;
+}
+dt.hdlist1.strong, td.hdlist1.strong {
+  font-weight: bold;
+}
+td.hdlist1 {
+  vertical-align: top;
+  font-style: normal;
+  padding-right: 0.8em;
+  color: navy;
+}
+td.hdlist2 {
+  vertical-align: top;
+}
+div.hdlist.compact tr {
+  margin: 0;
+  padding-bottom: 0;
+}
+
+.comment {
+  background: yellow;
+}
+
+.footnote, .footnoteref {
+  font-size: 0.8em;
+}
+
+span.footnote, span.footnoteref {
+  vertical-align: super;
+}
+
+#footnotes {
+  margin: 20px 0 20px 0;
+  padding: 7px 0 0 0;
+}
+
+#footnotes div.footnote {
+  margin: 0 0 5px 0;
+}
+
+#footnotes hr {
+  border: none;
+  border-top: 1px solid silver;
+  height: 1px;
+  text-align: left;
+  margin-left: 0;
+  width: 20%;
+  min-width: 100px;
+}
+
+div.colist td {
+  padding-right: 0.5em;
+  padding-bottom: 0.3em;
+  vertical-align: top;
+}
+div.colist td img {
+  margin-top: 0.3em;
+}
+
+ at media print {
+  div#footer-badges { display: none; }
+}
+
+div#toc {
+  margin-bottom: 2.5em;
+}
+
+div#toctitle {
+  color: #527bbd;
+  font-size: 1.1em;
+  font-weight: bold;
+  margin-top: 1.0em;
+  margin-bottom: 0.1em;
+}
+
+div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
+  margin-top: 0;
+  margin-bottom: 0;
+}
+div.toclevel2 {
+  margin-left: 2em;
+  font-size: 0.9em;
+}
+div.toclevel3 {
+  margin-left: 4em;
+  font-size: 0.9em;
+}
+div.toclevel4 {
+  margin-left: 6em;
+  font-size: 0.9em;
+}
+
+span.aqua { color: aqua; }
+span.black { color: black; }
+span.blue { color: blue; }
+span.fuchsia { color: fuchsia; }
+span.gray { color: gray; }
+span.green { color: green; }
+span.lime { color: lime; }
+span.maroon { color: maroon; }
+span.navy { color: navy; }
+span.olive { color: olive; }
+span.purple { color: purple; }
+span.red { color: red; }
+span.silver { color: silver; }
+span.teal { color: teal; }
+span.white { color: white; }
+span.yellow { color: yellow; }
+
+span.aqua-background { background: aqua; }
+span.black-background { background: black; }
+span.blue-background { background: blue; }
+span.fuchsia-background { background: fuchsia; }
+span.gray-background { background: gray; }
+span.green-background { background: green; }
+span.lime-background { background: lime; }
+span.maroon-background { background: maroon; }
+span.navy-background { background: navy; }
+span.olive-background { background: olive; }
+span.purple-background { background: purple; }
+span.red-background { background: red; }
+span.silver-background { background: silver; }
+span.teal-background { background: teal; }
+span.white-background { background: white; }
+span.yellow-background { background: yellow; }
+
+span.big { font-size: 2em; }
+span.small { font-size: 0.6em; }
+a:link { color:navy; }
+a:visited { color:navy; }
+
+.monospaced, code, pre {
+  font-family: "Courier New", Courier, monospace;
+  font-size: medium; /* inherit; */
+  color: black;
+  padding: 0;
+  margin: 0;
+}
+
+/*
+  background: #f8f8f8;
+  border: 1px solid #dddddd;
+  border-left: 5px solid #f0f0f0;
+  margin-right: 10%;
+*/
+
+div.listingblock > div.content {
+  padding: 0.5em;
+  background: none;
+  border: none;
+  border-left: none;
+  margin-right: none;
+}
+
+</style>
+<script type="text/javascript">
+/*<![CDATA[*/
+window.onload = function(){asciidoc.footnotes();}
+var asciidoc = {  // Namespace.
+
+/////////////////////////////////////////////////////////////////////
+// Table Of Contents generator
+/////////////////////////////////////////////////////////////////////
+
+/* Author: Mihai Bazon, September 2002
+ * http://students.infoiasi.ro/~mishoo
+ *
+ * Table Of Content generator
+ * Version: 0.4
+ *
+ * Feel free to use this script under the terms of the GNU General Public
+ * License, as long as you do not remove or alter this notice.
+ */
+
+ /* modified by Troy D. Hanson, September 2006. License: GPL */
+ /* modified by Stuart Rackham, 2006, 2009. License: GPL */
+
+// toclevels = 1..4.
+toc: function (toclevels) {
+
+  function getText(el) {
+    var text = "";
+    for (var i = el.firstChild; i != null; i = i.nextSibling) {
+      if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
+        text += i.data;
+      else if (i.firstChild != null)
+        text += getText(i);
+    }
+    return text;
+  }
+
+  function TocEntry(el, text, toclevel) {
+    this.element = el;
+    this.text = text;
+    this.toclevel = toclevel;
+  }
+
+  function tocEntries(el, toclevels) {
+    var result = new Array;
+    var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
+    // Function that scans the DOM tree for header elements (the DOM2
+    // nodeIterator API would be a better technique but not supported by all
+    // browsers).
+    var iterate = function (el) {
+      for (var i = el.firstChild; i != null; i = i.nextSibling) {
+        if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
+          var mo = re.exec(i.tagName);
+          if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
+            result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
+          }
+          iterate(i);
+        }
+      }
+    }
+    iterate(el);
+    return result;
+  }
+
+  var toc = document.getElementById("toc");
+  var entries = tocEntries(document.getElementById("content"), toclevels);
+  for (var i = 0; i < entries.length; ++i) {
+    var entry = entries[i];
+    if (entry.element.id == "")
+      entry.element.id = "_toc_" + i;
+    var a = document.createElement("a");
+    a.href = "#" + entry.element.id;
+    a.appendChild(document.createTextNode(entry.text));
+    var div = document.createElement("div");
+    div.appendChild(a);
+    div.className = "toclevel" + entry.toclevel;
+    toc.appendChild(div);
+  }
+  if (entries.length == 0)
+    toc.parentNode.removeChild(toc);
+},
+
+
+/////////////////////////////////////////////////////////////////////
+// Footnotes generator
+/////////////////////////////////////////////////////////////////////
+
+/* Based on footnote generation code from:
+ * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
+ */
+
+footnotes: function () {
+  var cont = document.getElementById("content");
+  var noteholder = document.getElementById("footnotes");
+  var spans = cont.getElementsByTagName("span");
+  var refs = {};
+  var n = 0;
+  for (i=0; i<spans.length; i++) {
+    if (spans[i].className == "footnote") {
+      n++;
+      // Use [\s\S] in place of . so multi-line matches work.
+      // Because JavaScript has no s (dotall) regex flag.
+      note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
+      noteholder.innerHTML +=
+        "<div class='footnote' id='_footnote_" + n + "'>" +
+        "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
+        n + "</a>. " + note + "</div>";
+      spans[i].innerHTML =
+        "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
+        "' title='View footnote' class='footnote'>" + n + "</a>]";
+      var id =spans[i].getAttribute("id");
+      if (id != null) refs["#"+id] = n;
+    }
+  }
+  if (n == 0)
+    noteholder.parentNode.removeChild(noteholder);
+  else {
+    // Process footnoterefs.
+    for (i=0; i<spans.length; i++) {
+      if (spans[i].className == "footnoteref") {
+        var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
+        href = href.match(/#.*/)[0];  // Because IE return full URL.
+        n = refs[href];
+        spans[i].innerHTML =
+          "[<a href='#_footnote_" + n +
+          "' title='View footnote' class='footnote'>" + n + "</a>]";
+      }
+    }
+  }
+}
+
+}
+/*]]>*/
+</script>
+</head>
+<body class="article" style="max-width:800px">
+<div id="header">
+<h1>Part 3: Analyzing results of a parallel ensemble</h1>
+</div>
+<div id="content">
+<div id="preamble">
+<div class="sectionbody">
+<div class="paragraph"><p>After all the parallel simulations in an ensemble run have completed,
+its typically necessary to gather and analyze their results with some
+kind of post-processing analysis program or script.  p3.swift
+introduces such a postprocessing step. In this case, the files created
+by all of the parallel runs of <tt>simulation.sh</tt> will be averaged by by
+the trivial "analysis application" <tt>stats.sh</tt>:</p></div>
+<div class="imageblock" style="text-align:center;">
+<div class="content">
+<img src="part03.png" alt="part03.png" />
+</div>
+</div>
+<div class="listingblock">
+<div class="title">p3.swift</div>
+<div class="content">
+<pre><tt>type file;
+
+app (file o) simulation (int sim_steps, int sim_range, int sim_values)
+{
+  simulate "--timesteps" sim_steps "--range" sim_range "--nvalues" sim_values stdout=@filename(o);
+}
+
+app (file o) analyze (file s[])
+{
+  stats @filenames(s) stdout=@filename(o);
+}
+
+int nsim   = @toInt(@arg("nsim","10"));
+int steps  = @toInt(@arg("steps","1"));
+int range  = @toInt(@arg("range","100"));
+int values = @toInt(@arg("values","5"));
+
+file sims[];
+
+foreach i in [0:nsim-1] {
+  file simout <single_file_mapper; file=@strcat("output/sim_",i,".out")>;
+  simout = simulation(steps,range,values);
+  sims[i] = simout;
+}
+
+file stats<"output/average.out">;
+stats = analyze(sims);</tt></pre>
+</div></div>
+<div class="paragraph"><p>To run:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ cd part03
+$ swift p3.swift</tt></pre>
+</div></div>
+<div class="paragraph"><p>Note that in <tt>p3.swift</tt> we expose more of the capabilities of the
+<tt>simulate.sh</tt> application to the <tt>simulation()</tt> app function:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>app (file o) simulation (int sim_steps, int sim_range, int sim_values)
+{
+  simulate "--timesteps" sim_steps "--range" sim_range "--nvalues" sim_values stdout=@filename(o);
+}</tt></pre>
+</div></div>
+<div class="paragraph"><p><tt>p3.swift</tt> also shows how to fetch application-specific values from
+the <tt>swift</tt> command line in a Swift script using <tt>@arg()</tt> which
+accepts a keyword-style argument and its default value:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>int nsim   = @toInt(@arg("nsim","10"));
+int steps  = @toInt(@arg("steps","1"));
+int range  = @toInt(@arg("range","100"));
+int values = @toInt(@arg("values","5"));</tt></pre>
+</div></div>
+<div class="paragraph"><p>Now we can specify that more runs should be performed and that each should run for more timesteps, and produce more that one value each, within a specified range, using command line arguments placed after the Swift script name in the form <tt>-parameterName=value</tt>:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ swift p3.swift -nsim=3 -steps=10 -values=4 -range=1000000
+
+Swift 0.94.1 RC2 swift-r6895 cog-r3765
+
+RunID: 20130827-1439-s3vvo809
+Progress:  time: Tue, 27 Aug 2013 14:39:42 -0500
+Progress:  time: Tue, 27 Aug 2013 14:39:53 -0500  Active:2  Stage out:1
+Final status: Tue, 27 Aug 2013 14:39:53 -0500  Finished successfully:4
+
+$ ls output/
+average.out  sim_0.out  sim_1.out  sim_2.out
+$ more output/*
+::::::::::::::
+output/average.out
+::::::::::::::
+651368
+::::::::::::::
+output/sim_0.out
+::::::::::::::
+  735700
+  886206
+  997391
+  982970
+::::::::::::::
+output/sim_1.out
+::::::::::::::
+  260071
+  264195
+  869198
+  933537
+::::::::::::::
+output/sim_2.out
+::::::::::::::
+  201806
+  213540
+  527576
+  944233</tt></pre>
+</div></div>
+<div class="paragraph"><p>Now try running (<tt>-nsim=</tt>) 100 simulations of (<tt>-steps=</tt>) 1 second each:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ swift p3.swift -nsim=100 -steps=1
+Swift 0.94.1 RC2 swift-r6895 cog-r3765
+
+RunID: 20130827-1444-rq809ts6
+Progress:  time: Tue, 27 Aug 2013 14:44:55 -0500
+Progress:  time: Tue, 27 Aug 2013 14:44:56 -0500  Selecting site:79  Active:20  Stage out:1
+Progress:  time: Tue, 27 Aug 2013 14:44:58 -0500  Selecting site:58  Active:20  Stage out:1  Finished successfully:21
+Progress:  time: Tue, 27 Aug 2013 14:44:59 -0500  Selecting site:37  Active:20  Stage out:1  Finished successfully:42
+Progress:  time: Tue, 27 Aug 2013 14:45:00 -0500  Selecting site:16  Active:20  Stage out:1  Finished successfully:63
+Progress:  time: Tue, 27 Aug 2013 14:45:02 -0500  Active:15  Stage out:1  Finished successfully:84
+Progress:  time: Tue, 27 Aug 2013 14:45:03 -0500  Finished successfully:101
+Final status: Tue, 27 Aug 2013 14:45:03 -0500  Finished successfully:101</tt></pre>
+</div></div>
+<div class="paragraph"><p>We can see from Swift’s "progress" status that the tutorial’s default
+<tt>sites.xml</tt> parameters for local execution allow Swift to run up to 20
+application invocations concurrently on the login node. We’ll look at
+this in more detail in the next sections where we execute applications
+on the site’s compute nodes.</p></div>
+</div>
+</div>
+</div>
+<div id="footnotes"><hr /></div>
+<div id="footer">
+<div id="footer-text">
+Last updated 2013-09-11 13:13:02 CDT
+</div>
+</div>
+</body>
+</html>

Added: SwiftApps/tryswift/scripts/p4.html
===================================================================
--- SwiftApps/tryswift/scripts/p4.html	                        (rev 0)
+++ SwiftApps/tryswift/scripts/p4.html	2013-09-11 18:25:03 UTC (rev 7055)
@@ -0,0 +1,816 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
+<meta name="generator" content="AsciiDoc 8.6.4" />
+<title>Part 4: Running a parallel ensemble on Cray compute nodes</title>
+<style type="text/css">
+/* Sans-serif font. */
+h1, h2, h3, h4, h5, h6,
+div.title, caption.title,
+thead, p.table.header,
+div#toctitle,
+span#author, span#revnumber, span#revdate, span#revremark,
+div#footer {
+  font-family: Arial,Helvetica,sans-serif;
+}
+
+/* Serif font. */
+div.sectionbody {
+  font-family: Georgia,"Times New Roman",Times,serif;
+}
+
+/* Monospace font. */
+tt {
+  font-size: inherit;
+}
+
+body {
+  margin: 1em 5% 1em 5%;
+}
+
+a {
+  color: blue;
+  text-decoration: underline;
+}
+a:visited {
+  color: fuchsia;
+}
+
+em {
+  font-style: italic;
+  color: navy;
+}
+
+strong {
+  font-weight: bold;
+  color: #083194;
+}
+
+tt {
+  font-size: inherit;
+  color: navy;
+}
+
+h1, h2, h3, h4, h5, h6 {
+  color: #527bbd;
+  margin-top: 1.2em;
+  margin-bottom: 0.5em;
+  line-height: 1.3;
+}
+
+h1, h2, h3 {
+  border-bottom: 2px solid silver;
+}
+h2 {
+  padding-top: 0.5em;
+}
+h3 {
+  float: left;
+}
+h3 + * {
+  clear: left;
+}
+
+div.sectionbody {
+  margin-left: 0;
+}
+
+hr {
+  border: 1px solid silver;
+}
+
+p {
+  margin-top: 0.5em;
+  margin-bottom: 0.5em;
+}
+
+ul, ol, li > p {
+  margin-top: 0;
+}
+ul > li     { color: #aaa; }
+ul > li > * { color: black; }
+
+pre {
+  padding: 0;
+  margin: 0;
+}
+
+span#author {
+  color: #527bbd;
+  font-weight: bold;
+  font-size: 1.1em;
+}
+span#email {
+}
+span#revnumber, span#revdate, span#revremark {
+}
+
+div#footer {
+  font-size: small;
+  border-top: 2px solid silver;
+  padding-top: 0.5em;
+  margin-top: 4.0em;
+}
+div#footer-text {
+  float: left;
+  padding-bottom: 0.5em;
+}
+div#footer-badges {
+  float: right;
+  padding-bottom: 0.5em;
+}
+
+div#preamble {
+  margin-top: 1.5em;
+  margin-bottom: 1.5em;
+}
+div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
+div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
+div.admonitionblock {
+  margin-top: 1.0em;
+  margin-bottom: 1.5em;
+}
+div.admonitionblock {
+  margin-top: 2.0em;
+  margin-bottom: 2.0em;
+  margin-right: 10%;
+  color: #606060;
+}
+
+div.content { /* Block element content. */
+  padding: 0;
+}
+
+/* Block element titles. */
+div.title, caption.title {
+  color: #527bbd;
+  font-weight: bold;
+  text-align: left;
+  margin-top: 1.0em;
+  margin-bottom: 0.5em;
+}
+div.title + * {
+  margin-top: 0;
+}
+
+td div.title:first-child {
+  margin-top: 0.0em;
+}
+div.content div.title:first-child {
+  margin-top: 0.0em;
+}
+div.content + div.title {
+  margin-top: 0.0em;
+}
+
+div.sidebarblock > div.content {
+  background: #ffffee;
+  border: 1px solid #dddddd;
+  border-left: 4px solid #f0f0f0;
+  padding: 0.5em;
+}
+
+div.listingblock > div.content {
+  border: 1px solid #dddddd;
+  border-left: 5px solid #f0f0f0;
+  background: #f8f8f8;
+  padding: 0.5em;
+}
+
+div.quoteblock, div.verseblock {
+  padding-left: 1.0em;
+  margin-left: 1.0em;
+  margin-right: 10%;
+  border-left: 5px solid #f0f0f0;
+  color: #777777;
+}
+
+div.quoteblock > div.attribution {
+  padding-top: 0.5em;
+  text-align: right;
+}
+
+div.verseblock > pre.content {
+  font-family: inherit;
+  font-size: inherit;
+}
+div.verseblock > div.attribution {
+  padding-top: 0.75em;
+  text-align: left;
+}
+/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
+div.verseblock + div.attribution {
+  text-align: left;
+}
+
+div.admonitionblock .icon {
+  vertical-align: top;
+  font-size: 1.1em;
+  font-weight: bold;
+  text-decoration: underline;
+  color: #527bbd;
+  padding-right: 0.5em;
+}
+div.admonitionblock td.content {
+  padding-left: 0.5em;
+  border-left: 3px solid #dddddd;
+}
+
+div.exampleblock > div.content {
+  border-left: 3px solid #dddddd;
+  padding-left: 0.5em;
+}
+
+div.imageblock div.content { padding-left: 0; }
+span.image img { border-style: none; }
+a.image:visited { color: white; }
+
+dl {
+  margin-top: 0.8em;
+  margin-bottom: 0.8em;
+}
+dt {
+  margin-top: 0.5em;
+  margin-bottom: 0;
+  font-style: normal;
+  color: navy;
+}
+dd > *:first-child {
+  margin-top: 0.1em;
+}
+
+ul, ol {
+    list-style-position: outside;
+}
+ol.arabic {
+  list-style-type: decimal;
+}
+ol.loweralpha {
+  list-style-type: lower-alpha;
+}
+ol.upperalpha {
+  list-style-type: upper-alpha;
+}
+ol.lowerroman {
+  list-style-type: lower-roman;
+}
+ol.upperroman {
+  list-style-type: upper-roman;
+}
+
+div.compact ul, div.compact ol,
+div.compact p, div.compact p,
+div.compact div, div.compact div {
+  margin-top: 0.1em;
+  margin-bottom: 0.1em;
+}
+
+div.tableblock > table {
+  border: 3px solid #527bbd;
+}
+thead, p.table.header {
+  font-weight: bold;
+  color: #527bbd;
+}
+tfoot {
+  font-weight: bold;
+}
+td > div.verse {
+  white-space: pre;
+}
+p.table {
+  margin-top: 0;
+}
+/* Because the table frame attribute is overriden by CSS in most browsers. */
+div.tableblock > table[frame="void"] {
+  border-style: none;
+}
+div.tableblock > table[frame="hsides"] {
+  border-left-style: none;
+  border-right-style: none;
+}
+div.tableblock > table[frame="vsides"] {
+  border-top-style: none;
+  border-bottom-style: none;
+}
+
+
+div.hdlist {
+  margin-top: 0.8em;
+  margin-bottom: 0.8em;
+}
+div.hdlist tr {
+  padding-bottom: 15px;
+}
+dt.hdlist1.strong, td.hdlist1.strong {
+  font-weight: bold;
+}
+td.hdlist1 {
+  vertical-align: top;
+  font-style: normal;
+  padding-right: 0.8em;
+  color: navy;
+}
+td.hdlist2 {
+  vertical-align: top;
+}
+div.hdlist.compact tr {
+  margin: 0;
+  padding-bottom: 0;
+}
+
+.comment {
+  background: yellow;
+}
+
+.footnote, .footnoteref {
+  font-size: 0.8em;
+}
+
+span.footnote, span.footnoteref {
+  vertical-align: super;
+}
+
+#footnotes {
+  margin: 20px 0 20px 0;
+  padding: 7px 0 0 0;
+}
+
+#footnotes div.footnote {
+  margin: 0 0 5px 0;
+}
+
+#footnotes hr {
+  border: none;
+  border-top: 1px solid silver;
+  height: 1px;
+  text-align: left;
+  margin-left: 0;
+  width: 20%;
+  min-width: 100px;
+}
+
+div.colist td {
+  padding-right: 0.5em;
+  padding-bottom: 0.3em;
+  vertical-align: top;
+}
+div.colist td img {
+  margin-top: 0.3em;
+}
+
+ at media print {
+  div#footer-badges { display: none; }
+}
+
+div#toc {
+  margin-bottom: 2.5em;
+}
+
+div#toctitle {
+  color: #527bbd;
+  font-size: 1.1em;
+  font-weight: bold;
+  margin-top: 1.0em;
+  margin-bottom: 0.1em;
+}
+
+div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
+  margin-top: 0;
+  margin-bottom: 0;
+}
+div.toclevel2 {
+  margin-left: 2em;
+  font-size: 0.9em;
+}
+div.toclevel3 {
+  margin-left: 4em;
+  font-size: 0.9em;
+}
+div.toclevel4 {
+  margin-left: 6em;
+  font-size: 0.9em;
+}
+
+span.aqua { color: aqua; }
+span.black { color: black; }
+span.blue { color: blue; }
+span.fuchsia { color: fuchsia; }
+span.gray { color: gray; }
+span.green { color: green; }
+span.lime { color: lime; }
+span.maroon { color: maroon; }
+span.navy { color: navy; }
+span.olive { color: olive; }
+span.purple { color: purple; }
+span.red { color: red; }
+span.silver { color: silver; }
+span.teal { color: teal; }
+span.white { color: white; }
+span.yellow { color: yellow; }
+
+span.aqua-background { background: aqua; }
+span.black-background { background: black; }
+span.blue-background { background: blue; }
+span.fuchsia-background { background: fuchsia; }
+span.gray-background { background: gray; }
+span.green-background { background: green; }
+span.lime-background { background: lime; }
+span.maroon-background { background: maroon; }
+span.navy-background { background: navy; }
+span.olive-background { background: olive; }
+span.purple-background { background: purple; }
+span.red-background { background: red; }
+span.silver-background { background: silver; }
+span.teal-background { background: teal; }
+span.white-background { background: white; }
+span.yellow-background { background: yellow; }
+
+span.big { font-size: 2em; }
+span.small { font-size: 0.6em; }
+a:link { color:navy; }
+a:visited { color:navy; }
+
+.monospaced, code, pre {
+  font-family: "Courier New", Courier, monospace;
+  font-size: medium; /* inherit; */
+  color: black;
+  padding: 0;
+  margin: 0;
+}
+
+/*
+  background: #f8f8f8;
+  border: 1px solid #dddddd;
+  border-left: 5px solid #f0f0f0;
+  margin-right: 10%;
+*/
+
+div.listingblock > div.content {
+  padding: 0.5em;
+  background: none;
+  border: none;
+  border-left: none;
+  margin-right: none;
+}
+
+</style>
+<script type="text/javascript">
+/*<![CDATA[*/
+window.onload = function(){asciidoc.footnotes();}
+var asciidoc = {  // Namespace.
+
+/////////////////////////////////////////////////////////////////////
+// Table Of Contents generator
+/////////////////////////////////////////////////////////////////////
+
+/* Author: Mihai Bazon, September 2002
+ * http://students.infoiasi.ro/~mishoo
+ *
+ * Table Of Content generator
+ * Version: 0.4
+ *
+ * Feel free to use this script under the terms of the GNU General Public
+ * License, as long as you do not remove or alter this notice.
+ */
+
+ /* modified by Troy D. Hanson, September 2006. License: GPL */
+ /* modified by Stuart Rackham, 2006, 2009. License: GPL */
+
+// toclevels = 1..4.
+toc: function (toclevels) {
+
+  function getText(el) {
+    var text = "";
+    for (var i = el.firstChild; i != null; i = i.nextSibling) {
+      if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
+        text += i.data;
+      else if (i.firstChild != null)
+        text += getText(i);
+    }
+    return text;
+  }
+
+  function TocEntry(el, text, toclevel) {
+    this.element = el;
+    this.text = text;
+    this.toclevel = toclevel;
+  }
+
+  function tocEntries(el, toclevels) {
+    var result = new Array;
+    var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
+    // Function that scans the DOM tree for header elements (the DOM2
+    // nodeIterator API would be a better technique but not supported by all
+    // browsers).
+    var iterate = function (el) {
+      for (var i = el.firstChild; i != null; i = i.nextSibling) {
+        if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
+          var mo = re.exec(i.tagName);
+          if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
+            result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
+          }
+          iterate(i);
+        }
+      }
+    }
+    iterate(el);
+    return result;
+  }
+
+  var toc = document.getElementById("toc");
+  var entries = tocEntries(document.getElementById("content"), toclevels);
+  for (var i = 0; i < entries.length; ++i) {
+    var entry = entries[i];
+    if (entry.element.id == "")
+      entry.element.id = "_toc_" + i;
+    var a = document.createElement("a");
+    a.href = "#" + entry.element.id;
+    a.appendChild(document.createTextNode(entry.text));
+    var div = document.createElement("div");
+    div.appendChild(a);
+    div.className = "toclevel" + entry.toclevel;
+    toc.appendChild(div);
+  }
+  if (entries.length == 0)
+    toc.parentNode.removeChild(toc);
+},
+
+
+/////////////////////////////////////////////////////////////////////
+// Footnotes generator
+/////////////////////////////////////////////////////////////////////
+
+/* Based on footnote generation code from:
+ * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
+ */
+
+footnotes: function () {
+  var cont = document.getElementById("content");
+  var noteholder = document.getElementById("footnotes");
+  var spans = cont.getElementsByTagName("span");
+  var refs = {};
+  var n = 0;
+  for (i=0; i<spans.length; i++) {
+    if (spans[i].className == "footnote") {
+      n++;
+      // Use [\s\S] in place of . so multi-line matches work.
+      // Because JavaScript has no s (dotall) regex flag.
+      note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
+      noteholder.innerHTML +=
+        "<div class='footnote' id='_footnote_" + n + "'>" +
+        "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
+        n + "</a>. " + note + "</div>";
+      spans[i].innerHTML =
+        "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
+        "' title='View footnote' class='footnote'>" + n + "</a>]";
+      var id =spans[i].getAttribute("id");
+      if (id != null) refs["#"+id] = n;
+    }
+  }
+  if (n == 0)
+    noteholder.parentNode.removeChild(noteholder);
+  else {
+    // Process footnoterefs.
+    for (i=0; i<spans.length; i++) {
+      if (spans[i].className == "footnoteref") {
+        var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
+        href = href.match(/#.*/)[0];  // Because IE return full URL.
+        n = refs[href];
+        spans[i].innerHTML =
+          "[<a href='#_footnote_" + n +
+          "' title='View footnote' class='footnote'>" + n + "</a>]";
+      }
+    }
+  }
+}
+
+}
+/*]]>*/
+</script>
+</head>
+<body class="article" style="max-width:800px">
+<div id="header">
+<h1>Part 4: Running a parallel ensemble on Cray compute nodes</h1>
+</div>
+<div id="content">
+<div id="preamble">
+<div class="sectionbody">
+<div class="paragraph"><p><tt>p4.swift</tt> will run our mock "simulation"
+applications on Cray compute nodes.  The script is similar to as
+<tt>p3.swift</tt>, but specifies that each simulation app invocation should
+additionally return the log file which the application writes to
+<tt>stderr</tt>.</p></div>
+<div class="paragraph"><p>Now when you run <tt>swift p4.swift</tt> you’ll see that two types output
+files will placed in the <tt>output/</tt> directory: <tt>sim_N.out</tt> and
+<tt>sim_N.log</tt>.  The log files provide data on the runtime environment of
+each app invocation. For example:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ cat output/sim_0.log
+Called as: /home/users/p01532/swift-cray-tutorial/app/simulate.sh: --timesteps 1 --range 100 --nvalues 5
+
+Start time: Tue Aug 27 12:17:43 CDT 2013
+Running on node: nid00018
+Running as user: uid=61532(p01532) gid=61532 groups=61532
+
+Simulation parameters:
+
+bias=0
+biasfile=none
+initseed=none
+log=yes
+paramfile=none
+range=100
+scale=1
+seedfile=none
+timesteps=1
+output width=8
+
+Environment:
+
+ALPS_APP_DEPTH=32
+ASSEMBLER_X86_64=/opt/cray/cce/8.2.0.173/cray-binutils/x86_64-unknown-linux-gnu/bin/as
+ASYNCPE_DIR=/opt/cray/xt-asyncpe/5.23.02
+ASYNCPE_VERSION=5.23.02
+...</tt></pre>
+</div></div>
+<div class="paragraph"><p>To tell Swift to run the apps on compute nodes, we specify in the
+<tt>apps</tt> file that the apps should be executed on the <tt>raven</tt> site
+(instead of the <tt>localhost</tt> site).  We can specify the location of
+each app in the third field of the <tt>apps</tt> file, with either an
+absolute pathname or the name of an executable to be located in
+<tt>PATH</tt>). Here we use the latter form:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ cat apps
+raven simulate simulate.sh
+raven stats    stats.sh</tt></pre>
+</div></div>
+<div class="paragraph"><p>You can experiment, for example, with an alternate version of stats.sh by specfying that app’s location explicitly:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ cat apps
+raven simulate simulate.sh
+raven stats    /home/users/p01532/bin/my-alt-stats.sh</tt></pre>
+</div></div>
+<div class="paragraph"><p>We can see that when we run many apps requesting a larger set of nodes (6), we are indeed running on the compute nodes:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ swift p4.swift -nsim=1000 -steps=1
+Swift 0.94.1 RC2 swift-r6895 cog-r3765
+
+RunID: 20130827-1638-t23ax37a
+Progress:  time: Tue, 27 Aug 2013 16:38:11 -0500
+Progress:  time: Tue, 27 Aug 2013 16:38:12 -0500  Initializing:966
+Progress:  time: Tue, 27 Aug 2013 16:38:13 -0500  Selecting site:499  Submitting:500  Submitted:1
+Progress:  time: Tue, 27 Aug 2013 16:38:14 -0500  Selecting site:499  Stage in:1  Submitted:500
+Progress:  time: Tue, 27 Aug 2013 16:38:16 -0500  Selecting site:499  Submitted:405  Active:95  Stage out:1
+Progress:  time: Tue, 27 Aug 2013 16:38:17 -0500  Selecting site:430  Submitted:434  Active:66  Stage out:1  Finished successfully:69
+Progress:  time: Tue, 27 Aug 2013 16:38:18 -0500  Selecting site:388  Submitted:405  Active:95  Stage out:1  Finished successfully:111
+...
+Progress:  time: Tue, 27 Aug 2013 16:38:30 -0500  Stage in:1  Submitted:93  Active:94  Finished successfully:812
+Progress:  time: Tue, 27 Aug 2013 16:38:31 -0500  Submitted:55  Active:95  Stage out:1  Finished successfully:849
+Progress:  time: Tue, 27 Aug 2013 16:38:32 -0500  Active:78  Stage out:1  Finished successfully:921
+Progress:  time: Tue, 27 Aug 2013 16:38:34 -0500  Active:70  Stage out:1  Finished successfully:929
+Progress:  time: Tue, 27 Aug 2013 16:38:37 -0500  Stage in:1  Finished successfully:1000
+Progress:  time: Tue, 27 Aug 2013 16:38:38 -0500  Stage out:1  Finished successfully:1000
+Final status: Tue, 27 Aug 2013 16:38:38 -0500  Finished successfully:1001
+
+$ grep "on node:" output/*log | head
+output/sim_0.log:Running on node: nid00063
+output/sim_100.log:Running on node: nid00060
+output/sim_101.log:Running on node: nid00061
+output/sim_102.log:Running on node: nid00032
+output/sim_103.log:Running on node: nid00060
+output/sim_104.log:Running on node: nid00061
+output/sim_105.log:Running on node: nid00032
+output/sim_106.log:Running on node: nid00060
+output/sim_107.log:Running on node: nid00061
+output/sim_108.log:Running on node: nid00062
+
+$ grep "on node:" output/*log | awk '{print $4}' | sort | uniq -c
+    158 nid00032
+    156 nid00033
+    171 nid00060
+    178 nid00061
+    166 nid00062
+    171 nid00063
+$ hostname
+raven
+$ hostname -f
+nid00008</tt></pre>
+</div></div>
+<div class="paragraph"><p>Swift’s <tt>sites.xml</tt> configuration file allows many parameters to
+specify how jobs should be run on a given cluster. Consider for
+example that Raven has several queues, each with limitiations on the
+size of jobs that can be run in them.  All Raven queues will only run
+2 jobs per user at one. The Raven queue "small" will only allow up to
+4 nodes per job and 1 hours of walltime per job.  The following
+site.xml parameters will allow us to match this:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>  <profile namespace="globus" key="queue">small</profile>
+  <profile namespace="globus" key="slots">2</profile>
+  <profile namespace="globus" key="maxNodes">4</profile>
+  <profile namespace="globus" key="nodeGranularity">4</profile></tt></pre>
+</div></div>
+<div class="paragraph"><p>To run large jobs, we can specify:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>  <profile namespace="globus" key="slots">2</profile>
+  <profile namespace="globus" key="maxNodes">8</profile>
+  <profile namespace="globus" key="nodeGranularity">8</profile>
+  <profile namespace="karajan" key="jobThrottle">50.0</profile>
+  <profile namespace="globus" key="maxTime">21600</profile>
+  <profile namespace="globus" key="lowOverAllocation">10000</profile>
+  <profile namespace="globus" key="highOverAllocation">10000</profile></tt></pre>
+</div></div>
+<div class="paragraph"><p>This will enable 512 Swift apps (2 x 8 x 32) to run concurrently
+within 2 8-node jobs on Raven’s 32-core nodes.  It results in the
+following two PBS jobs submitted by Swift to "provision" compute nodes
+to run thousands of apps, 512 at a time:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ qstat -u $USER
+
+Job ID          Username Queue    Jobname    SessID NDS TSK Memory Time  S Time
+--------------- -------- -------- ---------- ------ --- --- ------ ----- - -----
+288637.sdb      p01532   medium   B0827-2703    --    8 256    --  05:59 Q   --
+288638.sdb      p01532   medium   B0827-2703    --    8 256    --  05:59 Q   --</tt></pre>
+</div></div>
+<div class="paragraph"><p>The following section is a summary of the important <tt>sites.xml</tt>
+attributes for running apps on Cray systems. Many of these attributes
+can be set the same for all Swift users of a given system; only a few
+of the attributes need be overridden by users. We explain these
+attributes in detail here to show the degree of control afforded by
+Swift over application execution.  Most users will use templates for a
+given Cray system, only changing a few parameters to meet any unique
+needs of their application workflows.</p></div>
+<div class="paragraph"><p>The additional attributes in the <tt>sites.xml</tt> file (described here
+without their XML formatting) specify that Swift should run
+applications on Raven in the following manner:</p></div>
+<div class="paragraph"><p><tt>execution provider coaster, jobmanager local:pbs</tt> specifies that
+Swift should run apps using its "coaster" provider, which submits
+"pilot jobs" using qsub. These pilot jobs hold on to compute nodes and
+allow Swift to run many app invocations within a single job. This
+mechanism is described in
+<a href="http://www.swift-lang.org/papers/UCC-coasters.pdf">this paper from UCC-2011</a>.</p></div>
+<div class="paragraph"><p><tt>profile</tt> tags specify additional attributes for the execution
+provider. (A "provider" is like a driver which knows how to handle
+site-specific aspects of app execution). The attributes are grouped
+into various "namespaces", but we can ignore this for now).</p></div>
+<div class="paragraph"><p>The <tt>env</tt> key <tt>PATHPREFIX</tt> specifies that our tutorial <tt>app</tt> directory
+(<tt>../app</tt>) will be placed at the front of PATH to locate the app on
+the compute node.</p></div>
+<div class="paragraph"><p><tt>queue small</tt> specifies that pilot (coaster) jobs to run apps will be
+submitted to Raven’s <tt>small</tt> queue.</p></div>
+<div class="paragraph"><p><tt>providerAttributes pbs.aprun;pbs.mpp;depth=32</tt> specifies some
+Cray-specific attributes: that jobs should use Cray-specific PBS "mpp"
+resource attributes (eg <tt>mppwidth</tt> and <tt>mppnppn</tt>) and an mppdepth of
+32 (because we will be running one coaster process per node, and
+Raven’s XE6 dual IL-16 nodes have a depth of 32 processing elements
+(PEs).</p></div>
+<div class="paragraph"><p><tt>jobsPerNode 32</tt> tells Swift that each coaster should run up to 32
+concurrent apps. This can be reduced to place fewer apps per node, eg
+if each app needs more memory (or, rarely, greater than 32, e.g. if the apps are
+IO-bound or for benchmark experiments, etc).</p></div>
+<div class="paragraph"><p><tt>slots 2</tt> specifies that Swift will run up to 2 concurrent PBS jobs,
+and <tt>maxNodes 1</tt> specifies that each of these jobs will request only 1
+compute node.</p></div>
+<div class="paragraph"><p><tt>maxWallTime 00:01:00</tt> specifies that Swift should allow each app to
+run for up to one minute of walltime within the larger pilot job. In
+this example Swift will dynamically determine the total PBS walltime
+needed for the pilot job, but this can be specified manually using
+attributes <tt>maxtime</tt> along with <tt>highOverAllocation</tt> and
+<tt>lowOverAllocation</tt>.</p></div>
+<div class="paragraph"><p><tt>jobThrottle 3.20</tt> specifies that Swift should allow up to 320 apps to
+run on the <tt>raven</tt> site at once.  This is typically set to a number
+greater than or equal to the number of slots x compute nodes x apps
+per node (<tt>jobsPerNode</tt> attribute).</p></div>
+<div class="paragraph"><p><tt>initialscore 10000</tt> is specified to override Swift’s automatic
+throttling, and forces an actual throttle value of approximately
+(specifically 1 over) <tt>jobThrottle</tt> * 100 to be used.</p></div>
+<div class="paragraph"><p>The last two attributes specify where and how Swift should perform
+data management.  <tt>workdirectory /lus/scratch/{env.USER}/swiftwork</tt>
+specifies where the Swift "application execution sanbox directory"
+used for each app will be located. In some situations this can be a
+directory local to the compute node (eg, for Cray systems, <tt>/dev/shm</tt>
+or <tt>/tmp</tt>, if those are writable by user jobs and the nodes have
+sufficient space in these RAM-based filesystems).</p></div>
+<div class="paragraph"><p>Finally, <tt>stagingMethod sfs</tt> specifies that Swift will copy data to
+and from the shared file system to the application sandbox
+directories.</p></div>
+</div>
+</div>
+</div>
+<div id="footnotes"><hr /></div>
+<div id="footer">
+<div id="footer-text">
+Last updated 2013-09-11 13:13:14 CDT
+</div>
+</div>
+</body>
+</html>

Added: SwiftApps/tryswift/scripts/p5.html
===================================================================
--- SwiftApps/tryswift/scripts/p5.html	                        (rev 0)
+++ SwiftApps/tryswift/scripts/p5.html	2013-09-11 18:25:03 UTC (rev 7055)
@@ -0,0 +1,716 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
+<meta name="generator" content="AsciiDoc 8.6.4" />
+<title>Part 5: Controlling the compute-node pools where applications run</title>
+<style type="text/css">
+/* Sans-serif font. */
+h1, h2, h3, h4, h5, h6,
+div.title, caption.title,
+thead, p.table.header,
+div#toctitle,
+span#author, span#revnumber, span#revdate, span#revremark,
+div#footer {
+  font-family: Arial,Helvetica,sans-serif;
+}
+
+/* Serif font. */
+div.sectionbody {
+  font-family: Georgia,"Times New Roman",Times,serif;
+}
+
+/* Monospace font. */
+tt {
+  font-size: inherit;
+}
+
+body {
+  margin: 1em 5% 1em 5%;
+}
+
+a {
+  color: blue;
+  text-decoration: underline;
+}
+a:visited {
+  color: fuchsia;
+}
+
+em {
+  font-style: italic;
+  color: navy;
+}
+
+strong {
+  font-weight: bold;
+  color: #083194;
+}
+
+tt {
+  font-size: inherit;
+  color: navy;
+}
+
+h1, h2, h3, h4, h5, h6 {
+  color: #527bbd;
+  margin-top: 1.2em;
+  margin-bottom: 0.5em;
+  line-height: 1.3;
+}
+
+h1, h2, h3 {
+  border-bottom: 2px solid silver;
+}
+h2 {
+  padding-top: 0.5em;
+}
+h3 {
+  float: left;
+}
+h3 + * {
+  clear: left;
+}
+
+div.sectionbody {
+  margin-left: 0;
+}
+
+hr {
+  border: 1px solid silver;
+}
+
+p {
+  margin-top: 0.5em;
+  margin-bottom: 0.5em;
+}
+
+ul, ol, li > p {
+  margin-top: 0;
+}
+ul > li     { color: #aaa; }
+ul > li > * { color: black; }
+
+pre {
+  padding: 0;
+  margin: 0;
+}
+
+span#author {
+  color: #527bbd;
+  font-weight: bold;
+  font-size: 1.1em;
+}
+span#email {
+}
+span#revnumber, span#revdate, span#revremark {
+}
+
+div#footer {
+  font-size: small;
+  border-top: 2px solid silver;
+  padding-top: 0.5em;
+  margin-top: 4.0em;
+}
+div#footer-text {
+  float: left;
+  padding-bottom: 0.5em;
+}
+div#footer-badges {
+  float: right;
+  padding-bottom: 0.5em;
+}
+
+div#preamble {
+  margin-top: 1.5em;
+  margin-bottom: 1.5em;
+}
+div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
+div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
+div.admonitionblock {
+  margin-top: 1.0em;
+  margin-bottom: 1.5em;
+}
+div.admonitionblock {
+  margin-top: 2.0em;
+  margin-bottom: 2.0em;
+  margin-right: 10%;
+  color: #606060;
+}
+
+div.content { /* Block element content. */
+  padding: 0;
+}
+
+/* Block element titles. */
+div.title, caption.title {
+  color: #527bbd;
+  font-weight: bold;
+  text-align: left;
+  margin-top: 1.0em;
+  margin-bottom: 0.5em;
+}
+div.title + * {
+  margin-top: 0;
+}
+
+td div.title:first-child {
+  margin-top: 0.0em;
+}
+div.content div.title:first-child {
+  margin-top: 0.0em;
+}
+div.content + div.title {
+  margin-top: 0.0em;
+}
+
+div.sidebarblock > div.content {
+  background: #ffffee;
+  border: 1px solid #dddddd;
+  border-left: 4px solid #f0f0f0;
+  padding: 0.5em;
+}
+
+div.listingblock > div.content {
+  border: 1px solid #dddddd;
+  border-left: 5px solid #f0f0f0;
+  background: #f8f8f8;
+  padding: 0.5em;
+}
+
+div.quoteblock, div.verseblock {
+  padding-left: 1.0em;
+  margin-left: 1.0em;
+  margin-right: 10%;
+  border-left: 5px solid #f0f0f0;
+  color: #777777;
+}
+
+div.quoteblock > div.attribution {
+  padding-top: 0.5em;
+  text-align: right;
+}
+
+div.verseblock > pre.content {
+  font-family: inherit;
+  font-size: inherit;
+}
+div.verseblock > div.attribution {
+  padding-top: 0.75em;
+  text-align: left;
+}
+/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
+div.verseblock + div.attribution {
+  text-align: left;
+}
+
+div.admonitionblock .icon {
+  vertical-align: top;
+  font-size: 1.1em;
+  font-weight: bold;
+  text-decoration: underline;
+  color: #527bbd;
+  padding-right: 0.5em;
+}
+div.admonitionblock td.content {
+  padding-left: 0.5em;
+  border-left: 3px solid #dddddd;
+}
+
+div.exampleblock > div.content {
+  border-left: 3px solid #dddddd;
+  padding-left: 0.5em;
+}
+
+div.imageblock div.content { padding-left: 0; }
+span.image img { border-style: none; }
+a.image:visited { color: white; }
+
+dl {
+  margin-top: 0.8em;
+  margin-bottom: 0.8em;
+}
+dt {
+  margin-top: 0.5em;
+  margin-bottom: 0;
+  font-style: normal;
+  color: navy;
+}
+dd > *:first-child {
+  margin-top: 0.1em;
+}
+
+ul, ol {
+    list-style-position: outside;
+}
+ol.arabic {
+  list-style-type: decimal;
+}
+ol.loweralpha {
+  list-style-type: lower-alpha;
+}
+ol.upperalpha {
+  list-style-type: upper-alpha;
+}
+ol.lowerroman {
+  list-style-type: lower-roman;
+}
+ol.upperroman {
+  list-style-type: upper-roman;
+}
+
+div.compact ul, div.compact ol,
+div.compact p, div.compact p,
+div.compact div, div.compact div {
+  margin-top: 0.1em;
+  margin-bottom: 0.1em;
+}
+
+div.tableblock > table {
+  border: 3px solid #527bbd;
+}
+thead, p.table.header {
+  font-weight: bold;
+  color: #527bbd;
+}
+tfoot {
+  font-weight: bold;
+}
+td > div.verse {
+  white-space: pre;
+}
+p.table {
+  margin-top: 0;
+}
+/* Because the table frame attribute is overriden by CSS in most browsers. */
+div.tableblock > table[frame="void"] {
+  border-style: none;
+}
+div.tableblock > table[frame="hsides"] {
+  border-left-style: none;
+  border-right-style: none;
+}
+div.tableblock > table[frame="vsides"] {
+  border-top-style: none;
+  border-bottom-style: none;
+}
+
+
+div.hdlist {
+  margin-top: 0.8em;
+  margin-bottom: 0.8em;
+}
+div.hdlist tr {
+  padding-bottom: 15px;
+}
+dt.hdlist1.strong, td.hdlist1.strong {
+  font-weight: bold;
+}
+td.hdlist1 {
+  vertical-align: top;
+  font-style: normal;
+  padding-right: 0.8em;
+  color: navy;
+}
+td.hdlist2 {
+  vertical-align: top;
+}
+div.hdlist.compact tr {
+  margin: 0;
+  padding-bottom: 0;
+}
+
+.comment {
+  background: yellow;
+}
+
+.footnote, .footnoteref {
+  font-size: 0.8em;
+}
+
+span.footnote, span.footnoteref {
+  vertical-align: super;
+}
+
+#footnotes {
+  margin: 20px 0 20px 0;
+  padding: 7px 0 0 0;
+}
+
+#footnotes div.footnote {
+  margin: 0 0 5px 0;
+}
+
+#footnotes hr {
+  border: none;
+  border-top: 1px solid silver;
+  height: 1px;
+  text-align: left;
+  margin-left: 0;
+  width: 20%;
+  min-width: 100px;
+}
+
+div.colist td {
+  padding-right: 0.5em;
+  padding-bottom: 0.3em;
+  vertical-align: top;
+}
+div.colist td img {
+  margin-top: 0.3em;
+}
+
+ at media print {
+  div#footer-badges { display: none; }
+}
+
+div#toc {
+  margin-bottom: 2.5em;
+}
+
+div#toctitle {
+  color: #527bbd;
+  font-size: 1.1em;
+  font-weight: bold;
+  margin-top: 1.0em;
+  margin-bottom: 0.1em;
+}
+
+div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
+  margin-top: 0;
+  margin-bottom: 0;
+}
+div.toclevel2 {
+  margin-left: 2em;
+  font-size: 0.9em;
+}
+div.toclevel3 {
+  margin-left: 4em;
+  font-size: 0.9em;
+}
+div.toclevel4 {
+  margin-left: 6em;
+  font-size: 0.9em;
+}
+
+span.aqua { color: aqua; }
+span.black { color: black; }
+span.blue { color: blue; }
+span.fuchsia { color: fuchsia; }
+span.gray { color: gray; }
+span.green { color: green; }
+span.lime { color: lime; }
+span.maroon { color: maroon; }
+span.navy { color: navy; }
+span.olive { color: olive; }
+span.purple { color: purple; }
+span.red { color: red; }
+span.silver { color: silver; }
+span.teal { color: teal; }
+span.white { color: white; }
+span.yellow { color: yellow; }
+
+span.aqua-background { background: aqua; }
+span.black-background { background: black; }
+span.blue-background { background: blue; }
+span.fuchsia-background { background: fuchsia; }
+span.gray-background { background: gray; }
+span.green-background { background: green; }
+span.lime-background { background: lime; }
+span.maroon-background { background: maroon; }
+span.navy-background { background: navy; }
+span.olive-background { background: olive; }
+span.purple-background { background: purple; }
+span.red-background { background: red; }
+span.silver-background { background: silver; }
+span.teal-background { background: teal; }
+span.white-background { background: white; }
+span.yellow-background { background: yellow; }
+
+span.big { font-size: 2em; }
+span.small { font-size: 0.6em; }
+a:link { color:navy; }
+a:visited { color:navy; }
+
+.monospaced, code, pre {
+  font-family: "Courier New", Courier, monospace;
+  font-size: medium; /* inherit; */
+  color: black;
+  padding: 0;
+  margin: 0;
+}
+
+/*
+  background: #f8f8f8;
+  border: 1px solid #dddddd;
+  border-left: 5px solid #f0f0f0;
+  margin-right: 10%;
+*/
+
+div.listingblock > div.content {
+  padding: 0.5em;
+  background: none;
+  border: none;
+  border-left: none;
+  margin-right: none;
+}
+
+</style>
+<script type="text/javascript">
+/*<![CDATA[*/
+window.onload = function(){asciidoc.footnotes();}
+var asciidoc = {  // Namespace.
+
+/////////////////////////////////////////////////////////////////////
+// Table Of Contents generator
+/////////////////////////////////////////////////////////////////////
+
+/* Author: Mihai Bazon, September 2002
+ * http://students.infoiasi.ro/~mishoo
+ *
+ * Table Of Content generator
+ * Version: 0.4
+ *
+ * Feel free to use this script under the terms of the GNU General Public
+ * License, as long as you do not remove or alter this notice.
+ */
+
+ /* modified by Troy D. Hanson, September 2006. License: GPL */
+ /* modified by Stuart Rackham, 2006, 2009. License: GPL */
+
+// toclevels = 1..4.
+toc: function (toclevels) {
+
+  function getText(el) {
+    var text = "";
+    for (var i = el.firstChild; i != null; i = i.nextSibling) {
+      if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
+        text += i.data;
+      else if (i.firstChild != null)
+        text += getText(i);
+    }
+    return text;
+  }
+
+  function TocEntry(el, text, toclevel) {
+    this.element = el;
+    this.text = text;
+    this.toclevel = toclevel;
+  }
+
+  function tocEntries(el, toclevels) {
+    var result = new Array;
+    var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
+    // Function that scans the DOM tree for header elements (the DOM2
+    // nodeIterator API would be a better technique but not supported by all
+    // browsers).
+    var iterate = function (el) {
+      for (var i = el.firstChild; i != null; i = i.nextSibling) {
+        if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
+          var mo = re.exec(i.tagName);
+          if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
+            result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
+          }
+          iterate(i);
+        }
+      }
+    }
+    iterate(el);
+    return result;
+  }
+
+  var toc = document.getElementById("toc");
+  var entries = tocEntries(document.getElementById("content"), toclevels);
+  for (var i = 0; i < entries.length; ++i) {
+    var entry = entries[i];
+    if (entry.element.id == "")
+      entry.element.id = "_toc_" + i;
+    var a = document.createElement("a");
+    a.href = "#" + entry.element.id;
+    a.appendChild(document.createTextNode(entry.text));
+    var div = document.createElement("div");
+    div.appendChild(a);
+    div.className = "toclevel" + entry.toclevel;
+    toc.appendChild(div);
+  }
+  if (entries.length == 0)
+    toc.parentNode.removeChild(toc);
+},
+
+
+/////////////////////////////////////////////////////////////////////
+// Footnotes generator
+/////////////////////////////////////////////////////////////////////
+
+/* Based on footnote generation code from:
+ * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
+ */
+
+footnotes: function () {
+  var cont = document.getElementById("content");
+  var noteholder = document.getElementById("footnotes");
+  var spans = cont.getElementsByTagName("span");
+  var refs = {};
+  var n = 0;
+  for (i=0; i<spans.length; i++) {
+    if (spans[i].className == "footnote") {
+      n++;
+      // Use [\s\S] in place of . so multi-line matches work.
+      // Because JavaScript has no s (dotall) regex flag.
+      note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
+      noteholder.innerHTML +=
+        "<div class='footnote' id='_footnote_" + n + "'>" +
+        "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
+        n + "</a>. " + note + "</div>";
+      spans[i].innerHTML =
+        "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
+        "' title='View footnote' class='footnote'>" + n + "</a>]";
+      var id =spans[i].getAttribute("id");
+      if (id != null) refs["#"+id] = n;
+    }
+  }
+  if (n == 0)
+    noteholder.parentNode.removeChild(noteholder);
+  else {
+    // Process footnoterefs.
+    for (i=0; i<spans.length; i++) {
+      if (spans[i].className == "footnoteref") {
+        var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
+        href = href.match(/#.*/)[0];  // Because IE return full URL.
+        n = refs[href];
+        spans[i].innerHTML =
+          "[<a href='#_footnote_" + n +
+          "' title='View footnote' class='footnote'>" + n + "</a>]";
+      }
+    }
+  }
+}
+
+}
+/*]]>*/
+</script>
+</head>
+<body class="article" style="max-width:800px">
+<div id="header">
+<h1>Part 5: Controlling the compute-node pools where applications run</h1>
+</div>
+<div id="content">
+<div id="preamble">
+<div class="sectionbody">
+<div class="paragraph"><p>In this section we’ll use the script <tt>p5.swift</tt>, very similar to
+<tt>p4.swift</tt> of the prior section, to show how we can route apps to
+specific sites, and also how we can make multiple pools of resources
+(on the same or on different computer systems) available to run a
+single Swift script.</p></div>
+<div class="paragraph"><p>First, lets specify that the analysis app <tt>stats.sh</tt> should be run on
+the local login node instead of on the cluster. This is done simply by
+change the site name field of the analyze app in the apps file:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ cat apps
+raven     simulate  simulate.sh
+localhost stats     stats.sh</tt></pre>
+</div></div>
+<div class="paragraph"><p>Running this with <tt>swift p5.swift</tt> we see:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ grep "on node:" output/*.log
+output/average.log:Running on node: raven
+output/sim_0.log:Running on node: nid00029
+output/sim_1.log:Running on node: nid00029
+output/sim_2.log:Running on node: nid00029
+output/sim_3.log:Running on node: nid00029
+output/sim_4.log:Running on node: nid00029
+output/sim_5.log:Running on node: nid00029
+output/sim_6.log:Running on node: nid00029
+output/sim_7.log:Running on node: nid00029
+output/sim_8.log:Running on node: nid00029
+output/sim_9.log:Running on node: nid00029</tt></pre>
+</div></div>
+<div class="paragraph"><p>Now lets make further use of Swift’s ability to route specific apps to
+specific pools of resources. The Cray Raven system has two node types,
+XE6 32-core 2 x IL-16, and XK7 16-core 1 x IL-16 plus one GPU.  Each
+"pool" of nodes has different queue characteristics. We can define
+these differences to Swift as two separate pools, and then spread the
+load of executing a large ensemble of simulations across all the
+pools. (And we’ll continue to run the analysis script on a third pool,
+comprising the single login host.)</p></div>
+<div class="paragraph"><p>We use the following <tt>apps</tt> file:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ cat multipools
+raven     simulate simulate.sh
+ravenGPU  simulate simulate.sh
+localhost stats    stats.sh</tt></pre>
+</div></div>
+<div class="paragraph"><p>and we adjust the sites file to specify 4-node jobs in the Raven pool:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>    <profile namespace="globus" key="maxNodes">4</profile>
+    <profile namespace="globus" key="nodeGranularity">4</profile></tt></pre>
+</div></div>
+<div class="paragraph"><p>This results in these PBS jobs:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>p01532 at raven:~> qstat -u $USER
+
+Job ID          Username Queue    Jobname    SessID NDS TSK Memory Time  S Time
+--------------- -------- -------- ---------- ------ --- --- ------ ----- - -----
+288687.sdb      p01532   small    B0827-3406   9919   4 128    --  00:59 R 00:00
+288688.sdb      p01532   gpu_node B0827-3406   9931   6  96    --  00:59 R 00:00</tt></pre>
+</div></div>
+<div class="olist lowerroman"><ol class="lowerroman">
+<li>
+<p>
+and achieves the following parallelism (of about 224 concurrent app tasks):
+</p>
+</li>
+</ol></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ swift -tc.file multipools p5.swift -nsim=1000 -steps=3
+Swift 0.94.1 RC2 swift-r6895 cog-r3765
+
+RunID: 20130827-1829-o3h6mht5
+Progress:  time: Tue, 27 Aug 2013 18:29:31 -0500
+Progress:  time: Tue, 27 Aug 2013 18:29:32 -0500  Initializing:997
+Progress:  time: Tue, 27 Aug 2013 18:29:34 -0500  Selecting site:774  Submitting:225  Submitted:1
+Progress:  time: Tue, 27 Aug 2013 18:29:35 -0500  Selecting site:774  Stage in:1  Submitted:225
+Progress:  time: Tue, 27 Aug 2013 18:29:36 -0500  Selecting site:774  Stage in:1  Submitted:37  Active:188
+Progress:  time: Tue, 27 Aug 2013 18:29:39 -0500  Selecting site:774  Submitted:2  Active:223  Stage out:1
+Progress:  time: Tue, 27 Aug 2013 18:29:40 -0500  Selecting site:750  Submitted:17  Active:208  Stage out:1  Finished successfully:24
+Progress:  time: Tue, 27 Aug 2013 18:29:41 -0500  Selecting site:640  Stage in:1  Submitted:51  Active:174  Finished successfully:134
+Progress:  time: Tue, 27 Aug 2013 18:29:42 -0500  Selecting site:551  Submitted:11  Active:214  Stage out:1  Finished successfully:223
+Progress:  time: Tue, 27 Aug 2013 18:29:43 -0500  Selecting site:542  Submitted:2  Active:223  Stage out:1  Finished successfully:232
+Progress:  time: Tue, 27 Aug 2013 18:29:44 -0500  Selecting site:511  Submitting:1  Submitted:19  Active:206  Finished successfully:263
+Progress:  time: Tue, 27 Aug 2013 18:29:45 -0500  Selecting site:463  Stage in:1  Submitted:43  Active:182  Finished successfully:311
+Progress:  time: Tue, 27 Aug 2013 18:29:46 -0500  Selecting site:367  Submitting:1  Submitted:38  Active:186  Stage out:1  Finished successfully:407
+Progress:  time: Tue, 27 Aug 2013 18:29:47 -0500  Selecting site:309  Submitted:2  Active:223  Stage out:1  Finished successfully:465
+Progress:  time: Tue, 27 Aug 2013 18:29:48 -0500  Selecting site:300  Submitted:2  Active:223  Stage out:1  Finished successfully:474
+Progress:  time: Tue, 27 Aug 2013 18:29:50 -0500  Selecting site:259  Submitted:11  Active:214  Stage out:1  Finished successfully:515
+Progress:  time: Tue, 27 Aug 2013 18:29:51 -0500  Selecting site:201  Stage in:1  Submitted:39  Active:186  Finished successfully:573
+Progress:  time: Tue, 27 Aug 2013 18:29:52 -0500  Selecting site:80  Submitted:42  Active:184  Finished successfully:694
+Progress:  time: Tue, 27 Aug 2013 18:29:53 -0500  Selecting site:54  Submitted:2  Active:223  Stage out:1  Finished successfully:720
+Progress:  time: Tue, 27 Aug 2013 18:29:54 -0500  Selecting site:32  Submitted:4  Active:220  Stage out:1  Finished successfully:743
+Progress:  time: Tue, 27 Aug 2013 18:29:55 -0500  Submitted:3  Active:216  Stage out:1  Finished successfully:780
+Progress:  time: Tue, 27 Aug 2013 18:29:56 -0500  Stage in:1  Active:143  Finished successfully:856
+Progress:  time: Tue, 27 Aug 2013 18:29:57 -0500  Active:38  Stage out:1  Finished successfully:961
+Progress:  time: Tue, 27 Aug 2013 18:29:58 -0500  Active:8  Stage out:1  Finished successfully:991
+Progress:  time: Tue, 27 Aug 2013 18:29:59 -0500  Stage out:1  Finished successfully:999
+Progress:  time: Tue, 27 Aug 2013 18:30:01 -0500  Stage in:1  Finished successfully:1000
+Progress:  time: Tue, 27 Aug 2013 18:30:02 -0500  Active:1  Finished successfully:1000
+Progress:  time: Tue, 27 Aug 2013 18:30:06 -0500  Stage out:1  Finished successfully:1000
+Final status: Tue, 27 Aug 2013 18:30:07 -0500  Finished successfully:1001</tt></pre>
+</div></div>
+</div>
+</div>
+</div>
+<div id="footnotes"><hr /></div>
+<div id="footer">
+<div id="footer-text">
+Last updated 2013-09-11 13:13:27 CDT
+</div>
+</div>
+</body>
+</html>

Added: SwiftApps/tryswift/scripts/p6.html
===================================================================
--- SwiftApps/tryswift/scripts/p6.html	                        (rev 0)
+++ SwiftApps/tryswift/scripts/p6.html	2013-09-11 18:25:03 UTC (rev 7055)
@@ -0,0 +1,797 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />
+<meta name="generator" content="AsciiDoc 8.6.4" />
+<title></title>
+<style type="text/css">
+/* Sans-serif font. */
+h1, h2, h3, h4, h5, h6,
+div.title, caption.title,
+thead, p.table.header,
+div#toctitle,
+span#author, span#revnumber, span#revdate, span#revremark,
+div#footer {
+  font-family: Arial,Helvetica,sans-serif;
+}
+
+/* Serif font. */
+div.sectionbody {
+  font-family: Georgia,"Times New Roman",Times,serif;
+}
+
+/* Monospace font. */
+tt {
+  font-size: inherit;
+}
+
+body {
+  margin: 1em 5% 1em 5%;
+}
+
+a {
+  color: blue;
+  text-decoration: underline;
+}
+a:visited {
+  color: fuchsia;
+}
+
+em {
+  font-style: italic;
+  color: navy;
+}
+
+strong {
+  font-weight: bold;
+  color: #083194;
+}
+
+tt {
+  font-size: inherit;
+  color: navy;
+}
+
+h1, h2, h3, h4, h5, h6 {
+  color: #527bbd;
+  margin-top: 1.2em;
+  margin-bottom: 0.5em;
+  line-height: 1.3;
+}
+
+h1, h2, h3 {
+  border-bottom: 2px solid silver;
+}
+h2 {
+  padding-top: 0.5em;
+}
+h3 {
+  float: left;
+}
+h3 + * {
+  clear: left;
+}
+
+div.sectionbody {
+  margin-left: 0;
+}
+
+hr {
+  border: 1px solid silver;
+}
+
+p {
+  margin-top: 0.5em;
+  margin-bottom: 0.5em;
+}
+
+ul, ol, li > p {
+  margin-top: 0;
+}
+ul > li     { color: #aaa; }
+ul > li > * { color: black; }
+
+pre {
+  padding: 0;
+  margin: 0;
+}
+
+span#author {
+  color: #527bbd;
+  font-weight: bold;
+  font-size: 1.1em;
+}
+span#email {
+}
+span#revnumber, span#revdate, span#revremark {
+}
+
+div#footer {
+  font-size: small;
+  border-top: 2px solid silver;
+  padding-top: 0.5em;
+  margin-top: 4.0em;
+}
+div#footer-text {
+  float: left;
+  padding-bottom: 0.5em;
+}
+div#footer-badges {
+  float: right;
+  padding-bottom: 0.5em;
+}
+
+div#preamble {
+  margin-top: 1.5em;
+  margin-bottom: 1.5em;
+}
+div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
+div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
+div.admonitionblock {
+  margin-top: 1.0em;
+  margin-bottom: 1.5em;
+}
+div.admonitionblock {
+  margin-top: 2.0em;
+  margin-bottom: 2.0em;
+  margin-right: 10%;
+  color: #606060;
+}
+
+div.content { /* Block element content. */
+  padding: 0;
+}
+
+/* Block element titles. */
+div.title, caption.title {
+  color: #527bbd;
+  font-weight: bold;
+  text-align: left;
+  margin-top: 1.0em;
+  margin-bottom: 0.5em;
+}
+div.title + * {
+  margin-top: 0;
+}
+
+td div.title:first-child {
+  margin-top: 0.0em;
+}
+div.content div.title:first-child {
+  margin-top: 0.0em;
+}
+div.content + div.title {
+  margin-top: 0.0em;
+}
+
+div.sidebarblock > div.content {
+  background: #ffffee;
+  border: 1px solid #dddddd;
+  border-left: 4px solid #f0f0f0;
+  padding: 0.5em;
+}
+
+div.listingblock > div.content {
+  border: 1px solid #dddddd;
+  border-left: 5px solid #f0f0f0;
+  background: #f8f8f8;
+  padding: 0.5em;
+}
+
+div.quoteblock, div.verseblock {
+  padding-left: 1.0em;
+  margin-left: 1.0em;
+  margin-right: 10%;
+  border-left: 5px solid #f0f0f0;
+  color: #777777;
+}
+
+div.quoteblock > div.attribution {
+  padding-top: 0.5em;
+  text-align: right;
+}
+
+div.verseblock > pre.content {
+  font-family: inherit;
+  font-size: inherit;
+}
+div.verseblock > div.attribution {
+  padding-top: 0.75em;
+  text-align: left;
+}
+/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
+div.verseblock + div.attribution {
+  text-align: left;
+}
+
+div.admonitionblock .icon {
+  vertical-align: top;
+  font-size: 1.1em;
+  font-weight: bold;
+  text-decoration: underline;
+  color: #527bbd;
+  padding-right: 0.5em;
+}
+div.admonitionblock td.content {
+  padding-left: 0.5em;
+  border-left: 3px solid #dddddd;
+}
+
+div.exampleblock > div.content {
+  border-left: 3px solid #dddddd;
+  padding-left: 0.5em;
+}
+
+div.imageblock div.content { padding-left: 0; }
+span.image img { border-style: none; }
+a.image:visited { color: white; }
+
+dl {
+  margin-top: 0.8em;
+  margin-bottom: 0.8em;
+}
+dt {
+  margin-top: 0.5em;
+  margin-bottom: 0;
+  font-style: normal;
+  color: navy;
+}
+dd > *:first-child {
+  margin-top: 0.1em;
+}
+
+ul, ol {
+    list-style-position: outside;
+}
+ol.arabic {
+  list-style-type: decimal;
+}
+ol.loweralpha {
+  list-style-type: lower-alpha;
+}
+ol.upperalpha {
+  list-style-type: upper-alpha;
+}
+ol.lowerroman {
+  list-style-type: lower-roman;
+}
+ol.upperroman {
+  list-style-type: upper-roman;
+}
+
+div.compact ul, div.compact ol,
+div.compact p, div.compact p,
+div.compact div, div.compact div {
+  margin-top: 0.1em;
+  margin-bottom: 0.1em;
+}
+
+div.tableblock > table {
+  border: 3px solid #527bbd;
+}
+thead, p.table.header {
+  font-weight: bold;
+  color: #527bbd;
+}
+tfoot {
+  font-weight: bold;
+}
+td > div.verse {
+  white-space: pre;
+}
+p.table {
+  margin-top: 0;
+}
+/* Because the table frame attribute is overriden by CSS in most browsers. */
+div.tableblock > table[frame="void"] {
+  border-style: none;
+}
+div.tableblock > table[frame="hsides"] {
+  border-left-style: none;
+  border-right-style: none;
+}
+div.tableblock > table[frame="vsides"] {
+  border-top-style: none;
+  border-bottom-style: none;
+}
+
+
+div.hdlist {
+  margin-top: 0.8em;
+  margin-bottom: 0.8em;
+}
+div.hdlist tr {
+  padding-bottom: 15px;
+}
+dt.hdlist1.strong, td.hdlist1.strong {
+  font-weight: bold;
+}
+td.hdlist1 {
+  vertical-align: top;
+  font-style: normal;
+  padding-right: 0.8em;
+  color: navy;
+}
+td.hdlist2 {
+  vertical-align: top;
+}
+div.hdlist.compact tr {
+  margin: 0;
+  padding-bottom: 0;
+}
+
+.comment {
+  background: yellow;
+}
+
+.footnote, .footnoteref {
+  font-size: 0.8em;
+}
+
+span.footnote, span.footnoteref {
+  vertical-align: super;
+}
+
+#footnotes {
+  margin: 20px 0 20px 0;
+  padding: 7px 0 0 0;
+}
+
+#footnotes div.footnote {
+  margin: 0 0 5px 0;
+}
+
+#footnotes hr {
+  border: none;
+  border-top: 1px solid silver;
+  height: 1px;
+  text-align: left;
+  margin-left: 0;
+  width: 20%;
+  min-width: 100px;
+}
+
+div.colist td {
+  padding-right: 0.5em;
+  padding-bottom: 0.3em;
+  vertical-align: top;
+}
+div.colist td img {
+  margin-top: 0.3em;
+}
+
+ at media print {
+  div#footer-badges { display: none; }
+}
+
+div#toc {
+  margin-bottom: 2.5em;
+}
+
+div#toctitle {
+  color: #527bbd;
+  font-size: 1.1em;
+  font-weight: bold;
+  margin-top: 1.0em;
+  margin-bottom: 0.1em;
+}
+
+div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
+  margin-top: 0;
+  margin-bottom: 0;
+}
+div.toclevel2 {
+  margin-left: 2em;
+  font-size: 0.9em;
+}
+div.toclevel3 {
+  margin-left: 4em;
+  font-size: 0.9em;
+}
+div.toclevel4 {
+  margin-left: 6em;
+  font-size: 0.9em;
+}
+
+span.aqua { color: aqua; }
+span.black { color: black; }
+span.blue { color: blue; }
+span.fuchsia { color: fuchsia; }
+span.gray { color: gray; }
+span.green { color: green; }
+span.lime { color: lime; }
+span.maroon { color: maroon; }
+span.navy { color: navy; }
+span.olive { color: olive; }
+span.purple { color: purple; }
+span.red { color: red; }
+span.silver { color: silver; }
+span.teal { color: teal; }
+span.white { color: white; }
+span.yellow { color: yellow; }
+
+span.aqua-background { background: aqua; }
+span.black-background { background: black; }
+span.blue-background { background: blue; }
+span.fuchsia-background { background: fuchsia; }
+span.gray-background { background: gray; }
+span.green-background { background: green; }
+span.lime-background { background: lime; }
+span.maroon-background { background: maroon; }
+span.navy-background { background: navy; }
+span.olive-background { background: olive; }
+span.purple-background { background: purple; }
+span.red-background { background: red; }
+span.silver-background { background: silver; }
+span.teal-background { background: teal; }
+span.white-background { background: white; }
+span.yellow-background { background: yellow; }
+
+span.big { font-size: 2em; }
+span.small { font-size: 0.6em; }
+a:link { color:navy; }
+a:visited { color:navy; }
+
+.monospaced, code, pre {
+  font-family: "Courier New", Courier, monospace;
+  font-size: medium; /* inherit; */
+  color: black;
+  padding: 0;
+  margin: 0;
+}
+
+/*
+  background: #f8f8f8;
+  border: 1px solid #dddddd;
+  border-left: 5px solid #f0f0f0;
+  margin-right: 10%;
+*/
+
+div.listingblock > div.content {
+  padding: 0.5em;
+  background: none;
+  border: none;
+  border-left: none;
+  margin-right: none;
+}
+
+</style>
+<script type="text/javascript">
+/*<![CDATA[*/
+window.onload = function(){asciidoc.footnotes();}
+var asciidoc = {  // Namespace.
+
+/////////////////////////////////////////////////////////////////////
+// Table Of Contents generator
+/////////////////////////////////////////////////////////////////////
+
+/* Author: Mihai Bazon, September 2002
+ * http://students.infoiasi.ro/~mishoo
+ *
+ * Table Of Content generator
+ * Version: 0.4
+ *
+ * Feel free to use this script under the terms of the GNU General Public
+ * License, as long as you do not remove or alter this notice.
+ */
+
+ /* modified by Troy D. Hanson, September 2006. License: GPL */
+ /* modified by Stuart Rackham, 2006, 2009. License: GPL */
+
+// toclevels = 1..4.
+toc: function (toclevels) {
+
+  function getText(el) {
+    var text = "";
+    for (var i = el.firstChild; i != null; i = i.nextSibling) {
+      if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants.
+        text += i.data;
+      else if (i.firstChild != null)
+        text += getText(i);
+    }
+    return text;
+  }
+
+  function TocEntry(el, text, toclevel) {
+    this.element = el;
+    this.text = text;
+    this.toclevel = toclevel;
+  }
+
+  function tocEntries(el, toclevels) {
+    var result = new Array;
+    var re = new RegExp('[hH]([2-'+(toclevels+1)+'])');
+    // Function that scans the DOM tree for header elements (the DOM2
+    // nodeIterator API would be a better technique but not supported by all
+    // browsers).
+    var iterate = function (el) {
+      for (var i = el.firstChild; i != null; i = i.nextSibling) {
+        if (i.nodeType == 1 /* Node.ELEMENT_NODE */) {
+          var mo = re.exec(i.tagName);
+          if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") {
+            result[result.length] = new TocEntry(i, getText(i), mo[1]-1);
+          }
+          iterate(i);
+        }
+      }
+    }
+    iterate(el);
+    return result;
+  }
+
+  var toc = document.getElementById("toc");
+  var entries = tocEntries(document.getElementById("content"), toclevels);
+  for (var i = 0; i < entries.length; ++i) {
+    var entry = entries[i];
+    if (entry.element.id == "")
+      entry.element.id = "_toc_" + i;
+    var a = document.createElement("a");
+    a.href = "#" + entry.element.id;
+    a.appendChild(document.createTextNode(entry.text));
+    var div = document.createElement("div");
+    div.appendChild(a);
+    div.className = "toclevel" + entry.toclevel;
+    toc.appendChild(div);
+  }
+  if (entries.length == 0)
+    toc.parentNode.removeChild(toc);
+},
+
+
+/////////////////////////////////////////////////////////////////////
+// Footnotes generator
+/////////////////////////////////////////////////////////////////////
+
+/* Based on footnote generation code from:
+ * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html
+ */
+
+footnotes: function () {
+  var cont = document.getElementById("content");
+  var noteholder = document.getElementById("footnotes");
+  var spans = cont.getElementsByTagName("span");
+  var refs = {};
+  var n = 0;
+  for (i=0; i<spans.length; i++) {
+    if (spans[i].className == "footnote") {
+      n++;
+      // Use [\s\S] in place of . so multi-line matches work.
+      // Because JavaScript has no s (dotall) regex flag.
+      note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1];
+      noteholder.innerHTML +=
+        "<div class='footnote' id='_footnote_" + n + "'>" +
+        "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
+        n + "</a>. " + note + "</div>";
+      spans[i].innerHTML =
+        "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
+        "' title='View footnote' class='footnote'>" + n + "</a>]";
+      var id =spans[i].getAttribute("id");
+      if (id != null) refs["#"+id] = n;
+    }
+  }
+  if (n == 0)
+    noteholder.parentNode.removeChild(noteholder);
+  else {
+    // Process footnoterefs.
+    for (i=0; i<spans.length; i++) {
+      if (spans[i].className == "footnoteref") {
+        var href = spans[i].getElementsByTagName("a")[0].getAttribute("href");
+        href = href.match(/#.*/)[0];  // Because IE return full URL.
+        n = refs[href];
+        spans[i].innerHTML =
+          "[<a href='#_footnote_" + n +
+          "' title='View footnote' class='footnote'>" + n + "</a>]";
+      }
+    }
+  }
+}
+
+}
+/*]]>*/
+</script>
+</head>
+<body class="article" style="max-width:800px">
+<div id="header">
+</div>
+<div id="content">
+<div class="sect2">
+<h3 id="_part_6_specifying_more_complex_workflow_patterns">Part 6: Specifying more complex workflow patterns</h3>
+<div class="paragraph"><p>p6.swift expands the workflow pattern of p4.swift to add additional
+stages to the workflow. Here, we generate a dynamic seed value that
+will be used by all of the simulations, and for each simulation, we
+run an pre-processing application to generate a unique "bias
+file". This pattern is shown below, followed by the Swift script.</p></div>
+<div class="imageblock" style="text-align:center;">
+<div class="content">
+<img src="part06.png" alt="part06.png" />
+</div>
+</div>
+<div class="listingblock">
+<div class="title">p6.swift</div>
+<div class="content">
+<pre><tt>type file;
+
+# app() functions for application programs to be called:
+
+app (file out) genseed (int nseeds)
+{
+  genseed "-r" 2000000 "-n" nseeds stdout=@out;
+}
+
+app (file out) genbias (int bias_range, int nvalues)
+{
+  genbias "-r" bias_range "-n" nvalues stdout=@out;
+}
+
+app (file out, file log) simulation (int timesteps, int sim_range,
+                                     file bias_file, int scale, int sim_count)
+{
+  simulate "-t" timesteps "-r" sim_range "-B" @bias_file "-x" scale
+           "-n" sim_count stdout=@out stderr=@log;
+}
+
+app (file out, file log) analyze (file s[])
+{
+  stats @filenames(s) stdout=@out stderr=@log;
+}
+
+# Command line arguments
+
+int  nsim  = @toInt(@arg("nsim",   "10"));  # number of simulation programs to run
+int  steps = @toInt(@arg("steps",  "1"));   # number of timesteps (seconds) per simulation
+int  range = @toInt(@arg("range",  "100")); # range of the generated random numbers
+int  values = @toInt(@arg("values", "10"));  # number of values generated per simulation
+
+# Main script and data
+
+tracef("\n*** Script parameters: nsim=%i range=%i num values=%i\n\n", nsim, range, values);
+
+file seedfile<"output/seed.dat">;        # Dynamically generated bias for simulation ensemble
+seedfile = genseed(1);
+
+int seedval = readData(seedfile);
+tracef("Generated seed=%i\n", seedval);
+
+file sims[];                      # Array of files to hold each simulation output
+
+foreach i in [0:nsim-1] {
+  file biasfile <single_file_mapper; file=@strcat("output/bias_",i,".dat")>;
+  file simout   <single_file_mapper; file=@strcat("output/sim_",i,".out")>;
+  file simlog   <single_file_mapper; file=@strcat("output/sim_",i,".log")>;
+  biasfile = genbias(1000, 20);
+  (simout,simlog) = simulation(steps, range, biasfile, 1000000, values);
+  sims[i] = simout;
+}
+
+file stats_out<"output/average.out">;
+file stats_log<"output/average.log">;
+(stats_out,stats_log) = analyze(sims);</tt></pre>
+</div></div>
+<div class="paragraph"><p>Note that the workflow is based on data flow dependencies: each simulation depends on the seed value, calculated in these two dependent statements:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>seedfile = genseed(1);
+int seedval = readData(seedfile);</tt></pre>
+</div></div>
+<div class="paragraph"><p>and on the bias file, computed and then consumed in these two dependent statements:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>  biasfile = genbias(1000, 20);
+  (simout,simlog) = simulation(steps, range, biasfile, 1000000, values);</tt></pre>
+</div></div>
+<div class="paragraph"><p>To run:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ cd ../part06
+$ swift p6.swift</tt></pre>
+</div></div>
+<div class="paragraph"><p>The default parameters result in the following execution log:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ swift p6.swift
+Swift 0.94.1 RC2 swift-r6895 cog-r3765
+
+RunID: 20130827-1917-jvs4gqm5
+Progress:  time: Tue, 27 Aug 2013 19:17:56 -0500
+
+*** Script parameters: nsim=10 range=100 num values=10
+
+Progress:  time: Tue, 27 Aug 2013 19:17:57 -0500  Stage in:1  Submitted:10
+Generated seed=382537
+Progress:  time: Tue, 27 Aug 2013 19:17:59 -0500  Active:9  Stage out:1  Finished successfully:11
+Final status: Tue, 27 Aug 2013 19:18:00 -0500  Finished successfully:22</tt></pre>
+</div></div>
+<div class="paragraph"><p>which produces the following output:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ ls -lrt output
+total 264
+-rw-r--r-- 1 p01532 61532     9 Aug 27 19:17 seed.dat
+-rw-r--r-- 1 p01532 61532   180 Aug 27 19:17 bias_9.dat
+-rw-r--r-- 1 p01532 61532   180 Aug 27 19:17 bias_8.dat
+-rw-r--r-- 1 p01532 61532   180 Aug 27 19:17 bias_7.dat
+-rw-r--r-- 1 p01532 61532   180 Aug 27 19:17 bias_6.dat
+-rw-r--r-- 1 p01532 61532   180 Aug 27 19:17 bias_5.dat
+-rw-r--r-- 1 p01532 61532   180 Aug 27 19:17 bias_4.dat
+-rw-r--r-- 1 p01532 61532   180 Aug 27 19:17 bias_3.dat
+-rw-r--r-- 1 p01532 61532   180 Aug 27 19:17 bias_2.dat
+-rw-r--r-- 1 p01532 61532   180 Aug 27 19:17 bias_1.dat
+-rw-r--r-- 1 p01532 61532   180 Aug 27 19:17 bias_0.dat
+-rw-r--r-- 1 p01532 61532    90 Aug 27 19:17 sim_9.out
+-rw-r--r-- 1 p01532 61532 14897 Aug 27 19:17 sim_9.log
+-rw-r--r-- 1 p01532 61532 14897 Aug 27 19:17 sim_8.log
+-rw-r--r-- 1 p01532 61532    90 Aug 27 19:17 sim_7.out
+-rw-r--r-- 1 p01532 61532    90 Aug 27 19:17 sim_6.out
+-rw-r--r-- 1 p01532 61532 14897 Aug 27 19:17 sim_6.log
+-rw-r--r-- 1 p01532 61532    90 Aug 27 19:17 sim_5.out
+-rw-r--r-- 1 p01532 61532 14897 Aug 27 19:17 sim_5.log
+-rw-r--r-- 1 p01532 61532    90 Aug 27 19:17 sim_4.out
+-rw-r--r-- 1 p01532 61532 14897 Aug 27 19:17 sim_4.log
+-rw-r--r-- 1 p01532 61532 14897 Aug 27 19:17 sim_1.log
+-rw-r--r-- 1 p01532 61532    90 Aug 27 19:18 sim_8.out
+-rw-r--r-- 1 p01532 61532 14897 Aug 27 19:18 sim_7.log
+-rw-r--r-- 1 p01532 61532    90 Aug 27 19:18 sim_3.out
+-rw-r--r-- 1 p01532 61532 14897 Aug 27 19:18 sim_3.log
+-rw-r--r-- 1 p01532 61532    90 Aug 27 19:18 sim_2.out
+-rw-r--r-- 1 p01532 61532 14898 Aug 27 19:18 sim_2.log
+-rw-r--r-- 1 p01532 61532    90 Aug 27 19:18 sim_1.out
+-rw-r--r-- 1 p01532 61532    90 Aug 27 19:18 sim_0.out
+-rw-r--r-- 1 p01532 61532 14897 Aug 27 19:18 sim_0.log
+-rw-r--r-- 1 p01532 61532     9 Aug 27 19:18 average.out
+-rw-r--r-- 1 p01532 61532 14675 Aug 27 19:18 average.log</tt></pre>
+</div></div>
+<div class="paragraph"><p>Each sim_N.out file is the sum of its bias file plus newly "simulated" random output scaled by 1,000,000:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><tt>$ cat output/bias_0.dat
+     302
+     489
+      81
+     582
+     664
+     290
+     839
+     258
+     506
+     310
+     293
+     508
+      88
+     261
+     453
+     187
+      26
+     198
+     402
+     555
+
+$ cat output/sim_0.out
+64000302
+38000489
+32000081
+12000582
+46000664
+36000290
+35000839
+22000258
+49000506
+75000310</tt></pre>
+</div></div>
+<div class="paragraph"><p>We produce 20 values in each bias file. Simulations of less than that
+number of values ignore the unneeded number, while simualtions of more
+than 20 will use the last bias number for all remoaining values past
+20.  As an exercise, adjust the code to produce the same number of
+bias values as is needed for each simulation.  As a further exercise,
+modify the script to generate a unique seed value for each simulation,
+which is a common practice in ensemble computations.</p></div>
+</div>
+</div>
+<div id="footnotes"><hr /></div>
+<div id="footer">
+<div id="footer-text">
+Last updated 2013-09-11 13:10:53 CDT
+</div>
+</div>
+</body>
+</html>

Added: SwiftApps/tryswift/scripts/part1.txt
===================================================================
--- SwiftApps/tryswift/scripts/part1.txt	                        (rev 0)
+++ SwiftApps/tryswift/scripts/part1.txt	2013-09-11 18:25:03 UTC (rev 7055)
@@ -0,0 +1,13 @@
+Part 1: Run a single application under Swift
+============================================
+
+The first swift script, p1.swift, runs simulate.sh to generate a
+single random number. It writes the number to a file.
+
+image::part01.png["p1 workflow",align="center"]
+
+.p1.swift
+-----
+sys::[cat ../part01/p1.swift]
+-----
+

Added: SwiftApps/tryswift/scripts/part2.txt
===================================================================
--- SwiftApps/tryswift/scripts/part2.txt	                        (rev 0)
+++ SwiftApps/tryswift/scripts/part2.txt	2013-09-11 18:25:03 UTC (rev 7055)
@@ -0,0 +1,38 @@
+Part 2: Running an ensemble of many apps in parallel with a "foreach" loop
+==========================================================================
+
+The `p2.swift` script introduces the `foreach` parallel iteration
+construct to run many concurrent simulations.
+
+image::part02.png[align="center"]
+
+.p2.swift
+-----
+sys::[cat ../part02/p2.swift]
+-----
+
+The script also shows an
+example of naming the output files of an ensemble run. In this case, the output files will be named
+`output/sim_N.out`.
+
+To run the script and view the output:
+-----
+$ cd ../part02
+$ swift p2.swift
+$ ls output
+sim_0.out  sim_1.out  sim_2.out  sim_3.out  sim_4.out  sim_5.out  sim_6.out  sim_7.out  sim_8.out  sim_9.out
+$ more output/*
+::::::::::::::
+output/sim_0.out
+::::::::::::::
+      44
+::::::::::::::
+output/sim_1.out
+::::::::::::::
+      55
+...
+::::::::::::::
+output/sim_9.out
+::::::::::::::
+      82
+-----

Added: SwiftApps/tryswift/scripts/part3.txt
===================================================================
--- SwiftApps/tryswift/scripts/part3.txt	                        (rev 0)
+++ SwiftApps/tryswift/scripts/part3.txt	2013-09-11 18:25:03 UTC (rev 7055)
@@ -0,0 +1,108 @@
+Part 3: Analyzing results of a parallel ensemble
+================================================
+
+After all the parallel simulations in an ensemble run have completed,
+its typically necessary to gather and analyze their results with some
+kind of post-processing analysis program or script.  p3.swift
+introduces such a postprocessing step. In this case, the files created
+by all of the parallel runs of `simulation.sh` will be averaged by by
+the trivial "analysis application" `stats.sh`:
+
+image::part03.png[align="center"]
+
+.p3.swift
+----
+sys::[cat ../part03/p3.swift]
+----
+
+To run:
+----
+$ cd part03
+$ swift p3.swift
+----
+
+Note that in `p3.swift` we expose more of the capabilities of the
+`simulate.sh` application to the `simulation()` app function:
+
+-----
+app (file o) simulation (int sim_steps, int sim_range, int sim_values)
+{
+  simulate "--timesteps" sim_steps "--range" sim_range "--nvalues" sim_values stdout=@filename(o);
+}
+-----
+
+`p3.swift` also shows how to fetch application-specific values from
+the `swift` command line in a Swift script using `@arg()` which
+accepts a keyword-style argument and its default value:
+
+-----
+int nsim   = @toInt(@arg("nsim","10"));
+int steps  = @toInt(@arg("steps","1"));
+int range  = @toInt(@arg("range","100"));
+int values = @toInt(@arg("values","5"));
+-----
+
+Now we can specify that more runs should be performed and that each should run for more timesteps, and produce more that one value each, within a specified range, using command line arguments placed after the Swift script name in the form `-parameterName=value`:
+
+-----
+$ swift p3.swift -nsim=3 -steps=10 -values=4 -range=1000000
+
+Swift 0.94.1 RC2 swift-r6895 cog-r3765
+
+RunID: 20130827-1439-s3vvo809
+Progress:  time: Tue, 27 Aug 2013 14:39:42 -0500
+Progress:  time: Tue, 27 Aug 2013 14:39:53 -0500  Active:2  Stage out:1
+Final status: Tue, 27 Aug 2013 14:39:53 -0500  Finished successfully:4
+
+$ ls output/
+average.out  sim_0.out  sim_1.out  sim_2.out
+$ more output/*
+::::::::::::::
+output/average.out
+::::::::::::::
+651368
+::::::::::::::
+output/sim_0.out
+::::::::::::::
+  735700
+  886206
+  997391
+  982970
+::::::::::::::
+output/sim_1.out
+::::::::::::::
+  260071
+  264195
+  869198
+  933537
+::::::::::::::
+output/sim_2.out
+::::::::::::::
+  201806
+  213540
+  527576
+  944233
+-----
+
+Now try running (`-nsim=`) 100 simulations of (`-steps=`) 1 second each:
+
+-----
+$ swift p3.swift -nsim=100 -steps=1 
+Swift 0.94.1 RC2 swift-r6895 cog-r3765
+
+RunID: 20130827-1444-rq809ts6
+Progress:  time: Tue, 27 Aug 2013 14:44:55 -0500
+Progress:  time: Tue, 27 Aug 2013 14:44:56 -0500  Selecting site:79  Active:20  Stage out:1
+Progress:  time: Tue, 27 Aug 2013 14:44:58 -0500  Selecting site:58  Active:20  Stage out:1  Finished successfully:21
+Progress:  time: Tue, 27 Aug 2013 14:44:59 -0500  Selecting site:37  Active:20  Stage out:1  Finished successfully:42
+Progress:  time: Tue, 27 Aug 2013 14:45:00 -0500  Selecting site:16  Active:20  Stage out:1  Finished successfully:63
+Progress:  time: Tue, 27 Aug 2013 14:45:02 -0500  Active:15  Stage out:1  Finished successfully:84
+Progress:  time: Tue, 27 Aug 2013 14:45:03 -0500  Finished successfully:101
+Final status: Tue, 27 Aug 2013 14:45:03 -0500  Finished successfully:101
+-----
+
+We can see from Swift's "progress" status that the tutorial's default
+`sites.xml` parameters for local execution allow Swift to run up to 20
+application invocations concurrently on the login node. We'll look at
+this in more detail in the next sections where we execute applications
+on the site's compute nodes.

Added: SwiftApps/tryswift/scripts/part4.txt
===================================================================
--- SwiftApps/tryswift/scripts/part4.txt	                        (rev 0)
+++ SwiftApps/tryswift/scripts/part4.txt	2013-09-11 18:25:03 UTC (rev 7055)
@@ -0,0 +1,249 @@
+Part 4: Running a parallel ensemble on Cray compute nodes
+=========================================================
+
+`p4.swift` will run our mock "simulation"
+applications on Cray compute nodes.  The script is similar to as
+`p3.swift`, but specifies that each simulation app invocation should
+additionally return the log file which the application writes to
+`stderr`.
+
+////
+
+FIXME: need to revise this figure: drop prog:
+
+, making the parallel portion of the script behave like this:
+
+image::part04.png[align="center"]
+
+.p4.swift
+----
+sys::[cat ../part04/p4.swift]
+----
+////
+
+Now when you run `swift p4.swift` you'll see that two types output
+files will placed in the `output/` directory: `sim_N.out` and
+`sim_N.log`.  The log files provide data on the runtime environment of
+each app invocation. For example:
+
+-----
+$ cat output/sim_0.log
+Called as: /home/users/p01532/swift-cray-tutorial/app/simulate.sh: --timesteps 1 --range 100 --nvalues 5
+
+Start time: Tue Aug 27 12:17:43 CDT 2013
+Running on node: nid00018
+Running as user: uid=61532(p01532) gid=61532 groups=61532
+
+Simulation parameters:
+
+bias=0
+biasfile=none
+initseed=none
+log=yes
+paramfile=none
+range=100
+scale=1
+seedfile=none
+timesteps=1
+output width=8
+
+Environment:
+
+ALPS_APP_DEPTH=32
+ASSEMBLER_X86_64=/opt/cray/cce/8.2.0.173/cray-binutils/x86_64-unknown-linux-gnu/bin/as
+ASYNCPE_DIR=/opt/cray/xt-asyncpe/5.23.02
+ASYNCPE_VERSION=5.23.02
+...
+-----
+
+To tell Swift to run the apps on compute nodes, we specify in the
+`apps` file that the apps should be executed on the `raven` site
+(instead of the `localhost` site).  We can specify the location of
+each app in the third field of the `apps` file, with either an
+absolute pathname or the name of an executable to be located in
+`PATH`). Here we use the latter form:
+
+-----
+$ cat apps
+raven simulate simulate.sh
+raven stats    stats.sh
+-----
+
+You can experiment, for example, with an alternate version of stats.sh by specfying that app's location explicitly:
+
+-----
+$ cat apps
+raven simulate simulate.sh
+raven stats    /home/users/p01532/bin/my-alt-stats.sh
+-----
+
+We can see that when we run many apps requesting a larger set of nodes (6), we are indeed running on the compute nodes:
+-----
+$ swift p4.swift -nsim=1000 -steps=1 
+Swift 0.94.1 RC2 swift-r6895 cog-r3765
+
+RunID: 20130827-1638-t23ax37a
+Progress:  time: Tue, 27 Aug 2013 16:38:11 -0500
+Progress:  time: Tue, 27 Aug 2013 16:38:12 -0500  Initializing:966
+Progress:  time: Tue, 27 Aug 2013 16:38:13 -0500  Selecting site:499  Submitting:500  Submitted:1
+Progress:  time: Tue, 27 Aug 2013 16:38:14 -0500  Selecting site:499  Stage in:1  Submitted:500
+Progress:  time: Tue, 27 Aug 2013 16:38:16 -0500  Selecting site:499  Submitted:405  Active:95  Stage out:1
+Progress:  time: Tue, 27 Aug 2013 16:38:17 -0500  Selecting site:430  Submitted:434  Active:66  Stage out:1  Finished successfully:69
+Progress:  time: Tue, 27 Aug 2013 16:38:18 -0500  Selecting site:388  Submitted:405  Active:95  Stage out:1  Finished successfully:111
+...
+Progress:  time: Tue, 27 Aug 2013 16:38:30 -0500  Stage in:1  Submitted:93  Active:94  Finished successfully:812
+Progress:  time: Tue, 27 Aug 2013 16:38:31 -0500  Submitted:55  Active:95  Stage out:1  Finished successfully:849
+Progress:  time: Tue, 27 Aug 2013 16:38:32 -0500  Active:78  Stage out:1  Finished successfully:921
+Progress:  time: Tue, 27 Aug 2013 16:38:34 -0500  Active:70  Stage out:1  Finished successfully:929
+Progress:  time: Tue, 27 Aug 2013 16:38:37 -0500  Stage in:1  Finished successfully:1000
+Progress:  time: Tue, 27 Aug 2013 16:38:38 -0500  Stage out:1  Finished successfully:1000
+Final status: Tue, 27 Aug 2013 16:38:38 -0500  Finished successfully:1001
+
+$ grep "on node:" output/*log | head
+output/sim_0.log:Running on node: nid00063
+output/sim_100.log:Running on node: nid00060
+output/sim_101.log:Running on node: nid00061
+output/sim_102.log:Running on node: nid00032
+output/sim_103.log:Running on node: nid00060
+output/sim_104.log:Running on node: nid00061
+output/sim_105.log:Running on node: nid00032
+output/sim_106.log:Running on node: nid00060
+output/sim_107.log:Running on node: nid00061
+output/sim_108.log:Running on node: nid00062
+
+$ grep "on node:" output/*log | awk '{print $4}' | sort | uniq -c
+    158 nid00032
+    156 nid00033
+    171 nid00060
+    178 nid00061
+    166 nid00062
+    171 nid00063
+$ hostname
+raven
+$ hostname -f
+nid00008
+-----
+
+Swift's `sites.xml` configuration file allows many parameters to
+specify how jobs should be run on a given cluster. Consider for
+example that Raven has several queues, each with limitiations on the
+size of jobs that can be run in them.  All Raven queues will only run
+2 jobs per user at one. The Raven queue "small" will only allow up to
+4 nodes per job and 1 hours of walltime per job.  The following
+site.xml parameters will allow us to match this:
+
+-----
+  <profile namespace="globus" key="queue">small</profile>
+  <profile namespace="globus" key="slots">2</profile>
+  <profile namespace="globus" key="maxNodes">4</profile>
+  <profile namespace="globus" key="nodeGranularity">4</profile>
+-----
+
+To run large jobs, we can specify:
+
+-----
+  <profile namespace="globus" key="slots">2</profile>
+  <profile namespace="globus" key="maxNodes">8</profile>
+  <profile namespace="globus" key="nodeGranularity">8</profile>
+  <profile namespace="karajan" key="jobThrottle">50.0</profile>
+  <profile namespace="globus" key="maxTime">21600</profile>
+  <profile namespace="globus" key="lowOverAllocation">10000</profile>
+  <profile namespace="globus" key="highOverAllocation">10000</profile>
+-----
+
+This will enable 512 Swift apps (2 x 8 x 32) to run concurrently
+within 2 8-node jobs on Raven's 32-core nodes.  It results in the
+following two PBS jobs submitted by Swift to "provision" compute nodes
+to run thousands of apps, 512 at a time:
+
+-----
+$ qstat -u $USER
+
+Job ID          Username Queue    Jobname    SessID NDS TSK Memory Time  S Time
+--------------- -------- -------- ---------- ------ --- --- ------ ----- - -----
+288637.sdb      p01532   medium   B0827-2703    --    8 256    --  05:59 Q   -- 
+288638.sdb      p01532   medium   B0827-2703    --    8 256    --  05:59 Q   -- 
+-----
+
+The following section is a summary of the important `sites.xml`
+attributes for running apps on Cray systems. Many of these attributes
+can be set the same for all Swift users of a given system; only a few
+of the attributes need be overridden by users. We explain these
+attributes in detail here to show the degree of control afforded by
+Swift over application execution.  Most users will use templates for a
+given Cray system, only changing a few parameters to meet any unique
+needs of their application workflows.
+
+////
+.sites.xml
+-----
+sys::[egrep -v '<.xml|<config|</config' ../part04/sites.xml | cat -n ]
+-----
+////
+
+The additional attributes in the `sites.xml` file (described here
+without their XML formatting) specify that Swift should run
+applications on Raven in the following manner:
+
+`execution provider coaster, jobmanager local:pbs` specifies that
+Swift should run apps using its "coaster" provider, which submits
+"pilot jobs" using qsub. These pilot jobs hold on to compute nodes and
+allow Swift to run many app invocations within a single job. This
+mechanism is described in
+http://www.swift-lang.org/papers/UCC-coasters.pdf[this paper from UCC-2011].
+
+`profile` tags specify additional attributes for the execution
+provider. (A "provider" is like a driver which knows how to handle
+site-specific aspects of app execution). The attributes are grouped
+into various "namespaces", but we can ignore this for now).
+
+The `env` key `PATHPREFIX` specifies that our tutorial `app` directory
+(`../app`) will be placed at the front of PATH to locate the app on
+the compute node.
+
+`queue small` specifies that pilot (coaster) jobs to run apps will be
+submitted to Raven's `small` queue.
+
+`providerAttributes pbs.aprun;pbs.mpp;depth=32` specifies some
+Cray-specific attributes: that jobs should use Cray-specific PBS "mpp"
+resource attributes (eg `mppwidth` and `mppnppn`) and an mppdepth of
+32 (because we will be running one coaster process per node, and
+Raven's XE6 dual IL-16 nodes have a depth of 32 processing elements
+(PEs).
+
+`jobsPerNode 32` tells Swift that each coaster should run up to 32
+concurrent apps. This can be reduced to place fewer apps per node, eg
+if each app needs more memory (or, rarely, greater than 32, e.g. if the apps are
+IO-bound or for benchmark experiments, etc).
+
+`slots 2` specifies that Swift will run up to 2 concurrent PBS jobs,
+and `maxNodes 1` specifies that each of these jobs will request only 1
+compute node.
+
+`maxWallTime 00:01:00` specifies that Swift should allow each app to
+run for up to one minute of walltime within the larger pilot job. In
+this example Swift will dynamically determine the total PBS walltime
+needed for the pilot job, but this can be specified manually using
+attributes `maxtime` along with `highOverAllocation` and
+`lowOverAllocation`.
+
+`jobThrottle 3.20` specifies that Swift should allow up to 320 apps to
+run on the `raven` site at once.  This is typically set to a number
+greater than or equal to the number of slots x compute nodes x apps
+per node (`jobsPerNode` attribute).
+
+`initialscore 10000` is specified to override Swift's automatic
+throttling, and forces an actual throttle value of approximately
+(specifically 1 over) `jobThrottle` * 100 to be used.
+
+The last two attributes specify where and how Swift should perform
+data management.  `workdirectory /lus/scratch/{env.USER}/swiftwork`
+specifies where the Swift "application execution sanbox directory"
+used for each app will be located. In some situations this can be a
+directory local to the compute node (eg, for Cray systems, `/dev/shm`
+or `/tmp`, if those are writable by user jobs and the nodes have
+sufficient space in these RAM-based filesystems).
+
+Finally, `stagingMethod sfs` specifies that Swift will copy data to
+and from the shared file system to the application sandbox
+directories.

Added: SwiftApps/tryswift/scripts/part5.txt
===================================================================
--- SwiftApps/tryswift/scripts/part5.txt	                        (rev 0)
+++ SwiftApps/tryswift/scripts/part5.txt	2013-09-11 18:25:03 UTC (rev 7055)
@@ -0,0 +1,112 @@
+Part 5: Controlling the compute-node pools where applications run
+=================================================================
+
+In this section we'll use the script `p5.swift`, very similar to
+`p4.swift` of the prior section, to show how we can route apps to
+specific sites, and also how we can make multiple pools of resources
+(on the same or on different computer systems) available to run a
+single Swift script.
+
+////
+image::part05.png[align="center"]
+
+.p5.swift
+----
+sys::[cat ../part05/p5.swift]
+----
+////
+
+First, lets specify that the analysis app `stats.sh` should be run on
+the local login node instead of on the cluster. This is done simply by
+change the site name field of the analyze app in the apps file:
+
+-----
+$ cat apps
+raven     simulate  simulate.sh
+localhost stats     stats.sh
+-----
+
+Running this with `swift p5.swift` we see:
+-----
+$ grep "on node:" output/*.log
+output/average.log:Running on node: raven
+output/sim_0.log:Running on node: nid00029
+output/sim_1.log:Running on node: nid00029
+output/sim_2.log:Running on node: nid00029
+output/sim_3.log:Running on node: nid00029
+output/sim_4.log:Running on node: nid00029
+output/sim_5.log:Running on node: nid00029
+output/sim_6.log:Running on node: nid00029
+output/sim_7.log:Running on node: nid00029
+output/sim_8.log:Running on node: nid00029
+output/sim_9.log:Running on node: nid00029
+-----
+
+
+Now lets make further use of Swift's ability to route specific apps to
+specific pools of resources. The Cray Raven system has two node types,
+XE6 32-core 2 x IL-16, and XK7 16-core 1 x IL-16 plus one GPU.  Each
+"pool" of nodes has different queue characteristics. We can define
+these differences to Swift as two separate pools, and then spread the
+load of executing a large ensemble of simulations across all the
+pools. (And we'll continue to run the analysis script on a third pool,
+comprising the single login host.)
+
+We use the following `apps` file:
+-----
+$ cat multipools
+raven     simulate simulate.sh
+ravenGPU  simulate simulate.sh
+localhost stats    stats.sh
+----
+and we adjust the sites file to specify 4-node jobs in the Raven pool:
+-----
+    <profile namespace="globus" key="maxNodes">4</profile>
+    <profile namespace="globus" key="nodeGranularity">4</profile>
+-----
+This results in these PBS jobs:
+-----
+p01532 at raven:~> qstat -u $USER
+
+Job ID          Username Queue    Jobname    SessID NDS TSK Memory Time  S Time
+--------------- -------- -------- ---------- ------ --- --- ------ ----- - -----
+288687.sdb      p01532   small    B0827-3406   9919   4 128    --  00:59 R 00:00
+288688.sdb      p01532   gpu_node B0827-3406   9931   6  96    --  00:59 R 00:00
+-----
+... and achieves the following parallelism (of about 224 concurrent app tasks):
+
+-----
+$ swift -tc.file multipools p5.swift -nsim=1000 -steps=3
+Swift 0.94.1 RC2 swift-r6895 cog-r3765
+
+RunID: 20130827-1829-o3h6mht5
+Progress:  time: Tue, 27 Aug 2013 18:29:31 -0500
+Progress:  time: Tue, 27 Aug 2013 18:29:32 -0500  Initializing:997
+Progress:  time: Tue, 27 Aug 2013 18:29:34 -0500  Selecting site:774  Submitting:225  Submitted:1
+Progress:  time: Tue, 27 Aug 2013 18:29:35 -0500  Selecting site:774  Stage in:1  Submitted:225
+Progress:  time: Tue, 27 Aug 2013 18:29:36 -0500  Selecting site:774  Stage in:1  Submitted:37  Active:188
+Progress:  time: Tue, 27 Aug 2013 18:29:39 -0500  Selecting site:774  Submitted:2  Active:223  Stage out:1
+Progress:  time: Tue, 27 Aug 2013 18:29:40 -0500  Selecting site:750  Submitted:17  Active:208  Stage out:1  Finished successfully:24
+Progress:  time: Tue, 27 Aug 2013 18:29:41 -0500  Selecting site:640  Stage in:1  Submitted:51  Active:174  Finished successfully:134
+Progress:  time: Tue, 27 Aug 2013 18:29:42 -0500  Selecting site:551  Submitted:11  Active:214  Stage out:1  Finished successfully:223
+Progress:  time: Tue, 27 Aug 2013 18:29:43 -0500  Selecting site:542  Submitted:2  Active:223  Stage out:1  Finished successfully:232
+Progress:  time: Tue, 27 Aug 2013 18:29:44 -0500  Selecting site:511  Submitting:1  Submitted:19  Active:206  Finished successfully:263
+Progress:  time: Tue, 27 Aug 2013 18:29:45 -0500  Selecting site:463  Stage in:1  Submitted:43  Active:182  Finished successfully:311
+Progress:  time: Tue, 27 Aug 2013 18:29:46 -0500  Selecting site:367  Submitting:1  Submitted:38  Active:186  Stage out:1  Finished successfully:407
+Progress:  time: Tue, 27 Aug 2013 18:29:47 -0500  Selecting site:309  Submitted:2  Active:223  Stage out:1  Finished successfully:465
+Progress:  time: Tue, 27 Aug 2013 18:29:48 -0500  Selecting site:300  Submitted:2  Active:223  Stage out:1  Finished successfully:474
+Progress:  time: Tue, 27 Aug 2013 18:29:50 -0500  Selecting site:259  Submitted:11  Active:214  Stage out:1  Finished successfully:515
+Progress:  time: Tue, 27 Aug 2013 18:29:51 -0500  Selecting site:201  Stage in:1  Submitted:39  Active:186  Finished successfully:573
+Progress:  time: Tue, 27 Aug 2013 18:29:52 -0500  Selecting site:80  Submitted:42  Active:184  Finished successfully:694
+Progress:  time: Tue, 27 Aug 2013 18:29:53 -0500  Selecting site:54  Submitted:2  Active:223  Stage out:1  Finished successfully:720
+Progress:  time: Tue, 27 Aug 2013 18:29:54 -0500  Selecting site:32  Submitted:4  Active:220  Stage out:1  Finished successfully:743
+Progress:  time: Tue, 27 Aug 2013 18:29:55 -0500  Submitted:3  Active:216  Stage out:1  Finished successfully:780
+Progress:  time: Tue, 27 Aug 2013 18:29:56 -0500  Stage in:1  Active:143  Finished successfully:856
+Progress:  time: Tue, 27 Aug 2013 18:29:57 -0500  Active:38  Stage out:1  Finished successfully:961
+Progress:  time: Tue, 27 Aug 2013 18:29:58 -0500  Active:8  Stage out:1  Finished successfully:991
+Progress:  time: Tue, 27 Aug 2013 18:29:59 -0500  Stage out:1  Finished successfully:999
+Progress:  time: Tue, 27 Aug 2013 18:30:01 -0500  Stage in:1  Finished successfully:1000
+Progress:  time: Tue, 27 Aug 2013 18:30:02 -0500  Active:1  Finished successfully:1000
+Progress:  time: Tue, 27 Aug 2013 18:30:06 -0500  Stage out:1  Finished successfully:1000
+Final status: Tue, 27 Aug 2013 18:30:07 -0500  Finished successfully:1001
+-----

Added: SwiftApps/tryswift/scripts/part6.txt
===================================================================
--- SwiftApps/tryswift/scripts/part6.txt	                        (rev 0)
+++ SwiftApps/tryswift/scripts/part6.txt	2013-09-11 18:25:03 UTC (rev 7055)
@@ -0,0 +1,134 @@
+Part 6: Specifying more complex workflow patterns
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+p6.swift expands the workflow pattern of p4.swift to add additional
+stages to the workflow. Here, we generate a dynamic seed value that
+will be used by all of the simulations, and for each simulation, we
+run an pre-processing application to generate a unique "bias
+file". This pattern is shown below, followed by the Swift script.
+
+image::part06.png[align="center"]
+
+.p6.swift
+----
+sys::[cat ../part06/p6.swift]
+----
+
+Note that the workflow is based on data flow dependencies: each simulation depends on the seed value, calculated in these two dependent statements:
+-----
+seedfile = genseed(1);
+int seedval = readData(seedfile);
+-----
+and on the bias file, computed and then consumed in these two dependent statements:
+-----
+  biasfile = genbias(1000, 20);
+  (simout,simlog) = simulation(steps, range, biasfile, 1000000, values);
+-----
+
+To run:
+----
+$ cd ../part06
+$ swift p6.swift
+----
+
+The default parameters result in the following execution log:
+
+-----
+$ swift p6.swift
+Swift 0.94.1 RC2 swift-r6895 cog-r3765
+
+RunID: 20130827-1917-jvs4gqm5
+Progress:  time: Tue, 27 Aug 2013 19:17:56 -0500
+
+*** Script parameters: nsim=10 range=100 num values=10
+
+Progress:  time: Tue, 27 Aug 2013 19:17:57 -0500  Stage in:1  Submitted:10
+Generated seed=382537
+Progress:  time: Tue, 27 Aug 2013 19:17:59 -0500  Active:9  Stage out:1  Finished successfully:11
+Final status: Tue, 27 Aug 2013 19:18:00 -0500  Finished successfully:22
+-----
+which produces the following output:
+-----
+$ ls -lrt output
+total 264
+-rw-r--r-- 1 p01532 61532     9 Aug 27 19:17 seed.dat
+-rw-r--r-- 1 p01532 61532   180 Aug 27 19:17 bias_9.dat
+-rw-r--r-- 1 p01532 61532   180 Aug 27 19:17 bias_8.dat
+-rw-r--r-- 1 p01532 61532   180 Aug 27 19:17 bias_7.dat
+-rw-r--r-- 1 p01532 61532   180 Aug 27 19:17 bias_6.dat
+-rw-r--r-- 1 p01532 61532   180 Aug 27 19:17 bias_5.dat
+-rw-r--r-- 1 p01532 61532   180 Aug 27 19:17 bias_4.dat
+-rw-r--r-- 1 p01532 61532   180 Aug 27 19:17 bias_3.dat
+-rw-r--r-- 1 p01532 61532   180 Aug 27 19:17 bias_2.dat
+-rw-r--r-- 1 p01532 61532   180 Aug 27 19:17 bias_1.dat
+-rw-r--r-- 1 p01532 61532   180 Aug 27 19:17 bias_0.dat
+-rw-r--r-- 1 p01532 61532    90 Aug 27 19:17 sim_9.out
+-rw-r--r-- 1 p01532 61532 14897 Aug 27 19:17 sim_9.log
+-rw-r--r-- 1 p01532 61532 14897 Aug 27 19:17 sim_8.log
+-rw-r--r-- 1 p01532 61532    90 Aug 27 19:17 sim_7.out
+-rw-r--r-- 1 p01532 61532    90 Aug 27 19:17 sim_6.out
+-rw-r--r-- 1 p01532 61532 14897 Aug 27 19:17 sim_6.log
+-rw-r--r-- 1 p01532 61532    90 Aug 27 19:17 sim_5.out
+-rw-r--r-- 1 p01532 61532 14897 Aug 27 19:17 sim_5.log
+-rw-r--r-- 1 p01532 61532    90 Aug 27 19:17 sim_4.out
+-rw-r--r-- 1 p01532 61532 14897 Aug 27 19:17 sim_4.log
+-rw-r--r-- 1 p01532 61532 14897 Aug 27 19:17 sim_1.log
+-rw-r--r-- 1 p01532 61532    90 Aug 27 19:18 sim_8.out
+-rw-r--r-- 1 p01532 61532 14897 Aug 27 19:18 sim_7.log
+-rw-r--r-- 1 p01532 61532    90 Aug 27 19:18 sim_3.out
+-rw-r--r-- 1 p01532 61532 14897 Aug 27 19:18 sim_3.log
+-rw-r--r-- 1 p01532 61532    90 Aug 27 19:18 sim_2.out
+-rw-r--r-- 1 p01532 61532 14898 Aug 27 19:18 sim_2.log
+-rw-r--r-- 1 p01532 61532    90 Aug 27 19:18 sim_1.out
+-rw-r--r-- 1 p01532 61532    90 Aug 27 19:18 sim_0.out
+-rw-r--r-- 1 p01532 61532 14897 Aug 27 19:18 sim_0.log
+-rw-r--r-- 1 p01532 61532     9 Aug 27 19:18 average.out
+-rw-r--r-- 1 p01532 61532 14675 Aug 27 19:18 average.log
+-----
+
+Each sim_N.out file is the sum of its bias file plus newly "simulated" random output scaled by 1,000,000:
+
+-----
+$ cat output/bias_0.dat
+     302
+     489
+      81
+     582
+     664
+     290
+     839
+     258
+     506
+     310
+     293
+     508
+      88
+     261
+     453
+     187
+      26
+     198
+     402
+     555
+
+$ cat output/sim_0.out
+64000302
+38000489
+32000081
+12000582
+46000664
+36000290
+35000839
+22000258
+49000506
+75000310
+-----
+
+We produce 20 values in each bias file. Simulations of less than that
+number of values ignore the unneeded number, while simualtions of more
+than 20 will use the last bias number for all remoaining values past
+20.  As an exercise, adjust the code to produce the same number of
+bias values as is needed for each simulation.  As a further exercise,
+modify the script to generate a unique seed value for each simulation,
+which is a common practice in ensemble computations.
+




More information about the Swift-commit mailing list