[Swift-commit] r8101 - SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/03-blas

wozniak at ci.uchicago.edu wozniak at ci.uchicago.edu
Tue Aug 12 11:17:37 CDT 2014


Author: wozniak
Date: 2014-08-12 11:17:37 -0500 (Tue, 12 Aug 2014)
New Revision: 8101

Added:
   SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/03-blas/blas.tcl
Log:
Adding blas.tcl

Added: SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/03-blas/blas.tcl
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/03-blas/blas.tcl	                        (rev 0)
+++ SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/03-blas/blas.tcl	2014-08-12 16:17:37 UTC (rev 8101)
@@ -0,0 +1,35 @@
+
+# BLAS Turbine Tcl wrapper
+
+namespace eval blas {
+
+    proc ddot { stack outputs inputs } {
+
+        turbine::rule "ddot-$outputs" $inputs $turbine::LOCAL \
+            "blas::ddot_body $outputs $inputs"
+    }
+
+    proc ddot_body { z n x y } {
+
+        puts "$z,$n,$x,$y"
+
+        set N [ retrieve_integer $n ]
+        # Note: L = [ list pointer length ]
+        set LX [ adlb::blob_cache $x ]
+        set pointerX [ lindex $LX 0 ]
+        set lengthX  [ lindex $LX 1 ]
+        set LY [ adlb::blob_cache $y ]
+        set pointerY [ lindex $LY 0 ]
+        set lengthY  [ lindex $LY 1 ]
+
+        if { $lengthX != $lengthY } {
+            error "ddot: length(x) != length(y)"
+        }
+
+        set result [ blas::c::ddot $N $pointerX $pointerY ]
+        puts "result: $result"
+        turbine::store_float $z $result
+        adlb::blob_free $x
+        adlb::blob_free $y
+    }
+}




More information about the Swift-commit mailing list