[Swift-commit] r8176 - SwiftTutorials/ATPESC_2014-08-14/swift-t

wozniak at ci.uchicago.edu wozniak at ci.uchicago.edu
Thu Aug 14 10:25:44 CDT 2014


Author: wozniak
Date: 2014-08-14 10:25:44 -0500 (Thu, 14 Aug 2014)
New Revision: 8176

Modified:
   SwiftTutorials/ATPESC_2014-08-14/swift-t/tutorial.txt
Log:
Doc 02


Modified: SwiftTutorials/ATPESC_2014-08-14/swift-t/tutorial.txt
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/swift-t/tutorial.txt	2014-08-14 15:16:26 UTC (rev 8175)
+++ SwiftTutorials/ATPESC_2014-08-14/swift-t/tutorial.txt	2014-08-14 15:25:44 UTC (rev 8176)
@@ -44,6 +44,8 @@
 
 === 01 Hello world
 
+This is a very simple Swift/T program that illustrates Swift/T usage.
+
 1. +cd+ into the directory +01-hello+
 2. Run:
 +
@@ -82,3 +84,34 @@
 ----
 stdout[0]: Hello world!
 ----
+
+=== 02 Loop
+
+This example shows one way to obtain concurrency from Swift/T.
+
+----
+include::examples/02-loop/loop.swift[]
+----
+
+The program executes +compute()+ 10 times concurrently, because the
+Swift +foreach+ loop is concurrent.  The +compute()+ function is
+implemented as a Tcl fragment that does 3 things:
+
+1. Delay progress with +after+ (sleeps for +i*1000+ milliseconds)
+2. Print a timestamp for reference
+3. Set a result value
+
+The result value is printed by Swift's +printf()+.
+
+Note the use of the +<<++x++>>+ syntax, which maps Swift variable +x+ to a
+Tcl variable.
+
+This script may be run as the Hello World case, but the run scripts
+accept Turbine runtime arguments:
+
++-l+:: Prepend outputs with the MPI rank number (like +mpiexec -l+)
++-n N+:: Run +N+ MPI processes (like +mpiexec -n N+).  Note that one
+process is dedicated for Swift logic, so choose +N>1+.
+
+Add more processes and see how that improves time to job
+completion.




More information about the Swift-commit mailing list