public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/auto-numerical-bench:unstable commit in: /, accuracy/lapack/
@ 2011-08-05  1:42 Andrea Arteaga
  0 siblings, 0 replies; 3+ messages in thread
From: Andrea Arteaga @ 2011-08-05  1:42 UTC (permalink / raw
  To: gentoo-commits

commit:     7c9c82b70ca555ad7549150e6fe517d9623c6187
Author:     Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
AuthorDate: Fri Aug  5 01:42:29 2011 +0000
Commit:     Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
CommitDate: Fri Aug  5 01:42:29 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/auto-numerical-bench.git;a=commit;h=7c9c82b7

Solved problem with sizes.

---
 accuracy/lapack/main_lapack.cpp |    2 +-
 main.py                         |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/accuracy/lapack/main_lapack.cpp b/accuracy/lapack/main_lapack.cpp
index ca4fa67..896e190 100644
--- a/accuracy/lapack/main_lapack.cpp
+++ b/accuracy/lapack/main_lapack.cpp
@@ -29,7 +29,7 @@ extern "C" {
 template<typename exec_t>
 void test(exec_t exec, const std::string& testname, const int& max = 3000, const int& N = 100)
 {
-  static vector<int> sizes = logsizes(1, max, N);
+  vector<int> sizes = logsizes(1, max, N);
   Timer timer;
 
   ostringstream fname;

diff --git a/main.py b/main.py
index 360d055..0bd842f 100755
--- a/main.py
+++ b/main.py
@@ -108,6 +108,8 @@ cfg.tests = tests_from_input(input)
 # Write summary
 print 80*'='
 print "The following tests will be run:"
+print "-------------------------------"
+print
 for tname, ttest in cfg.tests.items():
     print "Test: " + tname
     if ttest['descr'] is not None:



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/auto-numerical-bench:unstable commit in: /, accuracy/lapack/
@ 2011-08-06 11:44 Andrea Arteaga
  0 siblings, 0 replies; 3+ messages in thread
From: Andrea Arteaga @ 2011-08-06 11:44 UTC (permalink / raw
  To: gentoo-commits

commit:     3b5ebb35257744ce830b1640259d9e08cde2e70d
Author:     Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
AuthorDate: Sat Aug  6 11:44:05 2011 +0000
Commit:     Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
CommitDate: Sat Aug  6 11:44:05 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/auto-numerical-bench.git;a=commit;h=3b5ebb35

Added eigensolver tests (syev, stev) to lapack_accuracy

---
 accuracy/lapack/lapack_STEV.hh  |   35 +++++++++++++++++++++++++++++++
 accuracy/lapack/lapack_SYEV.hh  |   43 +++++++++++++++++++++++++++++++++++++++
 accuracy/lapack/main_lapack.cpp |   19 ++++++++++++++--
 benchconfig.py                  |    5 +++-
 lapack_accuracy.py              |    9 ++++---
 5 files changed, 103 insertions(+), 8 deletions(-)

diff --git a/accuracy/lapack/lapack_STEV.hh b/accuracy/lapack/lapack_STEV.hh
new file mode 100644
index 0000000..0c9dea3
--- /dev/null
+++ b/accuracy/lapack/lapack_STEV.hh
@@ -0,0 +1,35 @@
+#ifndef LAPACK_STEV_HH
+#define LAPACK_STEV_HH
+
+#include "LinearCongruential.hh"
+#include "diff.hh"
+
+double test_STEV(const int& N, const unsigned& seed = 0)
+{
+  LinearCongruential lc(seed);
+  vector<double> A(N*N), D(N), E(N-1), Z(N*N), DD(N*N), work(2*N-2), tmp(N*N);
+
+  /* Fill D, E and A */
+  for (int i = 0; i < N-1; ++i) {
+      D[i] = lc.get_01(); A[i+i*N] = D[i];
+      E[i] = lc.get_01(); A[(i+1)+i*N] = E[i]; A[i+(i+1)*N] = E[i];
+  }
+  D[N-1] = lc.get_01(); A[N*N-1] = D[N-1];
+
+  /* Perform computation */
+  int info;
+  dstev_("V", &N, &D[0], &E[0], &Z[0], &N, &work[0], &info);
+
+  /* Construct DD */
+  for (int i = 0; i < N; ++i)
+    DD[i+i*N] = D[i];
+
+  /* A = V*D*V' */
+  const double dONE = 1., dZERO = 0.;
+  dgemm_("N", "N", &N, &N, &N, &dONE,   &Z[0], &N, &DD[0], &N, &dZERO, &tmp[0], &N);
+  dgemm_("N", "T", &N, &N, &N, &dONE, &tmp[0], &N,  &Z[0], &N, &dZERO,  &DD[0], &N);
+
+  return diff(A, DD);
+}
+
+#endif /* LAPACK_STEV_HH */

diff --git a/accuracy/lapack/lapack_SYEV.hh b/accuracy/lapack/lapack_SYEV.hh
new file mode 100644
index 0000000..a0acad0
--- /dev/null
+++ b/accuracy/lapack/lapack_SYEV.hh
@@ -0,0 +1,43 @@
+#ifndef LAPACK_SYEV_HH
+#define LAPACK_SYEV_HH
+
+#include "LinearCongruential.hh"
+#include "diff.hh"
+
+double test_SYEV(const int& N, const unsigned& seed = 0)
+{
+  LinearCongruential lc(seed);
+  vector<double> A(N*N), Acopy, W(N), D(N*N), work(1), tmp(N*N);
+
+  /* Fill A (symmetric) and Acopy */
+  for (int r = 0; r < N; ++r) {
+      A[r+r*N] = lc.get_01();
+      for (int c = r+1; c < N; ++c) {
+          A[r+c*N] = lc.get_01();
+          A[c+r*N] = A[r+c*N];
+      }
+  }
+  Acopy = A;
+
+  /* Retrieve lwork */
+  int lwork = -1, info;
+  dsyev_("V", "U", &N, &A[0], &N, &W[0], &work[0], &lwork, &info);
+  lwork = work[0];
+  work.resize(lwork);
+
+  /* Perform computation */
+  dsyev_("V", "U", &N, &A[0], &N, &W[0], &work[0], &lwork, &info);
+
+  /* Construct D */
+  for (int i = 0; i < N; ++i)
+    D[i+i*N] = W[i];
+
+  /* A = V*D*V' */
+  const double dONE = 1., dZERO = 0.;
+  dgemm_("N", "N", &N, &N, &N, &dONE,   &A[0], &N, &D[0], &N, &dZERO, &tmp[0], &N);
+  dgemm_("N", "T", &N, &N, &N, &dONE, &tmp[0], &N, &A[0], &N, &dZERO,   &D[0], &N);
+
+  return diff(Acopy, D);
+}
+
+#endif /* LAPACK_SYEV_HH */

diff --git a/accuracy/lapack/main_lapack.cpp b/accuracy/lapack/main_lapack.cpp
index 2426cc6..18b916c 100644
--- a/accuracy/lapack/main_lapack.cpp
+++ b/accuracy/lapack/main_lapack.cpp
@@ -26,6 +26,8 @@ extern "C" {
 #include "lapack_cholesky.hh"
 #include "lapack_SVD.hh"
 #include "lapack_QR.hh"
+#include "lapack_SYEV.hh"
+#include "lapack_STEV.hh"
 
 template<typename exec_t>
 void test(exec_t exec, const std::string& testname, const int& max = 3000, const int& N = 100)
@@ -59,7 +61,8 @@ void test(exec_t exec, const std::string& testname, const int& max = 3000, const
 int main(int argc, char **argv)
 {
   bool
-  lu_decomp=false, cholesky = false, svd_decomp=false, qr_decomp=false
+  lu_decomp=false, cholesky = false, svd_decomp=false, qr_decomp=false,
+  syev=false, stev=false
   ;
 
   for (int i = 1; i < argc; ++i) {
@@ -68,6 +71,8 @@ int main(int argc, char **argv)
           else if (arg == "cholesky") cholesky = true;
           else if (arg == "svd_decomp") svd_decomp = true;
           else if (arg == "qr_decomp") qr_decomp = true;
+          else if (arg == "syev") syev = true;
+          else if (arg == "stev") stev = true;
   }
 
   if (lu_decomp) {
@@ -79,11 +84,19 @@ int main(int argc, char **argv)
   }
 
   if (svd_decomp) {
-      test(test_SVD, "svd_decomp", 3000, 100);
+      test(test_SVD, "svd_decomp", 1000, 90);
   }
 
   if (qr_decomp) {
-      test(test_QR, "qr_decomp", 3000, 100);
+      test(test_QR, "qr_decomp", 500, 70);
+  }
+
+  if (syev) {
+      test(test_SYEV, "syev", 1000, 90);
+  }
+
+  if (stev) {
+      test(test_STEV, "stev", 1000, 90);
   }
 
   return 0;

diff --git a/benchconfig.py b/benchconfig.py
index 6b96b33..c684685 100644
--- a/benchconfig.py
+++ b/benchconfig.py
@@ -17,7 +17,10 @@ if needsinitialization:
     # Script directories
     curdir = os.path.abspath('.')
     scriptdir = os.path.dirname(os.path.realpath(__file__))
-    btldir = '/usr/include/btl'
+    if os.environ.has_key('BTLDIR'):
+        btldir = os.environ['BTLDIR']
+    else:
+        btldir = '/usr/include/btl'
     
     # Library directory (lib32 vs. lib64)
     libdir = sp.Popen \

diff --git a/lapack_accuracy.py b/lapack_accuracy.py
index 1f062fa..ef0c504 100644
--- a/lapack_accuracy.py
+++ b/lapack_accuracy.py
@@ -12,7 +12,8 @@ class Module(basemodule.BaseModule):
     
     def _initialize(self):
         self.libname = 'lapack'
-        self.avail=['lu_decomp', 'cholesky', 'svd_decomp', 'qr_decomp']
+        self.avail=['lu_decomp', 'cholesky', 'svd_decomp', 'qr_decomp', \
+                    'syev', 'stev']
     
     def _parse_args(self, args):     
         # Parse arguments
@@ -125,7 +126,7 @@ class LAPACK_accuracyTest(basemodule.BaseTest):
         logfile.write(' '.join([n+'='+v for n,v in self.runenv.items()]) + ' ')
         logfile.write(' '.join(args) + '\n')
         logfile.write(80*'-' + '\n')
-        proc = sp.Popen(args, bufsize=1, stdout=sp.PIPE, stderr=sp.PIPE, 
+        proc = sp.Popen(args, bufsize=1, stdout=sp.PIPE, stderr=logfile, 
           env=self.runenv, cwd=self.testdir)
         
         # Interpret output
@@ -143,7 +144,7 @@ class LAPACK_accuracyTest(basemodule.BaseTest):
                 Print.down()
             else:
                 Print(line[1:-1])
-        Print.up()          
-        logfile.close()      
+        Print.up()
+        logfile.close()
         proc.wait()
         return proc.returncode



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [gentoo-commits] proj/auto-numerical-bench:unstable commit in: /, accuracy/lapack/
@ 2011-08-06 23:55 Andrea Arteaga
  0 siblings, 0 replies; 3+ messages in thread
From: Andrea Arteaga @ 2011-08-06 23:55 UTC (permalink / raw
  To: gentoo-commits

commit:     13b03bd8fceb7b3f575a77d5ec95be91d47814ea
Author:     Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
AuthorDate: Sat Aug  6 23:55:21 2011 +0000
Commit:     Andrea Arteaga <andyspiros <AT> gmail <DOT> com>
CommitDate: Sat Aug  6 23:55:21 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/auto-numerical-bench.git;a=commit;h=13b03bd8

Added some LAPACK tests.

---
 accuracy/lapack/lapack_STEV.hh |    2 +-
 lapack.py                      |    5 +++--
 testdescr.py                   |    2 ++
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/accuracy/lapack/lapack_STEV.hh b/accuracy/lapack/lapack_STEV.hh
index 0c9dea3..ab020ae 100644
--- a/accuracy/lapack/lapack_STEV.hh
+++ b/accuracy/lapack/lapack_STEV.hh
@@ -7,7 +7,7 @@
 double test_STEV(const int& N, const unsigned& seed = 0)
 {
   LinearCongruential lc(seed);
-  vector<double> A(N*N), D(N), E(N-1), Z(N*N), DD(N*N), work(2*N-2), tmp(N*N);
+  vector<double> A(N*N), D(N), E(N-1), Z(N*N), DD(N*N), work(max(1, 2*N-2)), tmp(N*N);
 
   /* Fill D, E and A */
   for (int i = 0; i < N-1; ++i) {

diff --git a/lapack.py b/lapack.py
index e618380..677603e 100644
--- a/lapack.py
+++ b/lapack.py
@@ -6,7 +6,7 @@ class Module(btlbase.BTLBase):
     def _initialize(self):
         self.libname = "lapack"
         self.avail = ['general_solve', 'least_squares', 'lu_decomp', \
-          'cholesky', 'symm_ev']
+          'cholesky', 'qr_decomp', 'svd_decomp', 'syev', 'stev', 'symm_ev']
     
     def _parse_args(self, args):     
         # Parse arguments
@@ -22,7 +22,8 @@ class Module(btlbase.BTLBase):
         
         # If no test is specified, run everything
         if len(self.tests) == 0:
-            self.tests = self.avail
+            self.tests = ['lu_decomp', 'cholesky', 'qr_decomp', 'svd_decomp',\
+                          'syev', 'stev']
         
         btlbase.BTLBase._parse_args(self, args)
     

diff --git a/testdescr.py b/testdescr.py
index 51ad714..edadd06 100644
--- a/testdescr.py
+++ b/testdescr.py
@@ -21,6 +21,8 @@ testdescr = {
 'cholesky': 'Cholesky decomposition',
 'svd_decomp': 'SVD-decomposition',
 'qr_decomp': 'QR-decomposition',
+'syev': 'Diagonalization of a symmetric matrix',
+'stev': 'Diagonalization of a tridiagonal matrix',
 'symm_ev': 'Symmetric Eigenvalue computation',
 
 # FFTW



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-08-06 23:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-05  1:42 [gentoo-commits] proj/auto-numerical-bench:unstable commit in: /, accuracy/lapack/ Andrea Arteaga
  -- strict thread matches above, loose matches on Subject: below --
2011-08-06 11:44 Andrea Arteaga
2011-08-06 23:55 Andrea Arteaga

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