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

wozniak at ci.uchicago.edu wozniak at ci.uchicago.edu
Thu Aug 14 10:39:45 CDT 2014


Author: wozniak
Date: 2014-08-14 10:39:45 -0500 (Thu, 14 Aug 2014)
New Revision: 8178

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


Modified: SwiftTutorials/ATPESC_2014-08-14/swift-t/tutorial.txt
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/swift-t/tutorial.txt	2014-08-14 15:39:38 UTC (rev 8177)
+++ SwiftTutorials/ATPESC_2014-08-14/swift-t/tutorial.txt	2014-08-14 15:39:45 UTC (rev 8178)
@@ -114,4 +114,42 @@
 process is dedicated for Swift logic, so choose +N>1+.
 
 Add more processes and see how that improves time to job
-completion.
+completion.  Check +output.txt+ for the +ADLB Total Elapsed Time:+,
+which is a good measure of total execution time (discounts queue and
+allocation startup/shutdown time).
+
+NOTE: Ease of calling to Tcl makes for ease of calling to native code,
+as shown in the next example.
+
+== 03 BLAS
+
+In this example, we use Swift to call a BLAS routine for dot product.
+
+----
+include::examples/03-blas/dot.swift[]
+----
+
+In this example, we created a stub of a Swift BLAS library in
++blas.swift+.  This calls the CBLAS +cblas_ddot()+ function through a
+Tcl interface.
+
+1. Run:
++
+----
+./build.sh
+----
++
+This creates a Tcl package for BLAS (using a hand-coded method- we
+also use SWIG to automate this).
+
+2. Run +./run-*.sh+.
+
+In +dot.swift+, the Swift statement +import blas;+ brings +blas.swift+
+into the program.  The Swift call to +blas_ddot()+ operates on the
+Swift arrays +A+ and +B+.  In +blas.swift+, the Swift arrays are
+converted to C-compatible arrays of +double+, which are represented in
+Swift/T with the +blob+ type.  These are passed to the BLAS package.
+
+Thus, calling native code from Swift/T is comparable in complexity to
+calling native code from other scripting languages such as Tcl or
+Python.




More information about the Swift-commit mailing list