[Swift-commit] r8202 - www/ATPESC_2014/swift-k

wozniak at ci.uchicago.edu wozniak at ci.uchicago.edu
Thu Aug 14 12:43:36 CDT 2014


Author: wozniak
Date: 2014-08-14 12:43:36 -0500 (Thu, 14 Aug 2014)
New Revision: 8202

Added:
   www/ATPESC_2014/swift-k/README.html
Log:
Adding swift-k/README.html

Added: www/ATPESC_2014/swift-k/README.html
===================================================================
--- www/ATPESC_2014/swift-k/README.html	                        (rev 0)
+++ www/ATPESC_2014/swift-k/README.html	2014-08-14 17:43:36 UTC (rev 8202)
@@ -0,0 +1,1568 @@
+<!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.9" />
+<title>Swift Tutorial for RCC Midway Cluster</title>
+<style type="text/css">
+/* Shared CSS for AsciiDoc xhtml11 and html5 backends */
+
+/* Default font. */
+body {
+  font-family: Georgia,serif;
+}
+
+/* Title font. */
+h1, h2, h3, h4, h5, h6,
+div.title, caption.title,
+thead, p.table.header,
+#toctitle,
+#author, #revnumber, #revdate, #revremark,
+#footer {
+  font-family: Arial,Helvetica,sans-serif;
+}
+
+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;
+}
+
+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;
+}
+h5 {
+  font-size: 1.0em;
+}
+
+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; }
+
+.monospaced, code, pre {
+  font-family: "Courier New", Courier, monospace;
+  font-size: inherit;
+  color: navy;
+  padding: 0;
+  margin: 0;
+}
+pre {
+  white-space: pre-wrap;
+}
+
+#author {
+  color: #527bbd;
+  font-weight: bold;
+  font-size: 1.1em;
+}
+#email {
+}
+#revnumber, #revdate, #revremark {
+}
+
+#footer {
+  font-size: small;
+  border-top: 2px solid silver;
+  padding-top: 0.5em;
+  margin-top: 4.0em;
+}
+#footer-text {
+  float: left;
+  padding-bottom: 0.5em;
+}
+#footer-badges {
+  float: right;
+  padding-bottom: 0.5em;
+}
+
+#preamble {
+  margin-top: 1.5em;
+  margin-bottom: 1.5em;
+}
+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: #888;
+}
+
+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; vertical-align: text-bottom; }
+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;
+}
+
+tfoot {
+  font-weight: bold;
+}
+td > div.verse {
+  white-space: pre;
+}
+
+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 {
+  #footer-badges { display: none; }
+}
+
+#toc {
+  margin-bottom: 2.5em;
+}
+
+#toctitle {
+  color: #527bbd;
+  font-size: 1.1em;
+  font-weight: bold;
+  margin-top: 1.0em;
+  margin-bottom: 0.1em;
+}
+
+div.toclevel0, 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; }
+
+span.underline { text-decoration: underline; }
+span.overline { text-decoration: overline; }
+span.line-through { text-decoration: line-through; }
+
+div.unbreakable { page-break-inside: avoid; }
+
+
+/*
+ * xhtml11 specific
+ *
+ * */
+
+div.tableblock {
+  margin-top: 1.0em;
+  margin-bottom: 1.5em;
+}
+div.tableblock > table {
+  border: 3px solid #527bbd;
+}
+thead, p.table.header {
+  font-weight: bold;
+  color: #527bbd;
+}
+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;
+}
+
+
+/*
+ * html5 specific
+ *
+ * */
+
+table.tableblock {
+  margin-top: 1.0em;
+  margin-bottom: 1.5em;
+}
+thead, p.tableblock.header {
+  font-weight: bold;
+  color: #527bbd;
+}
+p.tableblock {
+  margin-top: 0;
+}
+table.tableblock {
+  border-width: 3px;
+  border-spacing: 0px;
+  border-style: solid;
+  border-color: #527bbd;
+  border-collapse: collapse;
+}
+th.tableblock, td.tableblock {
+  border-width: 1px;
+  padding: 4px;
+  border-style: solid;
+  border-color: #527bbd;
+}
+
+table.tableblock.frame-topbot {
+  border-left-style: hidden;
+  border-right-style: hidden;
+}
+table.tableblock.frame-sides {
+  border-top-style: hidden;
+  border-bottom-style: hidden;
+}
+table.tableblock.frame-none {
+  border-style: hidden;
+}
+
+th.tableblock.halign-left, td.tableblock.halign-left {
+  text-align: left;
+}
+th.tableblock.halign-center, td.tableblock.halign-center {
+  text-align: center;
+}
+th.tableblock.halign-right, td.tableblock.halign-right {
+  text-align: right;
+}
+
+th.tableblock.valign-top, td.tableblock.valign-top {
+  vertical-align: top;
+}
+th.tableblock.valign-middle, td.tableblock.valign-middle {
+  vertical-align: middle;
+}
+th.tableblock.valign-bottom, td.tableblock.valign-bottom {
+  vertical-align: bottom;
+}
+
+
+/*
+ * manpage specific
+ *
+ * */
+
+body.manpage h1 {
+  padding-top: 0.5em;
+  padding-bottom: 0.5em;
+  border-top: 2px solid silver;
+  border-bottom: 2px solid silver;
+}
+body.manpage h2 {
+  border-style: none;
+}
+body.manpage div.sectionbody {
+  margin-left: 3em;
+}
+
+ at media print {
+  body.manpage div#toc { display: none; }
+}
+
+
+
+/* SWIFT/T GUIDE CUSTOMIZATIONS */
+
+a:visited {
+  color: gray;
+}
+h5 {
+  font-size: 0.8em;
+}
+
+</style>
+<script type="text/javascript">
+/*<![CDATA[*/
+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]([1-'+(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");
+  if (!toc) {
+    return;
+  }
+
+  // Delete existing TOC entries in case we're reloading the TOC.
+  var tocEntriesToRemove = [];
+  var i;
+  for (i = 0; i < toc.childNodes.length; i++) {
+    var entry = toc.childNodes[i];
+    if (entry.nodeName.toLowerCase() == 'div'
+     && entry.getAttribute("class")
+     && entry.getAttribute("class").match(/^toclevel/))
+      tocEntriesToRemove.push(entry);
+  }
+  for (i = 0; i < tocEntriesToRemove.length; i++) {
+    toc.removeChild(tocEntriesToRemove[i]);
+  }
+
+  // Rebuild TOC entries.
+  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 () {
+  // Delete existing footnote entries in case we're reloading the footnodes.
+  var i;
+  var noteholder = document.getElementById("footnotes");
+  if (!noteholder) {
+    return;
+  }
+  var entriesToRemove = [];
+  for (i = 0; i < noteholder.childNodes.length; i++) {
+    var entry = noteholder.childNodes[i];
+    if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote")
+      entriesToRemove.push(entry);
+  }
+  for (i = 0; i < entriesToRemove.length; i++) {
+    noteholder.removeChild(entriesToRemove[i]);
+  }
+
+  // Rebuild footnote entries.
+  var cont = document.getElementById("content");
+  var spans = cont.getElementsByTagName("span");
+  var refs = {};
+  var n = 0;
+  for (i=0; i<spans.length; i++) {
+    if (spans[i].className == "footnote") {
+      n++;
+      var note = spans[i].getAttribute("data-note");
+      if (!note) {
+        // 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];
+        spans[i].innerHTML =
+          "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n +
+          "' title='View footnote' class='footnote'>" + n + "</a>]";
+        spans[i].setAttribute("data-note", note);
+      }
+      noteholder.innerHTML +=
+        "<div class='footnote' id='_footnote_" + n + "'>" +
+        "<a href='#_footnoteref_" + n + "' title='Return to text'>" +
+        n + "</a>. " + note + "</div>";
+      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>]";
+      }
+    }
+  }
+},
+
+install: function(toclevels) {
+  var timerId;
+
+  function reinstall() {
+    asciidoc.footnotes();
+    if (toclevels) {
+      asciidoc.toc(toclevels);
+    }
+  }
+
+  function reinstallAndRemoveTimer() {
+    clearInterval(timerId);
+    reinstall();
+  }
+
+  timerId = setInterval(reinstall, 500);
+  if (document.addEventListener)
+    document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false);
+  else
+    window.onload = reinstallAndRemoveTimer;
+}
+
+}
+asciidoc.install();
+/*]]>*/
+</script>
+</head>
+<body class="article" style="max-width:750px">
+<div id="header">
+<h1>Swift Tutorial for RCC Midway Cluster</h1>
+</div>
+<div id="content">
+<div id="preamble">
+<div class="sectionbody">
+<div class="paragraph"><p>This tutorial is viewable at:
+<a href="http://swiftlang.org/tutorials/midway/tutorial.html">http://swiftlang.org/tutorials/midway/tutorial.html</a></p></div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_introduction_why_parallel_scripting">Introduction: Why Parallel Scripting?</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>Swift is a simple scripting language for executing many instances of
+ordinary application programs on distributed parallel resources.
+Swift scripts run many copies of ordinary programs concurrently, using
+statements like this:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>foreach protein in proteinList {
+  runBLAST(protein);
+}</code></pre>
+</div></div>
+<div class="paragraph"><p>Swift acts like a structured "shell" language. It runs programs
+concurrently as soon as their inputs are available, reducing the need
+for complex parallel programming.  Swift expresses your workflow in a
+portable fashion: The same script runs on multicore computers,
+clusters, clouds, grids, and supercomputers.</p></div>
+<div class="paragraph"><p>In this tutorial, you’ll be able to first try a few Swift examples
+(parts 1-3) on a Midway login host, to get a sense of the
+language. Then in parts 4-6 you’ll run similar workflows on Midway
+compute nodes, and see how more complex workflows can be expressed
+with Swift scripts.</p></div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_swift_tutorial_setup">Swift tutorial setup</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>If you are using a temporary/guest account to access Midway, follow
+the instructions at <a href="http://docs.rcc.uchicago.edu/tutorials/intro-to-rcc-workshop.html">http://docs.rcc.uchicago.edu/tutorials/intro-to-rcc-workshop.html</a>
+for more information on using a yubikey to log in.</p></div>
+<div class="paragraph"><p>Once you are logged into the Midway login host, run the following commands
+to set up your environment.</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>$ cd $HOME
+$ wget http://swiftlang.org/tutorials/midway/swift-midway-tutorial.tar.gz
+$ tar xvfz swift-midway-tutorial.tar.gz
+$ cd swift-midway-tutorial
+$ source setup.sh</code></pre>
+</div></div>
+<div class="sect2">
+<h3 id="_verify_your_environment">Verify your environment</h3>
+<div class="paragraph"><p>To verify that Swift loaded, do:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>$ swift -version  # verify that you have Swift 0.95 RC1</code></pre>
+</div></div>
+<div class="admonitionblock">
+<table><tr>
+<td class="icon">
+<div class="title">Note</div>
+</td>
+<td class="content">If you re-login or open new ssh sessions, you must re-run <code>source setup.sh</code> in each ssh shell/window.</td>
+</tr></table>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_to_check_out_the_tutorial_scripts_from_svn">To check out the tutorial scripts from SVN</h3>
+<div class="paragraph"><p>If you later want to get the most recent version of this tutorial from
+the Swift Subversion repository, do:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>$ svn co https://svn.ci.uchicago.edu/svn/vdl2/SwiftTutorials/swift-midway-tutorial</code></pre>
+</div></div>
+<div class="paragraph"><p>This will create a directory called "swift-midway-tutorial" which contains all of the
+files used in this tutorial.</p></div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_simple_science_applications_for_the_workflow_tutorial">Simple "science applications" for the workflow tutorial</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>This tutorial is based on two intentionally trivial example programs,
+<code>simulation</code> and <code>stats</code>, (implemented as bash shell scripts)
+that serve as easy-to-understand proxies for real science
+applications. These "programs" behave as follows.</p></div>
+<div class="sect2">
+<h3 id="_simulate_sh">simulate.sh</h3>
+<div class="paragraph"><p>The simulation script serves as a trivial proxy for any more
+complex scientific simulation application. It generates and prints a
+set of one or more random integers in the range [0-2^62) as controlled
+by its command line arguments, which are:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>$ simulate -help
+simulate: usage:
+    -b|--bias       offset bias: add this integer to all results
+    -B|--biasfile   file of integer biases to add to results
+    -l|--log        generate a log in stderr if not null
+    -n|--nvalues    print this many values per simulation
+    -r|--range      range (limit) of generated results
+    -s|--seed       use this integer [0..32767] as a seed
+    -S|--seedfile   use this file (containing integer seeds [0..32767]) one per line
+    -t|--timesteps  number of simulated "timesteps" in seconds (determines runtime)
+    -x|--scale      scale the results by this integer
+    -h|-?|?|--help  print this help</code></pre>
+</div></div>
+<div class="paragraph"><p>All of these arguments are optional, with default values indicated above as <code>[n]</code>.</p></div>
+<div class="paragraph"><p>With no arguments, simulate prints 1 number in the range of
+1-100. Otherwise it generates n numbers of the form (R*scale)+bias
+where R is a random integer. By default it logs information about its
+execution environment to stderr.  Here’s some examples of its usage:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>$ simulate 2>log
+      51
+$ head -5 log
+
+Called as: /home/davidkelly999/swift-midway-tutorial/app/simulate:
+Start time: Mon Dec  2 13:47:41 CST 2013
+Running as user: uid=88848(davidkelly999) gid=88848(davidkelly999) groups=88848(davidkelly999),10008(rcc),10030(pi-gavoth),10031(sp-swift),10036(swift),10058(pi-joshuaelliott),10084(pi-wilde),10118(cron-account),10124(cmts),10138(cmtsworkshop)
+
+$ simulate -n 4 -r 1000000 2>log
+  239454
+  386702
+   13849
+  873526
+
+$ simulate -n 3 -r 1000000 -x 100 2>log
+ 6643700
+62182300
+ 5230600
+
+$ simulate -n 2 -r 1000 -x 1000 2>log
+  565000
+  636000
+
+$ time simulate -n 2 -r 1000 -x 1000 -t 3 2>log
+  336000
+  320000
+real    0m3.012s
+user    0m0.005s
+sys     0m0.006s</code></pre>
+</div></div>
+</div>
+<div class="sect2">
+<h3 id="_stats">stats</h3>
+<div class="paragraph"><p>The stats script serves as a trivial model of an "analysis"
+program. It reads N files each containing M integers and simply prints
+the average of all those numbers to stdout. Similarly to simulate
+it logs environmental information to the stderr.</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>$ ls f*
+f1  f2  f3  f4
+
+$ cat f*
+25
+60
+40
+75
+
+$ stats f* 2>log
+50</code></pre>
+</div></div>
+</div>
+</div>
+</div>
+<div class="sect1">
+<h2 id="_basic_of_the_swift_language_with_local_execution">Basic of the Swift language with local execution</h2>
+<div class="sectionbody">
+<div class="sect2">
+<h3 id="_a_summary_of_swift_in_a_nutshell">A Summary of Swift in a nutshell</h3>
+<div class="ulist"><ul>
+<li>
+<p>
+Swift scripts are text files ending in <code>.swift</code> The <code>swift</code> command
+runs on any host, and executes these scripts. <code>swift</code> is a Java
+application, which you can install almost anywhere.  On Linux, just
+unpack the distribution <code>tar</code> file and add its <code>bin/</code> directory to
+your <code>PATH</code>.
+</p>
+</li>
+<li>
+<p>
+Swift scripts run ordinary applications, just like shell scripts
+do. Swift makes it easy to run these applications on parallel and
+remote computers (from laptops to supercomputers). If you can <code>ssh</code> to
+the system, Swift can likely run applications there.
+</p>
+</li>
+<li>
+<p>
+The details of where to run applications and how to get files back
+and forth are described in configuration files separate from your
+program. Swift speaks ssh, PBS, Condor, SLURM, LSF, SGE, Cobalt, and
+Globus to run applications, and scp, http, ftp, and GridFTP to move
+data.
+</p>
+</li>
+<li>
+<p>
+The Swift language has 5 main data types: <code>boolean</code>, <code>int</code>,
+<code>string</code>, <code>float</code>, and <code>file</code>. Collections of these are dynamic,
+sparse arrays of arbitrary dimension and structures of scalars and/or
+arrays defined by the <code>type</code> declaration.
+</p>
+</li>
+<li>
+<p>
+Swift file variables are "mapped" to external files. Swift sends
+files to and from remote systems for you automatically.
+</p>
+</li>
+<li>
+<p>
+Swift variables are "single assignment": once you set them you can’t
+change them (in a given block of code).  This makes Swift a natural,
+"parallel data flow" language. This programming model keeps your
+workflow scripts simple and easy to write and understand.
+</p>
+</li>
+<li>
+<p>
+Swift lets you define functions to "wrap" application programs, and
+to cleanly structure more complex scripts. Swift <code>app</code> functions take
+files and parameters as inputs and return files as outputs.
+</p>
+</li>
+<li>
+<p>
+A compact set of built-in functions for string and file
+manipulation, type conversions, high level IO, etc. is provided.
+Swift’s equivalent of <code>printf()</code> is <code>tracef()</code>, with limited and
+slightly different format codes.
+</p>
+</li>
+<li>
+<p>
+Swift’s <code>foreach {}</code> statement is the main parallel workhorse of the
+language, and executes all iterations of the loop concurrently. The
+actual number of parallel tasks executed is based on available
+resources and settable "throttles".
+</p>
+</li>
+<li>
+<p>
+In fact, Swift conceptually executes <strong>all</strong> the statements,
+expressions and function calls in your program in parallel, based on
+data flow. These are similarly throttled based on available resources
+and settings.
+</p>
+</li>
+<li>
+<p>
+Swift also has <code>if</code> and <code>switch</code> statements for conditional
+execution. These are seldom needed in simple workflows but they enable
+very dynamic workflow patterns to be specified.
+</p>
+</li>
+</ul></div>
+<div class="paragraph"><p>We’ll see many of these points in action in the examples below. Lets
+get started!</p></div>
+</div>
+<div class="sect2">
+<h3 id="_part_1_run_a_single_application_under_swift">Part 1: Run a single application under Swift</h3>
+<div class="paragraph"><p>The first swift script, p1.swift, runs simulate 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><code>type file;
+
+app (file o) simulation ()
+{
+  simulate stdout=filename(o);
+}
+
+file f <"sim.out">;
+f = simulation();</code></pre>
+</div></div>
+<div class="paragraph"><p>To run this script, run the following command:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>$ cd part01
+$ swift p1.swift
+Swift 0.94.1 RC2 swift-r6895 cog-r3765
+
+RunID: 20130827-1413-oa6fdib2
+Progress:  time: Tue, 27 Aug 2013 14:13:33 -0500
+Final status: Tue, 27 Aug 2013 14:13:33 -0500  Finished successfully:1
+$ cat sim.out
+      84
+$ swift p1.swift
+$ cat sim.out
+      36</code></pre>
+</div></div>
+<div class="paragraph"><p>To cleanup the directory and remove all outputs (including the log
+files and directories that Swift generates), run the cleanup script
+which is located in the tutorial PATH:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>$ cleanup</code></pre>
+</div></div>
+<div class="admonitionblock">
+<table><tr>
+<td class="icon">
+<div class="title">Note</div>
+</td>
+<td class="content">You’ll also find a Swift configuration file in each <code>partNN</code>
+directory of this tutorial. This file specifies the environment-specific
+details of how to run. These files will be explained in more
+detail in parts 4-6, and can be ignored for now.</td>
+</tr></table>
+</div>
+</div>
+<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 <code>p2.swift</code> script introduces the <code>foreach</code> 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><code>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();
+}</code></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
+<code>output/sim_N.out</code>.</p></div>
+<div class="paragraph"><p>To run the script and view the output:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>$ 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</code></pre>
+</div></div>
+</div>
+<div class="sect2">
+<h3 id="_part_3_analyzing_results_of_a_parallel_ensemble">Part 3: Analyzing results of a parallel ensemble</h3>
+<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 <code>simulation</code> will be averaged by by
+the trivial "analysis application" <code>stats</code>:</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><code>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);</code></pre>
+</div></div>
+<div class="paragraph"><p>To run:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>$ cd part03
+$ swift p3.swift</code></pre>
+</div></div>
+<div class="paragraph"><p>Note that in <code>p3.swift</code> we expose more of the capabilities of the
+<code>simulate</code> application to the <code>simulation()</code> app function:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>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);
+}</code></pre>
+</div></div>
+<div class="paragraph"><p><code>p3.swift</code> also shows how to fetch application-specific values from
+the <code>swift</code> command line in a Swift script using <code>arg()</code> which
+accepts a keyword-style argument and its default value:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>int nsim   = toInt(arg("nsim","10"));
+int steps  = toInt(arg("steps","1"));
+int range  = toInt(arg("range","100"));
+int values = toInt(arg("values","5"));</code></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 <code>-parameterName=value</code>:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>$ 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</code></pre>
+</div></div>
+<div class="paragraph"><p>Now try running (<code>-nsim=</code>) 100 simulations of (<code>-steps=</code>) 1 second each:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>$ 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</code></pre>
+</div></div>
+<div class="paragraph"><p>We can see from Swift’s "progress" status that the tutorial’s default
+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 class="sect1">
+<h2 id="_running_applications_on_midway_compute_nodes_with_swift">Running applications on Midway compute nodes with Swift</h2>
+<div class="sectionbody">
+<div class="sect2">
+<h3 id="_part_4_running_a_parallel_ensemble_on_midway_compute_nodes">Part 4: Running a parallel ensemble on Midway compute nodes</h3>
+<div class="paragraph"><p><code>p4.swift</code> will run our mock "simulation" applications on Midway
+compute nodes. The script is similar to as <code>p3.swift</code>, but specifies
+that each simulation app invocation should additionally return the
+log file which the application writes to <code>stderr</code>.</p></div>
+<div class="paragraph"><p>Now when you run <code>swift p4.swift</code> you’ll see that two types output
+files will placed in the <code>output/</code> directory: <code>sim_N.out</code> and
+<code>sim_N.log</code>.  The log files provide data on the runtime environment of
+each app invocation. For example:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>$ cat output/sim_0.log
+Called as: /home/davidkelly999/swift-midway-tutorial/app/simulate: --timesteps 1 --range 100 --nvalues 5
+
+Start time: Mon Dec  2 12:17:06 CST 2013
+Running as user: uid=88848(davidkelly999) gid=88848(davidkelly999) groups=88848(davidkelly999),10008(rcc),10030(pi-gavoth),10031(sp-swift),10036(swift),10058(pi-joshuaelliott),10084(pi-wilde),10118(cron-account),10124(cmts),10138(cmtsworkshop)
+Running on node: midway002
+Node IP address: 10.50.181.2 172.25.181.2
+
+Simulation parameters:
+
+bias=0
+biasfile=none
+initseed=none
+log=yes
+paramfile=none
+range=100
+scale=1
+seedfile=none
+timesteps=1
+output width=8
+
+Environment:
+
+ANTLR_ROOT=/software/antlr-2.7-el6-x86_64
+ANT_HOME=/software/ant-1.8.4-all
+ANT_HOME_modshare=/software/ant-1.8.4-all:3
+...</code></pre>
+</div></div>
+<div class="paragraph"><p>Swift’s <code>swift.properties</code> configuration file allows many parameters to
+specify how jobs should be run on a given cluster.</p></div>
+<div class="paragraph"><p>Consider for example that Midway has several Slurm partitions. The sandyb
+partition has 16 cores, and the westmere partition has 12 cores. Depending
+on the application and which partitions are busy, you may want to modify
+where you run.</p></div>
+<div class="paragraph"><p>Here is an example of the swift.properties in the part04 directory:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>site=westmere
+site.westmere.slurm.reservation=workshop
+site.westmere.slurm.exclusive=false</code></pre>
+</div></div>
+<div class="paragraph"><p>The first line, site=westmere, allows you to define which partition to run on. Swift includes
+templates for each partition that provides some reasonable default values. Other valid partitions
+are amd, bigmem, gpu, local, and sandyb.</p></div>
+<div class="paragraph"><p>The second and third line override some of the default values, by specifying a reservation that will
+be used for this session, and enabling node sharing.</p></div>
+<div class="paragraph"><p>Try changing the queue to run on the sandyb queue. The new swift.properties should look like this:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>site=sandyb
+site.sandyb.slurm.reservation=workshop
+site.sandyb.slurm.exclusive=false</code></pre>
+</div></div>
+</div>
+<div class="sect2">
+<h3 id="_performing_larger_swift_runs">Performing larger Swift runs</h3>
+<div class="paragraph"><p>To test with larger runs, there are two changes that are required. The first is a
+change to the command line arguments. The example below will run 1000 simulations
+with each simulation taking 5 seconds.</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>$ swift p6.swift -steps=5 -nsim=1000</code></pre>
+</div></div>
+</div>
+<div class="sect2">
+<h3 id="_plotting_run_activity">Plotting run activity</h3>
+<div class="paragraph"><p>The tutorial <code>bin</code> directory in your <code>PATH</code> provides a script
+<code>plot.sh</code> to plot the progress of a Swift script.  It generates two
+image files: <code>activeplot.png</code>, which shows the number of active jobs
+over time, and <code>cumulativeplot.png</code>, which shows the total number of
+app calls completed as the Swift script progresses.</p></div>
+<div class="paragraph"><p>After each Swift run, a new run directory is created called runNNN.
+Each run directory will have a log file with a similar name called
+runNNN.log. Once you have identified the log file name, run the
+command <code>plot.sh</code> <logfile>` to generate the plots for that
+specific run. For example:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>$ ls
+output  p3.swift  run000  swift.properties
+
+$ cd run000/
+
+$ ls
+apps  cf  p3-20131202-2004-0kh4ha6e.d  run000.log  sites.xml
+
+$ plot.sh run000.log</code></pre>
+</div></div>
+<div class="paragraph"><p>This yields plots like:</p></div>
+<div class="imageblock">
+<div class="content">
+<img src="activeplot.png" alt="width=700" />
+</div>
+</div>
+<div class="imageblock">
+<div class="content">
+<img src="cumulativeplot.png" alt="width=700" />
+</div>
+</div>
+</div>
+<div class="sect2">
+<h3 id="_part_5_controlling_the_compute_node_pools_where_applications_run">Part 5: Controlling the compute-node pools where applications run</h3>
+<div class="paragraph"><p>This section is under development.</p></div>
+</div>
+<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><code>type file;
+
+# app() functions for application programs to be called:
+
+app (file out) genseed (int nseeds)
+{
+  simulate "-r" 2000000 "-n" nseeds stdout=@out;
+}
+
+app (file out) genbias (int bias_range, int nvalues)
+{
+  simulate "-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, file seed_file)
+{
+  simulate "-t" timesteps "-r" sim_range "-B" @bias_file "-x" scale
+           "-n" sim_count "-S" @seed_file 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
+file seedfile <"output/seed.dat">;        # Dynamically generated bias for simulation ensemble
+
+tracef("\n*** Script parameters: nsim=%i range=%i num values=%i\n\n", nsim, range, values);
+seedfile = genseed(1);
+
+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, seedfile);
+  sims[i] = simout;
+}
+
+file stats_out<"output/average.out">;
+file stats_log<"output/average.log">;
+(stats_out,stats_log) = analyze(sims);</code></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 this statement:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>seedfile = genseed(1);</code></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><code>  biasfile = genbias(1000, 20);
+  (simout,simlog) = simulation(steps, range, biasfile, 1000000, values, seedfile);</code></pre>
+</div></div>
+<div class="paragraph"><p>To run:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>$ cd ../part06
+$ swift p6.swift</code></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><code>$ 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</code></pre>
+</div></div>
+<div class="paragraph"><p>which produces the following output:</p></div>
+<div class="listingblock">
+<div class="content">
+<pre><code>$ 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</code></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><code>$ 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</code></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>
+</div>
+<div id="footnotes"><hr /></div>
+<div id="footer">
+<div id="footer-text">
+Last updated 2014-08-14 12:41:54 CDT
+</div>
+</div>
+</body>
+</html>




More information about the Swift-commit mailing list