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

wozniak at ci.uchicago.edu wozniak at ci.uchicago.edu
Tue Aug 12 12:40:46 CDT 2014


Author: wozniak
Date: 2014-08-12 12:40:46 -0500 (Tue, 12 Aug 2014)
New Revision: 8112

Modified:
   SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/03-blas/blas.swift
   SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/03-blas/blas.tcl
   SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/03-blas/blas_wrap.c
Log:
Clean up; add note


Modified: SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/03-blas/blas.swift
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/03-blas/blas.swift	2014-08-12 17:38:43 UTC (rev 8111)
+++ SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/03-blas/blas.swift	2014-08-12 17:40:46 UTC (rev 8112)
@@ -6,11 +6,12 @@
   z = blas_ddot_blobs(N, x, y);
 }
 
-// (float z) blas_ddot_blobs(int n, blob x, blob y) "blas" "0.0.1" "ddot";
-
 (float z) blas_ddot_blobs(int n, blob x, blob y)
 "blas" "0.0.1"
 [
+// Blobs are presented to Tcl as a [ list pointer length handle ]
+// The pointer is an integer: you can cast it to a pointer at the C level
+// The length is in bytes - ignore the handle  
 ----
   set <<z>> [ blas::ddot_impl <<n>> <<x>> <<y>> ]
 ----

Modified: SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/03-blas/blas.tcl
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/03-blas/blas.tcl	2014-08-12 17:38:43 UTC (rev 8111)
+++ SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/03-blas/blas.tcl	2014-08-12 17:40:46 UTC (rev 8112)
@@ -3,36 +3,6 @@
 
 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
-    # }
-
     proc ddot_impl { n x y } { 
         set x_ptr [ lindex $x 0 ] 
         set y_ptr [ lindex $y 0 ] 

Modified: SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/03-blas/blas_wrap.c
===================================================================
--- SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/03-blas/blas_wrap.c	2014-08-12 17:38:43 UTC (rev 8111)
+++ SwiftTutorials/ATPESC_2014-08-14/swift-t/examples/03-blas/blas_wrap.c	2014-08-12 17:40:46 UTC (rev 8112)
@@ -1,4 +1,10 @@
 
+/**
+   BLAS_WRAP.C
+   Tcl/C interface for BLAS functions
+   (You can auto-generate this with SWIG)
+*/
+ 
 #include <assert.h>
 
 #include <tcl.h>
@@ -46,13 +52,6 @@
   assert(rc == TCL_OK);
   Y = (double*) pointer;
 
-  /* printf("N: %i\n", N); */
-  /* for (int i = 0; i < N; i++) */
-  /* { */
-  /*   printf("X[%i]=%f\n", i, X[i]); */
-  /*   printf("Y[%i]=%f\n", i, Y[i]); */
-  /* } */
-
   // Call BLAS
   double Z = cblas_ddot(N, X, 1, Y, 1);
 




More information about the Swift-commit mailing list