public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/auto-numerical-bench:newinterfaces commit in: btl/actions/, btl/libs/BLAS/
@ 2012-09-30 20:32 Andrea Arteaga
  0 siblings, 0 replies; only message in thread
From: Andrea Arteaga @ 2012-09-30 20:32 UTC (permalink / raw
  To: gentoo-commits

commit:     c70b1444190f2f57d24c88b2f9f189c3d4be316a
Author:     Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
AuthorDate: Sun Sep 30 20:31:48 2012 +0000
Commit:     Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
CommitDate: Sun Sep 30 20:31:48 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/auto-numerical-bench.git;a=commit;h=c70b1444

Added and tested actions for BLAS level 3.

---
 ...on_MatrixVector.hpp => action_MatrixMatrix.hpp} |   33 ++++++++--------
 ...n_MatrixVector.hpp => action_MatrixTMatrix.hpp} |   33 ++++++++--------
 btl/actions/action_MatrixVector.hpp                |   11 ++---
 ...MatrixVector.hpp => action_TriMatrixMatrix.hpp} |   32 +++++++--------
 ...riSolveVector.hpp => action_TriSolveMatrix.hpp} |   41 ++++++++++----------
 btl/actions/action_TriSolveVector.hpp              |    2 +-
 btl/actions/actionsBLAS.hpp                        |    2 -
 btl/libs/BLAS/main.cpp                             |   22 +++++------
 8 files changed, 84 insertions(+), 92 deletions(-)

diff --git a/btl/actions/action_MatrixVector.hpp b/btl/actions/action_MatrixMatrix.hpp
similarity index 64%
copy from btl/actions/action_MatrixVector.hpp
copy to btl/actions/action_MatrixMatrix.hpp
index 923dc7b..a69a7f0 100644
--- a/btl/actions/action_MatrixVector.hpp
+++ b/btl/actions/action_MatrixMatrix.hpp
@@ -15,52 +15,51 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 //
-#ifndef ACTION_MATRIXVECTOR
-#define ACTION_MATRIXVECTOR
+#ifndef ACTION_MATRIXMATRIX
+#define ACTION_MATRIXMATRIX
 
 #include "LinearCongruential.hpp"
 #include <vector>
 #include <algorithm>
 
 template<class Interface>
-class Action_MatrixVector {
+class Action_MatrixMatrix {
 
     typedef typename Interface::Scalar Scalar;
     typedef std::vector<Scalar> vector_t;
 
 private:
     // Invalidate copy constructor
-    Action_MatrixVector(const Action_MatrixVector&);
+    Action_MatrixMatrix(const Action_MatrixMatrix&);
 
 public:
 
     // Constructor
-    Action_MatrixVector(int size)
+    Action_MatrixMatrix(int size)
     : _size(size), lc(10),
-      A(lc.fillVector<Scalar>(size*size)), x(lc.fillVector<Scalar>(size)),
-      A_work(size*size), x_work(size), y_work(size)
+      A(lc.fillVector<Scalar>(size*size)), B(lc.fillVector<Scalar>(size*size)),
+      C(size*size), C_work(size*size)
     {
-        MESSAGE("Action_MatrixVector Constructor");
+        MESSAGE("Action_MatrixMatrix Constructor");
     }
 
     // Action name
     static std::string name()
     {
-        return "MatrixVector_" + Interface::name();
+        return "MatrixMatrix_" + Interface::name();
     }
 
     double fpo() {
-        return 2*double(_size)*double(_size) - double(_size);
+        return double(_size)*double(_size)*(2*double(_size) - 1);
     }
 
     inline void initialize(){
-          std::copy(A.begin(), A.end(), A_work.begin());
-          std::copy(x.begin(), x.end(), x_work.begin());
+          std::copy(C.begin(), C.end(), C_work.begin());
     }
 
     inline void calculate() {
-        Interface::MatrixVector(false, _size, _size, 1., &A_work[0], &x_work[0],
-                                0., &y_work[0]);
+        Interface::MatrixMatrix(false, false, _size, _size, _size,
+                                1., &A[0], &B[0], 0., &C_work[0]);
     }
 
     Scalar getResidual() {
@@ -71,9 +70,9 @@ private:
     const int _size;
     LinearCongruential<> lc;
 
-    const vector_t A, x;
-    vector_t A_work, x_work, y_work;
+    const vector_t A, B, C;
+    vector_t C_work;
 
 };
 
-#endif // ACTION_MATRIXVECTOR
+#endif // ACTION_MATRIXMATRIX

diff --git a/btl/actions/action_MatrixVector.hpp b/btl/actions/action_MatrixTMatrix.hpp
similarity index 64%
copy from btl/actions/action_MatrixVector.hpp
copy to btl/actions/action_MatrixTMatrix.hpp
index 923dc7b..43aaf74 100644
--- a/btl/actions/action_MatrixVector.hpp
+++ b/btl/actions/action_MatrixTMatrix.hpp
@@ -15,52 +15,51 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 //
-#ifndef ACTION_MATRIXVECTOR
-#define ACTION_MATRIXVECTOR
+#ifndef ACTION_MATRIXTMATRIX
+#define ACTION_MATRIXTMATRIX
 
 #include "LinearCongruential.hpp"
 #include <vector>
 #include <algorithm>
 
 template<class Interface>
-class Action_MatrixVector {
+class Action_MatrixTMatrix {
 
     typedef typename Interface::Scalar Scalar;
     typedef std::vector<Scalar> vector_t;
 
 private:
     // Invalidate copy constructor
-    Action_MatrixVector(const Action_MatrixVector&);
+    Action_MatrixTMatrix(const Action_MatrixTMatrix&);
 
 public:
 
     // Constructor
-    Action_MatrixVector(int size)
+    Action_MatrixTMatrix(int size)
     : _size(size), lc(10),
-      A(lc.fillVector<Scalar>(size*size)), x(lc.fillVector<Scalar>(size)),
-      A_work(size*size), x_work(size), y_work(size)
+      A(lc.fillVector<Scalar>(size*size)), B(lc.fillVector<Scalar>(size*size)),
+      C(size*size), C_work(size*size)
     {
-        MESSAGE("Action_MatrixVector Constructor");
+        MESSAGE("Action_MatrixTMatrix Constructor");
     }
 
     // Action name
     static std::string name()
     {
-        return "MatrixVector_" + Interface::name();
+        return "MatrixTMatrix_" + Interface::name();
     }
 
     double fpo() {
-        return 2*double(_size)*double(_size) - double(_size);
+        return double(_size)*double(_size)*(2*double(_size) - 1);
     }
 
     inline void initialize(){
-          std::copy(A.begin(), A.end(), A_work.begin());
-          std::copy(x.begin(), x.end(), x_work.begin());
+          std::copy(C.begin(), C.end(), C_work.begin());
     }
 
     inline void calculate() {
-        Interface::MatrixVector(false, _size, _size, 1., &A_work[0], &x_work[0],
-                                0., &y_work[0]);
+        Interface::MatrixMatrix(true, false, _size, _size, _size,
+                                1., &A[0], &B[0], 0., &C_work[0]);
     }
 
     Scalar getResidual() {
@@ -71,9 +70,9 @@ private:
     const int _size;
     LinearCongruential<> lc;
 
-    const vector_t A, x;
-    vector_t A_work, x_work, y_work;
+    const vector_t A, B, C;
+    vector_t C_work;
 
 };
 
-#endif // ACTION_MATRIXVECTOR
+#endif // ACTION_MATRIXTMATRIX

diff --git a/btl/actions/action_MatrixVector.hpp b/btl/actions/action_MatrixVector.hpp
index 923dc7b..b1a37d0 100644
--- a/btl/actions/action_MatrixVector.hpp
+++ b/btl/actions/action_MatrixVector.hpp
@@ -38,7 +38,7 @@ public:
     Action_MatrixVector(int size)
     : _size(size), lc(10),
       A(lc.fillVector<Scalar>(size*size)), x(lc.fillVector<Scalar>(size)),
-      A_work(size*size), x_work(size), y_work(size)
+      y(size), y_work(size)
     {
         MESSAGE("Action_MatrixVector Constructor");
     }
@@ -54,12 +54,11 @@ public:
     }
 
     inline void initialize(){
-          std::copy(A.begin(), A.end(), A_work.begin());
-          std::copy(x.begin(), x.end(), x_work.begin());
+          std::copy(y.begin(), y.end(), y_work.begin());
     }
 
     inline void calculate() {
-        Interface::MatrixVector(false, _size, _size, 1., &A_work[0], &x_work[0],
+        Interface::MatrixVector(false, _size, _size, 1., &A[0], &x[0],
                                 0., &y_work[0]);
     }
 
@@ -71,8 +70,8 @@ private:
     const int _size;
     LinearCongruential<> lc;
 
-    const vector_t A, x;
-    vector_t A_work, x_work, y_work;
+    const vector_t A, x, y;
+    vector_t y_work;
 
 };
 

diff --git a/btl/actions/action_MatrixVector.hpp b/btl/actions/action_TriMatrixMatrix.hpp
similarity index 64%
copy from btl/actions/action_MatrixVector.hpp
copy to btl/actions/action_TriMatrixMatrix.hpp
index 923dc7b..2b8a7c1 100644
--- a/btl/actions/action_MatrixVector.hpp
+++ b/btl/actions/action_TriMatrixMatrix.hpp
@@ -15,52 +15,50 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 //
-#ifndef ACTION_MATRIXVECTOR
-#define ACTION_MATRIXVECTOR
+#ifndef ACTION_TRIMATRIXMATRIX
+#define ACTION_TRIMATRIXMATRIX
 
 #include "LinearCongruential.hpp"
 #include <vector>
 #include <algorithm>
 
 template<class Interface>
-class Action_MatrixVector {
+class Action_TriMatrixMatrix {
 
     typedef typename Interface::Scalar Scalar;
     typedef std::vector<Scalar> vector_t;
 
 private:
     // Invalidate copy constructor
-    Action_MatrixVector(const Action_MatrixVector&);
+    Action_TriMatrixMatrix(const Action_TriMatrixMatrix&);
 
 public:
 
     // Constructor
-    Action_MatrixVector(int size)
+    Action_TriMatrixMatrix(int size)
     : _size(size), lc(10),
-      A(lc.fillVector<Scalar>(size*size)), x(lc.fillVector<Scalar>(size)),
-      A_work(size*size), x_work(size), y_work(size)
+      A(lc.fillVector<Scalar>(size*size)), B(lc.fillVector<Scalar>(size*size)),
+      B_work(size*size)
     {
-        MESSAGE("Action_MatrixVector Constructor");
+        MESSAGE("Action_TriMatrixMatrix Constructor");
     }
 
     // Action name
     static std::string name()
     {
-        return "MatrixVector_" + Interface::name();
+        return "TriMatrixMatrix_" + Interface::name();
     }
 
     double fpo() {
-        return 2*double(_size)*double(_size) - double(_size);
+        return double(_size)*double(_size)*(double(_size) - 1);
     }
 
     inline void initialize(){
-          std::copy(A.begin(), A.end(), A_work.begin());
-          std::copy(x.begin(), x.end(), x_work.begin());
+          std::copy(B.begin(), B.end(), B_work.begin());
     }
 
     inline void calculate() {
-        Interface::MatrixVector(false, _size, _size, 1., &A_work[0], &x_work[0],
-                                0., &y_work[0]);
+        Interface::TriMatrixMatrix('U', _size, _size, &A[0], &B_work[0]);
     }
 
     Scalar getResidual() {
@@ -71,9 +69,9 @@ private:
     const int _size;
     LinearCongruential<> lc;
 
-    const vector_t A, x;
-    vector_t A_work, x_work, y_work;
+    const vector_t A, B;
+    vector_t B_work;
 
 };
 
-#endif // ACTION_MATRIXVECTOR
+#endif // ACTION_TRIMATRIXMATRIX

diff --git a/btl/actions/action_TriSolveVector.hpp b/btl/actions/action_TriSolveMatrix.hpp
similarity index 62%
copy from btl/actions/action_TriSolveVector.hpp
copy to btl/actions/action_TriSolveMatrix.hpp
index 6be18b0..f2f8879 100644
--- a/btl/actions/action_TriSolveVector.hpp
+++ b/btl/actions/action_TriSolveMatrix.hpp
@@ -15,34 +15,34 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 //
-#ifndef ACTION_TRISOLVEVECTOR
-#define ACTION_TRISOLVEVECTOR
+#ifndef ACTION_TRISOLVEMATRIX
+#define ACTION_TRISOLVEMATRIX
 
 #include "LinearCongruential.hpp"
 #include <vector>
 #include <algorithm>
 
 template<class Interface>
-class Action_TriSolveVector {
+class Action_TriSolveMatrix {
 
     typedef typename Interface::Scalar Scalar;
     typedef std::vector<Scalar> vector_t;
 
 private:
     // Invalidate copy constructor
-    Action_TriSolveVector(const Action_TriSolveVector&);
+    Action_TriSolveMatrix(const Action_TriSolveMatrix&);
 
 public:
 
     // Constructor
-    Action_TriSolveVector(int size)
+    Action_TriSolveMatrix(int size)
     : _size(size), lc(10),
-      A(lc.fillVector<Scalar>(size*size)), b(lc.fillVector<Scalar>(size)),
-      x_work(size)
+      A(lc.fillVector<Scalar>(size*size)), B(lc.fillVector<Scalar>(size*size)),
+      X_work(size*size)
     {
-        MESSAGE("Action_TriSolveVector Constructor");
+        MESSAGE("Action_TriSolveMatrix Constructor");
 
-        // Adding size to the diagonal of A to make it invertible
+        // Adding size to the diagonal of A to ensure it is invertible
         for (int i = 0; i < size; ++i)
             A[i+size*i] += size;
     }
@@ -50,36 +50,37 @@ public:
     // Action name
     static std::string name()
     {
-        return "TriSolveVector_" + Interface::name();
+        return "TriSolveMatrix_" + Interface::name();
     }
 
     double fpo() {
-        return double(_size)*double(_size) - 2*double(_size);
+        return double(_size)*double(_size)*(double(_size) - 2);
     }
 
     inline void initialize(){
-          std::copy(b.begin(), b.end(), x_work.begin());
+          std::copy(B.begin(), B.end(), X_work.begin());
     }
 
     inline void calculate() {
-        Interface::TriSolveVector('U', _size, &A[0], &x_work[0]);
+        Interface::TriSolveMatrix('U', _size, _size, &A[0], &X_work[0]);
     }
 
     Scalar getResidual() {
         initialize();
         calculate();
-        Interface::TriMatrixVector('U', _size, &A[0], &x_work[0]);
-        Interface::axpy(_size, -1., &b[0], &x_work[0]);
-        return Interface::norm(_size, &x_work[0]);
+        Interface::TriMatrixMatrix('U', _size, &A[0], &X_work[0]);
+        Interface::axpy(_size*_size, -1., &B[0], &X_work[0]);
+        return Interface::norm(_size*_size, &X_work[0]);
     }
 
-//private:
+private:
     const int _size;
     LinearCongruential<> lc;
 
-    vector_t A, b;
-    vector_t x_work;
+    vector_t A;
+    const vector_t B;
+    vector_t X_work;
 
 };
 
-#endif // ACTION_TRISOLVEVECTOR
+#endif // ACTION_TRISOLVEMATRIX

diff --git a/btl/actions/action_TriSolveVector.hpp b/btl/actions/action_TriSolveVector.hpp
index 6be18b0..6cac6f1 100644
--- a/btl/actions/action_TriSolveVector.hpp
+++ b/btl/actions/action_TriSolveVector.hpp
@@ -42,7 +42,7 @@ public:
     {
         MESSAGE("Action_TriSolveVector Constructor");
 
-        // Adding size to the diagonal of A to make it invertible
+        // Adding size to the diagonal of A to ensure it is invertible
         for (int i = 0; i < size; ++i)
             A[i+size*i] += size;
     }

diff --git a/btl/actions/actionsBLAS.hpp b/btl/actions/actionsBLAS.hpp
index 0a63675..1ac4b12 100644
--- a/btl/actions/actionsBLAS.hpp
+++ b/btl/actions/actionsBLAS.hpp
@@ -8,9 +8,7 @@
 #include "action_Rank1Update.hpp"
 #include "action_Rank2Update.hpp"
 
-/*
 #include "action_MatrixMatrix.hpp"
 #include "action_MatrixTMatrix.hpp"
 #include "action_TriMatrixMatrix.hpp"
 #include "action_TriSolveMatrix.hpp"
-*/

diff --git a/btl/libs/BLAS/main.cpp b/btl/libs/BLAS/main.cpp
index 9f43464..f4dc8fa 100644
--- a/btl/libs/BLAS/main.cpp
+++ b/btl/libs/BLAS/main.cpp
@@ -57,7 +57,7 @@ int main(int argv, char **argc)
     for (int i = 1; i < argv; ++i) {
       std::string arg = argc[i];
 
-      if (arg == "axpy") do_axpy = true;
+           if (arg == "axpy") do_axpy = true;
       else if (arg == "rot") do_rot = true;
 
       else if (arg == "MatrixVector") do_MatrixVector = true;
@@ -70,7 +70,7 @@ int main(int argv, char **argc)
       else if (arg == "MatrixMatrix") do_MatrixMatrix = true;
       else if (arg == "MatrixTMatrix") do_MatrixTMatrix = true;
       else if (arg == "TriMatrixMatrix") do_TriMatrixMatrix = true;
-      else if (arg == "TrisolveMatrix") do_TriSolveMatrix = true;
+      else if (arg == "TriSolveMatrix") do_TriSolveMatrix = true;
 
       // Check switch -N
       else if (arg[0] == '-' && arg[1] == 'N') {
@@ -99,16 +99,14 @@ int main(int argv, char **argc)
     if (do_TriSolveVector)
     bench<Action_TriSolveVector<Interface> >(MIN_MM,MAX_MM, N);
 
-    /*
-    if (matrix_matrix)
-    bench<Action_matrix_matrix_product<Interface> >(MIN_MM,MAX_MM, N);
-    if (aat)
-    bench<Action_aat_product<Interface> >(MIN_MM,MAX_MM, N);
-    if (trisolve_matrix)
-    bench<Action_trisolve_matrix<Interface> >(MIN_MM,MAX_MM, N);
-    if (trmm)
-    bench<Action_trmm<Interface> >(MIN_MM,MAX_MM, N);
-    */
+    if (do_MatrixMatrix)
+    bench<Action_MatrixMatrix<Interface> >(MIN_MM,MAX_MM, N);
+    if (do_MatrixTMatrix)
+    bench<Action_MatrixTMatrix<Interface> >(MIN_MM,MAX_MM, N);
+    if (do_TriMatrixMatrix)
+    bench<Action_TriMatrixMatrix<Interface> >(MIN_MM,MAX_MM, N);
+    if (do_TriSolveMatrix)
+    bench<Action_TriSolveMatrix<Interface> >(MIN_MM,MAX_MM, N);
 
 
   return 0;


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-09-30 20:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-30 20:32 [gentoo-commits] proj/auto-numerical-bench:newinterfaces commit in: btl/actions/, btl/libs/BLAS/ Andrea Arteaga

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox