commit: 0bf9d7c0c2541c7f8e607655a7c6035248b5d32d Author: Andrea Arteaga gmail com> AuthorDate: Sat Sep 29 09:20:41 2012 +0000 Commit: Andrea Arteaga gmail com> CommitDate: Sat Sep 29 09:20:41 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/auto-numerical-bench.git;a=commit;h=0bf9d7c0 Change BTL actions begins: BLAS levels 1 and 2 are done. Old implementations cleaned up. --- .../NI_internal/FortranDeclarations.hpp | 3 + NumericInterface/NI_internal/FortranInterface.hpp | 19 +- btl/actions/action_MatrixTVector.hpp | 79 +++ btl/actions/action_MatrixVector.hpp | 79 +++ btl/actions/action_Rank1Update.hpp | 77 +++ btl/actions/action_Rank2Update.hpp | 77 +++ btl/actions/action_SymMatrixVector.hpp | 78 +++ btl/actions/action_TriSolveVector.hpp | 81 +++ btl/actions/action_aat_product.hh | 145 ----- btl/actions/action_ata_product.hh | 145 ----- btl/actions/action_atv_product.hh | 134 ---- btl/actions/action_axpby.hh | 127 ---- btl/actions/action_axpy.hh | 139 ---- btl/actions/action_axpy.hpp | 77 +++ btl/actions/action_cholesky.hh | 129 ---- btl/actions/action_general_solve.hh | 137 ---- btl/actions/action_ger.hh | 128 ---- btl/actions/action_hessenberg.hh | 233 ------- btl/actions/action_least_squares.hh | 137 ---- btl/actions/action_lu_decomp.hh | 109 ---- btl/actions/action_lu_solve.hh | 136 ---- btl/actions/action_matrix_matrix_product.hh | 150 ----- btl/actions/action_matrix_matrix_product_bis.hh | 152 ----- btl/actions/action_matrix_vector_product.hh | 153 ----- btl/actions/action_parallel_axpy.hh | 158 ----- btl/actions/action_parallel_cholesky.hh | 130 ---- btl/actions/action_parallel_lu_decomp.hh | 142 ---- .../action_parallel_matrix_vector_product.hh | 159 ----- btl/actions/action_parallel_qr_decomp.hh | 116 ---- btl/actions/action_parallel_svd_decomp.hh | 151 ----- btl/actions/action_parallel_symm_ev.hh | 138 ---- btl/actions/action_partial_lu.hh | 125 ---- btl/actions/action_qr_decomp.hh | 112 ---- btl/actions/action_rot.hh | 116 ---- btl/actions/action_rot.hpp | 78 +++ btl/actions/action_stev.hh | 119 ---- btl/actions/action_svd_decomp.hh | 115 ---- btl/actions/action_syev.hh | 113 ---- btl/actions/action_symm_ev.hh | 104 --- btl/actions/action_symv.hh | 139 ---- btl/actions/action_syr2.hh | 133 ---- btl/actions/action_trisolve.hh | 137 ---- btl/actions/action_trisolve_matrix.hh | 165 ----- btl/actions/action_trmm.hh | 165 ----- btl/actions/actionsBLAS.hpp | 16 + btl/actions/base_action_fftw.hh | 86 --- btl/actions/basic_actions.hh | 21 - btl/generic_bench/init/init_function.hh | 54 -- btl/generic_bench/init/init_matrix.hh | 93 --- btl/generic_bench/init/init_vector.hh | 37 -- btl/generic_bench/static/intel_bench_fixed_size.hh | 6 +- btl/generic_bench/timers/STL_perf_analyzer.hh | 82 --- btl/generic_bench/timers/STL_timer.hh | 78 --- .../timers/distributed_perf_analyzer_node.hh | 1 - .../timers/distributed_perf_analyzer_root.hh | 5 +- btl/generic_bench/timers/mixed_perf_analyzer.hh | 73 --- btl/generic_bench/timers/portable_perf_analyzer.hh | 9 +- .../timers/portable_perf_analyzer_old.hh | 134 ---- btl/generic_bench/timers/x86_perf_analyzer.hh | 108 --- btl/generic_bench/timers/x86_timer.hh | 246 ------- btl/generic_bench/utils/LinearCongruential.hh | 83 --- btl/generic_bench/utils/LinearCongruential.hpp | 77 +++ btl/libs/BLAS/CMakeLists.txt | 60 -- btl/libs/BLAS/blas.h | 681 -------------------- btl/libs/BLAS/blas_interface.hh | 77 --- btl/libs/BLAS/blas_interface_impl.hh | 96 --- btl/libs/BLAS/c_interface_base.h | 89 --- btl/libs/BLAS/cblas_interface_impl.hh | 96 --- btl/libs/BLAS/main.cpp | 99 +--- btl/libs/STL/CMakeLists.txt | 2 - btl/libs/STL/STL_interface.hh | 255 -------- btl/libs/STL/main.cpp | 42 -- numbench/modules/internal/blasBase.py | 9 +- numbench/testdescr.py | 22 +- 74 files changed, 774 insertions(+), 7302 deletions(-) diff --git a/NumericInterface/NI_internal/FortranDeclarations.hpp b/NumericInterface/NI_internal/FortranDeclarations.hpp index 9fe0b04..76dfc01 100644 --- a/NumericInterface/NI_internal/FortranDeclarations.hpp +++ b/NumericInterface/NI_internal/FortranDeclarations.hpp @@ -51,6 +51,9 @@ extern "C" { void ssymv_(const char*, const int*, const float*, const float*, const int*, const float*, const int*, const float*, float*, const int*); void dsymv_(const char*, const int*, const double*, const double*, const int*, const double*, const int*, const double*, double*, const int*); + void strmv_(const char*, const char*, const char*, const int*, const float*, const int*, float*, const int*); + void dtrmv_(const char*, const char*, const char*, const int*, const double*, const int*, double*, const int*); + void strsv_(const char*, const char*, const char*, const int*, const float*, const int*, float*, const int*); void dtrsv_(const char*, const char*, const char*, const int*, const double*, const int*, double*, const int*); diff --git a/NumericInterface/NI_internal/FortranInterface.hpp b/NumericInterface/NI_internal/FortranInterface.hpp index 39dfa84..ab20783 100644 --- a/NumericInterface/NI_internal/FortranInterface.hpp +++ b/NumericInterface/NI_internal/FortranInterface.hpp @@ -81,7 +81,7 @@ public: * LEVEL 2 BLAS * ****************/ - static void matrixVector(const bool& trans, const int& M, const int& N, + static void MatrixVector(const bool& trans, const int& M, const int& N, const Scalar& alpha, const Scalar* A, const Scalar* x, const Scalar& beta, Scalar* y) { @@ -90,26 +90,32 @@ public: FORTFUNC(gemv)(&tA, &M, &N, &alpha, A, &LDA, x, &ONE, &beta, y, &ONE); } - static void symmetricMatrixVector(const char& uplo, const int& N, + static void SymMatrixVector(const char& uplo, const int& N, const Scalar& alpha, const Scalar* A, const Scalar* x, const Scalar& beta, Scalar* y) { FORTFUNC(symv)(&uplo, &N, &alpha, A, &N, x, &ONE, &beta, y, &ONE); } - static void triangularSolveVector(const char& uplo, const char& diag, + static void TriMatrixVector(const char& uplo, const int& N, + const Scalar* A, Scalar* x) + { + FORTFUNC(trmv)(&uplo, "N", "N", &N, A, &N, x, &ONE); + } + + static void TriSolveVector(const char& uplo, const int& N, const Scalar* A, Scalar* x) { - FORTFUNC(trsv)(&uplo, "N", &diag, &N, A, &N, x, &ONE); + FORTFUNC(trsv)(&uplo, "N", "N", &N, A, &N, x, &ONE); } - static void rank1update(const int& M, const int& N, const Scalar& alpha, + static void Rank1Update(const int& M, const int& N, const Scalar& alpha, const Scalar* x, const Scalar* y, Scalar* A) { FORTFUNC(ger)(&M, &N, &alpha, x, &ONE, y, &ONE, A, &M); } - static void rank2update(const char& uplo, const int& N, const Scalar& alpha, + static void Rank2Update(const char& uplo, const int& N, const Scalar& alpha, const Scalar* x, const Scalar* y, Scalar* A) { FORTFUNC(syr2)(&uplo, &N, &alpha, x, &ONE, y, &ONE, A, &N); @@ -138,7 +144,6 @@ public: tB = Trans; } - const int LDB = transB ? N : K; FORTFUNC(gemm)(&tA, &tB, &M, &N, &K, &alpha, A, &LDA, B, &LDB, &beta, C, &M); } diff --git a/btl/actions/action_MatrixTVector.hpp b/btl/actions/action_MatrixTVector.hpp new file mode 100644 index 0000000..20b360a --- /dev/null +++ b/btl/actions/action_MatrixTVector.hpp @@ -0,0 +1,79 @@ +//===================================================== +// Copyright (C) 2012 Andrea Arteaga +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// 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_MATRIXTVECTOR +#define ACTION_MATRIXTVECTOR + +#include "LinearCongruential.hpp" +#include +#include + +template +class Action_MatrixTVector { + + typedef typename Interface::Scalar Scalar; + typedef std::vector vector_t; + +private: + // Invalidate copy constructor + Action_MatrixTVector(const Action_MatrixTVector&); + +public: + + // Constructor + Action_MatrixTVector(int size) + : _size(size), lc(10), + A(lc.fillVector(size*size)), x(lc.fillVector(size)), + A_work(size*size), x_work(size), y_work(size) + { + MESSAGE("Action_MatrixTVector Constructor"); + } + + // Action name + static std::string name() + { + return "MatrixTVector_" + Interface::name(); + } + + double fpo() { + return 2*double(_size)*double(_size) - double(_size); + } + + inline void initialize(){ + std::copy(A.begin(), A.end(), A_work.begin()); + std::copy(x.begin(), x.end(), x_work.begin()); + } + + inline void calculate() { + Interface::MatrixVector(true, _size, _size, 1., &A_work[0], &x_work[0], + 0., &y_work[0]); + } + + Scalar getResidual() { + return 0.; + } + +private: + const int _size; + LinearCongruential<> lc; + + const vector_t A, x; + vector_t A_work, x_work, y_work; + +}; + +#endif // ACTION_MATRIXVECTOR diff --git a/btl/actions/action_MatrixVector.hpp b/btl/actions/action_MatrixVector.hpp new file mode 100644 index 0000000..923dc7b --- /dev/null +++ b/btl/actions/action_MatrixVector.hpp @@ -0,0 +1,79 @@ +//===================================================== +// Copyright (C) 2012 Andrea Arteaga +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// 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 + +#include "LinearCongruential.hpp" +#include +#include + +template +class Action_MatrixVector { + + typedef typename Interface::Scalar Scalar; + typedef std::vector vector_t; + +private: + // Invalidate copy constructor + Action_MatrixVector(const Action_MatrixVector&); + +public: + + // Constructor + Action_MatrixVector(int size) + : _size(size), lc(10), + A(lc.fillVector(size*size)), x(lc.fillVector(size)), + A_work(size*size), x_work(size), y_work(size) + { + MESSAGE("Action_MatrixVector Constructor"); + } + + // Action name + static std::string name() + { + return "MatrixVector_" + Interface::name(); + } + + double fpo() { + return 2*double(_size)*double(_size) - double(_size); + } + + inline void initialize(){ + std::copy(A.begin(), A.end(), A_work.begin()); + std::copy(x.begin(), x.end(), x_work.begin()); + } + + inline void calculate() { + Interface::MatrixVector(false, _size, _size, 1., &A_work[0], &x_work[0], + 0., &y_work[0]); + } + + Scalar getResidual() { + return 0.; + } + +private: + const int _size; + LinearCongruential<> lc; + + const vector_t A, x; + vector_t A_work, x_work, y_work; + +}; + +#endif // ACTION_MATRIXVECTOR diff --git a/btl/actions/action_Rank1Update.hpp b/btl/actions/action_Rank1Update.hpp new file mode 100644 index 0000000..bd88ac3 --- /dev/null +++ b/btl/actions/action_Rank1Update.hpp @@ -0,0 +1,77 @@ +//===================================================== +// Copyright (C) 2012 Andrea Arteaga +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// 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_RANK1UPDATE +#define ACTION_RANK1UPDATE + +#include "LinearCongruential.hpp" +#include +#include + +template +class Action_Rank1Update { + + typedef typename Interface::Scalar Scalar; + typedef std::vector vector_t; + +private: + // Invalidate copy constructor + Action_Rank1Update(const Action_Rank1Update&); + +public: + + // Constructor + Action_Rank1Update(int size) + : _size(size), lc(10), + A(lc.fillVector(size*size)), A_work(size*size), + x(lc.fillVector(size)), y(lc.fillVector(size)) + { + MESSAGE("Action_Rank1Update Constructor"); + } + + // Action name + static std::string name() + { + return "Rank1Update_" + Interface::name(); + } + + double fpo() { + return 3*double(_size)*double(_size); + } + + inline void initialize(){ + std::copy(A.begin(), A.end(), A_work.begin()); + } + + inline void calculate() { + Interface::Rank1Update(_size, _size, 1., &x[0], &y[0], &A_work[0]); + } + + Scalar getResidual() { + return 0.; + } + +private: + const int _size; + LinearCongruential<> lc; + + const vector_t A, x, y; + vector_t A_work; + +}; + +#endif // ACTION_RANK1UPDATE diff --git a/btl/actions/action_Rank2Update.hpp b/btl/actions/action_Rank2Update.hpp new file mode 100644 index 0000000..b0b1693 --- /dev/null +++ b/btl/actions/action_Rank2Update.hpp @@ -0,0 +1,77 @@ +//===================================================== +// Copyright (C) 2012 Andrea Arteaga +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// 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_RANK2UPDATE +#define ACTION_RANK2UPDATE + +#include "LinearCongruential.hpp" +#include +#include + +template +class Action_Rank2Update { + + typedef typename Interface::Scalar Scalar; + typedef std::vector vector_t; + +private: + // Invalidate copy constructor + Action_Rank2Update(const Action_Rank2Update&); + +public: + + // Constructor + Action_Rank2Update(int size) + : _size(size), lc(10), + A(lc.fillVector(size*size)), A_work(size*size), + x(lc.fillVector(size)), y(lc.fillVector(size)) + { + MESSAGE("Action_Rank2Update Constructor"); + } + + // Action name + static std::string name() + { + return "Rank2Update_" + Interface::name(); + } + + double fpo() { + return 2*double(_size)*double(_size); + } + + inline void initialize(){ + std::copy(A.begin(), A.end(), A_work.begin()); + } + + inline void calculate() { + Interface::Rank2Update('U', _size, 1., &x[0], &y[0], &A_work[0]); + } + + Scalar getResidual() { + return 0.; + } + +private: + const int _size; + LinearCongruential<> lc; + + const vector_t A, x, y; + vector_t A_work; + +}; + +#endif // ACTION_RANK2UPDATE diff --git a/btl/actions/action_SymMatrixVector.hpp b/btl/actions/action_SymMatrixVector.hpp new file mode 100644 index 0000000..e475007 --- /dev/null +++ b/btl/actions/action_SymMatrixVector.hpp @@ -0,0 +1,78 @@ +//===================================================== +// Copyright (C) 2012 Andrea Arteaga +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// 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_SYMMATRIXVECTOR +#define ACTION_SYMMATRIXVECTOR + +#include "LinearCongruential.hpp" +#include +#include + +template +class Action_SymMatrixVector { + + typedef typename Interface::Scalar Scalar; + typedef std::vector vector_t; + +private: + // Invalidate copy constructor + Action_SymMatrixVector(const Action_SymMatrixVector&); + +public: + + // Constructor + Action_SymMatrixVector(int size) + : _size(size), lc(10), + A(lc.fillVector(size*size)), x(lc.fillVector(size)), + y(size), y_work(size) + { + MESSAGE("Action_SymMatrixVector Constructor"); + } + + // Action name + static std::string name() + { + return "SymMatrixVector_" + Interface::name(); + } + + double fpo() { + return double(_size)*double(_size); + } + + inline void initialize(){ + std::copy(y.begin(), y.end(), y_work.begin()); + } + + inline void calculate() { + Interface::SymMatrixVector('U', _size, 1., &A[0], &x[0], + 0., &y_work[0]); + } + + Scalar getResidual() { + return 0.; + } + +private: + const int _size; + LinearCongruential<> lc; + + const vector_t A, x, y; + vector_t y_work; + +}; + +#endif // ACTION_MATRIXVECTOR diff --git a/btl/actions/action_TriSolveVector.hpp b/btl/actions/action_TriSolveVector.hpp new file mode 100644 index 0000000..2bfefb8 --- /dev/null +++ b/btl/actions/action_TriSolveVector.hpp @@ -0,0 +1,81 @@ +//===================================================== +// Copyright (C) 2012 Andrea Arteaga +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// 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 + +#include "LinearCongruential.hpp" +#include +#include + +template +class Action_TriSolveVector { + + typedef typename Interface::Scalar Scalar; + typedef std::vector vector_t; + +private: + // Invalidate copy constructor + Action_TriSolveVector(const Action_TriSolveVector&); + +public: + + // Constructor + Action_TriSolveVector(int size) + : _size(size), lc(10), + A(lc.fillVector(size*size)), x(lc.fillVector(size)), + x_work(size) + { + MESSAGE("Action_TriSolveVector Constructor"); + } + + // Action name + static std::string name() + { + return "TriSolveVector_" + Interface::name(); + } + + double fpo() { + return double(_size)*double(_size) - 2*double(_size); + } + + inline void initialize(){ + std::copy(x.begin(), x.end(), x_work.begin()); + } + + inline void calculate() { + Interface::TriSolveVector('U', _size, &A[0], &x_work[0]); + } + + Scalar getResidual() { + initialize(); + calculate(); + Interface::TriMatrixVector('U', _size, &A[0], &x_work[0]); + Interface::axpy(_size, -1., &x[0], &x_work[0]); + return Interface::norm(_size, &x_work[0]); + } + +private: + const int _size; + LinearCongruential<> lc; + + const vector_t A, x; + vector_t x_work; + +}; + +#endif // ACTION_TRISOLVEVECTOR diff --git a/btl/actions/action_aat_product.hh b/btl/actions/action_aat_product.hh deleted file mode 100644 index aa5b35c..0000000 --- a/btl/actions/action_aat_product.hh +++ /dev/null @@ -1,145 +0,0 @@ -//===================================================== -// File : action_aat_product.hh -// Author : L. Plagne -// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_AAT_PRODUCT -#define ACTION_AAT_PRODUCT -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_aat_product { - -public : - - // Ctor - - Action_aat_product( int size ):_size(size) - { - MESSAGE("Action_aat_product Ctor"); - - // STL matrix and vector initialization - - init_matrix(A_stl,_size); - init_matrix(X_stl,_size); - init_matrix(resu_stl,_size); - - // generic matrix and vector initialization - - Interface::matrix_from_stl(A_ref,A_stl); - Interface::matrix_from_stl(X_ref,X_stl); - - Interface::matrix_from_stl(A,A_stl); - Interface::matrix_from_stl(X,X_stl); - - } - - // invalidate copy ctor - - Action_aat_product( const Action_aat_product & ) - { - INFOS("illegal call to Action_aat_product Copy Ctor"); - exit(0); - } - - // Dtor - - ~Action_aat_product( void ){ - - MESSAGE("Action_aat_product Dtor"); - - // deallocation - - Interface::free_matrix(A,_size); - Interface::free_matrix(X,_size); - - Interface::free_matrix(A_ref,_size); - Interface::free_matrix(X_ref,_size); - - } - - // action name - - static inline std::string name( void ) - { - return "aat_"+Interface::name(); - } - - double nb_op_base( void ){ - return double(_size)*double(_size)*double(_size); - } - - inline void initialize( void ){ - - Interface::copy_matrix(A_ref,A,_size); - Interface::copy_matrix(X_ref,X,_size); - - } - - inline void calculate( void ) { - - Interface::aat_product(A,X,_size); - - } - - void check_result( void ){ - if (_size>128) return; - // calculation check - - Interface::matrix_to_stl(X,resu_stl); - - STL_interface::aat_product(A_stl,X_stl,_size); - - typename Interface::real_type error= - STL_interface::norm_diff(X_stl,resu_stl); - - if (error>1.e-6){ - INFOS("WRONG CALCULATION...residual=" << error); - exit(1); - } - - } - -private : - - typename Interface::stl_matrix A_stl; - typename Interface::stl_matrix X_stl; - typename Interface::stl_matrix resu_stl; - - typename Interface::gene_matrix A_ref; - typename Interface::gene_matrix X_ref; - - typename Interface::gene_matrix A; - typename Interface::gene_matrix X; - - - int _size; - -}; - - -#endif - - - diff --git a/btl/actions/action_ata_product.hh b/btl/actions/action_ata_product.hh deleted file mode 100644 index 04364fe..0000000 --- a/btl/actions/action_ata_product.hh +++ /dev/null @@ -1,145 +0,0 @@ -//===================================================== -// File : action_ata_product.hh -// Author : L. Plagne -// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_ATA_PRODUCT -#define ACTION_ATA_PRODUCT -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_ata_product { - -public : - - // Ctor - - Action_ata_product( int size ):_size(size) - { - MESSAGE("Action_ata_product Ctor"); - - // STL matrix and vector initialization - - init_matrix(A_stl,_size); - init_matrix(X_stl,_size); - init_matrix(resu_stl,_size); - - // generic matrix and vector initialization - - Interface::matrix_from_stl(A_ref,A_stl); - Interface::matrix_from_stl(X_ref,X_stl); - - Interface::matrix_from_stl(A,A_stl); - Interface::matrix_from_stl(X,X_stl); - - } - - // invalidate copy ctor - - Action_ata_product( const Action_ata_product & ) - { - INFOS("illegal call to Action_ata_product Copy Ctor"); - exit(0); - } - - // Dtor - - ~Action_ata_product( void ){ - - MESSAGE("Action_ata_product Dtor"); - - // deallocation - - Interface::free_matrix(A,_size); - Interface::free_matrix(X,_size); - - Interface::free_matrix(A_ref,_size); - Interface::free_matrix(X_ref,_size); - - } - - // action name - - static inline std::string name( void ) - { - return "ata_"+Interface::name(); - } - - double nb_op_base( void ){ - return 2.0*_size*_size*_size; - } - - inline void initialize( void ){ - - Interface::copy_matrix(A_ref,A,_size); - Interface::copy_matrix(X_ref,X,_size); - - } - - inline void calculate( void ) { - - Interface::ata_product(A,X,_size); - - } - - void check_result( void ){ - if (_size>128) return; - // calculation check - - Interface::matrix_to_stl(X,resu_stl); - - STL_interface::ata_product(A_stl,X_stl,_size); - - typename Interface::real_type error= - STL_interface::norm_diff(X_stl,resu_stl); - - if (error>1.e-6){ - INFOS("WRONG CALCULATION...residual=" << error); - exit(1); - } - - } - -private : - - typename Interface::stl_matrix A_stl; - typename Interface::stl_matrix X_stl; - typename Interface::stl_matrix resu_stl; - - typename Interface::gene_matrix A_ref; - typename Interface::gene_matrix X_ref; - - typename Interface::gene_matrix A; - typename Interface::gene_matrix X; - - - int _size; - -}; - - -#endif - - - diff --git a/btl/actions/action_atv_product.hh b/btl/actions/action_atv_product.hh deleted file mode 100644 index a823451..0000000 --- a/btl/actions/action_atv_product.hh +++ /dev/null @@ -1,134 +0,0 @@ -//===================================================== -// File : action_atv_product.hh -// Author : L. Plagne -// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_ATV_PRODUCT -#define ACTION_ATV_PRODUCT -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_atv_product { - -public : - - Action_atv_product( int size ) : _size(size) - { - MESSAGE("Action_atv_product Ctor"); - - // STL matrix and vector initialization - - init_matrix(A_stl,_size); - init_vector(B_stl,_size); - init_vector(X_stl,_size); - init_vector(resu_stl,_size); - - // generic matrix and vector initialization - - Interface::matrix_from_stl(A_ref,A_stl); - Interface::vector_from_stl(B_ref,B_stl); - Interface::vector_from_stl(X_ref,X_stl); - - Interface::matrix_from_stl(A,A_stl); - Interface::vector_from_stl(B,B_stl); - Interface::vector_from_stl(X,X_stl); - } - - // invalidate copy ctor - Action_atv_product( const Action_atv_product & ) - { - INFOS("illegal call to Action_atv_product Copy Ctor"); - exit(1); - } - - ~Action_atv_product( void ) - { - MESSAGE("Action_atv_product Dtor"); - - Interface::free_matrix(A,_size); - Interface::free_vector(B); - Interface::free_vector(X); - - Interface::free_matrix(A_ref,_size); - Interface::free_vector(B_ref); - Interface::free_vector(X_ref); - } - - static inline std::string name() { return "atv_" + Interface::name(); } - - double nb_op_base( void ) { return 2.0*_size*_size; } - - inline void initialize( void ){ - Interface::copy_matrix(A_ref,A,_size); - Interface::copy_vector(B_ref,B,_size); - Interface::copy_vector(X_ref,X,_size); - } - - BTL_DONT_INLINE void calculate( void ) { - BTL_ASM_COMMENT("begin atv"); - Interface::atv_product(A,B,X,_size); - BTL_ASM_COMMENT("end atv"); - } - - void check_result( void ) - { - if (_size>128) return; - Interface::vector_to_stl(X,resu_stl); - - STL_interface::atv_product(A_stl,B_stl,X_stl,_size); - - typename Interface::real_type error= - STL_interface::norm_diff(X_stl,resu_stl); - - if (error>1.e-6){ - INFOS("WRONG CALCULATION...residual=" << error); - exit(1); - } - } - -private : - - typename Interface::stl_matrix A_stl; - typename Interface::stl_vector B_stl; - typename Interface::stl_vector X_stl; - typename Interface::stl_vector resu_stl; - - typename Interface::gene_matrix A_ref; - typename Interface::gene_vector B_ref; - typename Interface::gene_vector X_ref; - - typename Interface::gene_matrix A; - typename Interface::gene_vector B; - typename Interface::gene_vector X; - - - int _size; - -}; - - -#endif - - - diff --git a/btl/actions/action_axpby.hh b/btl/actions/action_axpby.hh deleted file mode 100644 index 98511ab..0000000 --- a/btl/actions/action_axpby.hh +++ /dev/null @@ -1,127 +0,0 @@ -//===================================================== -// File : action_axpby.hh -// Copyright (C) 2008 Gael Guennebaud -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_AXPBY -#define ACTION_AXPBY -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_axpby { - -public : - - // Ctor - Action_axpby( int size ):_size(size),_alpha(0.5),_beta(0.95) - { - MESSAGE("Action_axpby Ctor"); - - // STL vector initialization - init_vector(X_stl,_size); - init_vector(Y_stl,_size); - init_vector(resu_stl,_size); - - // generic matrix and vector initialization - Interface::vector_from_stl(X_ref,X_stl); - Interface::vector_from_stl(Y_ref,Y_stl); - - Interface::vector_from_stl(X,X_stl); - Interface::vector_from_stl(Y,Y_stl); - } - - // invalidate copy ctor - Action_axpby( const Action_axpby & ) - { - INFOS("illegal call to Action_axpby Copy Ctor"); - exit(1); - } - - // Dtor - ~Action_axpby( void ){ - MESSAGE("Action_axpby Dtor"); - - // deallocation - Interface::free_vector(X_ref); - Interface::free_vector(Y_ref); - - Interface::free_vector(X); - Interface::free_vector(Y); - } - - // action name - static inline std::string name( void ) - { - return "axpby_"+Interface::name(); - } - - double nb_op_base( void ){ - return 3.0*_size; - } - - inline void initialize( void ){ - Interface::copy_vector(X_ref,X,_size); - Interface::copy_vector(Y_ref,Y,_size); - } - - inline void calculate( void ) { - BTL_ASM_COMMENT("mybegin axpby"); - Interface::axpby(_alpha,X,_beta,Y,_size); - BTL_ASM_COMMENT("myend axpby"); - } - - void check_result( void ){ - if (_size>128) return; - // calculation check - Interface::vector_to_stl(Y,resu_stl); - - STL_interface::axpby(_alpha,X_stl,_beta,Y_stl,_size); - - typename Interface::real_type error= - STL_interface::norm_diff(Y_stl,resu_stl); - - if (error>1.e-6){ - INFOS("WRONG CALCULATION...residual=" << error); - exit(2); - } - } - -private : - - typename Interface::stl_vector X_stl; - typename Interface::stl_vector Y_stl; - typename Interface::stl_vector resu_stl; - - typename Interface::gene_vector X_ref; - typename Interface::gene_vector Y_ref; - - typename Interface::gene_vector X; - typename Interface::gene_vector Y; - - typename Interface::real_type _alpha; - typename Interface::real_type _beta; - - int _size; -}; - -#endif diff --git a/btl/actions/action_axpy.hh b/btl/actions/action_axpy.hh deleted file mode 100644 index e4cb3a5..0000000 --- a/btl/actions/action_axpy.hh +++ /dev/null @@ -1,139 +0,0 @@ -//===================================================== -// File : action_axpy.hh -// Author : L. Plagne -// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_AXPY -#define ACTION_AXPY -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_axpy { - -public : - - // Ctor - - Action_axpy( int size ):_size(size),_coef(1.0) - { - MESSAGE("Action_axpy Ctor"); - - // STL vector initialization - - init_vector(X_stl,_size); - init_vector(Y_stl,_size); - init_vector(resu_stl,_size); - - // generic matrix and vector initialization - - Interface::vector_from_stl(X_ref,X_stl); - Interface::vector_from_stl(Y_ref,Y_stl); - - Interface::vector_from_stl(X,X_stl); - Interface::vector_from_stl(Y,Y_stl); - - - } - - // invalidate copy ctor - - Action_axpy( const Action_axpy & ) - { - INFOS("illegal call to Action_axpy Copy Ctor"); - exit(1); - } - - // Dtor - - ~Action_axpy( void ){ - - MESSAGE("Action_axpy Dtor"); - - // deallocation - - Interface::free_vector(X_ref); - Interface::free_vector(Y_ref); - - Interface::free_vector(X); - Interface::free_vector(Y); - } - - // action name - - static inline std::string name( void ) - { - return "axpy_"+Interface::name(); - } - - double nb_op_base( void ){ - return 2.0*_size; - } - - inline void initialize( void ){ - Interface::copy_vector(X_ref,X,_size); - Interface::copy_vector(Y_ref,Y,_size); - } - - inline void calculate( void ) { - BTL_ASM_COMMENT("mybegin axpy"); - Interface::axpy(_coef,X,Y,_size); - BTL_ASM_COMMENT("myend axpy"); - } - - void check_result( void ){ - if (_size>128) return; - // calculation check - - Interface::vector_to_stl(Y,resu_stl); - - STL_interface::axpy(_coef,X_stl,Y_stl,_size); - - typename Interface::real_type error= - STL_interface::norm_diff(Y_stl,resu_stl); - - if (error>1.e-6){ - INFOS("WRONG CALCULATION...residual=" << error); - exit(0); - } - - } - -private : - - typename Interface::stl_vector X_stl; - typename Interface::stl_vector Y_stl; - typename Interface::stl_vector resu_stl; - - typename Interface::gene_vector X_ref; - typename Interface::gene_vector Y_ref; - - typename Interface::gene_vector X; - typename Interface::gene_vector Y; - - typename Interface::real_type _coef; - - int _size; -}; - -#endif diff --git a/btl/actions/action_axpy.hpp b/btl/actions/action_axpy.hpp new file mode 100644 index 0000000..85cb40e --- /dev/null +++ b/btl/actions/action_axpy.hpp @@ -0,0 +1,77 @@ +//===================================================== +// Copyright (C) 2012 Andrea Arteaga +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// 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_AXPY +#define ACTION_AXPY + +#include "LinearCongruential.hpp" +#include +#include + +template +class Action_axpy { + + typedef typename Interface::Scalar Scalar; + typedef std::vector vector_t; + +private: + // Invalidate copy constructor + Action_axpy(const Action_axpy&); + +public: + + // Constructor + Action_axpy(int size) + : _size(size), lc(10), + x(lc.fillVector(size)), + x_work(size), y_work(size) + { + MESSAGE("Action_axpy Constructor"); + } + + // Action name + static std::string name() + { + return "axpy_" + Interface::name(); + } + + double fpo() { + return 2*double(_size); + } + + inline void initialize(){ + std::copy(x.begin(), x.end(), x_work.begin()); + } + + inline void calculate() { + Interface::axpy(_size, 1., &x_work[0], &y_work[0]); + } + + Scalar getResidual() { + return 0.; + } + +private: + const int _size; + LinearCongruential<> lc; + + const vector_t x; + vector_t x_work, y_work; + +}; + +#endif // ACTION_AXPY diff --git a/btl/actions/action_cholesky.hh b/btl/actions/action_cholesky.hh deleted file mode 100644 index a1c751b..0000000 --- a/btl/actions/action_cholesky.hh +++ /dev/null @@ -1,129 +0,0 @@ -//===================================================== -// File : action_cholesky.hh -// Copyright (C) 2008 Gael Guennebaud -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_CHOLESKY -#define ACTION_CHOLESKY -#include "utilities.h" -#include "STL_interface.hh" -#include -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_cholesky { - -public : - - // Ctor - - Action_cholesky( int size ):_size(size) - { - MESSAGE("Action_cholesky Ctor"); - - // STL mat/vec initialization - init_matrix_symm(X_stl,_size); - init_matrix(C_stl,_size); - - // make sure X is invertible - for (int i=0; i<_size; ++i) - X_stl[i][i] = std::abs(X_stl[i][i]) * 1e2 + 100; - - // generic matrix and vector initialization - Interface::matrix_from_stl(X_ref,X_stl); - Interface::matrix_from_stl(X,X_stl); - Interface::matrix_from_stl(C,C_stl); - - _cost = 0; - for (int j=0; j<_size; ++j) - { - double r = std::max(_size - j -1,0); - _cost += 2*(r*j+r+j); - } - } - - // invalidate copy ctor - - Action_cholesky( const Action_cholesky & ) - { - INFOS("illegal call to Action_cholesky Copy Ctor"); - exit(1); - } - - // Dtor - - ~Action_cholesky( void ){ - - MESSAGE("Action_cholesky Dtor"); - - // deallocation - Interface::free_matrix(X_ref,_size); - Interface::free_matrix(X,_size); - Interface::free_matrix(C,_size); - } - - // action name - - static inline std::string name( void ) - { - return "cholesky_"+Interface::name(); - } - - double nb_op_base( void ){ - return _cost; - } - - inline void initialize( void ){ - Interface::copy_matrix(X_ref,X,_size); - } - - inline void calculate( void ) { - Interface::cholesky(X,C,_size); - } - - void check_result( void ){ - // calculation check -// STL_interface::cholesky(X_stl,C_stl,_size); -// -// typename Interface::real_type error= -// STL_interface::norm_diff(C_stl,resu_stl); -// -// if (error>1.e-6){ -// INFOS("WRONG CALCULATION...residual=" << error); -// exit(0); -// } - - } - -private : - - typename Interface::stl_matrix X_stl; - typename Interface::stl_matrix C_stl; - - typename Interface::gene_matrix X_ref; - typename Interface::gene_matrix X; - typename Interface::gene_matrix C; - - int _size; - double _cost; -}; - -#endif diff --git a/btl/actions/action_general_solve.hh b/btl/actions/action_general_solve.hh deleted file mode 100644 index 78aebd8..0000000 --- a/btl/actions/action_general_solve.hh +++ /dev/null @@ -1,137 +0,0 @@ -//===================================================== -// Copyright (C) 2011 Andrea Arteaga -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_GENERAL_SOLVE -#define ACTION_GENERAL_SOLVE - -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_general_solve { - -public: - - // Ctor - Action_general_solve( int size ) : _size(size) - { - MESSAGE("Action_general_solve Ctor"); - - // STL matrix and vector initialization - - init_matrix(A_stl,_size); - init_vector(B_stl,_size); - init_vector(X_stl,_size); - init_vector(resu_stl,_size); - - // generic matrix and vector initialization - - Interface::matrix_from_stl(A_ref,A_stl); - Interface::matrix_from_stl(A,A_stl); - Interface::vector_from_stl(B_ref,B_stl); - Interface::vector_from_stl(B,B_stl); - Interface::vector_from_stl(X_ref,X_stl); - Interface::vector_from_stl(X,X_stl); - - - } - - // invalidate copy ctor - - Action_general_solve( const Action_general_solve & ) - { - INFOS("illegal call to Action_general_solve Copy Ctor"); - exit(0); - } - - // Dtor - - BTL_DONT_INLINE ~Action_general_solve( void ){ - - MESSAGE("Action_general_solve Dtor"); - - // deallocation - - Interface::free_matrix(A,_size); - Interface::free_vector(B); - Interface::free_vector(X); - - Interface::free_matrix(A_ref,_size); - Interface::free_vector(B_ref); - Interface::free_vector(X_ref); - - } - - // action name - - static inline std::string name( void ) - { - return "general_solve_" + Interface::name(); - } - - double nb_op_base( void ){ - return 2.0*_size*_size*_size; - } - - BTL_DONT_INLINE void initialize( void ){ - - Interface::copy_matrix(A_ref,A,_size); - Interface::copy_vector(B_ref,B,_size); - Interface::copy_vector(X_ref,X,_size); - - } - - BTL_DONT_INLINE void calculate( void ) { - BTL_ASM_COMMENT("#begin general_solve"); - Interface::general_solve(A,B,X,_size); - BTL_ASM_COMMENT("end general_solve"); - } - - BTL_DONT_INLINE void check_result() { - // TODO: check result - } - - -private: - - typename Interface::stl_matrix A_stl; - typename Interface::stl_vector B_stl; - typename Interface::stl_vector X_stl; - typename Interface::stl_vector resu_stl; - - typename Interface::gene_matrix A_ref; - typename Interface::gene_vector B_ref; - typename Interface::gene_vector X_ref; - - typename Interface::gene_matrix A; - typename Interface::gene_vector B; - typename Interface::gene_vector X; - - - int _size; - - -}; - - -#endif// ACTION_GENERAL_SOLVE diff --git a/btl/actions/action_ger.hh b/btl/actions/action_ger.hh deleted file mode 100644 index dc766ef..0000000 --- a/btl/actions/action_ger.hh +++ /dev/null @@ -1,128 +0,0 @@ - -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_GER -#define ACTION_GER -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_ger { - -public : - - // Ctor - BTL_DONT_INLINE Action_ger( int size ):_size(size) - { - MESSAGE("Action_ger Ctor"); - - // STL matrix and vector initialization - typename Interface::stl_matrix tmp; - init_matrix(A_stl,_size); - init_vector(B_stl,_size); - init_vector(X_stl,_size); - init_vector(resu_stl,_size); - - // generic matrix and vector initialization - Interface::matrix_from_stl(A_ref,A_stl); - Interface::matrix_from_stl(A,A_stl); - Interface::vector_from_stl(B_ref,B_stl); - Interface::vector_from_stl(B,B_stl); - Interface::vector_from_stl(X_ref,X_stl); - Interface::vector_from_stl(X,X_stl); - } - - // invalidate copy ctor - Action_ger( const Action_ger & ) - { - INFOS("illegal call to Action_ger Copy Ctor"); - exit(1); - } - - // Dtor - BTL_DONT_INLINE ~Action_ger( void ){ - MESSAGE("Action_ger Dtor"); - Interface::free_matrix(A,_size); - Interface::free_vector(B); - Interface::free_vector(X); - Interface::free_matrix(A_ref,_size); - Interface::free_vector(B_ref); - Interface::free_vector(X_ref); - - } - - // action name - static inline std::string name( void ) - { - return "ger_" + Interface::name(); - } - - double nb_op_base( void ){ - return 2.0*_size*_size; - } - - BTL_DONT_INLINE void initialize( void ){ - Interface::copy_matrix(A_ref,A,_size); - Interface::copy_vector(B_ref,B,_size); - Interface::copy_vector(X_ref,X,_size); - } - - BTL_DONT_INLINE void calculate( void ) { - BTL_ASM_COMMENT("#begin ger"); - Interface::ger(A,B,X,_size); - BTL_ASM_COMMENT("end ger"); - } - - BTL_DONT_INLINE void check_result( void ){ - // calculation check - Interface::vector_to_stl(X,resu_stl); - - STL_interface::ger(A_stl,B_stl,X_stl,_size); - - typename Interface::real_type error= - STL_interface::norm_diff(X_stl,resu_stl); - - if (error>1.e-3){ - INFOS("WRONG CALCULATION...residual=" << error); -// exit(0); - } - - } - -private : - - typename Interface::stl_matrix A_stl; - typename Interface::stl_vector B_stl; - typename Interface::stl_vector X_stl; - typename Interface::stl_vector resu_stl; - - typename Interface::gene_matrix A_ref; - typename Interface::gene_vector B_ref; - typename Interface::gene_vector X_ref; - - typename Interface::gene_matrix A; - typename Interface::gene_vector B; - typename Interface::gene_vector X; - - int _size; -}; - - -#endif diff --git a/btl/actions/action_hessenberg.hh b/btl/actions/action_hessenberg.hh deleted file mode 100644 index 2100ebd..0000000 --- a/btl/actions/action_hessenberg.hh +++ /dev/null @@ -1,233 +0,0 @@ -//===================================================== -// File : action_hessenberg.hh -// Copyright (C) 2008 Gael Guennebaud -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_HESSENBERG -#define ACTION_HESSENBERG -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_hessenberg { - -public : - - // Ctor - - Action_hessenberg( int size ):_size(size) - { - MESSAGE("Action_hessenberg Ctor"); - - // STL vector initialization - init_matrix(X_stl,_size); - - init_matrix(C_stl,_size); - init_matrix(resu_stl,_size); - - // generic matrix and vector initialization - Interface::matrix_from_stl(X_ref,X_stl); - Interface::matrix_from_stl(X,X_stl); - Interface::matrix_from_stl(C,C_stl); - - _cost = 0; - for (int j=0; j<_size-2; ++j) - { - double r = std::max(0,_size-j-1); - double b = std::max(0,_size-j-2); - _cost += 6 + 3*b + r*r*4 + r*_size*4; - } - } - - // invalidate copy ctor - - Action_hessenberg( const Action_hessenberg & ) - { - INFOS("illegal call to Action_hessenberg Copy Ctor"); - exit(1); - } - - // Dtor - - ~Action_hessenberg( void ){ - - MESSAGE("Action_hessenberg Dtor"); - - // deallocation - Interface::free_matrix(X_ref,_size); - Interface::free_matrix(X,_size); - Interface::free_matrix(C,_size); - } - - // action name - - static inline std::string name( void ) - { - return "hessenberg_"+Interface::name(); - } - - double nb_op_base( void ){ - return _cost; - } - - inline void initialize( void ){ - Interface::copy_matrix(X_ref,X,_size); - } - - inline void calculate( void ) { - Interface::hessenberg(X,C,_size); - } - - void check_result( void ){ - // calculation check - Interface::matrix_to_stl(C,resu_stl); - -// STL_interface::hessenberg(X_stl,C_stl,_size); -// -// typename Interface::real_type error= -// STL_interface::norm_diff(C_stl,resu_stl); -// -// if (error>1.e-6){ -// INFOS("WRONG CALCULATION...residual=" << error); -// exit(0); -// } - - } - -private : - - typename Interface::stl_matrix X_stl; - typename Interface::stl_matrix C_stl; - typename Interface::stl_matrix resu_stl; - - typename Interface::gene_matrix X_ref; - typename Interface::gene_matrix X; - typename Interface::gene_matrix C; - - int _size; - double _cost; -}; - -template -class Action_tridiagonalization { - -public : - - // Ctor - - Action_tridiagonalization( int size ):_size(size) - { - MESSAGE("Action_tridiagonalization Ctor"); - - // STL vector initialization - init_matrix(X_stl,_size); - - for(int i=0; i<_size; ++i) - { - for(int j=0; j(C_stl,_size); - init_matrix(resu_stl,_size); - - // generic matrix and vector initialization - Interface::matrix_from_stl(X_ref,X_stl); - Interface::matrix_from_stl(X,X_stl); - Interface::matrix_from_stl(C,C_stl); - - _cost = 0; - for (int j=0; j<_size-2; ++j) - { - double r = std::max(0,_size-j-1); - double b = std::max(0,_size-j-2); - _cost += 6. + 3.*b + r*r*8.; - } - } - - // invalidate copy ctor - - Action_tridiagonalization( const Action_tridiagonalization & ) - { - INFOS("illegal call to Action_tridiagonalization Copy Ctor"); - exit(1); - } - - // Dtor - - ~Action_tridiagonalization( void ){ - - MESSAGE("Action_tridiagonalization Dtor"); - - // deallocation - Interface::free_matrix(X_ref,_size); - Interface::free_matrix(X,_size); - Interface::free_matrix(C,_size); - } - - // action name - - static inline std::string name( void ) { return "tridiagonalization_"+Interface::name(); } - - double nb_op_base( void ){ - return _cost; - } - - inline void initialize( void ){ - Interface::copy_matrix(X_ref,X,_size); - } - - inline void calculate( void ) { - Interface::tridiagonalization(X,C,_size); - } - - void check_result( void ){ - // calculation check - Interface::matrix_to_stl(C,resu_stl); - -// STL_interface::tridiagonalization(X_stl,C_stl,_size); -// -// typename Interface::real_type error= -// STL_interface::norm_diff(C_stl,resu_stl); -// -// if (error>1.e-6){ -// INFOS("WRONG CALCULATION...residual=" << error); -// exit(0); -// } - - } - -private : - - typename Interface::stl_matrix X_stl; - typename Interface::stl_matrix C_stl; - typename Interface::stl_matrix resu_stl; - - typename Interface::gene_matrix X_ref; - typename Interface::gene_matrix X; - typename Interface::gene_matrix C; - - int _size; - double _cost; -}; - -#endif diff --git a/btl/actions/action_least_squares.hh b/btl/actions/action_least_squares.hh deleted file mode 100644 index f13c7dc..0000000 --- a/btl/actions/action_least_squares.hh +++ /dev/null @@ -1,137 +0,0 @@ -//===================================================== -// Copyright (C) 2011 Andrea Arteaga -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_LEAST_SQUARES -#define ACTION_LEAST_SQUARES - -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_least_squares { - -public: - - // Ctor - Action_least_squares( int size ) : _size(size) - { - MESSAGE("Action_least_squares Ctor"); - - // STL matrix and vector initialization - - init_matrix(A_stl,_size); - init_vector(B_stl,_size); - init_vector(X_stl,_size); - init_vector(resu_stl,_size); - - // generic matrix and vector initialization - - Interface::matrix_from_stl(A_ref,A_stl); - Interface::matrix_from_stl(A,A_stl); - Interface::vector_from_stl(B_ref,B_stl); - Interface::vector_from_stl(B,B_stl); - Interface::vector_from_stl(X_ref,X_stl); - Interface::vector_from_stl(X,X_stl); - - - } - - // invalidate copy ctor - - Action_least_squares( const Action_least_squares & ) - { - INFOS("illegal call to Action_least_squares Copy Ctor"); - exit(0); - } - - // Dtor - - BTL_DONT_INLINE ~Action_least_squares( void ){ - - MESSAGE("Action_least_squares Dtor"); - - // deallocation - - Interface::free_matrix(A,_size); - Interface::free_vector(B); - Interface::free_vector(X); - - Interface::free_matrix(A_ref,_size); - Interface::free_vector(B_ref); - Interface::free_vector(X_ref); - - } - - // action name - - static inline std::string name( void ) - { - return "least_squares_" + Interface::name(); - } - - double nb_op_base( void ){ - return 2.0*_size*_size*_size; - } - - BTL_DONT_INLINE void initialize( void ){ - - Interface::copy_matrix(A_ref,A,_size); - Interface::copy_vector(B_ref,B,_size); - Interface::copy_vector(X_ref,X,_size); - - } - - BTL_DONT_INLINE void calculate( void ) { - BTL_ASM_COMMENT("#begin least_squares"); - Interface::least_squares(A,B,X,_size); - BTL_ASM_COMMENT("end least_squares"); - } - - BTL_DONT_INLINE void check_result() { - // TODO: check result - } - - -private: - - typename Interface::stl_matrix A_stl; - typename Interface::stl_vector B_stl; - typename Interface::stl_vector X_stl; - typename Interface::stl_vector resu_stl; - - typename Interface::gene_matrix A_ref; - typename Interface::gene_vector B_ref; - typename Interface::gene_vector X_ref; - - typename Interface::gene_matrix A; - typename Interface::gene_vector B; - typename Interface::gene_vector X; - - - int _size; - - -}; - - -#endif // ACTION_LEAST_SQUARES diff --git a/btl/actions/action_lu_decomp.hh b/btl/actions/action_lu_decomp.hh deleted file mode 100644 index 770c87d..0000000 --- a/btl/actions/action_lu_decomp.hh +++ /dev/null @@ -1,109 +0,0 @@ -//===================================================== -// File : action_lu_decomp.hh -// Copyright (C) 2008 Gael Guennebaud -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_LU_DECOMP -#define ACTION_LU_DECOMP -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_lu_decomp { - -public : - - // Ctor - - Action_lu_decomp( int size ):_size(size) - { - MESSAGE("Action_lu_decomp Ctor"); - - // STL vector initialization - init_matrix(X_stl,_size); - - init_matrix(C_stl,_size); - - // generic matrix and vector initialization - Interface::matrix_from_stl(X_ref,X_stl); - Interface::matrix_from_stl(X,X_stl); - Interface::matrix_from_stl(C,C_stl); - - _cost = 2.0*size*size*size/3.0 + size*size; - } - - // invalidate copy ctor - - Action_lu_decomp( const Action_lu_decomp & ) - { - INFOS("illegal call to Action_lu_decomp Copy Ctor"); - exit(1); - } - - // Dtor - - ~Action_lu_decomp( void ){ - - MESSAGE("Action_lu_decomp Dtor"); - - // deallocation - Interface::free_matrix(X_ref,_size); - Interface::free_matrix(X,_size); - Interface::free_matrix(C,_size); - } - - // action name - - static inline std::string name( void ) - { - return "lu_decomp_"+Interface::name(); - } - - double nb_op_base( void ){ - return _cost; - } - - inline void initialize( void ){ - Interface::copy_matrix(X_ref,X,_size); - } - - inline void calculate( void ) { - Interface::lu_decomp(X,C,_size); - } - - void check_result( void ){ - } - -private : - - typename Interface::stl_matrix X_stl; - typename Interface::stl_matrix C_stl; - - typename Interface::gene_matrix X_ref; - typename Interface::gene_matrix X; - typename Interface::gene_matrix C; - - int _size; - double _cost; -}; - -#endif diff --git a/btl/actions/action_lu_solve.hh b/btl/actions/action_lu_solve.hh deleted file mode 100644 index 5a81e63..0000000 --- a/btl/actions/action_lu_solve.hh +++ /dev/null @@ -1,136 +0,0 @@ -//===================================================== -// File : action_lu_solve.hh -// Author : L. Plagne -// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_LU_SOLVE -#define ACTION_LU_SOLVE -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_lu_solve -{ - -public : - - static inline std::string name( void ) - { - return "lu_solve_"+Interface::name(); - } - - static double nb_op_base(int size){ - return 2.0*size*size*size/3.0; // questionable but not really important - } - - - static double calculate( int nb_calc, int size ) { - - // STL matrix and vector initialization - - typename Interface::stl_matrix A_stl; - typename Interface::stl_vector B_stl; - typename Interface::stl_vector X_stl; - - init_matrix(A_stl,size); - init_vector(B_stl,size); - init_vector(X_stl,size); - - // generic matrix and vector initialization - - typename Interface::gene_matrix A; - typename Interface::gene_vector B; - typename Interface::gene_vector X; - - typename Interface::gene_matrix LU; - - Interface::matrix_from_stl(A,A_stl); - Interface::vector_from_stl(B,B_stl); - Interface::vector_from_stl(X,X_stl); - Interface::matrix_from_stl(LU,A_stl); - - // local variable : - - typename Interface::Pivot_Vector pivot; // pivot vector - Interface::new_Pivot_Vector(pivot,size); - - // timer utilities - - Portable_Timer chronos; - - // time measurement - - chronos.start(); - - for (int ii=0;ii::matrix_vector_product(A_stl,X_stl,B_new_stl,size); - - typename Interface::real_type error= - STL_interface::norm_diff(B_stl,B_new_stl); - - if (error>1.e-5){ - INFOS("WRONG CALCULATION...residual=" << error); - STL_interface::display_vector(B_stl); - STL_interface::display_vector(B_new_stl); - exit(0); - } - - // deallocation and return time - - Interface::free_matrix(A,size); - Interface::free_vector(B); - Interface::free_vector(X); - Interface::free_Pivot_Vector(pivot); - - return time; - } - -}; - - -#endif - - - diff --git a/btl/actions/action_matrix_matrix_product.hh b/btl/actions/action_matrix_matrix_product.hh deleted file mode 100644 index f65ee05..0000000 --- a/btl/actions/action_matrix_matrix_product.hh +++ /dev/null @@ -1,150 +0,0 @@ -//===================================================== -// File : action_matrix_matrix_product.hh -// Author : L. Plagne -// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_MATRIX_MATRIX_PRODUCT -#define ACTION_MATRIX_MATRIX_PRODUCT -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_matrix_matrix_product { - -public : - - // Ctor - - Action_matrix_matrix_product( int size ):_size(size) - { - MESSAGE("Action_matrix_matrix_product Ctor"); - - // STL matrix and vector initialization - - init_matrix(A_stl,_size); - init_matrix(B_stl,_size); - init_matrix(X_stl,_size); - init_matrix(resu_stl,_size); - - // generic matrix and vector initialization - - Interface::matrix_from_stl(A_ref,A_stl); - Interface::matrix_from_stl(B_ref,B_stl); - Interface::matrix_from_stl(X_ref,X_stl); - - Interface::matrix_from_stl(A,A_stl); - Interface::matrix_from_stl(B,B_stl); - Interface::matrix_from_stl(X,X_stl); - - } - - // invalidate copy ctor - - Action_matrix_matrix_product( const Action_matrix_matrix_product & ) - { - INFOS("illegal call to Action_matrix_matrix_product Copy Ctor"); - exit(0); - } - - // Dtor - - ~Action_matrix_matrix_product( void ){ - - MESSAGE("Action_matrix_matrix_product Dtor"); - - // deallocation - - Interface::free_matrix(A,_size); - Interface::free_matrix(B,_size); - Interface::free_matrix(X,_size); - - Interface::free_matrix(A_ref,_size); - Interface::free_matrix(B_ref,_size); - Interface::free_matrix(X_ref,_size); - - } - - // action name - - static inline std::string name( void ) - { - return "matrix_matrix_"+Interface::name(); - } - - double nb_op_base( void ){ - return 2.0*_size*_size*_size; - } - - inline void initialize( void ){ - - Interface::copy_matrix(A_ref,A,_size); - Interface::copy_matrix(B_ref,B,_size); - Interface::copy_matrix(X_ref,X,_size); - - } - - inline void calculate( void ) { - Interface::matrix_matrix_product(A,B,X,_size); - } - - void check_result( void ){ - - // calculation check - if (_size<200) - { - Interface::matrix_to_stl(X,resu_stl); - STL_interface::matrix_matrix_product(A_stl,B_stl,X_stl,_size); - typename Interface::real_type error= - STL_interface::norm_diff(X_stl,resu_stl); - if (error>1.e-6){ - INFOS("WRONG CALCULATION...residual=" << error); - exit(1); - } - } - } - -private : - - typename Interface::stl_matrix A_stl; - typename Interface::stl_matrix B_stl; - typename Interface::stl_matrix X_stl; - typename Interface::stl_matrix resu_stl; - - typename Interface::gene_matrix A_ref; - typename Interface::gene_matrix B_ref; - typename Interface::gene_matrix X_ref; - - typename Interface::gene_matrix A; - typename Interface::gene_matrix B; - typename Interface::gene_matrix X; - - - int _size; - -}; - - -#endif - - - diff --git a/btl/actions/action_matrix_matrix_product_bis.hh b/btl/actions/action_matrix_matrix_product_bis.hh deleted file mode 100644 index 29c10a6..0000000 --- a/btl/actions/action_matrix_matrix_product_bis.hh +++ /dev/null @@ -1,152 +0,0 @@ -//===================================================== -// File : action_matrix_matrix_product_bis.hh -// Author : L. Plagne -// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_MATRIX_MATRIX_PRODUCT_BIS -#define ACTION_MATRIX_MATRIX_PRODUCT_BIS -#include "utilities.h" -#include "STL_interface.hh" -#include "STL_timer.hh" -#include -#include "init_function.hh" -#include "init_vector.hh" -#include "init_matrix.hh" - -using namespace std; - -template -class Action_matrix_matrix_product_bis { - -public : - - static inline std::string name( void ) - { - return "matrix_matrix_"+Interface::name(); - } - - static double nb_op_base(int size){ - return 2.0*size*size*size; - } - - static double calculate( int nb_calc, int size ) { - - // STL matrix and vector initialization - - typename Interface::stl_matrix A_stl; - typename Interface::stl_matrix B_stl; - typename Interface::stl_matrix X_stl; - - init_matrix(A_stl,size); - init_matrix(B_stl,size); - init_matrix(X_stl,size); - - // generic matrix and vector initialization - - typename Interface::gene_matrix A_ref; - typename Interface::gene_matrix B_ref; - typename Interface::gene_matrix X_ref; - - typename Interface::gene_matrix A; - typename Interface::gene_matrix B; - typename Interface::gene_matrix X; - - - Interface::matrix_from_stl(A_ref,A_stl); - Interface::matrix_from_stl(B_ref,B_stl); - Interface::matrix_from_stl(X_ref,X_stl); - - Interface::matrix_from_stl(A,A_stl); - Interface::matrix_from_stl(B,B_stl); - Interface::matrix_from_stl(X,X_stl); - - - // STL_timer utilities - - STL_timer chronos; - - // Baseline evaluation - - chronos.start_baseline(nb_calc); - - do { - - Interface::copy_matrix(A_ref,A,size); - Interface::copy_matrix(B_ref,B,size); - Interface::copy_matrix(X_ref,X,size); - - - // Interface::matrix_matrix_product(A,B,X,size); This line must be commented !!!! - } - while(chronos.check()); - - chronos.report(true); - - // Time measurement - - chronos.start(nb_calc); - - do { - - Interface::copy_matrix(A_ref,A,size); - Interface::copy_matrix(B_ref,B,size); - Interface::copy_matrix(X_ref,X,size); - - Interface::matrix_matrix_product(A,B,X,size); // here it is not commented !!!! - } - while(chronos.check()); - - chronos.report(true); - - double time=chronos.calculated_time/2000.0; - - // calculation check - - typename Interface::stl_matrix resu_stl(size); - - Interface::matrix_to_stl(X,resu_stl); - - STL_interface::matrix_matrix_product(A_stl,B_stl,X_stl,size); - - typename Interface::real_type error= - STL_interface::norm_diff(X_stl,resu_stl); - - if (error>1.e-6){ - INFOS("WRONG CALCULATION...residual=" << error); - exit(1); - } - - // deallocation and return time - - Interface::free_matrix(A,size); - Interface::free_matrix(B,size); - Interface::free_matrix(X,size); - - Interface::free_matrix(A_ref,size); - Interface::free_matrix(B_ref,size); - Interface::free_matrix(X_ref,size); - - return time; - } - -}; - - -#endif - - - diff --git a/btl/actions/action_matrix_vector_product.hh b/btl/actions/action_matrix_vector_product.hh deleted file mode 100644 index 8bab79d..0000000 --- a/btl/actions/action_matrix_vector_product.hh +++ /dev/null @@ -1,153 +0,0 @@ -//===================================================== -// File : action_matrix_vector_product.hh -// Author : L. Plagne -// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_MATRIX_VECTOR_PRODUCT -#define ACTION_MATRIX_VECTOR_PRODUCT -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_matrix_vector_product { - -public : - - // Ctor - - BTL_DONT_INLINE Action_matrix_vector_product( int size ):_size(size) - { - MESSAGE("Action_matrix_vector_product Ctor"); - - // STL matrix and vector initialization - - init_matrix(A_stl,_size); - init_vector(B_stl,_size); - init_vector(X_stl,_size); - init_vector(resu_stl,_size); - - // generic matrix and vector initialization - - Interface::matrix_from_stl(A_ref,A_stl); - Interface::matrix_from_stl(A,A_stl); - Interface::vector_from_stl(B_ref,B_stl); - Interface::vector_from_stl(B,B_stl); - Interface::vector_from_stl(X_ref,X_stl); - Interface::vector_from_stl(X,X_stl); - - } - - // invalidate copy ctor - - Action_matrix_vector_product( const Action_matrix_vector_product & ) - { - INFOS("illegal call to Action_matrix_vector_product Copy Ctor"); - exit(1); - } - - // Dtor - - BTL_DONT_INLINE ~Action_matrix_vector_product( void ){ - - MESSAGE("Action_matrix_vector_product Dtor"); - - // deallocation - - Interface::free_matrix(A,_size); - Interface::free_vector(B); - Interface::free_vector(X); - - Interface::free_matrix(A_ref,_size); - Interface::free_vector(B_ref); - Interface::free_vector(X_ref); - - } - - // action name - - static inline std::string name( void ) - { - return "matrix_vector_" + Interface::name(); - } - - double nb_op_base( void ){ - return 2.0*_size*_size; - } - - BTL_DONT_INLINE void initialize( void ){ - - Interface::copy_matrix(A_ref,A,_size); - Interface::copy_vector(B_ref,B,_size); - Interface::copy_vector(X_ref,X,_size); - - } - - BTL_DONT_INLINE void calculate( void ) { - BTL_ASM_COMMENT("#begin matrix_vector_product"); - Interface::matrix_vector_product(A,B,X,_size); - BTL_ASM_COMMENT("end matrix_vector_product"); - } - - BTL_DONT_INLINE void check_result( void ){ - - // calculation check - - Interface::vector_to_stl(X,resu_stl); - - STL_interface::matrix_vector_product(A_stl,B_stl,X_stl,_size); - - typename Interface::real_type error= - STL_interface::norm_diff(X_stl,resu_stl); - - if (error>1.e-5){ - INFOS("WRONG CALCULATION...residual=" << error); - exit(0); - } - - } - -private : - - typename Interface::stl_matrix A_stl; - typename Interface::stl_vector B_stl; - typename Interface::stl_vector X_stl; - typename Interface::stl_vector resu_stl; - - typename Interface::gene_matrix A_ref; - typename Interface::gene_vector B_ref; - typename Interface::gene_vector X_ref; - - typename Interface::gene_matrix A; - typename Interface::gene_vector B; - typename Interface::gene_vector X; - - - int _size; - -}; - - -#endif - - - diff --git a/btl/actions/action_parallel_axpy.hh b/btl/actions/action_parallel_axpy.hh deleted file mode 100644 index 5053446..0000000 --- a/btl/actions/action_parallel_axpy.hh +++ /dev/null @@ -1,158 +0,0 @@ -//===================================================== -// Copyright (C) 2011 Andrea Arteaga -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_PARALLEL_AXPY -#define ACTION_PARALLEL_AXPY -#include "utilities.h" -#include "STL_interface.hh" -#include -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -#include "blas.h" - -using namespace std; - -template -class Action_parallel_axpy { -public: - BTL_DONT_INLINE Action_parallel_axpy( int size ):_size(size), _coef(1.) - { - MESSAGE("Action_parallel_axpy Ctor"); - int iZERO = 0, iONE = 1; - - GlobalRows = _size; - GlobalCols = 1; - BlockRows = 2; - BlockCols= 1; - - int myid, procnum; - blacs_pinfo_(&myid, &procnum); - iamroot = (myid == 0); - - // STL matrix and vector initialization - if (iamroot) { - init_vector(Global_x_stl, _size); - init_vector(Global_y_stl, _size); - } - - Interface::scatter_matrix(Global_x_stl, Local_x_stl, GlobalRows, GlobalCols, BlockRows, BlockCols, LocalRows, LocalCols); - Interface::scatter_matrix(Global_y_stl, Local_y_stl, GlobalRows, GlobalCols, BlockRows, BlockCols, LocalRows, LocalCols); - - Interface::vector_from_stl(Local_x_ref, Local_x_stl); - Interface::vector_from_stl(Local_x , Local_x_stl); - Interface::vector_from_stl(Local_y_ref, Local_y_stl); - Interface::vector_from_stl(Local_y , Local_y_stl); - - // Descinit - int context = Interface::context(); - int info; - int LD = std::max(1, LocalRows); - descinit_(descX, &_size, &iONE, &BlockRows, &BlockCols, &iZERO, &iZERO, &context, &LD, &info); - descinit_(descY, &_size, &iONE, &BlockRows, &BlockCols, &iZERO, &iZERO, &context, &LD, &info); - - // Copy Y to Test_y - Test_y_stl = Global_y_stl; - } - - // Invalidate copy constructor - Action_parallel_axpy (const Action_parallel_axpy&) - { - INFOS("illegal call to Action_parallel_axpy Copy Ctor"); - exit(1); - } - - // Destructor - BTL_DONT_INLINE ~Action_parallel_axpy(){ - - MESSAGE("Action_parallel_axpy Dtor"); - - // deallocation - - Interface::free_vector(Local_x_ref); - Interface::free_vector(Local_y_ref); - - Interface::free_vector(Local_x); - Interface::free_vector(Local_y); - } - - // action name - static inline std::string name() - { - return "axpy_" + Interface::name(); - } - - double nb_op_base( void ){ - return 2.0*_size; - } - - BTL_DONT_INLINE void initialize(){ - Interface::copy_vector(Local_x_ref, Local_x, LocalRows*LocalCols); - Interface::copy_vector(Local_y_ref, Local_y, LocalRows*LocalCols); - } - - BTL_DONT_INLINE void calculate( void ) { - BTL_ASM_COMMENT("#begin axpy"); - Interface::parallel_axpy(_coef, Local_x, descX, Local_y, descY, _size); - BTL_ASM_COMMENT("end axpy"); - } - - void check_result( void ){ - int iONE = 1; - Interface::vector_to_stl(Local_y, Local_y_stl); - Interface::gather_matrix(Global_y_stl, Local_y_stl, GlobalRows, GlobalCols, BlockRows, BlockCols, LocalRows, LocalCols); - - // calculation check - if (iamroot) { - - // Compute YTest - STL_interface::axpy(_coef, Global_x_stl, Test_y_stl, _size); - - typename Interface::real_type error = - STL_interface::norm_diff(Global_y_stl, Test_y_stl); - - if (error > 1e-5) - std::cerr << "Error: " << error << std::endl; - } - - } - -private: - int _size; - int GlobalRows, GlobalCols, BlockRows, BlockCols, LocalRows, LocalCols; - typename Interface::real_type _coef; - bool iamroot; - - typename Interface::stl_vector Global_x_stl; - typename Interface::stl_vector Global_y_stl; - typename Interface::stl_vector Test_y_stl; - - typename Interface::stl_vector Local_x_stl; - typename Interface::stl_vector Local_y_stl; - - typename Interface::gene_vector Local_x_ref; - typename Interface::gene_vector Local_y_ref; - - typename Interface::gene_vector Local_x; - typename Interface::gene_vector Local_y; - - int descX[9], descY[9]; -}; - -#endif diff --git a/btl/actions/action_parallel_cholesky.hh b/btl/actions/action_parallel_cholesky.hh deleted file mode 100644 index d6bef14..0000000 --- a/btl/actions/action_parallel_cholesky.hh +++ /dev/null @@ -1,130 +0,0 @@ -//===================================================== -// Copyright (C) 2011 Andrea Arteaga -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_PARALLEL_CHOLESKY_HH_ -#define ACTION_PARALLEL_CHOLESKY_HH_ - -#include "utilities.h" -#include "init/init_function.hh" -#include "init/init_vector.hh" - -#include "lapack_interface.hh" -#include "STL_interface.hh" - -#include -#include -#include - -template -class Action_parallel_cholesky { - typedef lapack_interface LapackInterface; - -public : - - // Constructor - BTL_DONT_INLINE Action_parallel_cholesky( int size ) : _size(size) - { - MESSAGE("Action_parallel_cholesky Ctor"); - - int myid, procnum; - blacs_pinfo_(&myid, &procnum); - iamroot = (myid == 0); - - // STL matrix and vector initialization - if (iamroot) { - /* Using a constant seed */ - const unsigned seed = 3; - init_SPD_matrix(Global_A_stl, size, seed); - } - - const int blocksize = std::max(std::min(size/4, 64), 2); - scatter_matrix(Global_A_stl, Local_A_stl, desc, size, size, blocksize, blocksize); - LocalRows = desc[8]; - LocalCols = Local_A_stl.size()/desc[8]; - - // Generic local matrix and vectors initialization - Interface::matrix_from_stl(Local_A , Local_A_stl); - - _cost = 0; - for (int j=0; j<_size; ++j) { - double r = std::max(_size - j -1,0); - _cost += 2*(r*j+r+j); - } - } - - - // Invalidate copy constructor - Action_parallel_cholesky(const Action_parallel_cholesky&) - { - INFOS("illegal call to Action_parallel_cholesky copy constructor"); - exit(1); - } - - // Destructor - ~Action_parallel_cholesky() - { - MESSAGE("Action_parallel_cholesky destructor"); - - // Deallocation - Interface::free_matrix(Local_A , Local_A_stl.size()); - } - - // Action name - static inline std::string name() - { - return "cholesky_" + Interface::name(); - } - - double nb_op_base() - { - return _cost; - } - - BTL_DONT_INLINE void initialize() - { - } - - BTL_DONT_INLINE void calculate() - { - Interface::copy_matrix(&Local_A_stl[0], Local_A, Local_A_stl.size()); - Interface::parallel_cholesky(Local_A, desc); - } - - BTL_DONT_INLINE void check_result() - { - if (_size > 2) { - double error = Interface::test_cholesky(Global_A_stl, Local_A, desc); - if (iamroot) - cout << " {error: " << error << "} "; - } - } - - -private: - int _size, desc[9], LocalRows, LocalCols; - double _cost; - bool iamroot; - - typename Interface::stl_matrix Global_A_stl; - typename Interface::stl_matrix Local_A_stl; - typename Interface::gene_matrix Local_A; - - typename Interface::stl_matrix Glotal_Test_stl; - typename Interface::stl_matrix Local_Test_stl; -}; - -#endif /* ACTION_PARALLEL_CHOLESKY_HH_ */ diff --git a/btl/actions/action_parallel_lu_decomp.hh b/btl/actions/action_parallel_lu_decomp.hh deleted file mode 100644 index a6b3600..0000000 --- a/btl/actions/action_parallel_lu_decomp.hh +++ /dev/null @@ -1,142 +0,0 @@ -//===================================================== -// Copyright (C) 2011 Andrea Arteaga -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_PARALLEL_LU_DECOMP_HH_ -#define ACTION_PARALLEL_LU_DECOMP_HH_ - -#include "utilities.h" -#include "init/init_function.hh" -#include "init/init_vector.hh" - -#include "lapack_interface.hh" -#include "STL_interface.hh" - -#include - -template -class Action_parallel_lu_decomp { - -public : - - // Constructor - BTL_DONT_INLINE Action_parallel_lu_decomp( int size ) : _size(size) - { - MESSAGE("Action_parallel_lu_decomp Ctor"); - - int myid, procnum; - blacs_pinfo_(&myid, &procnum); - iamroot = (myid == 0); - - // STL matrix and vector initialization - if (iamroot) { - /* Using a constant seed */ - const unsigned seed = 3; - init_matrix(Global_A_stl, size, seed); - } - - const int blocksize = std::max(std::min(size/4, 64), 2); - scatter_matrix(Global_A_stl, Local_A_stl, desc, size, size, blocksize, blocksize); - LocalRows = desc[8]; - LocalCols = Local_A_stl.size()/desc[8]; - - // Generic local matrix and vectors initialization - Interface::matrix_from_stl(Local_A , Local_A_stl); - - _cost = 2.0*size*size*size/3.0 + static_cast(size*size); - } - - - // Invalidate copy constructor - Action_parallel_lu_decomp(const Action_parallel_lu_decomp&) - { - INFOS("illegal call to Action_parallel_lu_decomp copy constructor"); - exit(1); - } - - // Destructor - ~Action_parallel_lu_decomp() - { - MESSAGE("Action_parallel_lu_decomp destructor"); - - // Deallocation - Interface::free_matrix(Local_A , Local_A_stl.size()); - } - - // Action name - static inline std::string name() - { - return "lu_decomp_" + Interface::name(); - } - - double nb_op_base() - { - return _cost; - } - - BTL_DONT_INLINE void initialize() - { - } - - BTL_DONT_INLINE void calculate() - { - Interface::copy_matrix(&Local_A_stl[0], Local_A, Local_A_stl.size()); - Interface::parallel_lu_decomp(Local_A, ipiv_stl, desc); - } - - BTL_DONT_INLINE void check_result() - { -// /* Gather */ -// typename Interface::stl_matrix Global_Y; -// typename Interface::stl_matrix Local_Y(Local_A_stl.size()); -// Interface::matrix_to_stl(Local_A, Local_Y); -// Interface::gather_matrix(Global_Y, Local_Y, desc); -// -// if (iamroot) { -// -// typename Interface::gene_matrix A; -// Interface::matrix_from_stl(A, Global_A_stl); -// lapack_interface::lu_decomp(&Global_A_stl[0], A, _size); -// typename Interface::stl_vector correct(A, A+_size*_size); -// typename Interface::real_type error = STL_interface::norm_diff(Global_Y, correct); -// if (error > 10e-5) -// cerr << " { !! error : " << error << " !! } "; -// -// Interface::free_matrix(A, _size*_size); -// } - - -// if (_size > 2) { -// double error = Interface::test_LU(Global_A_stl, Local_A, desc); -// if (iamroot) -// cout << " {error: " << error << "} "; -// } - } - -private: - int _size, desc[9], LocalRows, LocalCols; - double _cost; - bool iamroot; - - typename Interface::stl_matrix Global_A_stl; - typename Interface::stl_matrix Local_A_stl; - typename Interface::gene_matrix Local_A; - - std::vector ipiv_stl; -}; - - -#endif /* ACTION_PARALLEL_LU_DECOMP_HH_ */ diff --git a/btl/actions/action_parallel_matrix_vector_product.hh b/btl/actions/action_parallel_matrix_vector_product.hh deleted file mode 100644 index 51eafb9..0000000 --- a/btl/actions/action_parallel_matrix_vector_product.hh +++ /dev/null @@ -1,159 +0,0 @@ -//===================================================== -// Copyright (C) 2011 Andrea Arteaga -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_PARALLEL_MATRIX_VECTOR_PRODUCT -#define ACTION_PARALLEL_MATRIX_VECTOR_PRODUCT -#include "utilities.h" -#include "STL_interface.hh" -#include -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -#include "blas.h" - -template -class Action_parallel_matrix_vector_product { - -public : - - // Ctor - - BTL_DONT_INLINE Action_parallel_matrix_vector_product( int size ):_size(size) - { - MESSAGE("Action_parallel_matrix_vector_product Ctor"); - int iZERO = 0, iONE = 1; - - int myid, procnum; - blacs_pinfo_(&myid, &procnum); - iamroot = (myid == 0); - - // STL matrix and vector initialization - if (iamroot) { - init_vector(Global_A_stl, size*size); - init_vector(Global_x_stl, size); - init_vector(Global_y_stl, size); - } - - const int blocksize = std::max(std::min(size/4, 64), 2); - Interface::scatter_matrix(Global_A_stl, Local_A_stl, descA, size, size, blocksize, blocksize); - Interface::scatter_matrix(Global_x_stl, Local_x_stl, descX, size, 1, blocksize, blocksize); - Interface::scatter_matrix(Global_y_stl, Local_y_stl, descY, size, 1, blocksize, blocksize); - - // generic local matrix and vectors initialization - - Interface::matrix_from_stl(Local_A_ref, Local_A_stl); - Interface::matrix_from_stl(Local_A , Local_A_stl); - Interface::vector_from_stl(Local_x_ref, Local_x_stl); - Interface::vector_from_stl(Local_x , Local_x_stl); - Interface::vector_from_stl(Local_y_ref, Local_y_stl); - Interface::vector_from_stl(Local_y , Local_y_stl); - } - - // invalidate copy ctor - Action_parallel_matrix_vector_product( const Action_parallel_matrix_vector_product & ) - { - INFOS("illegal call to Action_parallel_matrix_vector_product copy constructor"); - exit(1); - } - - // Dtor - BTL_DONT_INLINE ~Action_parallel_matrix_vector_product(){ - - MESSAGE("Action_parallel_matrix_vector_product destructor"); - - // deallocation - - Interface::free_matrix(Local_A_ref, _size*_size); - Interface::free_vector(Local_x_ref); - Interface::free_vector(Local_y_ref); - - Interface::free_matrix(Local_A, _size*_size); - Interface::free_vector(Local_x); - Interface::free_vector(Local_y); - - } - - // action name - static inline std::string name( void ) - { - return "matrix_vector_" + Interface::name(); - } - - double nb_op_base( void ){ - return 2.0*_size*_size; - } - - BTL_DONT_INLINE void initialize( void ){ - Interface::copy_matrix(Local_A_ref, Local_A, Local_A_stl.size()); - Interface::copy_vector(Local_x_ref, Local_x, Local_x_stl.size()); - Interface::copy_vector(Local_y_ref, Local_y, Local_y_stl.size()); - } - - BTL_DONT_INLINE void calculate( void ) { - Interface::parallel_matrix_vector_product(_size, _size, Local_A, descA, Local_x, descX, Local_y, descY); - } - - BTL_DONT_INLINE void check_result( void ){ - int GlobalYCols; - Interface::vector_to_stl(Local_y, Local_y_stl); - - Interface::gather_matrix(Global_y_stl, Local_y_stl, descY); - - // calculation check - if (iamroot) { - - // Compute YTest - Test_y_stl.resize(_size); - STL_interface::matrix_vector_product(Global_A_stl, Global_x_stl, Test_y_stl, _size); - - typename Interface::real_type error = STL_interface::norm_diff(Global_y_stl, Test_y_stl); - - if (error > 1e-5) - std::cerr << "Error: " << error << " "; - } - - } - -private : - - typename Interface::stl_matrix Global_A_stl; - typename Interface::stl_vector Global_x_stl; - typename Interface::stl_vector Global_y_stl; - typename Interface::stl_vector Test_y_stl; - - typename Interface::stl_matrix Local_A_stl; - typename Interface::stl_vector Local_x_stl; - typename Interface::stl_vector Local_y_stl; - - typename Interface::gene_matrix Local_A_ref; - typename Interface::gene_vector Local_x_ref; - typename Interface::gene_vector Local_y_ref; - - typename Interface::gene_matrix Local_A; - typename Interface::gene_vector Local_x; - typename Interface::gene_vector Local_y; - - bool iamroot; - int _size; - int descA[9], descX[9], descY[9]; - -}; - - -#endif diff --git a/btl/actions/action_parallel_qr_decomp.hh b/btl/actions/action_parallel_qr_decomp.hh deleted file mode 100644 index 3c50fb4..0000000 --- a/btl/actions/action_parallel_qr_decomp.hh +++ /dev/null @@ -1,116 +0,0 @@ -//===================================================== -// Copyright (C) 2011 Andrea Arteaga -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_PARALLEL_QR_DECOMP_HH_ -#define ACTION_PARALLEL_QR_DECOMP_HH_ - -#include "utilities.h" -#include "init/init_function.hh" -#include "init/init_vector.hh" - -#include "lapack_interface.hh" -#include "STL_interface.hh" - -#include -#include - -template -class Action_parallel_qr_decomp { - -public : - - // Constructor - BTL_DONT_INLINE Action_parallel_qr_decomp( int size ) : _size(size) - { - MESSAGE("Action_parallel_qr_decomp Ctor"); - - int myid, procnum; - blacs_pinfo_(&myid, &procnum); - iamroot = (myid == 0); - - // STL matrix and vector initialization - if (iamroot) { - /* Using a constant seed */ - const unsigned seed = 3; - init_matrix(Global_A_stl, size, seed); - } - - const int blocksize = std::max(std::min(size/4, 64), 2); - scatter_matrix(Global_A_stl, Local_A_stl, desc, size, size, blocksize, blocksize); - LocalRows = desc[8]; - LocalCols = Local_A_stl.size()/desc[8]; - - // Generic local matrix and vectors initialization - Interface::matrix_from_stl(Local_A , Local_A_stl); - - _cost = 2.0*size*size*size; - } - - - // Invalidate copy constructor - Action_parallel_qr_decomp(const Action_parallel_qr_decomp&) - { - INFOS("illegal call to Action_parallel_qr_decomp copy constructor"); - exit(1); - } - - // Destructor - ~Action_parallel_qr_decomp() - { - MESSAGE("Action_parallel_qr_decomp destructor"); - - // Deallocation - Interface::free_matrix(Local_A , Local_A_stl.size()); - } - - // Action name - static inline std::string name() - { - return "qr_decomp_" + Interface::name(); - } - - double nb_op_base() - { - return _cost; - } - - BTL_DONT_INLINE void initialize() - { - } - - BTL_DONT_INLINE void calculate() - { - Interface::copy_matrix(&Local_A_stl[0], Local_A, Local_A_stl.size()); - Interface::parallel_qr_decomp(Local_A, desc); - } - - BTL_DONT_INLINE void check_result() - { - } - -private: - int _size, desc[9], LocalRows, LocalCols; - double _cost; - bool iamroot; - - typename Interface::stl_matrix Global_A_stl; - typename Interface::stl_matrix Local_A_stl; - typename Interface::gene_matrix Local_A; -}; - - -#endif /* ACTION_PARALLEL_QR_DECOMP_HH_ */ diff --git a/btl/actions/action_parallel_svd_decomp.hh b/btl/actions/action_parallel_svd_decomp.hh deleted file mode 100644 index 3281886..0000000 --- a/btl/actions/action_parallel_svd_decomp.hh +++ /dev/null @@ -1,151 +0,0 @@ -//===================================================== -// Copyright (C) 2011 Andrea Arteaga -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_PARALLEL_SVD_DECOMP_HH_ -#define ACTION_PARALLEL_SVD_DECOMP_HH_ - -#include "utilities.h" -#include "init/init_function.hh" -#include "init/init_vector.hh" - -#include "lapack_interface.hh" -#include "STL_interface.hh" - -#include -#include - -template -class Action_parallel_svd_decomp { - -public : - - // Constructor - BTL_DONT_INLINE Action_parallel_svd_decomp( int size ) : _size(size) - { - MESSAGE("Action_parallel_svd_decomp Ctor"); - - int myid, procnum; - blacs_pinfo_(&myid, &procnum); - iamroot = (myid == 0); - - // STL matrix and vector initialization - if (iamroot) { - init_vector(Global_A_stl, size*size); - init_vector(Global_U_stl, size*size); - init_vector(Global_V_stl, size*size); - } - init_vector(Local_s_stl, size); - - const int blocksize = std::max(std::min(size/4, 64), 2); - Interface::scatter_matrix(Global_A_stl, Local_A_stl, descA, size, size, blocksize, blocksize); - Interface::scatter_matrix(Global_U_stl, Local_U_stl, descU, size, size, blocksize, blocksize); - Interface::scatter_matrix(Global_V_stl, Local_V_stl, descV, size, size, blocksize, blocksize); - LocalRows = descA[8]; - LocalCols = Local_A_stl.size()/descA[8]; - - // Generic local matrix and vectors initialization - Interface::matrix_from_stl(Local_A_ref, Local_A_stl); - Interface::matrix_from_stl(Local_A , Local_A_stl); - Interface::matrix_from_stl(Local_U_ref, Local_U_stl); - Interface::matrix_from_stl(Local_U , Local_U_stl); - Interface::matrix_from_stl(Local_V_ref, Local_V_stl); - Interface::matrix_from_stl(Local_V , Local_V_stl); - Interface::vector_from_stl(Local_s_ref, Local_s_stl); - Interface::vector_from_stl(Local_s , Local_s_stl); - - _cost = 2.0*size*size*size; - } - - - // Invalidate copy constructor - Action_parallel_svd_decomp(const Action_parallel_svd_decomp&) - { - INFOS("illegal call to Action_parallel_svd_decomp copy constructor"); - exit(1); - } - - // Destructor - ~Action_parallel_svd_decomp() - { - MESSAGE("Action_parallel_svd_decomp destructor"); - - // Deallocation - Interface::free_matrix(Local_A_ref, Local_A_stl.size()); - Interface::free_matrix(Local_A , Local_A_stl.size()); - Interface::free_matrix(Local_U_ref, Local_U_stl.size()); - Interface::free_matrix(Local_U , Local_U_stl.size()); - Interface::free_matrix(Local_V_ref, Local_V_stl.size()); - Interface::free_matrix(Local_V , Local_V_stl.size()); - Interface::free_vector(Local_s_ref); - Interface::free_vector(Local_s ); - } - - // Action name - static inline std::string name() - { - return "svd_decomp_" + Interface::name(); - } - - double nb_op_base() - { - return _cost; - } - - BTL_DONT_INLINE void initialize() - { - Interface::copy_matrix(Local_A_ref, Local_A, Local_A_stl.size()); - Interface::copy_matrix(Local_U_ref, Local_U, Local_U_stl.size()); - Interface::copy_matrix(Local_V_ref, Local_V, Local_V_stl.size()); - Interface::copy_vector(Local_s_ref, Local_s, Local_s_stl.size()); - } - - BTL_DONT_INLINE void calculate() - { - Interface::parallel_svd_decomp(Local_A, descA, Local_U, descU, Local_V, descV, Local_s); - } - - BTL_DONT_INLINE void check_result() - { - } - -private: - int _size, descA[9], descU[9], descV[9], LocalRows, LocalCols; - double _cost; - bool iamroot; - - typename Interface::stl_matrix Global_A_stl; - typename Interface::stl_matrix Local_A_stl; - typename Interface::gene_matrix Local_A_ref; - typename Interface::gene_matrix Local_A; - - typename Interface::stl_matrix Global_U_stl; - typename Interface::stl_matrix Local_U_stl; - typename Interface::gene_matrix Local_U_ref; - typename Interface::gene_matrix Local_U; - - typename Interface::stl_matrix Global_V_stl; - typename Interface::stl_matrix Local_V_stl; - typename Interface::gene_matrix Local_V_ref; - typename Interface::gene_matrix Local_V; - - typename Interface::stl_vector Local_s_stl; - typename Interface::gene_vector Local_s_ref; - typename Interface::gene_vector Local_s; -}; - - -#endif /* ACTION_PARALLEL_SVD_DECOMP_HH */ diff --git a/btl/actions/action_parallel_symm_ev.hh b/btl/actions/action_parallel_symm_ev.hh deleted file mode 100644 index 85a1d13..0000000 --- a/btl/actions/action_parallel_symm_ev.hh +++ /dev/null @@ -1,138 +0,0 @@ -//===================================================== -// Copyright (C) 2011 Andrea Arteaga -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_PARALLEL_SYMM_EV_HH_ -#define ACTION_PARALLEL_SYMM_EV_HH_ - -#include "utilities.h" -#include "init/init_function.hh" -#include "init/init_vector.hh" - -#include "lapack_interface.hh" -#include "STL_interface.hh" - -#include - -template -class Action_parallel_symm_ev { - -public : - - // Constructor - BTL_DONT_INLINE Action_parallel_symm_ev( int size ) : _size(size) - { - MESSAGE("Action_parallel_symm_ev constructor"); - - int myid, procnum; - blacs_pinfo_(&myid, &procnum); - iamroot = (myid == 0); - - // STL matrix and vector initialization - if (iamroot) { - init_vector(Global_A_stl, size*size); - init_vector(Global_Z_stl, size*size); - } - init_vector(Local_w_stl, size); - - const int blocksize = std::max(std::min(size/4, 64), 2); - Interface::scatter_matrix(Global_A_stl, Local_A_stl, descA, size, size, blocksize, blocksize); - Interface::scatter_matrix(Global_Z_stl, Local_Z_stl, descZ, size, size, blocksize, blocksize); - LocalRows = descA[8]; - LocalCols = Local_A_stl.size()/descA[8]; - - // Generic local matrix and vectors initialization - Interface::matrix_from_stl(Local_A_ref, Local_A_stl); - Interface::matrix_from_stl(Local_A , Local_A_stl); - Interface::matrix_from_stl(Local_Z_ref, Local_Z_stl); - Interface::matrix_from_stl(Local_Z , Local_Z_stl); - Interface::vector_from_stl(Local_w , Local_w_stl); - Interface::vector_from_stl(Local_w_ref, Local_w_stl); - - _cost = size*size*size; - } - - - // Invalidate copy constructor - Action_parallel_symm_ev(const Action_parallel_symm_ev&) - { - INFOS("illegal call to Action_parallel_symm_ev copy constructor"); - exit(1); - } - - // Destructor - ~Action_parallel_symm_ev() - { - MESSAGE("Action_parallel_symm_ev destructor"); - - // Deallocation - Interface::free_matrix(Local_A_ref, Local_A_stl.size()); - Interface::free_matrix(Local_A , Local_A_stl.size()); - Interface::free_matrix(Local_Z_ref, Local_Z_stl.size()); - Interface::free_matrix(Local_Z , Local_Z_stl.size()); - Interface::free_vector(Local_w_ref); - Interface::free_vector(Local_w ); - } - - // Action name - static inline std::string name() - { - return "symm_ev_" + Interface::name(); - } - - double nb_op_base() - { - return _cost; - } - - BTL_DONT_INLINE void initialize() - { - Interface::copy_matrix(Local_A_ref, Local_A, Local_A_stl.size()); - Interface::copy_matrix(Local_Z_ref, Local_Z, Local_Z_stl.size()); - Interface::copy_vector(Local_w_ref, Local_w, Local_w_stl.size()); - } - - BTL_DONT_INLINE void calculate() - { - Interface::parallel_symm_ev(Local_A, descA, Local_w, Local_Z, descZ); - } - - BTL_DONT_INLINE void check_result() - { - } - -private: - int _size, descA[9], descZ[9], LocalRows, LocalCols; - double _cost; - bool iamroot; - - typename Interface::stl_matrix Global_A_stl; - typename Interface::stl_matrix Local_A_stl; - typename Interface::gene_matrix Local_A_ref; - typename Interface::gene_matrix Local_A; - - typename Interface::stl_matrix Global_Z_stl; - typename Interface::stl_matrix Local_Z_stl; - typename Interface::gene_matrix Local_Z_ref; - typename Interface::gene_matrix Local_Z; - - typename Interface::stl_vector Local_w_stl; - typename Interface::gene_vector Local_w_ref; - typename Interface::gene_vector Local_w; -}; - - -#endif /* ACTION_PARALLEL_SYMM_EV_HH_ */ diff --git a/btl/actions/action_partial_lu.hh b/btl/actions/action_partial_lu.hh deleted file mode 100644 index 770ea1d..0000000 --- a/btl/actions/action_partial_lu.hh +++ /dev/null @@ -1,125 +0,0 @@ -//===================================================== -// File : action_lu_decomp.hh -// Copyright (C) 2008 Gael Guennebaud -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_PARTIAL_LU -#define ACTION_PARTIAL_LU -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_partial_lu { - -public : - - // Ctor - - Action_partial_lu( int size ):_size(size) - { - MESSAGE("Action_partial_lu Ctor"); - - // STL vector initialization - init_matrix(X_stl,_size); - init_matrix(C_stl,_size); - - // make sure X is invertible - for (int i=0; i<_size; ++i) - X_stl[i][i] = X_stl[i][i] * 1e2 + 1; - - // generic matrix and vector initialization - Interface::matrix_from_stl(X_ref,X_stl); - Interface::matrix_from_stl(X,X_stl); - Interface::matrix_from_stl(C,C_stl); - - _cost = 2.0*size*size*size/3.0 + size*size; - } - - // invalidate copy ctor - - Action_partial_lu( const Action_partial_lu & ) - { - INFOS("illegal call to Action_partial_lu Copy Ctor"); - exit(1); - } - - // Dtor - - ~Action_partial_lu( void ){ - - MESSAGE("Action_partial_lu Dtor"); - - // deallocation - Interface::free_matrix(X_ref,_size); - Interface::free_matrix(X,_size); - Interface::free_matrix(C,_size); - } - - // action name - - static inline std::string name( void ) - { - return "partial_lu_decomp_"+Interface::name(); - } - - double nb_op_base( void ){ - return _cost; - } - - inline void initialize( void ){ - Interface::copy_matrix(X_ref,X,_size); - } - - inline void calculate( void ) { - Interface::partial_lu_decomp(X,C,_size); - } - - void check_result( void ){ - // calculation check -// Interface::matrix_to_stl(C,resu_stl); - -// STL_interface::lu_decomp(X_stl,C_stl,_size); -// -// typename Interface::real_type error= -// STL_interface::norm_diff(C_stl,resu_stl); -// -// if (error>1.e-6){ -// INFOS("WRONG CALCULATION...residual=" << error); -// exit(0); -// } - - } - -private : - - typename Interface::stl_matrix X_stl; - typename Interface::stl_matrix C_stl; - - typename Interface::gene_matrix X_ref; - typename Interface::gene_matrix X; - typename Interface::gene_matrix C; - - int _size; - double _cost; -}; - -#endif diff --git a/btl/actions/action_qr_decomp.hh b/btl/actions/action_qr_decomp.hh deleted file mode 100644 index 15a4619..0000000 --- a/btl/actions/action_qr_decomp.hh +++ /dev/null @@ -1,112 +0,0 @@ -//===================================================== -// Copyright (C) 2011 Andrea Arteaga -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_QR_DECOMP -#define ACTION_QR_DECOMP -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_qr_decomp { - -public : - - // Ctor - - Action_qr_decomp( int size ) : _size(size) - { - MESSAGE("Action_qr_decomp Ctor"); - - // STL vector initialization - init_matrix(X_stl ,_size); - init_matrix(C_stl, _size); - init_vector(tau_stl, _size); - - // generic matrix and vector initialization - Interface::matrix_from_stl(X_ref, X_stl); - Interface::matrix_from_stl(X, X_stl); - Interface::matrix_from_stl(C, C_stl); - Interface::vector_from_stl(tau, tau_stl); - - _cost = 2.0*size*size*size/3.0 + size*size + 1.0*size/3.0 - 2; - } - - // invalidate copy ctor - - Action_qr_decomp( const Action_qr_decomp & ) - { - INFOS("illegal call to Action_qr_decomp Copy Ctor"); - exit(1); - } - - // Dtor - - ~Action_qr_decomp( void ){ - - MESSAGE("Action_qr_decomp Dtor"); - - // deallocation - Interface::free_matrix(X_ref, _size); - Interface::free_matrix(X, _size); - Interface::free_matrix(C, _size); - Interface::free_vector(tau); - } - - // action name - - static inline std::string name() - { - return "qr_decomp_"+Interface::name(); - } - - double nb_op_base( void ){ - return _cost; - } - - inline void initialize( void ){ - Interface::copy_matrix(X_ref, X, _size); - } - - inline void calculate( void ) { - Interface::qr_decomp(X, C, tau, _size); - } - - void check_result( void ){ - } - -private : - - typename Interface::stl_matrix X_stl; - typename Interface::stl_matrix C_stl; - typename Interface::stl_vector tau_stl; - - typename Interface::gene_matrix X_ref; - typename Interface::gene_matrix X; - typename Interface::gene_matrix C; - typename Interface::gene_vector tau; - - int _size; - double _cost; -}; - -#endif diff --git a/btl/actions/action_rot.hh b/btl/actions/action_rot.hh deleted file mode 100644 index df822a6..0000000 --- a/btl/actions/action_rot.hh +++ /dev/null @@ -1,116 +0,0 @@ - -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_ROT -#define ACTION_ROT -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_rot { - -public : - - // Ctor - BTL_DONT_INLINE Action_rot( int size ):_size(size) - { - MESSAGE("Action_rot Ctor"); - - // STL matrix and vector initialization - typename Interface::stl_matrix tmp; - init_vector(A_stl,_size); - init_vector(B_stl,_size); - - // generic matrix and vector initialization - Interface::vector_from_stl(A_ref,A_stl); - Interface::vector_from_stl(A,A_stl); - Interface::vector_from_stl(B_ref,B_stl); - Interface::vector_from_stl(B,B_stl); - } - - // invalidate copy ctor - Action_rot( const Action_rot & ) - { - INFOS("illegal call to Action_rot Copy Ctor"); - exit(1); - } - - // Dtor - BTL_DONT_INLINE ~Action_rot( void ){ - MESSAGE("Action_rot Dtor"); - Interface::free_vector(A); - Interface::free_vector(B); - Interface::free_vector(A_ref); - Interface::free_vector(B_ref); - } - - // action name - static inline std::string name( void ) - { - return "rot_" + Interface::name(); - } - - double nb_op_base( void ){ - return 6.0*_size; - } - - BTL_DONT_INLINE void initialize( void ){ - Interface::copy_vector(A_ref,A,_size); - Interface::copy_vector(B_ref,B,_size); - } - - BTL_DONT_INLINE void calculate( void ) { - BTL_ASM_COMMENT("#begin rot"); - Interface::rot(A,B,0.5,0.6,_size); - BTL_ASM_COMMENT("end rot"); - } - - BTL_DONT_INLINE void check_result( void ){ - // calculation check -// Interface::vector_to_stl(X,resu_stl); - -// STL_interface::rot(A_stl,B_stl,X_stl,_size); - -// typename Interface::real_type error= -// STL_interface::norm_diff(X_stl,resu_stl); - -// if (error>1.e-3){ -// INFOS("WRONG CALCULATION...residual=" << error); -// exit(0); -// } - - } - -private : - - typename Interface::stl_vector A_stl; - typename Interface::stl_vector B_stl; - - typename Interface::gene_vector A_ref; - typename Interface::gene_vector B_ref; - - typename Interface::gene_vector A; - typename Interface::gene_vector B; - - int _size; -}; - - -#endif diff --git a/btl/actions/action_rot.hpp b/btl/actions/action_rot.hpp new file mode 100644 index 0000000..93cba4e --- /dev/null +++ b/btl/actions/action_rot.hpp @@ -0,0 +1,78 @@ +//===================================================== +// Copyright (C) 2012 Andrea Arteaga +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// 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_ROT +#define ACTION_ROT + +#include "LinearCongruential.hpp" +#include +#include + +template +class Action_rot { + + typedef typename Interface::Scalar Scalar; + typedef std::vector vector_t; + +private: + // Invalidate copy constructor + Action_rot(const Action_rot&); + +public: + + // Constructor + Action_rot(int size) + : _size(size), lc(10), + x(lc.fillVector(size)), y(lc.fillVector(size)), + x_work(size), y_work(size) + { + MESSAGE("Action_rot Constructor"); + } + + // Action name + static std::string name() + { + return "rot_" + Interface::name(); + } + + double fpo() { + return 2*double(_size); + } + + inline void initialize(){ + std::copy(x.begin(), x.end(), x_work.begin()); + std::copy(y.begin(), y.end(), y_work.begin()); + } + + inline void calculate() { + Interface::rot(_size, &x_work[0], &y_work[0], 0.5, 0.6); + } + + Scalar getResidual() { + return 0.; + } + +private: + const int _size; + LinearCongruential<> lc; + + const vector_t x, y; + vector_t x_work, y_work; + +}; + +#endif // ACTION_AXPY diff --git a/btl/actions/action_stev.hh b/btl/actions/action_stev.hh deleted file mode 100644 index e564571..0000000 --- a/btl/actions/action_stev.hh +++ /dev/null @@ -1,119 +0,0 @@ -//===================================================== -// Copyright (C) 2011 Andrea Arteaga -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_STEV -#define ACTION_STEV -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_stev { - -public : - - // Ctor - - Action_stev( int size ) : _size(size) - { - MESSAGE("Action_stev Ctor"); - - // STL vector initialization - init_vector(D_stl, _size); - init_vector(E_stl, max(0, _size-1)); - init_matrix(V_stl, _size); - init_vector(W_stl, _size); - - // generic matrix and vector initialization - Interface::vector_from_stl(D_ref, D_stl); - Interface::vector_from_stl(E_ref, E_stl); - Interface::vector_from_stl(D, D_stl); - Interface::vector_from_stl(E, E_stl); - Interface::matrix_from_stl(V, V_stl); - Interface::vector_from_stl(W, W_stl); - - // FIXME: correct? - _cost = size*size*size; - } - - // invalidate copy ctor - - Action_stev( const Action_stev& ) - { - INFOS("illegal call to Action_stev Copy Ctor"); - exit(1); - } - - // Dtor - - ~Action_stev( void ){ - - MESSAGE("Action_stev Dtor"); - - // deallocation - Interface::free_vector(D_ref); - Interface::free_vector(E_ref); - Interface::free_vector(D); - Interface::free_vector(E); - Interface::free_matrix(V, _size); - Interface::free_vector(W); - } - - // action name - - static inline std::string name() - { - return "stev_"+Interface::name(); - } - - double nb_op_base( void ){ - return _cost; - } - - inline void initialize( void ){ - Interface::copy_vector(D_ref, D, _size); - Interface::copy_vector(E_ref, E, _size-1); - } - - inline void calculate( void ) { - Interface::stev(D, E, W, V, _size); - } - - void check_result( void ){ - } - -private : - - typename Interface::stl_vector D_stl, E_stl; - typename Interface::stl_matrix V_stl; - typename Interface::stl_vector W_stl; - - typename Interface::gene_vector D_ref, E_ref; - typename Interface::gene_vector D, E; - typename Interface::gene_matrix V; - typename Interface::gene_vector W; - - int _size; - double _cost; -}; - -#endif diff --git a/btl/actions/action_svd_decomp.hh b/btl/actions/action_svd_decomp.hh deleted file mode 100644 index be6740a..0000000 --- a/btl/actions/action_svd_decomp.hh +++ /dev/null @@ -1,115 +0,0 @@ -//===================================================== -// Copyright (C) 2011 Andrea Arteaga -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_SVD_DECOMP -#define ACTION_SVD_DECOMP -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_svd_decomp { - -public : - - // Ctor - - Action_svd_decomp( int size ) : _size(size) - { - MESSAGE("Action_svd_decomp Ctor"); - - // STL vector initialization - init_matrix(X_stl ,_size); - init_matrix(U_stl, _size); - init_matrix(VT_stl, _size); - init_vector(S_stl, _size); - - // generic matrix and vector initialization - Interface::matrix_from_stl(X_ref, X_stl); - Interface::matrix_from_stl(X, X_stl); - Interface::matrix_from_stl(U, U_stl); - Interface::matrix_from_stl(VT, VT_stl); - Interface::vector_from_stl(S, S_stl); - - _cost = 4*size*size*size; - } - - // invalidate copy ctor - - Action_svd_decomp( const Action_svd_decomp & ) - { - INFOS("illegal call to Action_svd_decomp Copy Ctor"); - exit(1); - } - - // Dtor - - ~Action_svd_decomp( void ){ - - MESSAGE("Action_svd_decomp Dtor"); - - // deallocation - Interface::free_matrix(X_ref, _size); - Interface::free_matrix(X, _size); - Interface::free_matrix(U, _size); - Interface::free_matrix(VT, _size); - Interface::free_vector(S); - } - - // action name - - static inline std::string name() - { - return "svd_decomp_"+Interface::name(); - } - - double nb_op_base( void ){ - return _cost; - } - - inline void initialize( void ){ - Interface::copy_matrix(X_ref, X, _size); - } - - inline void calculate( void ) { - Interface::svd_decomp(X, U, S, VT, _size); - } - - void check_result( void ){ - } - -private : - - typename Interface::stl_matrix X_stl; - typename Interface::stl_matrix U_stl, VT_stl; - typename Interface::stl_vector S_stl; - - typename Interface::gene_matrix X_ref; - typename Interface::gene_matrix X; - typename Interface::gene_matrix U, VT; - typename Interface::gene_vector S; - - int _size; - double _cost; -}; - -#endif diff --git a/btl/actions/action_syev.hh b/btl/actions/action_syev.hh deleted file mode 100644 index b8f33be..0000000 --- a/btl/actions/action_syev.hh +++ /dev/null @@ -1,113 +0,0 @@ -//===================================================== -// Copyright (C) 2011 Andrea Arteaga -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_SYEV -#define ACTION_SYEV -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_syev { - -public : - - // Ctor - - Action_syev( int size ) : _size(size) - { - MESSAGE("Action_syev Ctor"); - - // STL vector initialization - init_matrix_symm(X_stl ,_size); - init_matrix(V_stl, _size); - init_vector(W_stl, _size); - - // generic matrix and vector initialization - Interface::matrix_from_stl(X_ref, X_stl); - Interface::matrix_from_stl(X, X_stl); - Interface::matrix_from_stl(V, V_stl); - Interface::vector_from_stl(W, W_stl); - - // FIXME: correct? - _cost = size*size*size; - } - - // invalidate copy ctor - - Action_syev( const Action_syev& ) - { - INFOS("illegal call to Action_syev Copy Ctor"); - exit(1); - } - - // Dtor - - ~Action_syev( void ){ - - MESSAGE("Action_syev Dtor"); - - // deallocation - Interface::free_matrix(X_ref, _size); - Interface::free_matrix(X, _size); - Interface::free_matrix(V, _size); - Interface::free_vector(W); - } - - // action name - - static inline std::string name() - { - return "syev_"+Interface::name(); - } - - double nb_op_base( void ){ - return _cost; - } - - inline void initialize( void ){ - Interface::copy_matrix(X_ref, X, _size); - } - - inline void calculate( void ) { - Interface::syev(X, V, W, _size); - } - - void check_result( void ){ - } - -private : - - typename Interface::stl_matrix X_stl; - typename Interface::stl_matrix V_stl; - typename Interface::stl_vector W_stl; - - typename Interface::gene_matrix X_ref; - typename Interface::gene_matrix X; - typename Interface::gene_matrix V; - typename Interface::gene_vector W; - - int _size; - double _cost; -}; - -#endif diff --git a/btl/actions/action_symm_ev.hh b/btl/actions/action_symm_ev.hh deleted file mode 100644 index c696da2..0000000 --- a/btl/actions/action_symm_ev.hh +++ /dev/null @@ -1,104 +0,0 @@ -//===================================================== -// Copyright (C) 2011 Andrea Arteaga -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_SYMM_EV -#define ACTION_SYMM_EV - -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -template -class Action_symm_ev { - -public: - - // Ctor - Action_symm_ev( int size ) : _size(size) - { - MESSAGE("Action_symm_ev Ctor"); - - // STL matrix initialization - init_matrix_symm(X_stl,_size); - init_vector(W_stl,_size); - - // generic matrix and vector initialization - Interface::matrix_from_stl(X,X_stl); - Interface::vector_from_stl(W,W_stl); - - - } - - // invalidate copy ctor - - Action_symm_ev( const Action_symm_ev & ) - { - INFOS("illegal call to Action_symm_ev Copy Ctor"); - exit(1); - } - - // Dtor - - ~Action_symm_ev( void ){ - - MESSAGE("Action_symm_ev Dtor"); - - // deallocation - Interface::free_matrix(X,_size); - } - - // action name - - static inline std::string name( void ) - { - return "symm_ev_"+Interface::name(); - } - - double nb_op_base( void ){ - // TODO: is this right? - return _size*_size; - } - - inline void initialize( void ){ - } - - inline void calculate( void ) { - Interface::symm_ev(X,W,_size); - } - - void check_result( void ) { - // TODO: check result - } - -private : - - typename Interface::stl_matrix X_stl; - typename Interface::stl_vector W_stl; - - typename Interface::gene_matrix X; - typename Interface::gene_vector W; - - int _size; - double _cost; - -}; - - -#endif // ACTION_SYMM_EV diff --git a/btl/actions/action_symv.hh b/btl/actions/action_symv.hh deleted file mode 100644 index a32b9df..0000000 --- a/btl/actions/action_symv.hh +++ /dev/null @@ -1,139 +0,0 @@ -//===================================================== -// File : action_symv.hh -// Author : L. Plagne -// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_SYMV -#define ACTION_SYMV -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_symv { - -public : - - // Ctor - - BTL_DONT_INLINE Action_symv( int size ):_size(size) - { - MESSAGE("Action_symv Ctor"); - - // STL matrix and vector initialization - init_matrix_symm(A_stl,_size); - init_vector(B_stl,_size); - init_vector(X_stl,_size); - init_vector(resu_stl,_size); - - // generic matrix and vector initialization - Interface::matrix_from_stl(A_ref,A_stl); - Interface::matrix_from_stl(A,A_stl); - Interface::vector_from_stl(B_ref,B_stl); - Interface::vector_from_stl(B,B_stl); - Interface::vector_from_stl(X_ref,X_stl); - Interface::vector_from_stl(X,X_stl); - - } - - // invalidate copy ctor - - Action_symv( const Action_symv & ) - { - INFOS("illegal call to Action_symv Copy Ctor"); - exit(1); - } - - // Dtor - BTL_DONT_INLINE ~Action_symv( void ){ - Interface::free_matrix(A,_size); - Interface::free_vector(B); - Interface::free_vector(X); - Interface::free_matrix(A_ref,_size); - Interface::free_vector(B_ref); - Interface::free_vector(X_ref); - } - - // action name - - static inline std::string name( void ) - { - return "symv_" + Interface::name(); - } - - double nb_op_base( void ){ - return 2.0*_size*_size; - } - - BTL_DONT_INLINE void initialize( void ){ - - Interface::copy_matrix(A_ref,A,_size); - Interface::copy_vector(B_ref,B,_size); - Interface::copy_vector(X_ref,X,_size); - - } - - BTL_DONT_INLINE void calculate( void ) { - BTL_ASM_COMMENT("#begin symv"); - Interface::symv(A,B,X,_size); - BTL_ASM_COMMENT("end symv"); - } - - BTL_DONT_INLINE void check_result( void ){ - if (_size>128) return; - // calculation check - Interface::vector_to_stl(X,resu_stl); - - STL_interface::symv(A_stl,B_stl,X_stl,_size); - - typename Interface::real_type error= - STL_interface::norm_diff(X_stl,resu_stl); - - if (error>1.e-5){ - INFOS("WRONG CALCULATION...residual=" << error); - exit(0); - } - - } - -private : - - typename Interface::stl_matrix A_stl; - typename Interface::stl_vector B_stl; - typename Interface::stl_vector X_stl; - typename Interface::stl_vector resu_stl; - - typename Interface::gene_matrix A_ref; - typename Interface::gene_vector B_ref; - typename Interface::gene_vector X_ref; - - typename Interface::gene_matrix A; - typename Interface::gene_vector B; - typename Interface::gene_vector X; - - - int _size; - -}; - - -#endif diff --git a/btl/actions/action_syr2.hh b/btl/actions/action_syr2.hh deleted file mode 100644 index 7c6712b..0000000 --- a/btl/actions/action_syr2.hh +++ /dev/null @@ -1,133 +0,0 @@ -//===================================================== -// File : action_syr2.hh -// Author : L. Plagne -// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_SYR2 -#define ACTION_SYR2 -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_syr2 { - -public : - - // Ctor - - BTL_DONT_INLINE Action_syr2( int size ):_size(size) - { - // STL matrix and vector initialization - typename Interface::stl_matrix tmp; - init_matrix(A_stl,_size); - init_vector(B_stl,_size); - init_vector(X_stl,_size); - init_vector(resu_stl,_size); - - // generic matrix and vector initialization - Interface::matrix_from_stl(A_ref,A_stl); - Interface::matrix_from_stl(A,A_stl); - Interface::vector_from_stl(B_ref,B_stl); - Interface::vector_from_stl(B,B_stl); - Interface::vector_from_stl(X_ref,X_stl); - Interface::vector_from_stl(X,X_stl); - } - - // invalidate copy ctor - Action_syr2( const Action_syr2 & ) - { - INFOS("illegal call to Action_syr2 Copy Ctor"); - exit(1); - } - - // Dtor - BTL_DONT_INLINE ~Action_syr2( void ){ - Interface::free_matrix(A,_size); - Interface::free_vector(B); - Interface::free_vector(X); - Interface::free_matrix(A_ref,_size); - Interface::free_vector(B_ref); - Interface::free_vector(X_ref); - } - - // action name - - static inline std::string name( void ) - { - return "syr2_" + Interface::name(); - } - - double nb_op_base( void ){ - return 2.0*_size*_size; - } - - BTL_DONT_INLINE void initialize( void ){ - Interface::copy_matrix(A_ref,A,_size); - Interface::copy_vector(B_ref,B,_size); - Interface::copy_vector(X_ref,X,_size); - } - - BTL_DONT_INLINE void calculate( void ) { - BTL_ASM_COMMENT("#begin syr2"); - Interface::syr2(A,B,X,_size); - BTL_ASM_COMMENT("end syr2"); - } - - BTL_DONT_INLINE void check_result( void ){ - // calculation check - Interface::vector_to_stl(X,resu_stl); - - STL_interface::syr2(A_stl,B_stl,X_stl,_size); - - typename Interface::real_type error= - STL_interface::norm_diff(X_stl,resu_stl); - - if (error>1.e-3){ - INFOS("WRONG CALCULATION...residual=" << error); -// exit(0); - } - - } - -private : - - typename Interface::stl_matrix A_stl; - typename Interface::stl_vector B_stl; - typename Interface::stl_vector X_stl; - typename Interface::stl_vector resu_stl; - - typename Interface::gene_matrix A_ref; - typename Interface::gene_vector B_ref; - typename Interface::gene_vector X_ref; - - typename Interface::gene_matrix A; - typename Interface::gene_vector B; - typename Interface::gene_vector X; - - - int _size; - -}; - - -#endif diff --git a/btl/actions/action_trisolve.hh b/btl/actions/action_trisolve.hh deleted file mode 100644 index d6f0b47..0000000 --- a/btl/actions/action_trisolve.hh +++ /dev/null @@ -1,137 +0,0 @@ -//===================================================== -// File : action_trisolve.hh -// Copyright (C) 2008 Gael Guennebaud -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_TRISOLVE -#define ACTION_TRISOLVE -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_trisolve { - -public : - - // Ctor - - Action_trisolve( int size ):_size(size) - { - MESSAGE("Action_trisolve Ctor"); - - // STL vector initialization - init_matrix(L_stl,_size); - init_vector(B_stl,_size); - init_vector(X_stl,_size); - for (int j=0; j<_size; ++j) - { - for (int i=0; i(resu_stl,_size); - - // generic matrix and vector initialization - Interface::matrix_from_stl(L,L_stl); - Interface::vector_from_stl(X,X_stl); - Interface::vector_from_stl(B,B_stl); - - _cost = 0; - for (int j=0; j<_size; ++j) - { - _cost += 2*j + 1; - } - } - - // invalidate copy ctor - - Action_trisolve( const Action_trisolve & ) - { - INFOS("illegal call to Action_trisolve Copy Ctor"); - exit(1); - } - - // Dtor - - ~Action_trisolve( void ){ - - MESSAGE("Action_trisolve Dtor"); - - // deallocation - Interface::free_matrix(L,_size); - Interface::free_vector(B); - Interface::free_vector(X); - } - - // action name - - static inline std::string name( void ) - { - return "trisolve_vector_"+Interface::name(); - } - - double nb_op_base( void ){ - return _cost; - } - - inline void initialize( void ){ - //Interface::copy_vector(X_ref,X,_size); - } - - inline void calculate( void ) { - Interface::trisolve_lower(L,B,X,_size); - } - - void check_result(){ - if (_size>128) return; - // calculation check - Interface::vector_to_stl(X,resu_stl); - - STL_interface::trisolve_lower(L_stl,B_stl,X_stl,_size); - - typename Interface::real_type error= - STL_interface::norm_diff(X_stl,resu_stl); - - if (error>1.e-4){ - INFOS("WRONG CALCULATION...residual=" << error); - exit(2); - } //else INFOS("CALCULATION OK...residual=" << error); - - } - -private : - - typename Interface::stl_matrix L_stl; - typename Interface::stl_vector X_stl; - typename Interface::stl_vector B_stl; - typename Interface::stl_vector resu_stl; - - typename Interface::gene_matrix L; - typename Interface::gene_vector X; - typename Interface::gene_vector B; - - int _size; - double _cost; -}; - -#endif diff --git a/btl/actions/action_trisolve_matrix.hh b/btl/actions/action_trisolve_matrix.hh deleted file mode 100644 index 0fc2bb9..0000000 --- a/btl/actions/action_trisolve_matrix.hh +++ /dev/null @@ -1,165 +0,0 @@ -//===================================================== -// File : action_matrix_matrix_product.hh -// Author : L. Plagne -// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_TRISOLVE_MATRIX_PRODUCT -#define ACTION_TRISOLVE_MATRIX_PRODUCT -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_trisolve_matrix { - -public : - - // Ctor - - Action_trisolve_matrix( int size ):_size(size) - { - MESSAGE("Action_trisolve_matrix Ctor"); - - // STL matrix and vector initialization - - init_matrix(A_stl,_size); - init_matrix(B_stl,_size); - init_matrix(X_stl,_size); - init_matrix(resu_stl,_size); - - for (int j=0; j<_size; ++j) - { - for (int i=0; i::matrix_matrix_product(A_stl,B_stl,X_stl,_size); -// -// typename Interface::real_type error= -// STL_interface::norm_diff(X_stl,resu_stl); -// -// if (error>1.e-6){ -// INFOS("WRONG CALCULATION...residual=" << error); -// // exit(1); -// } - - } - -private : - - typename Interface::stl_matrix A_stl; - typename Interface::stl_matrix B_stl; - typename Interface::stl_matrix X_stl; - typename Interface::stl_matrix resu_stl; - - typename Interface::gene_matrix A_ref; - typename Interface::gene_matrix B_ref; - typename Interface::gene_matrix X_ref; - - typename Interface::gene_matrix A; - typename Interface::gene_matrix B; - typename Interface::gene_matrix X; - - int _size; - double _cost; - -}; - - -#endif - - - diff --git a/btl/actions/action_trmm.hh b/btl/actions/action_trmm.hh deleted file mode 100644 index 8f78138..0000000 --- a/btl/actions/action_trmm.hh +++ /dev/null @@ -1,165 +0,0 @@ -//===================================================== -// File : action_matrix_matrix_product.hh -// Author : L. Plagne -// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// 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_TRMM -#define ACTION_TRMM -#include "utilities.h" -#include "STL_interface.hh" -#include -#include "init/init_function.hh" -#include "init/init_vector.hh" -#include "init/init_matrix.hh" - -using namespace std; - -template -class Action_trmm { - -public : - - // Ctor - - Action_trmm( int size ):_size(size) - { - MESSAGE("Action_trmm Ctor"); - - // STL matrix and vector initialization - - init_matrix(A_stl,_size); - init_matrix(B_stl,_size); - init_matrix(X_stl,_size); - init_matrix(resu_stl,_size); - - for (int j=0; j<_size; ++j) - { - for (int i=0; i::matrix_matrix_product(A_stl,B_stl,X_stl,_size); -// -// typename Interface::real_type error= -// STL_interface::norm_diff(X_stl,resu_stl); -// -// if (error>1.e-6){ -// INFOS("WRONG CALCULATION...residual=" << error); -// // exit(1); -// } - - } - -private : - - typename Interface::stl_matrix A_stl; - typename Interface::stl_matrix B_stl; - typename Interface::stl_matrix X_stl; - typename Interface::stl_matrix resu_stl; - - typename Interface::gene_matrix A_ref; - typename Interface::gene_matrix B_ref; - typename Interface::gene_matrix X_ref; - - typename Interface::gene_matrix A; - typename Interface::gene_matrix B; - typename Interface::gene_matrix X; - - int _size; - double _cost; - -}; - - -#endif - - - diff --git a/btl/actions/actionsBLAS.hpp b/btl/actions/actionsBLAS.hpp new file mode 100644 index 0000000..0a63675 --- /dev/null +++ b/btl/actions/actionsBLAS.hpp @@ -0,0 +1,16 @@ +#include "action_axpy.hpp" +#include "action_rot.hpp" + +#include "action_MatrixVector.hpp" +#include "action_MatrixTVector.hpp" +#include "action_SymMatrixVector.hpp" +#include "action_TriSolveVector.hpp" +#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/actions/base_action_fftw.hh b/btl/actions/base_action_fftw.hh deleted file mode 100644 index fb32b51..0000000 --- a/btl/actions/base_action_fftw.hh +++ /dev/null @@ -1,86 +0,0 @@ -//===================================================== -// Copyright (C) 2011 Andrea Arteaga -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -#ifndef BASE_ACTION_FFTW_HH -#define BASE_ACTION_FFTW_HH - -#include "utilities.h" -#include "init/init_function.hh" -#include "init/init_vector.hh" - -inline int power(const int& base, const int& exp) { - int ret = 1; - for (int i = 0; i < exp; ++i) - ret *= base; - return ret; -} - -template -class Action_FFTW_base -{ -public: - // Constructor - Action_FFTW_base(const int& size, const int& dimensions) : - size_(size), dimensions_(dimensions), N_(power(size, dimensions)) - { - // STL vector initialization - init_vector < pseudo_random > (X_stl, N_); - init_vector < null_function > (Y_stl, N_); - - // Generic vector initialization - Interface::vector_from_stl(X, X_stl); - Interface::vector_from_stl(Y, Y_stl); - - // To be done by the child: - /* initialize plan! */ - } - - // Invalidate copy constructor - Action_FFTW_base( const Action_FFTW_base & ) - { - INFOS("illegal call to Action_FFTW_base Copy Ctor"); - exit(1); - } - - // Destructor: - // frees the memory - ~Action_FFTW_base() - { - Interface::free_vector(X); - Interface::free_vector(Y); - } - - inline void initialize() { } - - inline void calculate( void ) { - Interface::fftw_run(p); - } - - void check_result( void ){ - } - - -protected: - const int size_, dimensions_, N_; - - typename Interface::stl_vector X_stl, Y_stl; - typename Interface::gene_vector X, Y; - - typename Interface::plan p; -}; - -#endif /* BASE_ACTION_FFTW_HH */ diff --git a/btl/actions/basic_actions.hh b/btl/actions/basic_actions.hh deleted file mode 100644 index a3333ea..0000000 --- a/btl/actions/basic_actions.hh +++ /dev/null @@ -1,21 +0,0 @@ - -#include "action_axpy.hh" -#include "action_axpby.hh" - -#include "action_matrix_vector_product.hh" -#include "action_atv_product.hh" - -#include "action_matrix_matrix_product.hh" -// #include "action_ata_product.hh" -#include "action_aat_product.hh" - -#include "action_trisolve.hh" -#include "action_trmm.hh" -#include "action_symv.hh" -// #include "action_symm.hh" -#include "action_syr2.hh" -#include "action_ger.hh" -#include "action_rot.hh" - -// #include "action_lu_solve.hh" - diff --git a/btl/generic_bench/init/init_function.hh b/btl/generic_bench/init/init_function.hh deleted file mode 100644 index 7b3bdba..0000000 --- a/btl/generic_bench/init/init_function.hh +++ /dev/null @@ -1,54 +0,0 @@ -//===================================================== -// File : init_function.hh -// Author : L. Plagne -// Copyright (C) EDF R&D, lun sep 30 14:23:18 CEST 2002 -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -#ifndef INIT_FUNCTION_HH -#define INIT_FUNCTION_HH - -double simple_function(int index) -{ - return index; -} - -double simple_function(int index_i, int index_j) -{ - return index_i+index_j; -} - -double pseudo_random(int index) -{ - return std::rand()/double(RAND_MAX); -} - -double pseudo_random(int index_i, int index_j) -{ - return std::rand()/double(RAND_MAX); -} - - -double null_function(int index) -{ - return 0.0; -} - -double null_function(int index_i, int index_j) -{ - return 0.0; -} - -#endif diff --git a/btl/generic_bench/init/init_matrix.hh b/btl/generic_bench/init/init_matrix.hh deleted file mode 100644 index c598ffc..0000000 --- a/btl/generic_bench/init/init_matrix.hh +++ /dev/null @@ -1,93 +0,0 @@ -//===================================================== -// File : init_matrix.hh -// Author : L. Plagne -// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 -// Copyright (C) 2011 Andrea Arteaga -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -#ifndef INIT_MATRIX_HH -#define INIT_MATRIX_HH - -#include "LinearCongruential.hh" - -// The Vector class must satisfy the following part of STL vector concept : -// resize() method -// [] operator for setting element -// value_type defined -template -BTL_DONT_INLINE void init_row(Vector & X, int size, int row){ - - X.resize(size); - - for (int j=0;j -BTL_DONT_INLINE void init_matrix(Vector & A, int size){ - A.resize(size); - for (int row=0; row(A[row],size,row); - } -} - -template -BTL_DONT_INLINE void init_matrix_symm(Matrix& A, int size){ - A.resize(size); - for (int row=0; row BTL_DONT_INLINE -void init_matrix(Matrix& A, const int& size, const unsigned& seed) -{ - typedef typename Matrix::value_type value_t; - A.resize(size*size); - LinearCongruential rng(seed); - for (typename Matrix::iterator i = A.begin(), end = A.end(); i != end; ++i) - *i = rng.get_01(); -} - -template BTL_DONT_INLINE -void init_SPD_matrix(Matrix& A, const int& size, const unsigned& seed) -{ - typedef typename Matrix::value_type value_t; - A.resize(size*size); - LinearCongruential rng(seed); - for (int r = 0; r < size; ++r) { - A[r+size*r] = rng.get_01() + size; - for (int c = r+1; c < size; ++c) { - const value_t v = rng.get_01(); - A[r+size*c] = v; - A[c+size*r] = v; - } - } -} - -#endif diff --git a/btl/generic_bench/init/init_vector.hh b/btl/generic_bench/init/init_vector.hh deleted file mode 100644 index efaf0c9..0000000 --- a/btl/generic_bench/init/init_vector.hh +++ /dev/null @@ -1,37 +0,0 @@ -//===================================================== -// File : init_vector.hh -// Author : L. Plagne -// Copyright (C) EDF R&D, lun sep 30 14:23:18 CEST 2002 -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -#ifndef INIT_VECTOR_HH -#define INIT_VECTOR_HH - -// The Vector class must satisfy the following part of STL vector concept : -// resize() method -// [] operator for setting element -// value_type defined -template -void init_vector(Vector & X, int size){ - - X.resize(size); - - for (int i=0;i -// Copyright (C) EDF R&D, mar déc 3 18:59:37 CET 2002 +// Copyright (C) EDF R&D, mar d�c 3 18:59:37 CET 2002 //===================================================== // // This program is free software; you can redistribute it and/or @@ -55,11 +55,9 @@ double bench_fixed_size(int size, unsigned long long & nb_calc,unsigned long lo time_action=time_action/(double(nb_calc)); - action.check_result(); - time_action=time_action-time_baseline; - return action.nb_op_base()/(time_action*1000000.0); + return action.fpo()/(time_action*1000000.0); } diff --git a/btl/generic_bench/timers/STL_perf_analyzer.hh b/btl/generic_bench/timers/STL_perf_analyzer.hh deleted file mode 100644 index c9f894b..0000000 --- a/btl/generic_bench/timers/STL_perf_analyzer.hh +++ /dev/null @@ -1,82 +0,0 @@ -//===================================================== -// File : STL_perf_analyzer.hh -// Author : L. Plagne -// Copyright (C) EDF R&D, mar déc 3 18:59:35 CET 2002 -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -#ifndef _STL_PERF_ANALYSER_HH -#define _STL_PERF_ANALYSER_HH - -#include "STL_timer.hh" -#include "bench_parameter.hh" - -template -class STL_Perf_Analyzer{ -public: - STL_Perf_Analyzer(unsigned long long nb_sample=DEFAULT_NB_SAMPLE):_nb_sample(nb_sample),_chronos() - { - MESSAGE("STL_Perf_Analyzer Ctor"); - }; - STL_Perf_Analyzer( const STL_Perf_Analyzer & ){ - INFOS("Copy Ctor not implemented"); - exit(0); - }; - ~STL_Perf_Analyzer( void ){ - MESSAGE("STL_Perf_Analyzer Dtor"); - }; - - - inline double eval_mflops(int size) - { - - ACTION action(size); - - _chronos.start_baseline(_nb_sample); - - do { - - action.initialize(); - } while (_chronos.check()); - - double baseline_time=_chronos.get_time(); - - _chronos.start(_nb_sample); - do { - action.initialize(); - action.calculate(); - } while (_chronos.check()); - - double calculate_time=_chronos.get_time(); - - double corrected_time=calculate_time-baseline_time; - - // cout << size <<" "< -// Copyright (C) EDF R&D, mar déc 3 18:59:35 CET 2002 -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// STL Timer Class. Adapted (L.P.) from the timer class by Musser et Al -// described int the Book : STL Tutorial and reference guide. -// Define a timer class for analyzing algorithm performance. -#include -#include -#include -#include -#include -using namespace std; - -class STL_Timer { -public: - STL_Timer(){ baseline = false; }; // Default constructor - // Start a series of r trials: - void start(unsigned int r){ - reps = r; - count = 0; - iterations.clear(); - iterations.reserve(reps); - initial = time(0); - }; - // Start a series of r trials to determine baseline time: - void start_baseline(unsigned int r) - { - baseline = true; - start(r); - } - // Returns true if the trials have been completed, else false - bool check() - { - ++count; - final = time(0); - if (initial < final) { - iterations.push_back(count); - initial = final; - count = 0; - } - return (iterations.size() < reps); - }; - // Returns the results for external use - double get_time( void ) - { - sort(iterations.begin(), iterations.end()); - return 1.0/iterations[reps/2]; - }; -private: - unsigned int reps; // Number of trials - // For storing loop iterations of a trial - vector iterations; - // For saving initial and final times of a trial - time_t initial, final; - // For counting loop iterations of a trial - unsigned long count; - // true if this is a baseline computation, false otherwise - bool baseline; - // For recording the baseline time - double baseline_time; -}; - diff --git a/btl/generic_bench/timers/distributed_perf_analyzer_node.hh b/btl/generic_bench/timers/distributed_perf_analyzer_node.hh index 924eb87..d6ec5c2 100644 --- a/btl/generic_bench/timers/distributed_perf_analyzer_node.hh +++ b/btl/generic_bench/timers/distributed_perf_analyzer_node.hh @@ -66,7 +66,6 @@ public: if (do_check > 0) { action.initialize(); action.calculate(); - action.check_result(); } /* Return a void value */ diff --git a/btl/generic_bench/timers/distributed_perf_analyzer_root.hh b/btl/generic_bench/timers/distributed_perf_analyzer_root.hh index bbab901..1fc7c3c 100644 --- a/btl/generic_bench/timers/distributed_perf_analyzer_root.hh +++ b/btl/generic_bench/timers/distributed_perf_analyzer_root.hh @@ -62,7 +62,7 @@ public: for (int i = 1; i < tries; ++i) { Action _action(size); if (!silent) - std::cout << " " << _action.nb_op_base()*_nb_calc/(m_time_action*1e6) << " " << std::flush; + std::cout << " " << _action.fpo()*_nb_calc/(m_time_action*1e6) << " " << std::flush; _action.initialize(); m_time_action = std::min(m_time_action, time_calculate(_action)); } @@ -74,10 +74,9 @@ public: if (do_check > 0) { action.initialize(); action.calculate(); - action.check_result(); } - return action.nb_op_base()/(time_action*1e6); + return action.fpo()/(time_action*1e6); } BTL_DONT_INLINE double time_calculate(Action & action) diff --git a/btl/generic_bench/timers/mixed_perf_analyzer.hh b/btl/generic_bench/timers/mixed_perf_analyzer.hh deleted file mode 100644 index e190236..0000000 --- a/btl/generic_bench/timers/mixed_perf_analyzer.hh +++ /dev/null @@ -1,73 +0,0 @@ -//===================================================== -// File : mixed_perf_analyzer.hh -// Author : L. Plagne -// Copyright (C) EDF R&D, mar déc 3 18:59:36 CET 2002 -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -#ifndef _MIXED_PERF_ANALYSER_HH -#define _MIXED_PERF_ANALYSER_HH - -#include "x86_perf_analyzer.hh" -#include "portable_perf_analyzer.hh" - -// choose portable perf analyzer for long calculations and x86 analyser for short ones - - -template -class Mixed_Perf_Analyzer{ - -public: - Mixed_Perf_Analyzer( void ):_x86pa(),_ppa(),_use_ppa(true) - { - MESSAGE("Mixed_Perf_Analyzer Ctor"); - }; - Mixed_Perf_Analyzer( const Mixed_Perf_Analyzer & ){ - INFOS("Copy Ctor not implemented"); - exit(0); - }; - ~Mixed_Perf_Analyzer( void ){ - MESSAGE("Mixed_Perf_Analyzer Dtor"); - }; - - - inline double eval_mflops(int size) - { - - double result=0.0; - if (_use_ppa){ - result=_ppa.eval_mflops(size); - if (_ppa.get_nb_calc()>DEFAULT_NB_SAMPLE){_use_ppa=false;} - } - else{ - result=_x86pa.eval_mflops(size); - } - - return result; - } - -private: - - Portable_Perf_Analyzer _ppa; - X86_Perf_Analyzer _x86pa; - bool _use_ppa; - -}; - -#endif - - - - diff --git a/btl/generic_bench/timers/portable_perf_analyzer.hh b/btl/generic_bench/timers/portable_perf_analyzer.hh index b207bde..2c6b568 100644 --- a/btl/generic_bench/timers/portable_perf_analyzer.hh +++ b/btl/generic_bench/timers/portable_perf_analyzer.hh @@ -55,9 +55,9 @@ public: { Action _action(size); if (!silent) { - if (_action.nb_op_base()*_nb_calc < 0) - std::cout << " { op*calc = " << _action.nb_op_base()*_nb_calc << " } " << std::flush; - std::cout << " " << _action.nb_op_base()*_nb_calc/(m_time_action*1e6) << " "; + if (_action.fpo()*_nb_calc < 0) + std::cout << " { op*calc = " << _action.fpo()*_nb_calc << " } " << std::flush; + std::cout << " " << _action.fpo()*_nb_calc/(m_time_action*1e6) << " "; } _action.initialize(); m_time_action = std::min(m_time_action, time_calculate(_action)); @@ -70,9 +70,8 @@ public: { action.initialize(); action.calculate(); - action.check_result(); } - return action.nb_op_base()/(time_action*1e6); + return action.fpo()/(time_action*1e6); } BTL_DONT_INLINE double time_calculate(Action & action) diff --git a/btl/generic_bench/timers/portable_perf_analyzer_old.hh b/btl/generic_bench/timers/portable_perf_analyzer_old.hh deleted file mode 100644 index fce3781..0000000 --- a/btl/generic_bench/timers/portable_perf_analyzer_old.hh +++ /dev/null @@ -1,134 +0,0 @@ -//===================================================== -// File : portable_perf_analyzer.hh -// Author : L. Plagne -// Copyright (C) EDF R&D, mar d�c 3 18:59:35 CET 2002 -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -#ifndef _PORTABLE_PERF_ANALYZER_HH -#define _PORTABLE_PERF_ANALYZER_HH - -#include "utilities.h" -#include "timers/portable_timer.hh" - -template -class Portable_Perf_Analyzer{ -public: - Portable_Perf_Analyzer( void ):_nb_calc(1),_nb_init(1),_chronos(){ - MESSAGE("Portable_Perf_Analyzer Ctor"); - }; - Portable_Perf_Analyzer( const Portable_Perf_Analyzer & ){ - INFOS("Copy Ctor not implemented"); - exit(0); - }; - ~Portable_Perf_Analyzer( void ){ - MESSAGE("Portable_Perf_Analyzer Dtor"); - }; - - - - inline double eval_mflops(int size) - { - - Action action(size); - -// double time_baseline = time_init(action); -// while (time_baseline < MIN_TIME_INIT) -// { -// _nb_init *= 2; -// time_baseline = time_init(action); -// } -// -// // optimize -// for (int i=1; i -class X86_Perf_Analyzer{ -public: - X86_Perf_Analyzer( unsigned long long nb_sample=DEFAULT_NB_SAMPLE):_nb_sample(nb_sample),_chronos() - { - MESSAGE("X86_Perf_Analyzer Ctor"); - _chronos.find_frequency(); - }; - X86_Perf_Analyzer( const X86_Perf_Analyzer & ){ - INFOS("Copy Ctor not implemented"); - exit(0); - }; - ~X86_Perf_Analyzer( void ){ - MESSAGE("X86_Perf_Analyzer Dtor"); - }; - - - inline double eval_mflops(int size) - { - - ACTION action(size); - - int nb_loop=5; - double calculate_time=0.0; - double baseline_time=0.0; - - for (int j=0 ; j < nb_loop ; j++){ - - _chronos.clear(); - - for(int i=0 ; i < _nb_sample ; i++) - { - _chronos.start(); - action.initialize(); - action.calculate(); - _chronos.stop(); - _chronos.add_get_click(); - } - - calculate_time += double(_chronos.get_shortest_clicks())/_chronos.frequency(); - - if (j==0) action.check_result(); - - _chronos.clear(); - - for(int i=0 ; i < _nb_sample ; i++) - { - _chronos.start(); - action.initialize(); - _chronos.stop(); - _chronos.add_get_click(); - - } - - baseline_time+=double(_chronos.get_shortest_clicks())/_chronos.frequency(); - - } - - double corrected_time = (calculate_time-baseline_time)/double(nb_loop); - - -// INFOS("_nb_sample="<<_nb_sample); -// INFOS("baseline_time="< -// Copyright (C) EDF R&D, mar d�c 3 18:59:35 CET 2002 -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -#ifndef _X86_TIMER_HH -#define _X86_TIMER_HH - -#include -#include -#include -#include -//#include "system_time.h" -#define u32 unsigned int -#include -#include "utilities.h" -#include -#include -#include -#include - -// frequence de la becanne en Hz -//#define FREQUENCY 648000000 -//#define FREQUENCY 1400000000 -#define FREQUENCY 1695000000 - -using namespace std; - - -class X86_Timer { - -public : - - X86_Timer( void ):_frequency(FREQUENCY),_nb_sample(0) - { - MESSAGE("X86_Timer Default Ctor"); - } - - inline void start( void ){ - - rdtsc(_click_start.n32[0],_click_start.n32[1]); - - } - - - inline void stop( void ){ - - rdtsc(_click_stop.n32[0],_click_stop.n32[1]); - - } - - - inline double frequency( void ){ - return _frequency; - } - - double get_elapsed_time_in_second( void ){ - - return (_click_stop.n64-_click_start.n64)/double(FREQUENCY); - - - } - - unsigned long long get_click( void ){ - - return (_click_stop.n64-_click_start.n64); - - } - - inline void find_frequency( void ){ - - time_t initial, final; - int dummy=2; - - initial = time(0); - start(); - do { - dummy+=2; - } - while(time(0)==initial); - // On est au debut d'un cycle d'une seconde !!! - initial = time(0); - start(); - do { - dummy+=2; - } - while(time(0)==initial); - final=time(0); - stop(); - // INFOS("fine grained time : "<< get_elapsed_time_in_second()); - // INFOS("coarse grained time : "<< final-initial); - _frequency=_frequency*get_elapsed_time_in_second()/double(final-initial); - /// INFOS("CPU frequency : "<< _frequency); - - } - - void add_get_click( void ){ - - _nb_sample++; - _counted_clicks[get_click()]++; - fill_history_clicks(); - - } - - void dump_statistics(string filemane){ - - ofstream outfile (filemane.c_str(),ios::out) ; - - std::map::iterator itr; - for(itr=_counted_clicks.begin() ; itr!=_counted_clicks.end() ; itr++) - { - outfile << (*itr).first << " " << (*itr).second << endl ; - } - - outfile.close(); - - } - - void dump_history(string filemane){ - - ofstream outfile (filemane.c_str(),ios::out) ; - - - - for(int i=0 ; i<_history_mean_clicks.size() ; i++) - { - outfile << i << " " - << _history_mean_clicks[i] << " " - << _history_shortest_clicks[i] << " " - << _history_most_occured_clicks[i] << endl ; - } - - outfile.close(); - - } - - - - double get_mean_clicks( void ){ - - std::map::iterator itr; - - unsigned long long mean_clicks=0; - - for(itr=_counted_clicks.begin() ; itr!=_counted_clicks.end() ; itr++) - { - - mean_clicks+=(*itr).second*(*itr).first; - } - - return mean_clicks/double(_nb_sample); - - } - - double get_shortest_clicks( void ){ - - return double((*_counted_clicks.begin()).first); - - } - - void fill_history_clicks( void ){ - - _history_mean_clicks.push_back(get_mean_clicks()); - _history_shortest_clicks.push_back(get_shortest_clicks()); - _history_most_occured_clicks.push_back(get_most_occured_clicks()); - - } - - - double get_most_occured_clicks( void ){ - - unsigned long long moc=0; - unsigned long long max_occurence=0; - - std::map::iterator itr; - - for(itr=_counted_clicks.begin() ; itr!=_counted_clicks.end() ; itr++) - { - - if (max_occurence<=(*itr).second){ - max_occurence=(*itr).second; - moc=(*itr).first; - } - } - - return double(moc); - - } - - void clear( void ) - { - _counted_clicks.clear(); - - _history_mean_clicks.clear(); - _history_shortest_clicks.clear(); - _history_most_occured_clicks.clear(); - - _nb_sample=0; - } - - - -private : - - union - { - unsigned long int n32[2] ; - unsigned long long n64 ; - } _click_start; - - union - { - unsigned long int n32[2] ; - unsigned long long n64 ; - } _click_stop; - - double _frequency ; - - map _counted_clicks; - - vector _history_mean_clicks; - vector _history_shortest_clicks; - vector _history_most_occured_clicks; - - unsigned long long _nb_sample; - - - -}; - - -#endif diff --git a/btl/generic_bench/utils/LinearCongruential.hh b/btl/generic_bench/utils/LinearCongruential.hh deleted file mode 100644 index 3aa3716..0000000 --- a/btl/generic_bench/utils/LinearCongruential.hh +++ /dev/null @@ -1,83 +0,0 @@ -//===================================================== -// Copyright (C) 2011 Andrea Arteaga -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -#ifndef LINEARCONGRUENTIAL_HH_ -#define LINEARCONGRUENTIAL_HH_ - -#include - -class LinearCongruential -{ - typedef std::vector buffer_t; - typedef unsigned int_t; - -public: - LinearCongruential(const int_t& seed) : - a_(1664525u), c_(1013904223u), m_(getM()), i_(0) - { - buffer_.resize(4096/sizeof(unsigned)); - fillBuffer(seed); - } - - int_t a() const { return a_; } - int_t c() const { return c_; } - int_t m() const { return m_; } - - int_t get_int() { - if (i_ >= buffer_.size()) { - fillBuffer(); - i_ = 0; - } - return buffer_.at(i_++); - } - - double get_01() { - return static_cast(get_int())/static_cast(m_); - } - -private: - buffer_t buffer_; - const int_t a_, c_, m_; - std::size_t i_; - - void fillBuffer(const int_t& seed) - { - buffer_.front() = (seed*a_+c_) & m_; - for ( - typename buffer_t::iterator i = buffer_.begin()+1, end = buffer_.end(); - i != end; ++i) - *i = (*(i-1)*a_ + c_) & m_; - } - - void fillBuffer() - { - const int_t seed = buffer_.back(); - fillBuffer(seed); - } - - static int_t getM() - { - int_t _m = 1; - for (int i = 1; i < 32; ++i) { - _m <<= 1; - _m += 1; - } - return _m; - } -}; - -#endif /* LINEARCONGRUENTIAL_HH_ */ diff --git a/btl/generic_bench/utils/LinearCongruential.hpp b/btl/generic_bench/utils/LinearCongruential.hpp new file mode 100644 index 0000000..a735f77 --- /dev/null +++ b/btl/generic_bench/utils/LinearCongruential.hpp @@ -0,0 +1,77 @@ +#ifndef LINEARCONGRUENTIAL_HPP +#define LINEARCONGRUENTIAL_HPP + +#include "stdint.h" +#include +#include + +template< + typename value_t = uint32_t, + value_t a = 1664525u, + value_t c = 1013904223u +> +class LinearCongruential { + typedef typename std::vector buf_t; + typedef typename buf_t::iterator iterator_t; + typedef typename buf_t::const_iterator constiterator_t; + +public: + LinearCongruential(const value_t& seed, const int bufsize = 4*1024) + : maxvalue(std::numeric_limits::max()) + { + buffer.resize(bufsize); + fillBuffer(seed); + } + + value_t operator()() + { + if (j == buffer.end()) + fillBuffer(buffer.back()); + return *(j++); + } + + template + void fillVector ( + result_t *vector, + const int& size, + const result_t& min = 0., + const result_t& max = 1. + ) + { + const result_t maxvalue = this->maxvalue; + const result_t diff = max-min; + + for (const result_t *const endp = vector+size; vector!=endp; ++vector) + *vector = diff * (this->operator()() / maxvalue) + min; + } + + + template + std::vector fillVector ( + const int& size, + const result_t& min = 0., + const result_t& max = 1. + ) + { + std::vector result(size); + fillVector(&result[0], size, min, max); + return result; + } + +private: + buf_t buffer; + constiterator_t j; + + const value_t maxvalue; + + void fillBuffer(int seed) + { + for (iterator_t i = buffer.begin(), e = buffer.end(); i!=e; ++i) { + *i = ((seed *= a) += c); + } + + j = buffer.begin(); + } +}; + +#endif // LINEARCONGRUENTIAL_HPP diff --git a/btl/libs/BLAS/CMakeLists.txt b/btl/libs/BLAS/CMakeLists.txt deleted file mode 100644 index de42fe0..0000000 --- a/btl/libs/BLAS/CMakeLists.txt +++ /dev/null @@ -1,60 +0,0 @@ - -find_package(ATLAS) -if (ATLAS_FOUND) - btl_add_bench(btl_atlas main.cpp) - if(BUILD_btl_atlas) - target_link_libraries(btl_atlas ${ATLAS_LIBRARIES}) - set_target_properties(btl_atlas PROPERTIES COMPILE_FLAGS "-DCBLASNAME=ATLAS -DHAS_LAPACK=1") - endif(BUILD_btl_atlas) -endif (ATLAS_FOUND) - -find_package(MKL) -if (MKL_FOUND) - btl_add_bench(btl_mkl main.cpp) - if(BUILD_btl_mkl) - target_link_libraries(btl_mkl ${MKL_LIBRARIES}) - set_target_properties(btl_mkl PROPERTIES COMPILE_FLAGS "-DCBLASNAME=INTEL_MKL -DHAS_LAPACK=1") - endif(BUILD_btl_mkl) -endif (MKL_FOUND) - - -find_package(GOTO2) -if (GOTO2_FOUND) - btl_add_bench(btl_goto2 main.cpp) - if(BUILD_btl_goto2) - target_link_libraries(btl_goto2 ${GOTO_LIBRARIES} ) - set_target_properties(btl_goto2 PROPERTIES COMPILE_FLAGS "-DCBLASNAME=GOTO2") - endif(BUILD_btl_goto2) -endif (GOTO2_FOUND) - -find_package(GOTO) -if (GOTO_FOUND) - if(GOTO2_FOUND) - btl_add_bench(btl_goto main.cpp OFF) - else() - btl_add_bench(btl_goto main.cpp) - endif() - if(BUILD_btl_goto) - target_link_libraries(btl_goto ${GOTO_LIBRARIES} ) - set_target_properties(btl_goto PROPERTIES COMPILE_FLAGS "-DCBLASNAME=GOTO") - endif(BUILD_btl_goto) -endif (GOTO_FOUND) - -find_package(ACML) -if (ACML_FOUND) - btl_add_bench(btl_acml main.cpp) - if(BUILD_btl_acml) - target_link_libraries(btl_acml ${ACML_LIBRARIES} ) - set_target_properties(btl_acml PROPERTIES COMPILE_FLAGS "-DCBLASNAME=ACML -DHAS_LAPACK=1") - endif(BUILD_btl_acml) -endif (ACML_FOUND) - -if(Eigen_SOURCE_DIR AND CMAKE_Fortran_COMPILER_WORKS) - # we are inside Eigen and blas/lapack interface is compilable - include_directories(${Eigen_SOURCE_DIR}) - btl_add_bench(btl_eigenblas main.cpp) - if(BUILD_btl_eigenblas) - target_link_libraries(btl_eigenblas eigen_blas eigen_lapack ) - set_target_properties(btl_eigenblas PROPERTIES COMPILE_FLAGS "-DCBLASNAME=EigenBLAS") - endif() -endif() diff --git a/btl/libs/BLAS/blas.h b/btl/libs/BLAS/blas.h deleted file mode 100644 index 25607a5..0000000 --- a/btl/libs/BLAS/blas.h +++ /dev/null @@ -1,681 +0,0 @@ -#ifndef BLAS_H -#define BLAS_H - -#define BLASFUNC(FUNC) FUNC##_ - -#ifdef __WIN64__ -typedef long long BLASLONG; -typedef unsigned long long BLASULONG; -#else -typedef long BLASLONG; -typedef unsigned long BLASULONG; -#endif - -#include - -extern "C" { - -int BLASFUNC(xerbla)(const char *, int *info, int); - -float BLASFUNC(sdot) (int *, float *, int *, float *, int *); -float BLASFUNC(sdsdot)(int *, float *, float *, int *, float *, int *); - -double BLASFUNC(dsdot) (int *, float *, int *, float *, int *); -double BLASFUNC(ddot) (int *, double *, int *, double *, int *); -double BLASFUNC(qdot) (int *, double *, int *, double *, int *); - -#if defined(F_INTERFACE_GFORT) && !defined(__64BIT__) -int BLASFUNC(cdotu) (int *, float * , int *, float *, int *); -int BLASFUNC(cdotc) (int *, float *, int *, float *, int *); -void BLASFUNC(zdotu) (double *, int *, double *, int *, double *, int *); -void BLASFUNC(zdotc) (double *, int *, double *, int *, double *, int *); -void BLASFUNC(xdotu) (double *, int *, double *, int *, double *, int *); -void BLASFUNC(xdotc) (double *, int *, double *, int *, double *, int *); -#elif defined(F_INTERFACE_F2C) || \ - defined(F_INTERFACE_PGI) || \ - defined(F_INTERFACE_GFORT) || \ - (defined(F_INTERFACE_PATHSCALE) && defined(__64BIT__)) -void BLASFUNC(cdotu) (float *, int *, float * , int *, float *, int *); -void BLASFUNC(cdotc) (float *, int *, float *, int *, float *, int *); -void BLASFUNC(zdotu) (double *, int *, double *, int *, double *, int *); -void BLASFUNC(zdotc) (double *, int *, double *, int *, double *, int *); -void BLASFUNC(xdotu) (double *, int *, double *, int *, double *, int *); -void BLASFUNC(xdotc) (double *, int *, double *, int *, double *, int *); -#else -std::complex BLASFUNC(cdotu) (int *, float *, int *, float *, int *); -std::complex BLASFUNC(cdotc) (int *, float *, int *, float *, int *); -std::complex BLASFUNC(zdotu) (int *, double *, int *, double *, int *); -std::complex BLASFUNC(zdotc) (int *, double *, int *, double *, int *); -double BLASFUNC(xdotu) (int *, double *, int *, double *, int *); -double BLASFUNC(xdotc) (int *, double *, int *, double *, int *); -#endif - -int BLASFUNC(cdotuw) (int *, float *, int *, float *, int *, float*); -int BLASFUNC(cdotcw) (int *, float *, int *, float *, int *, float*); -int BLASFUNC(zdotuw) (int *, double *, int *, double *, int *, double*); -int BLASFUNC(zdotcw) (int *, double *, int *, double *, int *, double*); - -int BLASFUNC(saxpy) (int *, float *, float *, int *, float *, int *); -int BLASFUNC(daxpy) (int *, double *, double *, int *, double *, int *); -int BLASFUNC(qaxpy) (int *, double *, double *, int *, double *, int *); -int BLASFUNC(caxpy) (int *, float *, float *, int *, float *, int *); -int BLASFUNC(zaxpy) (int *, double *, double *, int *, double *, int *); -int BLASFUNC(xaxpy) (int *, double *, double *, int *, double *, int *); -int BLASFUNC(caxpyc)(int *, float *, float *, int *, float *, int *); -int BLASFUNC(zaxpyc)(int *, double *, double *, int *, double *, int *); -int BLASFUNC(xaxpyc)(int *, double *, double *, int *, double *, int *); - -int BLASFUNC(scopy) (int *, float *, int *, float *, int *); -int BLASFUNC(dcopy) (int *, double *, int *, double *, int *); -int BLASFUNC(qcopy) (int *, double *, int *, double *, int *); -int BLASFUNC(ccopy) (int *, float *, int *, float *, int *); -int BLASFUNC(zcopy) (int *, double *, int *, double *, int *); -int BLASFUNC(xcopy) (int *, double *, int *, double *, int *); - -int BLASFUNC(sswap) (int *, float *, int *, float *, int *); -int BLASFUNC(dswap) (int *, double *, int *, double *, int *); -int BLASFUNC(qswap) (int *, double *, int *, double *, int *); -int BLASFUNC(cswap) (int *, float *, int *, float *, int *); -int BLASFUNC(zswap) (int *, double *, int *, double *, int *); -int BLASFUNC(xswap) (int *, double *, int *, double *, int *); - -float BLASFUNC(sasum) (int *, float *, int *); -float BLASFUNC(scasum)(int *, float *, int *); -double BLASFUNC(dasum) (int *, double *, int *); -double BLASFUNC(qasum) (int *, double *, int *); -double BLASFUNC(dzasum)(int *, double *, int *); -double BLASFUNC(qxasum)(int *, double *, int *); - -int BLASFUNC(isamax)(int *, float *, int *); -int BLASFUNC(idamax)(int *, double *, int *); -int BLASFUNC(iqamax)(int *, double *, int *); -int BLASFUNC(icamax)(int *, float *, int *); -int BLASFUNC(izamax)(int *, double *, int *); -int BLASFUNC(ixamax)(int *, double *, int *); - -int BLASFUNC(ismax) (int *, float *, int *); -int BLASFUNC(idmax) (int *, double *, int *); -int BLASFUNC(iqmax) (int *, double *, int *); -int BLASFUNC(icmax) (int *, float *, int *); -int BLASFUNC(izmax) (int *, double *, int *); -int BLASFUNC(ixmax) (int *, double *, int *); - -int BLASFUNC(isamin)(int *, float *, int *); -int BLASFUNC(idamin)(int *, double *, int *); -int BLASFUNC(iqamin)(int *, double *, int *); -int BLASFUNC(icamin)(int *, float *, int *); -int BLASFUNC(izamin)(int *, double *, int *); -int BLASFUNC(ixamin)(int *, double *, int *); - -int BLASFUNC(ismin)(int *, float *, int *); -int BLASFUNC(idmin)(int *, double *, int *); -int BLASFUNC(iqmin)(int *, double *, int *); -int BLASFUNC(icmin)(int *, float *, int *); -int BLASFUNC(izmin)(int *, double *, int *); -int BLASFUNC(ixmin)(int *, double *, int *); - -float BLASFUNC(samax) (int *, float *, int *); -double BLASFUNC(damax) (int *, double *, int *); -double BLASFUNC(qamax) (int *, double *, int *); -float BLASFUNC(scamax)(int *, float *, int *); -double BLASFUNC(dzamax)(int *, double *, int *); -double BLASFUNC(qxamax)(int *, double *, int *); - -float BLASFUNC(samin) (int *, float *, int *); -double BLASFUNC(damin) (int *, double *, int *); -double BLASFUNC(qamin) (int *, double *, int *); -float BLASFUNC(scamin)(int *, float *, int *); -double BLASFUNC(dzamin)(int *, double *, int *); -double BLASFUNC(qxamin)(int *, double *, int *); - -float BLASFUNC(smax) (int *, float *, int *); -double BLASFUNC(dmax) (int *, double *, int *); -double BLASFUNC(qmax) (int *, double *, int *); -float BLASFUNC(scmax) (int *, float *, int *); -double BLASFUNC(dzmax) (int *, double *, int *); -double BLASFUNC(qxmax) (int *, double *, int *); - -float BLASFUNC(smin) (int *, float *, int *); -double BLASFUNC(dmin) (int *, double *, int *); -double BLASFUNC(qmin) (int *, double *, int *); -float BLASFUNC(scmin) (int *, float *, int *); -double BLASFUNC(dzmin) (int *, double *, int *); -double BLASFUNC(qxmin) (int *, double *, int *); - -int BLASFUNC(sscal) (int *, float *, float *, int *); -int BLASFUNC(dscal) (int *, double *, double *, int *); -int BLASFUNC(qscal) (int *, double *, double *, int *); -int BLASFUNC(cscal) (int *, float *, float *, int *); -int BLASFUNC(zscal) (int *, double *, double *, int *); -int BLASFUNC(xscal) (int *, double *, double *, int *); -int BLASFUNC(csscal)(int *, float *, float *, int *); -int BLASFUNC(zdscal)(int *, double *, double *, int *); -int BLASFUNC(xqscal)(int *, double *, double *, int *); - -float BLASFUNC(snrm2) (int *, float *, int *); -float BLASFUNC(scnrm2)(int *, float *, int *); - -double BLASFUNC(dnrm2) (int *, double *, int *); -double BLASFUNC(qnrm2) (int *, double *, int *); -double BLASFUNC(dznrm2)(int *, double *, int *); -double BLASFUNC(qxnrm2)(int *, double *, int *); - -int BLASFUNC(srot) (int *, float *, int *, float *, int *, float *, float *); -int BLASFUNC(drot) (int *, double *, int *, double *, int *, double *, double *); -int BLASFUNC(qrot) (int *, double *, int *, double *, int *, double *, double *); -int BLASFUNC(csrot) (int *, float *, int *, float *, int *, float *, float *); -int BLASFUNC(zdrot) (int *, double *, int *, double *, int *, double *, double *); -int BLASFUNC(xqrot) (int *, double *, int *, double *, int *, double *, double *); - -int BLASFUNC(srotg) (float *, float *, float *, float *); -int BLASFUNC(drotg) (double *, double *, double *, double *); -int BLASFUNC(qrotg) (double *, double *, double *, double *); -int BLASFUNC(crotg) (float *, float *, float *, float *); -int BLASFUNC(zrotg) (double *, double *, double *, double *); -int BLASFUNC(xrotg) (double *, double *, double *, double *); - -int BLASFUNC(srotmg)(float *, float *, float *, float *, float *); -int BLASFUNC(drotmg)(double *, double *, double *, double *, double *); - -int BLASFUNC(srotm) (int *, float *, int *, float *, int *, float *); -int BLASFUNC(drotm) (int *, double *, int *, double *, int *, double *); -int BLASFUNC(qrotm) (int *, double *, int *, double *, int *, double *); - -/* Level 2 routines */ - -int BLASFUNC(sger)(int *, int *, float *, float *, int *, - float *, int *, float *, int *); -int BLASFUNC(dger)(int *, int *, double *, double *, int *, - double *, int *, double *, int *); -int BLASFUNC(qger)(int *, int *, double *, double *, int *, - double *, int *, double *, int *); -int BLASFUNC(cgeru)(int *, int *, float *, float *, int *, - float *, int *, float *, int *); -int BLASFUNC(cgerc)(int *, int *, float *, float *, int *, - float *, int *, float *, int *); -int BLASFUNC(zgeru)(int *, int *, double *, double *, int *, - double *, int *, double *, int *); -int BLASFUNC(zgerc)(int *, int *, double *, double *, int *, - double *, int *, double *, int *); -int BLASFUNC(xgeru)(int *, int *, double *, double *, int *, - double *, int *, double *, int *); -int BLASFUNC(xgerc)(int *, int *, double *, double *, int *, - double *, int *, double *, int *); - -int BLASFUNC(sgemv)(char *, int *, int *, float *, float *, int *, - float *, int *, float *, float *, int *); -int BLASFUNC(dgemv)(char *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); -int BLASFUNC(qgemv)(char *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); -int BLASFUNC(cgemv)(char *, int *, int *, float *, float *, int *, - float *, int *, float *, float *, int *); -int BLASFUNC(zgemv)(char *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); -int BLASFUNC(xgemv)(char *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); - -int BLASFUNC(strsv) (char *, char *, char *, int *, float *, int *, - float *, int *); -int BLASFUNC(dtrsv) (char *, char *, char *, int *, double *, int *, - double *, int *); -int BLASFUNC(qtrsv) (char *, char *, char *, int *, double *, int *, - double *, int *); -int BLASFUNC(ctrsv) (char *, char *, char *, int *, float *, int *, - float *, int *); -int BLASFUNC(ztrsv) (char *, char *, char *, int *, double *, int *, - double *, int *); -int BLASFUNC(xtrsv) (char *, char *, char *, int *, double *, int *, - double *, int *); - -int BLASFUNC(stpsv) (char *, char *, char *, int *, float *, float *, int *); -int BLASFUNC(dtpsv) (char *, char *, char *, int *, double *, double *, int *); -int BLASFUNC(qtpsv) (char *, char *, char *, int *, double *, double *, int *); -int BLASFUNC(ctpsv) (char *, char *, char *, int *, float *, float *, int *); -int BLASFUNC(ztpsv) (char *, char *, char *, int *, double *, double *, int *); -int BLASFUNC(xtpsv) (char *, char *, char *, int *, double *, double *, int *); - -int BLASFUNC(strmv) (char *, char *, char *, int *, float *, int *, - float *, int *); -int BLASFUNC(dtrmv) (char *, char *, char *, int *, double *, int *, - double *, int *); -int BLASFUNC(qtrmv) (char *, char *, char *, int *, double *, int *, - double *, int *); -int BLASFUNC(ctrmv) (char *, char *, char *, int *, float *, int *, - float *, int *); -int BLASFUNC(ztrmv) (char *, char *, char *, int *, double *, int *, - double *, int *); -int BLASFUNC(xtrmv) (char *, char *, char *, int *, double *, int *, - double *, int *); - -int BLASFUNC(stpmv) (char *, char *, char *, int *, float *, float *, int *); -int BLASFUNC(dtpmv) (char *, char *, char *, int *, double *, double *, int *); -int BLASFUNC(qtpmv) (char *, char *, char *, int *, double *, double *, int *); -int BLASFUNC(ctpmv) (char *, char *, char *, int *, float *, float *, int *); -int BLASFUNC(ztpmv) (char *, char *, char *, int *, double *, double *, int *); -int BLASFUNC(xtpmv) (char *, char *, char *, int *, double *, double *, int *); - -int BLASFUNC(stbmv) (char *, char *, char *, int *, int *, float *, int *, float *, int *); -int BLASFUNC(dtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); -int BLASFUNC(qtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); -int BLASFUNC(ctbmv) (char *, char *, char *, int *, int *, float *, int *, float *, int *); -int BLASFUNC(ztbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); -int BLASFUNC(xtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); - -int BLASFUNC(stbsv) (char *, char *, char *, int *, int *, float *, int *, float *, int *); -int BLASFUNC(dtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); -int BLASFUNC(qtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); -int BLASFUNC(ctbsv) (char *, char *, char *, int *, int *, float *, int *, float *, int *); -int BLASFUNC(ztbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); -int BLASFUNC(xtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); - -int BLASFUNC(ssymv) (char *, int *, float *, float *, int *, - float *, int *, float *, float *, int *); -int BLASFUNC(dsymv) (char *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); -int BLASFUNC(qsymv) (char *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); -int BLASFUNC(csymv) (char *, int *, float *, float *, int *, - float *, int *, float *, float *, int *); -int BLASFUNC(zsymv) (char *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); -int BLASFUNC(xsymv) (char *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); - -int BLASFUNC(sspmv) (char *, int *, float *, float *, - float *, int *, float *, float *, int *); -int BLASFUNC(dspmv) (char *, int *, double *, double *, - double *, int *, double *, double *, int *); -int BLASFUNC(qspmv) (char *, int *, double *, double *, - double *, int *, double *, double *, int *); -int BLASFUNC(cspmv) (char *, int *, float *, float *, - float *, int *, float *, float *, int *); -int BLASFUNC(zspmv) (char *, int *, double *, double *, - double *, int *, double *, double *, int *); -int BLASFUNC(xspmv) (char *, int *, double *, double *, - double *, int *, double *, double *, int *); - -int BLASFUNC(ssyr) (char *, int *, float *, float *, int *, - float *, int *); -int BLASFUNC(dsyr) (char *, int *, double *, double *, int *, - double *, int *); -int BLASFUNC(qsyr) (char *, int *, double *, double *, int *, - double *, int *); -int BLASFUNC(csyr) (char *, int *, float *, float *, int *, - float *, int *); -int BLASFUNC(zsyr) (char *, int *, double *, double *, int *, - double *, int *); -int BLASFUNC(xsyr) (char *, int *, double *, double *, int *, - double *, int *); - -int BLASFUNC(ssyr2) (char *, int *, float *, - float *, int *, float *, int *, float *, int *); -int BLASFUNC(dsyr2) (char *, int *, double *, - double *, int *, double *, int *, double *, int *); -int BLASFUNC(qsyr2) (char *, int *, double *, - double *, int *, double *, int *, double *, int *); -int BLASFUNC(csyr2) (char *, int *, float *, - float *, int *, float *, int *, float *, int *); -int BLASFUNC(zsyr2) (char *, int *, double *, - double *, int *, double *, int *, double *, int *); -int BLASFUNC(xsyr2) (char *, int *, double *, - double *, int *, double *, int *, double *, int *); - -int BLASFUNC(sspr) (char *, int *, float *, float *, int *, - float *); -int BLASFUNC(dspr) (char *, int *, double *, double *, int *, - double *); -int BLASFUNC(qspr) (char *, int *, double *, double *, int *, - double *); -int BLASFUNC(cspr) (char *, int *, float *, float *, int *, - float *); -int BLASFUNC(zspr) (char *, int *, double *, double *, int *, - double *); -int BLASFUNC(xspr) (char *, int *, double *, double *, int *, - double *); - -int BLASFUNC(sspr2) (char *, int *, float *, - float *, int *, float *, int *, float *); -int BLASFUNC(dspr2) (char *, int *, double *, - double *, int *, double *, int *, double *); -int BLASFUNC(qspr2) (char *, int *, double *, - double *, int *, double *, int *, double *); -int BLASFUNC(cspr2) (char *, int *, float *, - float *, int *, float *, int *, float *); -int BLASFUNC(zspr2) (char *, int *, double *, - double *, int *, double *, int *, double *); -int BLASFUNC(xspr2) (char *, int *, double *, - double *, int *, double *, int *, double *); - -int BLASFUNC(cher) (char *, int *, float *, float *, int *, - float *, int *); -int BLASFUNC(zher) (char *, int *, double *, double *, int *, - double *, int *); -int BLASFUNC(xher) (char *, int *, double *, double *, int *, - double *, int *); - -int BLASFUNC(chpr) (char *, int *, float *, float *, int *, float *); -int BLASFUNC(zhpr) (char *, int *, double *, double *, int *, double *); -int BLASFUNC(xhpr) (char *, int *, double *, double *, int *, double *); - -int BLASFUNC(cher2) (char *, int *, float *, - float *, int *, float *, int *, float *, int *); -int BLASFUNC(zher2) (char *, int *, double *, - double *, int *, double *, int *, double *, int *); -int BLASFUNC(xher2) (char *, int *, double *, - double *, int *, double *, int *, double *, int *); - -int BLASFUNC(chpr2) (char *, int *, float *, - float *, int *, float *, int *, float *); -int BLASFUNC(zhpr2) (char *, int *, double *, - double *, int *, double *, int *, double *); -int BLASFUNC(xhpr2) (char *, int *, double *, - double *, int *, double *, int *, double *); - -int BLASFUNC(chemv) (char *, int *, float *, float *, int *, - float *, int *, float *, float *, int *); -int BLASFUNC(zhemv) (char *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); -int BLASFUNC(xhemv) (char *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); - -int BLASFUNC(chpmv) (char *, int *, float *, float *, - float *, int *, float *, float *, int *); -int BLASFUNC(zhpmv) (char *, int *, double *, double *, - double *, int *, double *, double *, int *); -int BLASFUNC(xhpmv) (char *, int *, double *, double *, - double *, int *, double *, double *, int *); - -int BLASFUNC(snorm)(char *, int *, int *, float *, int *); -int BLASFUNC(dnorm)(char *, int *, int *, double *, int *); -int BLASFUNC(cnorm)(char *, int *, int *, float *, int *); -int BLASFUNC(znorm)(char *, int *, int *, double *, int *); - -int BLASFUNC(sgbmv)(char *, int *, int *, int *, int *, float *, float *, int *, - float *, int *, float *, float *, int *); -int BLASFUNC(dgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); -int BLASFUNC(qgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); -int BLASFUNC(cgbmv)(char *, int *, int *, int *, int *, float *, float *, int *, - float *, int *, float *, float *, int *); -int BLASFUNC(zgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); -int BLASFUNC(xgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); - -int BLASFUNC(ssbmv)(char *, int *, int *, float *, float *, int *, - float *, int *, float *, float *, int *); -int BLASFUNC(dsbmv)(char *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); -int BLASFUNC(qsbmv)(char *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); -int BLASFUNC(csbmv)(char *, int *, int *, float *, float *, int *, - float *, int *, float *, float *, int *); -int BLASFUNC(zsbmv)(char *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); -int BLASFUNC(xsbmv)(char *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); - -int BLASFUNC(chbmv)(char *, int *, int *, float *, float *, int *, - float *, int *, float *, float *, int *); -int BLASFUNC(zhbmv)(char *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); -int BLASFUNC(xhbmv)(char *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); - -/* Level 3 routines */ - -int BLASFUNC(sgemm)(char *, char *, int *, int *, int *, float *, - float *, int *, float *, int *, float *, float *, int *); -int BLASFUNC(dgemm)(char *, char *, int *, int *, int *, double *, - double *, int *, double *, int *, double *, double *, int *); -int BLASFUNC(qgemm)(char *, char *, int *, int *, int *, double *, - double *, int *, double *, int *, double *, double *, int *); -int BLASFUNC(cgemm)(char *, char *, int *, int *, int *, float *, - float *, int *, float *, int *, float *, float *, int *); -int BLASFUNC(zgemm)(char *, char *, int *, int *, int *, double *, - double *, int *, double *, int *, double *, double *, int *); -int BLASFUNC(xgemm)(char *, char *, int *, int *, int *, double *, - double *, int *, double *, int *, double *, double *, int *); - -int BLASFUNC(cgemm3m)(char *, char *, int *, int *, int *, float *, - float *, int *, float *, int *, float *, float *, int *); -int BLASFUNC(zgemm3m)(char *, char *, int *, int *, int *, double *, - double *, int *, double *, int *, double *, double *, int *); -int BLASFUNC(xgemm3m)(char *, char *, int *, int *, int *, double *, - double *, int *, double *, int *, double *, double *, int *); - -int BLASFUNC(sge2mm)(char *, char *, char *, int *, int *, - float *, float *, int *, float *, int *, - float *, float *, int *); -int BLASFUNC(dge2mm)(char *, char *, char *, int *, int *, - double *, double *, int *, double *, int *, - double *, double *, int *); -int BLASFUNC(cge2mm)(char *, char *, char *, int *, int *, - float *, float *, int *, float *, int *, - float *, float *, int *); -int BLASFUNC(zge2mm)(char *, char *, char *, int *, int *, - double *, double *, int *, double *, int *, - double *, double *, int *); - -int BLASFUNC(strsm)(char *, char *, char *, char *, int *, int *, - float *, float *, int *, float *, int *); -int BLASFUNC(dtrsm)(char *, char *, char *, char *, int *, int *, - double *, double *, int *, double *, int *); -int BLASFUNC(qtrsm)(char *, char *, char *, char *, int *, int *, - double *, double *, int *, double *, int *); -int BLASFUNC(ctrsm)(char *, char *, char *, char *, int *, int *, - float *, float *, int *, float *, int *); -int BLASFUNC(ztrsm)(char *, char *, char *, char *, int *, int *, - double *, double *, int *, double *, int *); -int BLASFUNC(xtrsm)(char *, char *, char *, char *, int *, int *, - double *, double *, int *, double *, int *); - -int BLASFUNC(strmm)(char *, char *, char *, char *, int *, int *, - float *, float *, int *, float *, int *); -int BLASFUNC(dtrmm)(char *, char *, char *, char *, int *, int *, - double *, double *, int *, double *, int *); -int BLASFUNC(qtrmm)(char *, char *, char *, char *, int *, int *, - double *, double *, int *, double *, int *); -int BLASFUNC(ctrmm)(char *, char *, char *, char *, int *, int *, - float *, float *, int *, float *, int *); -int BLASFUNC(ztrmm)(char *, char *, char *, char *, int *, int *, - double *, double *, int *, double *, int *); -int BLASFUNC(xtrmm)(char *, char *, char *, char *, int *, int *, - double *, double *, int *, double *, int *); - -int BLASFUNC(ssymm)(char *, char *, int *, int *, float *, float *, int *, - float *, int *, float *, float *, int *); -int BLASFUNC(dsymm)(char *, char *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); -int BLASFUNC(qsymm)(char *, char *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); -int BLASFUNC(csymm)(char *, char *, int *, int *, float *, float *, int *, - float *, int *, float *, float *, int *); -int BLASFUNC(zsymm)(char *, char *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); -int BLASFUNC(xsymm)(char *, char *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); - -int BLASFUNC(csymm3m)(char *, char *, int *, int *, float *, float *, int *, - float *, int *, float *, float *, int *); -int BLASFUNC(zsymm3m)(char *, char *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); -int BLASFUNC(xsymm3m)(char *, char *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); - -int BLASFUNC(ssyrk)(char *, char *, int *, int *, float *, float *, int *, - float *, float *, int *); -int BLASFUNC(dsyrk)(char *, char *, int *, int *, double *, double *, int *, - double *, double *, int *); -int BLASFUNC(qsyrk)(char *, char *, int *, int *, double *, double *, int *, - double *, double *, int *); -int BLASFUNC(csyrk)(char *, char *, int *, int *, float *, float *, int *, - float *, float *, int *); -int BLASFUNC(zsyrk)(char *, char *, int *, int *, double *, double *, int *, - double *, double *, int *); -int BLASFUNC(xsyrk)(char *, char *, int *, int *, double *, double *, int *, - double *, double *, int *); - -int BLASFUNC(ssyr2k)(char *, char *, int *, int *, float *, float *, int *, - float *, int *, float *, float *, int *); -int BLASFUNC(dsyr2k)(char *, char *, int *, int *, double *, double *, int *, - double*, int *, double *, double *, int *); -int BLASFUNC(qsyr2k)(char *, char *, int *, int *, double *, double *, int *, - double*, int *, double *, double *, int *); -int BLASFUNC(csyr2k)(char *, char *, int *, int *, float *, float *, int *, - float *, int *, float *, float *, int *); -int BLASFUNC(zsyr2k)(char *, char *, int *, int *, double *, double *, int *, - double*, int *, double *, double *, int *); -int BLASFUNC(xsyr2k)(char *, char *, int *, int *, double *, double *, int *, - double*, int *, double *, double *, int *); - -int BLASFUNC(chemm)(char *, char *, int *, int *, float *, float *, int *, - float *, int *, float *, float *, int *); -int BLASFUNC(zhemm)(char *, char *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); -int BLASFUNC(xhemm)(char *, char *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); - -int BLASFUNC(chemm3m)(char *, char *, int *, int *, float *, float *, int *, - float *, int *, float *, float *, int *); -int BLASFUNC(zhemm3m)(char *, char *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); -int BLASFUNC(xhemm3m)(char *, char *, int *, int *, double *, double *, int *, - double *, int *, double *, double *, int *); - -int BLASFUNC(cherk)(char *, char *, int *, int *, float *, float *, int *, - float *, float *, int *); -int BLASFUNC(zherk)(char *, char *, int *, int *, double *, double *, int *, - double *, double *, int *); -int BLASFUNC(xherk)(char *, char *, int *, int *, double *, double *, int *, - double *, double *, int *); - -int BLASFUNC(cher2k)(char *, char *, int *, int *, float *, float *, int *, - float *, int *, float *, float *, int *); -int BLASFUNC(zher2k)(char *, char *, int *, int *, double *, double *, int *, - double*, int *, double *, double *, int *); -int BLASFUNC(xher2k)(char *, char *, int *, int *, double *, double *, int *, - double*, int *, double *, double *, int *); -int BLASFUNC(cher2m)(char *, char *, char *, int *, int *, float *, float *, int *, - float *, int *, float *, float *, int *); -int BLASFUNC(zher2m)(char *, char *, char *, int *, int *, double *, double *, int *, - double*, int *, double *, double *, int *); -int BLASFUNC(xher2m)(char *, char *, char *, int *, int *, double *, double *, int *, - double*, int *, double *, double *, int *); - -int BLASFUNC(sgemt)(char *, int *, int *, float *, float *, int *, - float *, int *); -int BLASFUNC(dgemt)(char *, int *, int *, double *, double *, int *, - double *, int *); -int BLASFUNC(cgemt)(char *, int *, int *, float *, float *, int *, - float *, int *); -int BLASFUNC(zgemt)(char *, int *, int *, double *, double *, int *, - double *, int *); - -int BLASFUNC(sgema)(char *, char *, int *, int *, float *, - float *, int *, float *, float *, int *, float *, int *); -int BLASFUNC(dgema)(char *, char *, int *, int *, double *, - double *, int *, double*, double *, int *, double*, int *); -int BLASFUNC(cgema)(char *, char *, int *, int *, float *, - float *, int *, float *, float *, int *, float *, int *); -int BLASFUNC(zgema)(char *, char *, int *, int *, double *, - double *, int *, double*, double *, int *, double*, int *); - -int BLASFUNC(sgems)(char *, char *, int *, int *, float *, - float *, int *, float *, float *, int *, float *, int *); -int BLASFUNC(dgems)(char *, char *, int *, int *, double *, - double *, int *, double*, double *, int *, double*, int *); -int BLASFUNC(cgems)(char *, char *, int *, int *, float *, - float *, int *, float *, float *, int *, float *, int *); -int BLASFUNC(zgems)(char *, char *, int *, int *, double *, - double *, int *, double*, double *, int *, double*, int *); - -int BLASFUNC(sgetf2)(int *, int *, float *, int *, int *, int *); -int BLASFUNC(dgetf2)(int *, int *, double *, int *, int *, int *); -int BLASFUNC(qgetf2)(int *, int *, double *, int *, int *, int *); -int BLASFUNC(cgetf2)(int *, int *, float *, int *, int *, int *); -int BLASFUNC(zgetf2)(int *, int *, double *, int *, int *, int *); -int BLASFUNC(xgetf2)(int *, int *, double *, int *, int *, int *); - -//int BLASFUNC(sgetrf)(int *, int *, float *, int *, int *, int *); -//int BLASFUNC(dgetrf)(int *, int *, double *, int *, int *, int *); -int BLASFUNC(qgetrf)(int *, int *, double *, int *, int *, int *); -int BLASFUNC(cgetrf)(int *, int *, float *, int *, int *, int *); -int BLASFUNC(zgetrf)(int *, int *, double *, int *, int *, int *); -int BLASFUNC(xgetrf)(int *, int *, double *, int *, int *, int *); - -int BLASFUNC(slaswp)(int *, float *, int *, int *, int *, int *, int *); -int BLASFUNC(dlaswp)(int *, double *, int *, int *, int *, int *, int *); -int BLASFUNC(qlaswp)(int *, double *, int *, int *, int *, int *, int *); -int BLASFUNC(claswp)(int *, float *, int *, int *, int *, int *, int *); -int BLASFUNC(zlaswp)(int *, double *, int *, int *, int *, int *, int *); -int BLASFUNC(xlaswp)(int *, double *, int *, int *, int *, int *, int *); - -int BLASFUNC(sgetrs)(char *, int *, int *, float *, int *, int *, float *, int *, int *); -int BLASFUNC(dgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); -int BLASFUNC(qgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); -int BLASFUNC(cgetrs)(char *, int *, int *, float *, int *, int *, float *, int *, int *); -int BLASFUNC(zgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); -int BLASFUNC(xgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); - -int BLASFUNC(sgesv)(int *, int *, float *, int *, int *, float *, int *, int *); -int BLASFUNC(dgesv)(int *, int *, double *, int *, int *, double*, int *, int *); -int BLASFUNC(qgesv)(int *, int *, double *, int *, int *, double*, int *, int *); -int BLASFUNC(cgesv)(int *, int *, float *, int *, int *, float *, int *, int *); -int BLASFUNC(zgesv)(int *, int *, double *, int *, int *, double*, int *, int *); -int BLASFUNC(xgesv)(int *, int *, double *, int *, int *, double*, int *, int *); - -int BLASFUNC(spotf2)(char *, int *, float *, int *, int *); -int BLASFUNC(dpotf2)(char *, int *, double *, int *, int *); -int BLASFUNC(qpotf2)(char *, int *, double *, int *, int *); -int BLASFUNC(cpotf2)(char *, int *, float *, int *, int *); -int BLASFUNC(zpotf2)(char *, int *, double *, int *, int *); -int BLASFUNC(xpotf2)(char *, int *, double *, int *, int *); - -//int BLASFUNC(spotrf)(char *, int *, float *, int *, int *); -//int BLASFUNC(dpotrf)(char *, int *, double *, int *, int *); -int BLASFUNC(qpotrf)(char *, int *, double *, int *, int *); -int BLASFUNC(cpotrf)(char *, int *, float *, int *, int *); -int BLASFUNC(zpotrf)(char *, int *, double *, int *, int *); -int BLASFUNC(xpotrf)(char *, int *, double *, int *, int *); - -int BLASFUNC(slauu2)(char *, int *, float *, int *, int *); -int BLASFUNC(dlauu2)(char *, int *, double *, int *, int *); -int BLASFUNC(qlauu2)(char *, int *, double *, int *, int *); -int BLASFUNC(clauu2)(char *, int *, float *, int *, int *); -int BLASFUNC(zlauu2)(char *, int *, double *, int *, int *); -int BLASFUNC(xlauu2)(char *, int *, double *, int *, int *); - -int BLASFUNC(slauum)(char *, int *, float *, int *, int *); -int BLASFUNC(dlauum)(char *, int *, double *, int *, int *); -int BLASFUNC(qlauum)(char *, int *, double *, int *, int *); -int BLASFUNC(clauum)(char *, int *, float *, int *, int *); -int BLASFUNC(zlauum)(char *, int *, double *, int *, int *); -int BLASFUNC(xlauum)(char *, int *, double *, int *, int *); - -int BLASFUNC(strti2)(char *, char *, int *, float *, int *, int *); -int BLASFUNC(dtrti2)(char *, char *, int *, double *, int *, int *); -int BLASFUNC(qtrti2)(char *, char *, int *, double *, int *, int *); -int BLASFUNC(ctrti2)(char *, char *, int *, float *, int *, int *); -int BLASFUNC(ztrti2)(char *, char *, int *, double *, int *, int *); -int BLASFUNC(xtrti2)(char *, char *, int *, double *, int *, int *); - -int BLASFUNC(strtri)(char *, char *, int *, float *, int *, int *); -int BLASFUNC(dtrtri)(char *, char *, int *, double *, int *, int *); -int BLASFUNC(qtrtri)(char *, char *, int *, double *, int *, int *); -int BLASFUNC(ctrtri)(char *, char *, int *, float *, int *, int *); -int BLASFUNC(ztrtri)(char *, char *, int *, double *, int *, int *); -int BLASFUNC(xtrtri)(char *, char *, int *, double *, int *, int *); - -int BLASFUNC(spotri)(char *, int *, float *, int *, int *); -int BLASFUNC(dpotri)(char *, int *, double *, int *, int *); -int BLASFUNC(qpotri)(char *, int *, double *, int *, int *); -int BLASFUNC(cpotri)(char *, int *, float *, int *, int *); -int BLASFUNC(zpotri)(char *, int *, double *, int *, int *); -int BLASFUNC(xpotri)(char *, int *, double *, int *, int *); - -} - -#endif diff --git a/btl/libs/BLAS/blas_interface.hh b/btl/libs/BLAS/blas_interface.hh deleted file mode 100644 index 19fc3c1..0000000 --- a/btl/libs/BLAS/blas_interface.hh +++ /dev/null @@ -1,77 +0,0 @@ -//===================================================== -// File : blas_interface.hh -// Author : L. Plagne -// Copyright (C) EDF R&D, lun sep 30 14:23:28 CEST 2002 -// Copyright (C) 2011 Andrea Arteaga -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -#ifndef blas_PRODUIT_MATRICE_VECTEUR_HH -#define blas_PRODUIT_MATRICE_VECTEUR_HH - -#include -#include -extern "C" -{ -#include "blas.h" -#ifdef CBLAS_INTERFACE -# include "cblas.h" -#endif -} - -#define MAKE_STRING2(S) #S -#define MAKE_STRING(S) MAKE_STRING2(S) - -#define CAT2(A,B) A##B -#define CAT(A,B) CAT2(A,B) - - -template class blas_interface; - - -static char notrans = 'N'; -static char trans = 'T'; -static char nonunit = 'N'; -static char lower = 'L'; -static char right = 'R'; -static char left = 'L'; -static int intone = 1; - - -#define SCALAR float -#define SCALAR_PREFIX s -#ifdef CBLAS_INTERFACE -# include "cblas_interface_impl.hh" -#else -# include "blas_interface_impl.hh" -#endif -#undef SCALAR -#undef SCALAR_PREFIX - - -#define SCALAR double -#define SCALAR_PREFIX d -#ifdef CBLAS_INTERFACE -# include "cblas_interface_impl.hh" -#else -# include "blas_interface_impl.hh" -#endif -#undef SCALAR -#undef SCALAR_PREFIX - -#endif - - - diff --git a/btl/libs/BLAS/blas_interface_impl.hh b/btl/libs/BLAS/blas_interface_impl.hh deleted file mode 100644 index 63883a9..0000000 --- a/btl/libs/BLAS/blas_interface_impl.hh +++ /dev/null @@ -1,96 +0,0 @@ -//===================================================== -// Copyright (C) 2011 Andrea Arteaga -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// - -#define BLAS_FUNC(NAME) CAT(CAT(SCALAR_PREFIX,NAME),_) - -template<> class blas_interface : public c_interface_base -{ - -public : - - static SCALAR fone; - static SCALAR fzero; - - static inline std::string name() - { - return MAKE_STRING(CBLASNAME); - } - - static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ - BLAS_FUNC(gemv)(¬rans,&N,&N,&fone,A,&N,B,&intone,&fzero,X,&intone); - } - - static inline void symv(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ - BLAS_FUNC(symv)(&lower, &N,&fone,A,&N,B,&intone,&fzero,X,&intone); - } - - static inline void syr2(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ - BLAS_FUNC(syr2)(&lower,&N,&fone,B,&intone,X,&intone,A,&N); - } - - static inline void ger(gene_matrix & A, gene_vector & X, gene_vector & Y, int N){ - BLAS_FUNC(ger)(&N,&N,&fone,X,&intone,Y,&intone,A,&N); - } - - static inline void rot(gene_vector & A, gene_vector & B, SCALAR c, SCALAR s, int N){ - BLAS_FUNC(rot)(&N,A,&intone,B,&intone,&c,&s); - } - - static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ - BLAS_FUNC(gemv)(&trans,&N,&N,&fone,A,&N,B,&intone,&fzero,X,&intone); - } - - static inline void matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N){ - BLAS_FUNC(gemm)(¬rans,¬rans,&N,&N,&N,&fone,A,&N,B,&N,&fzero,X,&N); - } - - static inline void transposed_matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N){ - BLAS_FUNC(gemm)(¬rans,¬rans,&N,&N,&N,&fone,A,&N,B,&N,&fzero,X,&N); - } - - static inline void aat_product(gene_matrix & A, gene_matrix & X, int N){ - BLAS_FUNC(syrk)(&lower,¬rans,&N,&N,&fone,A,&N,&fzero,X,&N); - } - - static inline void axpy(SCALAR coef, const gene_vector & X, gene_vector & Y, int N){ - BLAS_FUNC(axpy)(&N,&coef,X,&intone,Y,&intone); - } - - static inline void axpby(SCALAR a, const gene_vector & X, SCALAR b, gene_vector & Y, int N){ - BLAS_FUNC(scal)(&N,&b,Y,&intone); - BLAS_FUNC(axpy)(&N,&a,X,&intone,Y,&intone); - } - - static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector & X, int N){ - BLAS_FUNC(copy)(&N, B, &intone, X, &intone); - BLAS_FUNC(trsv)(&lower, ¬rans, &nonunit, &N, L, &N, X, &intone); - } - - static inline void trisolve_lower_matrix(const gene_matrix & L, const gene_matrix& B, gene_matrix & X, int N){ - BLAS_FUNC(copy)(&N, B, &intone, X, &intone); - BLAS_FUNC(trsm)(&right, &lower, ¬rans, &nonunit, &N, &N, &fone, L, &N, X, &N); - } - - static inline void trmm(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N){ - BLAS_FUNC(trmm)(&left, &lower, ¬rans,&nonunit, &N,&N,&fone,A,&N,B,&N); - } - -}; - -SCALAR blas_interface::fone = SCALAR(1); -SCALAR blas_interface::fzero = SCALAR(0); diff --git a/btl/libs/BLAS/c_interface_base.h b/btl/libs/BLAS/c_interface_base.h deleted file mode 100644 index 3b6afbb..0000000 --- a/btl/libs/BLAS/c_interface_base.h +++ /dev/null @@ -1,89 +0,0 @@ -//===================================================== -// Copyright (C) 2011 Andrea Arteaga -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -#ifndef BTL_C_INTERFACE_BASE_H -#define BTL_C_INTERFACE_BASE_H - -#include "utilities.h" -#include - -template class c_interface_base -{ - -public: - - typedef real real_type; - typedef std::vector stl_vector; - typedef std::vector stl_matrix; - - typedef real* gene_matrix; - typedef real* gene_vector; - - static void free_matrix(gene_matrix & A, int N){ - delete A; - } - - static void free_vector(gene_vector & B){ - delete B; - } - - static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ - int N = A_stl.size(); - A = new real[N*N]; - for (int j=0;j -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// - -#define BLAS_FUNC(NAME) CAT(cblas_,CAT(SCALAR_PREFIX,NAME)) - -template<> class blas_interface : public c_interface_base -{ - -public : - - static SCALAR fone; - static SCALAR fzero; - - static inline std::string name() - { - return MAKE_STRING(CBLASNAME); - } - - static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ - BLAS_FUNC(gemv)(CblasColMajor,CblasNoTrans,N,N,fone,A,N,B,intone,fzero,X,intone); - } - - static inline void symv(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ - BLAS_FUNC(symv)(CblasColMajor,CblasLower,N,fone,A,N,B,intone,fzero,X,intone); - } - - static inline void syr2(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ - BLAS_FUNC(syr2)(CblasColMajor,CblasLower,N,fone,B,intone,X,intone,A,N); - } - - static inline void ger(gene_matrix & A, gene_vector & X, gene_vector & Y, int N){ - BLAS_FUNC(ger)(CblasColMajor,N,N,fone,X,intone,Y,intone,A,N); - } - - static inline void rot(gene_vector & A, gene_vector & B, SCALAR c, SCALAR s, int N){ - BLAS_FUNC(rot)(N,A,intone,B,intone,c,s); - } - - static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ - BLAS_FUNC(gemv)(CblasColMajor,CblasTrans,N,N,fone,A,N,B,intone,fzero,X,intone); - } - - static inline void matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N){ - BLAS_FUNC(gemm)(CblasColMajor,CblasNoTrans,CblasNoTrans,N,N,N,fone,A,N,B,N,fzero,X,N); - } - - static inline void transposed_matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N){ - BLAS_FUNC(gemm)(CblasColMajor,CblasTrans,CblasNoTrans,N,N,N,fone,A,N,B,N,fzero,X,N); - } - - static inline void aat_product(gene_matrix & A, gene_matrix & X, int N){ - BLAS_FUNC(syrk)(CblasColMajor,CblasLower,CblasNoTrans,N,N,fone,A,N,fzero,X,N); - } - - static inline void axpy(SCALAR coef, const gene_vector & X, gene_vector & Y, int N){ - BLAS_FUNC(axpy)(N,coef,X,intone,Y,intone); - } - - static inline void axpby(SCALAR a, const gene_vector & X, SCALAR b, gene_vector & Y, int N){ - BLAS_FUNC(scal)(N,b,Y,intone); - BLAS_FUNC(axpy)(N,a,X,intone,Y,intone); - } - - static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector & X, int N){ - BLAS_FUNC(copy)(N, B, intone, X, intone); - BLAS_FUNC(trsv)(CblasColMajor,CblasLower, CblasNoTrans, CblasNonUnit, N, L, N, X, intone); - } - - static inline void trisolve_lower_matrix(const gene_matrix & L, const gene_matrix& B, gene_matrix & X, int N){ - BLAS_FUNC(copy)(N, B, intone, X, intone); - BLAS_FUNC(trsm)(CblasColMajor,CblasRight, CblasLower, CblasNoTrans, CblasNonUnit, N, N, fone, L, N, X, N); - } - - static inline void trmm(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N){ - BLAS_FUNC(trmm)(CblasColMajor,CblasLeft, CblasLower, CblasNoTrans,CblasNonUnit, N,N,fone,A,N,B,N); - } - -}; - -SCALAR blas_interface::fone = SCALAR(1); -SCALAR blas_interface::fzero = SCALAR(0); diff --git a/btl/libs/BLAS/main.cpp b/btl/libs/BLAS/main.cpp index 401cb5b..da156b8 100644 --- a/btl/libs/BLAS/main.cpp +++ b/btl/libs/BLAS/main.cpp @@ -1,8 +1,5 @@ //===================================================== -// File : main.cpp -// Author : L. Plagne -// Copyright (C) EDF R&D, lun sep 30 14:23:28 CEST 2002 -// Copyright (C) 2011 Andrea Arteaga +// Copyright (C) 2012 Andrea Arteaga //===================================================== // // This program is free software; you can redistribute it and/or @@ -19,17 +16,16 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // -#ifndef BLAS_INTERFACE -# ifndef CBLAS_INTERFACE -# define BLAS_INTERFACE -# endif -#endif +// Include the numeric interface +#define NI_FORTRAN +#include "NumericInterface.hpp" +// Include the BTL #include "utilities.h" -#include "blas_interface.hh" #include "bench.hh" -#include "basic_actions.hh" -#include "action_trisolve_matrix.hh" + +// Include the operations +#include "actionsBLAS.hpp" #include @@ -37,80 +33,17 @@ BTL_MAIN; int main(int argv, char **argc) { - bool - axpy=false, axpby=false, rot=false, - matrix_vector=false, atv=false, symv=false, syr2=false, ger=false, trisolve_vector=false, - matrix_matrix=false, aat=false, trisolve_matrix=false, trmm=false - ; - int N = 100; - - - for (int i = 1; i < argv; ++i) { - std::string arg = argc[i]; - if (arg == "axpy") axpy = true; - else if (arg == "axpby") axpby = true; - else if (arg == "rot") rot = true; - else if (arg == "matrix_vector") matrix_vector = true; - else if (arg == "atv") atv = true; - else if (arg == "symv") symv = true; - else if (arg == "syr2") syr2 = true; - else if (arg == "ger") ger = true; - else if (arg == "trisolve_vector") trisolve_vector = true; - else if (arg == "matrix_matrix") matrix_matrix = true; - else if (arg == "aat") aat = true; - else if (arg == "trisolve_matrix") trisolve_matrix = true; - else if (arg == "trmm") trmm = true; - - else if (arg[0] == '1' && arg[1] == '\0') { - axpy = true; axpby = true; rot = true; - } - else if (arg[0] == '2' && arg[1] == '\0') { - matrix_vector=true; atv=true; symv=true; syr2=true; ger=true; trisolve_vector=true; - } - else if (arg[0] == '3' && arg[1] == '\0') { - matrix_matrix=true; aat=true; trisolve_matrix=true; trmm=true; - } - - // Check switch -N - else if (arg[0] == '-' && arg[1] == 'N') { - if (arg[2] != '\0') - N = atoi(arg.c_str()+2); - else - N = atoi(argc[++i]); - } - } - - if (axpy) - bench > >(MIN_AXPY,MAX_AXPY, N); - if (axpby) - bench > >(MIN_AXPY,MAX_AXPY, N); - if (rot) - bench > >(MIN_AXPY,MAX_AXPY, N); + bench > >(4, 6000, 20); + bench > >(4, 6000, 20); - if (matrix_vector) - bench > >(MIN_MV,MAX_MV, N); - if (atv) - bench > >(MIN_MV,MAX_MV, N); - if (symv) - bench > >(MIN_MV,MAX_MV, N); - if (syr2) - bench > >(MIN_MV,MAX_MV, N); - if (ger) - bench > >(MIN_MV,MAX_MV, N); - if (trisolve_vector) - bench > >(MIN_MM,MAX_MM, N); - - if (matrix_matrix) - bench > >(MIN_MM,MAX_MM, N); - if (aat) - bench > >(MIN_MM,MAX_MM, N); - if (trisolve_matrix) - bench > >(MIN_MM,MAX_MM, N); - if (trmm) - bench > >(MIN_MM,MAX_MM, N); + bench > >(4, 2000, 20); + bench > >(4, 2000, 20); + bench > >(4, 2000, 20); + bench > >(4, 2000, 20); + bench > >(4, 2000, 20); + bench > >(4, 2000, 20); return 0; } - diff --git a/btl/libs/STL/CMakeLists.txt b/btl/libs/STL/CMakeLists.txt deleted file mode 100644 index 4cfc2dc..0000000 --- a/btl/libs/STL/CMakeLists.txt +++ /dev/null @@ -1,2 +0,0 @@ - -btl_add_bench(btl_STL main.cpp OFF) diff --git a/btl/libs/STL/STL_interface.hh b/btl/libs/STL/STL_interface.hh deleted file mode 100644 index 060cb69..0000000 --- a/btl/libs/STL/STL_interface.hh +++ /dev/null @@ -1,255 +0,0 @@ -//===================================================== -// File : STL_interface.hh -// Author : L. Plagne -// Copyright (C) EDF R&D, lun sep 30 14:23:24 CEST 2002 -//===================================================== -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -#ifndef STL_INTERFACE_HH -#define STL_INTERFACE_HH -#include -#include -#include "utilities.h" - -using namespace std; - -template -class STL_interface{ - -public : - - typedef real real_type ; - - typedef std::vector stl_vector; - typedef std::vector stl_matrix; - - typedef stl_matrix gene_matrix; - - typedef stl_vector gene_vector; - - static inline std::string name( void ) - { - return "STL"; - } - - static void free_matrix(gene_matrix & A, int N){} - - static void free_vector(gene_vector & B){} - - static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ - A = A_stl; - } - - static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){ - B = B_stl; - } - - static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){ - B_stl = B ; - } - - - static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){ - A_stl = A ; - } - - static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){ - for (int i=0;i=j) - { - for (int k=0;k > >(MIN_AXPY,MAX_AXPY,NB_POINT); - bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); - bench > >(MIN_MV,MAX_MV,NB_POINT); - bench > >(MIN_MV,MAX_MV,NB_POINT); - bench > >(MIN_MV,MAX_MV,NB_POINT); - bench > >(MIN_MV,MAX_MV,NB_POINT); - bench > >(MIN_MM,MAX_MM,NB_POINT); - bench > >(MIN_MM,MAX_MM,NB_POINT); - bench > >(MIN_MM,MAX_MM,NB_POINT); - - return 0; -} - - diff --git a/numbench/modules/internal/blasBase.py b/numbench/modules/internal/blasBase.py index dd786db..bf2faf5 100644 --- a/numbench/modules/internal/blasBase.py +++ b/numbench/modules/internal/blasBase.py @@ -21,11 +21,12 @@ import btlBase from os.path import join as pjoin -avail1 = ('axpy', 'axpby', 'rot') -avail2 = ('matrix_vector', 'atv', 'symv', 'ger', 'syr2', 'trisolve_vector') -avail3 = ('matrix_matrix', 'aat', 'trisolve_matrix', 'trmm') +avail1 = ('axpy', 'rot') +avail2 = ('MatrixVector', 'MatrixTVector', 'SymMatrixVector', + 'Rank1Update', 'Rank2Update', 'TriSolveVector') +avail3 = ('MatrixMatrix', 'MatrixTMatrix', 'TriMatrixMatrix', 'TriSolveMatrix') availableTests = avail1 + avail2 + avail3 -defaultTests = ('axpy', 'matrix_vector', 'trisolve_vector', 'matrix_matrix') +defaultTests = ('axpy', 'MatrixVector', 'TriSolveVector', 'MatrixMatrix') def init(self, args): diff --git a/numbench/testdescr.py b/numbench/testdescr.py index 3db919b..1f96080 100644 --- a/numbench/testdescr.py +++ b/numbench/testdescr.py @@ -20,18 +20,18 @@ testdescr = { 'axpy' : 'y = a*x + y', 'axpby' : 'y = a*x + b*y', 'rot': 'Apply Givens rotation', -'matrix_vector': 'Matrix-Vector multiply', -'atv': 'Transposed Matrix-Vector multiply (A\' * x)', -'symv': 'Symmetric Matrix-Vector multiply', -'ger': 'Rank-1 update', -'syr2': 'Symmetric Rank-2 update', -'trisolve_vector': 'Triangular system solution', -'matrix_matrix': 'Matrix-Matrix multiply', -'aat': 'Symmetric Rank-n update', -'trisolve_matrix': 'Triangular system solution with n right hand side vectors', -'trmm': 'Triangular Matrix-Matrix multiply', +'MatrixVector': 'Matrix-Vector multiply', +'MatrixTVector': 'Transposed Matrix-Vector multiply (A\' * x)', +'SymMatrixVector': 'Symmetric Matrix-Vector multiply', +'Rank1Update': 'Rank-1 update', +'Rank2Update': 'Symmetric Rank-2 update', +'TriSolveVector': 'Triangular system solution', +'MatrixMatrix': 'Matrix-Matrix multiply', +'MatrixTMatrix': 'Symmetric Rank-n update', +'TriMatrixMatrix': 'Triangular Matrix-Matrix multiply', +'TriSolveMatrix': 'Triangular system solution with n right hand side vectors', -# LAPACK +# LAPACK(e) 'general_solve': 'Solution of a generic linear system of equations', 'least_squares': 'Least squares solution', 'lu_decomp': 'LU-decomposition',