summaryrefslogtreecommitdiffhomepage
path: root/eigen/bench/btl/libs
diff options
context:
space:
mode:
Diffstat (limited to 'eigen/bench/btl/libs')
-rw-r--r--eigen/bench/btl/libs/BLAS/CMakeLists.txt29
-rw-r--r--eigen/bench/btl/libs/BLAS/blas_interface_impl.hh12
-rw-r--r--eigen/bench/btl/libs/BLAS/c_interface_base.h6
-rw-r--r--eigen/bench/btl/libs/BLAS/main.cpp12
-rw-r--r--eigen/bench/btl/libs/STL/STL_interface.hh28
-rw-r--r--eigen/bench/btl/libs/blaze/CMakeLists.txt13
-rw-r--r--eigen/bench/btl/libs/blaze/blaze_interface.hh141
-rw-r--r--eigen/bench/btl/libs/blaze/main.cpp40
-rw-r--r--eigen/bench/btl/libs/eigen2/eigen2_interface.hh2
-rw-r--r--eigen/bench/btl/libs/eigen3/eigen3_interface.hh64
-rw-r--r--eigen/bench/btl/libs/eigen3/main_adv.cpp14
-rw-r--r--eigen/bench/btl/libs/eigen3/main_matmat.cpp2
-rw-r--r--eigen/bench/btl/libs/tensors/CMakeLists.txt44
-rw-r--r--eigen/bench/btl/libs/tensors/main_linear.cpp23
-rw-r--r--eigen/bench/btl/libs/tensors/main_matmat.cpp21
-rw-r--r--eigen/bench/btl/libs/tensors/main_vecmat.cpp21
-rw-r--r--eigen/bench/btl/libs/tensors/tensor_interface.hh105
17 files changed, 485 insertions, 92 deletions
diff --git a/eigen/bench/btl/libs/BLAS/CMakeLists.txt b/eigen/bench/btl/libs/BLAS/CMakeLists.txt
index de42fe0..0272cca 100644
--- a/eigen/bench/btl/libs/BLAS/CMakeLists.txt
+++ b/eigen/bench/btl/libs/BLAS/CMakeLists.txt
@@ -18,27 +18,14 @@ if (MKL_FOUND)
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(OPENBLAS)
+if (OPENBLAS_FOUND)
+ btl_add_bench(btl_openblas main.cpp)
+ if(BUILD_btl_openblas)
+ target_link_libraries(btl_openblas ${OPENBLAS_LIBRARIES} )
+ set_target_properties(btl_openblas PROPERTIES COMPILE_FLAGS "-DCBLASNAME=OPENBLAS")
+ endif(BUILD_btl_openblas)
+endif (OPENBLAS_FOUND)
find_package(ACML)
if (ACML_FOUND)
diff --git a/eigen/bench/btl/libs/BLAS/blas_interface_impl.hh b/eigen/bench/btl/libs/BLAS/blas_interface_impl.hh
index 0e84df0..9e0a649 100644
--- a/eigen/bench/btl/libs/BLAS/blas_interface_impl.hh
+++ b/eigen/bench/btl/libs/BLAS/blas_interface_impl.hh
@@ -46,9 +46,9 @@ public :
BLAS_FUNC(gemm)(&notrans,&notrans,&N,&N,&N,&fone,A,&N,B,&N,&fzero,X,&N);
}
-// static inline void ata_product(gene_matrix & A, gene_matrix & X, int N){
-// ssyrk_(&lower,&trans,&N,&N,&fone,A,&N,&fzero,X,&N);
-// }
+ static inline void ata_product(gene_matrix & A, gene_matrix & X, int N){
+ BLAS_FUNC(syrk)(&lower,&trans,&N,&N,&fone,A,&N,&fzero,X,&N);
+ }
static inline void aat_product(gene_matrix & A, gene_matrix & X, int N){
BLAS_FUNC(syrk)(&lower,&notrans,&N,&N,&fone,A,&N,&fzero,X,&N);
@@ -75,7 +75,6 @@ public :
static inline void partial_lu_decomp(const gene_matrix & X, gene_matrix & C, int N){
int N2 = N*N;
BLAS_FUNC(copy)(&N2, X, &intone, C, &intone);
- char uplo = 'L';
int info = 0;
int * ipiv = (int*)alloca(sizeof(int)*N);
BLAS_FUNC(getrf)(&N, &N, C, &N, ipiv, &info);
@@ -92,7 +91,7 @@ public :
BLAS_FUNC(trsm)(&right, &lower, &notrans, &nonunit, &N, &N, &fone, L, &N, X, &N);
}
- static inline void trmm(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N){
+ static inline void trmm(gene_matrix & A, gene_matrix & B, gene_matrix & /*X*/, int N){
BLAS_FUNC(trmm)(&left, &lower, &notrans,&nonunit, &N,&N,&fone,A,&N,B,&N);
}
@@ -101,7 +100,6 @@ public :
static inline void lu_decomp(const gene_matrix & X, gene_matrix & C, int N){
int N2 = N*N;
BLAS_FUNC(copy)(&N2, X, &intone, C, &intone);
- char uplo = 'L';
int info = 0;
int * ipiv = (int*)alloca(sizeof(int)*N);
int * jpiv = (int*)alloca(sizeof(int)*N);
@@ -134,8 +132,6 @@ public :
}
char uplo = 'U';
int info = 0;
- int ilo = 1;
- int ihi = N;
int bsize = 64;
int worksize = N*bsize;
SCALAR* d = new SCALAR[3*N+worksize];
diff --git a/eigen/bench/btl/libs/BLAS/c_interface_base.h b/eigen/bench/btl/libs/BLAS/c_interface_base.h
index 515d8dc..de61380 100644
--- a/eigen/bench/btl/libs/BLAS/c_interface_base.h
+++ b/eigen/bench/btl/libs/BLAS/c_interface_base.h
@@ -17,12 +17,12 @@ public:
typedef real* gene_matrix;
typedef real* gene_vector;
- static void free_matrix(gene_matrix & A, int N){
- delete A;
+ static void free_matrix(gene_matrix & A, int /*N*/){
+ delete[] A;
}
static void free_vector(gene_vector & B){
- delete B;
+ delete[] B;
}
static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){
diff --git a/eigen/bench/btl/libs/BLAS/main.cpp b/eigen/bench/btl/libs/BLAS/main.cpp
index 8347c9f..fd99149 100644
--- a/eigen/bench/btl/libs/BLAS/main.cpp
+++ b/eigen/bench/btl/libs/BLAS/main.cpp
@@ -48,7 +48,7 @@ int main()
bench<Action_rot<blas_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
bench<Action_matrix_matrix_product<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
-// bench<Action_ata_product<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
+ bench<Action_ata_product<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
bench<Action_aat_product<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
bench<Action_trisolve<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
@@ -56,13 +56,13 @@ int main()
bench<Action_trmm<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
- bench<Action_cholesky<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
- bench<Action_partial_lu<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
+ bench<Action_cholesky<blas_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
+ bench<Action_partial_lu<blas_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
#ifdef HAS_LAPACK
- bench<Action_lu_decomp<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
- bench<Action_hessenberg<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
- bench<Action_tridiagonalization<blas_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
+// bench<Action_lu_decomp<blas_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
+ bench<Action_hessenberg<blas_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
+ bench<Action_tridiagonalization<blas_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
#endif
//bench<Action_lu_solve<blas_LU_solve_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
diff --git a/eigen/bench/btl/libs/STL/STL_interface.hh b/eigen/bench/btl/libs/STL/STL_interface.hh
index 93e76bd..16658c4 100644
--- a/eigen/bench/btl/libs/STL/STL_interface.hh
+++ b/eigen/bench/btl/libs/STL/STL_interface.hh
@@ -44,9 +44,9 @@ public :
return "STL";
}
- static void free_matrix(gene_matrix & A, int N){}
+ static void free_matrix(gene_matrix & /*A*/, int /*N*/){}
- static void free_vector(gene_vector & B){}
+ static void free_vector(gene_vector & /*B*/){}
static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){
A = A_stl;
@@ -78,18 +78,18 @@ public :
cible[i][j]=source[i][j];
}
-// static inline void ata_product(const gene_matrix & A, gene_matrix & X, int N)
-// {
-// real somme;
-// for (int j=0;j<N;j++){
-// for (int i=0;i<N;i++){
-// somme=0.0;
-// for (int k=0;k<N;k++)
-// somme += A[i][k]*A[j][k];
-// X[j][i]=somme;
-// }
-// }
-// }
+ static inline void ata_product(const gene_matrix & A, gene_matrix & X, int N)
+ {
+ real somme;
+ for (int j=0;j<N;j++){
+ for (int i=0;i<N;i++){
+ somme=0.0;
+ for (int k=0;k<N;k++)
+ somme += A[i][k]*A[j][k];
+ X[j][i]=somme;
+ }
+ }
+ }
static inline void aat_product(const gene_matrix & A, gene_matrix & X, int N)
{
diff --git a/eigen/bench/btl/libs/blaze/CMakeLists.txt b/eigen/bench/btl/libs/blaze/CMakeLists.txt
new file mode 100644
index 0000000..e99a085
--- /dev/null
+++ b/eigen/bench/btl/libs/blaze/CMakeLists.txt
@@ -0,0 +1,13 @@
+
+find_package(BLAZE)
+find_package(Boost COMPONENTS system)
+if (BLAZE_FOUND AND Boost_FOUND)
+ include_directories(${BLAZE_INCLUDE_DIR} ${Boost_INCLUDE_DIRS})
+ btl_add_bench(btl_blaze main.cpp)
+ # Note: The newest blaze version requires C++14.
+ # Ideally, we should set this depending on the version of Blaze we found
+ set_property(TARGET btl_blaze PROPERTY CXX_STANDARD 14)
+ if(BUILD_btl_blaze)
+ target_link_libraries(btl_blaze ${Boost_LIBRARIES})
+ endif()
+endif ()
diff --git a/eigen/bench/btl/libs/blaze/blaze_interface.hh b/eigen/bench/btl/libs/blaze/blaze_interface.hh
new file mode 100644
index 0000000..7b418f6
--- /dev/null
+++ b/eigen/bench/btl/libs/blaze/blaze_interface.hh
@@ -0,0 +1,141 @@
+//=====================================================
+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
+//=====================================================
+//
+// 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 BLAZE_INTERFACE_HH
+#define BLAZE_INTERFACE_HH
+
+#include <blaze/Math.h>
+#include <blaze/Blaze.h>
+#include <Eigen/Core>
+// using namespace blaze;
+
+#include <vector>
+
+template<class real>
+class blaze_interface {
+
+public :
+
+ typedef real real_type ;
+
+ typedef std::vector<real> stl_vector;
+ typedef std::vector<stl_vector > stl_matrix;
+
+ typedef blaze::DynamicMatrix<real,blaze::columnMajor> gene_matrix;
+ typedef blaze::DynamicVector<real> gene_vector;
+
+ static inline std::string name() { return "blaze"; }
+
+ static void free_matrix(gene_matrix & A, int N){
+ return ;
+ }
+
+ static void free_vector(gene_vector & B){
+ return ;
+ }
+
+ static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){
+ A.resize(A_stl[0].size(), A_stl.size());
+
+ for (int j=0; j<A_stl.size() ; j++){
+ for (int i=0; i<A_stl[j].size() ; i++){
+ A(i,j) = A_stl[j][i];
+ }
+ }
+ }
+
+ static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){
+ B.resize(B_stl.size());
+ for (int i=0; i<B_stl.size() ; i++){
+ B[i] = B_stl[i];
+ }
+ }
+
+ static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){
+ for (int i=0; i<B_stl.size() ; i++){
+ B_stl[i] = B[i];
+ }
+ }
+
+ static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){
+ int N=A_stl.size();
+ for (int j=0;j<N;j++){
+ A_stl[j].resize(N);
+ for (int i=0;i<N;i++){
+ A_stl[j][i] = A(i,j);
+ }
+ }
+ }
+
+ static EIGEN_DONT_INLINE void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){
+ X = (A*B);
+ }
+
+ static EIGEN_DONT_INLINE void transposed_matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){
+ X = (trans(A)*trans(B));
+ }
+
+ static EIGEN_DONT_INLINE void ata_product(const gene_matrix & A, gene_matrix & X, int N){
+ X = (trans(A)*A);
+ }
+
+ static EIGEN_DONT_INLINE void aat_product(const gene_matrix & A, gene_matrix & X, int N){
+ X = (A*trans(A));
+ }
+
+ static EIGEN_DONT_INLINE void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
+ X = (A*B);
+ }
+
+ static EIGEN_DONT_INLINE void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
+ X = (trans(A)*B);
+ }
+
+ static EIGEN_DONT_INLINE void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N){
+ Y += coef * X;
+ }
+
+ static EIGEN_DONT_INLINE void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int N){
+ Y = a*X + b*Y;
+ }
+
+// static inline void cholesky(const gene_matrix & X, gene_matrix & C, int N){
+// C = X;
+// recursive_cholesky(C);
+// }
+
+// static inline void lu_decomp(const gene_matrix & X, gene_matrix & R, int N){
+// R = X;
+// std::vector<int> ipvt(N);
+// lu_factor(R, ipvt);
+// }
+
+// static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector & X, int N){
+// X = lower_trisolve(L, B);
+// }
+
+ static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){
+ cible = source;
+ }
+
+ static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){
+ cible = source;
+ }
+
+};
+
+#endif
diff --git a/eigen/bench/btl/libs/blaze/main.cpp b/eigen/bench/btl/libs/blaze/main.cpp
new file mode 100644
index 0000000..ccae0cb
--- /dev/null
+++ b/eigen/bench/btl/libs/blaze/main.cpp
@@ -0,0 +1,40 @@
+//=====================================================
+// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
+//=====================================================
+//
+// 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.
+//
+#include "utilities.h"
+#include "blaze_interface.hh"
+#include "bench.hh"
+#include "basic_actions.hh"
+
+BTL_MAIN;
+
+int main()
+{
+
+ bench<Action_axpy<blaze_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
+ bench<Action_axpby<blaze_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
+
+ bench<Action_matrix_vector_product<blaze_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
+ bench<Action_atv_product<blaze_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
+ bench<Action_matrix_matrix_product<blaze_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
+ bench<Action_ata_product<blaze_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
+ bench<Action_aat_product<blaze_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
+
+ return 0;
+}
+
+
diff --git a/eigen/bench/btl/libs/eigen2/eigen2_interface.hh b/eigen/bench/btl/libs/eigen2/eigen2_interface.hh
index 47fe581..1deabda 100644
--- a/eigen/bench/btl/libs/eigen2/eigen2_interface.hh
+++ b/eigen/bench/btl/libs/eigen2/eigen2_interface.hh
@@ -47,7 +47,7 @@ public :
{
#if defined(EIGEN_VECTORIZE_SSE)
if (SIZE==Dynamic) return "eigen2"; else return "tiny_eigen2";
- #elif defined(EIGEN_VECTORIZE_ALTIVEC)
+ #elif defined(EIGEN_VECTORIZE_ALTIVEC) || defined(EIGEN_VECTORIZE_VSX)
if (SIZE==Dynamic) return "eigen2"; else return "tiny_eigen2";
#else
if (SIZE==Dynamic) return "eigen2_novec"; else return "tiny_eigen2_novec";
diff --git a/eigen/bench/btl/libs/eigen3/eigen3_interface.hh b/eigen/bench/btl/libs/eigen3/eigen3_interface.hh
index 31bcc1f..2e302d0 100644
--- a/eigen/bench/btl/libs/eigen3/eigen3_interface.hh
+++ b/eigen/bench/btl/libs/eigen3/eigen3_interface.hh
@@ -45,15 +45,15 @@ public :
return EIGEN_MAKESTRING(BTL_PREFIX);
}
- static void free_matrix(gene_matrix & A, int N) {}
+ static void free_matrix(gene_matrix & /*A*/, int /*N*/) {}
- static void free_vector(gene_vector & B) {}
+ static void free_vector(gene_vector & /*B*/) {}
static BTL_DONT_INLINE void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){
A.resize(A_stl[0].size(), A_stl.size());
- for (int j=0; j<A_stl.size() ; j++){
- for (int i=0; i<A_stl[j].size() ; i++){
+ for (unsigned int j=0; j<A_stl.size() ; j++){
+ for (unsigned int i=0; i<A_stl[j].size() ; i++){
A.coeffRef(i,j) = A_stl[j][i];
}
}
@@ -62,19 +62,19 @@ public :
static BTL_DONT_INLINE void vector_from_stl(gene_vector & B, stl_vector & B_stl){
B.resize(B_stl.size(),1);
- for (int i=0; i<B_stl.size() ; i++){
+ for (unsigned int i=0; i<B_stl.size() ; i++){
B.coeffRef(i) = B_stl[i];
}
}
static BTL_DONT_INLINE void vector_to_stl(gene_vector & B, stl_vector & B_stl){
- for (int i=0; i<B_stl.size() ; i++){
+ for (unsigned int i=0; i<B_stl.size() ; i++){
B_stl[i] = B.coeff(i);
}
}
static BTL_DONT_INLINE void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){
- int N=A_stl.size();
+ int N=A_stl.size();
for (int j=0;j<N;j++){
A_stl[j].resize(N);
@@ -84,28 +84,30 @@ public :
}
}
- static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){
+ static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int /*N*/){
X.noalias() = A*B;
}
- static inline void transposed_matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){
+ static inline void transposed_matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int /*N*/){
X.noalias() = A.transpose()*B.transpose();
}
-// static inline void ata_product(const gene_matrix & A, gene_matrix & X, int N){
-// X.noalias() = A.transpose()*A;
-// }
+ static inline void ata_product(const gene_matrix & A, gene_matrix & X, int /*N*/){
+ //X.noalias() = A.transpose()*A;
+ X.template triangularView<Lower>().setZero();
+ X.template selfadjointView<Lower>().rankUpdate(A.transpose());
+ }
- static inline void aat_product(const gene_matrix & A, gene_matrix & X, int N){
+ static inline void aat_product(const gene_matrix & A, gene_matrix & X, int /*N*/){
X.template triangularView<Lower>().setZero();
X.template selfadjointView<Lower>().rankUpdate(A);
}
- static inline void matrix_vector_product(const gene_matrix & A, const gene_vector & B, gene_vector & X, int N){
+ static inline void matrix_vector_product(const gene_matrix & A, const gene_vector & B, gene_vector & X, int /*N*/){
X.noalias() = A*B;
}
- static inline void symv(const gene_matrix & A, const gene_vector & B, gene_vector & X, int N){
+ static inline void symv(const gene_matrix & A, const gene_vector & B, gene_vector & X, int /*N*/){
X.noalias() = (A.template selfadjointView<Lower>() * B);
// internal::product_selfadjoint_vector<real,0,LowerTriangularBit,false,false>(N,A.data(),N, B.data(), 1, X.data(), 1);
}
@@ -155,54 +157,54 @@ public :
}
}
- static EIGEN_DONT_INLINE void syr2(gene_matrix & A, gene_vector & X, gene_vector & Y, int N){
+ static EIGEN_DONT_INLINE void syr2(gene_matrix & A, gene_vector & X, gene_vector & Y, int N){
// internal::product_selfadjoint_rank2_update<real,0,LowerTriangularBit>(N,A.data(),N, X.data(), 1, Y.data(), 1, -1);
for(int j=0; j<N; ++j)
A.col(j).tail(N-j) += X[j] * Y.tail(N-j) + Y[j] * X.tail(N-j);
}
- static EIGEN_DONT_INLINE void ger(gene_matrix & A, gene_vector & X, gene_vector & Y, int N){
+ static EIGEN_DONT_INLINE void ger(gene_matrix & A, gene_vector & X, gene_vector & Y, int N){
for(int j=0; j<N; ++j)
A.col(j) += X * Y[j];
}
- static EIGEN_DONT_INLINE void rot(gene_vector & A, gene_vector & B, real c, real s, int N){
+ static EIGEN_DONT_INLINE void rot(gene_vector & A, gene_vector & B, real c, real s, int /*N*/){
internal::apply_rotation_in_the_plane(A, B, JacobiRotation<real>(c,s));
}
- static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){
+ static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int /*N*/){
X.noalias() = (A.transpose()*B);
}
- static inline void axpy(real coef, const gene_vector & X, gene_vector & Y, int N){
+ static inline void axpy(real coef, const gene_vector & X, gene_vector & Y, int /*N*/){
Y += coef * X;
}
- static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int N){
+ static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int /*N*/){
Y = a*X + b*Y;
}
- static EIGEN_DONT_INLINE void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){
+ static EIGEN_DONT_INLINE void copy_matrix(const gene_matrix & source, gene_matrix & cible, int /*N*/){
cible = source;
}
- static EIGEN_DONT_INLINE void copy_vector(const gene_vector & source, gene_vector & cible, int N){
+ static EIGEN_DONT_INLINE void copy_vector(const gene_vector & source, gene_vector & cible, int /*N*/){
cible = source;
}
- static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector& X, int N){
+ static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector& X, int /*N*/){
X = L.template triangularView<Lower>().solve(B);
}
- static inline void trisolve_lower_matrix(const gene_matrix & L, const gene_matrix& B, gene_matrix& X, int N){
+ static inline void trisolve_lower_matrix(const gene_matrix & L, const gene_matrix& B, gene_matrix& X, int /*N*/){
X = L.template triangularView<Upper>().solve(B);
}
- static inline void trmm(const gene_matrix & L, const gene_matrix& B, gene_matrix& X, int N){
+ static inline void trmm(const gene_matrix & L, const gene_matrix& B, gene_matrix& X, int /*N*/){
X.noalias() = L.template triangularView<Lower>() * B;
}
- static inline void cholesky(const gene_matrix & X, gene_matrix & C, int N){
+ static inline void cholesky(const gene_matrix & X, gene_matrix & C, int /*N*/){
C = X;
internal::llt_inplace<real,Lower>::blocked(C);
//C = X.llt().matrixL();
@@ -211,11 +213,11 @@ public :
// Cholesky<gene_matrix>::computeInPlaceBlock(C);
}
- static inline void lu_decomp(const gene_matrix & X, gene_matrix & C, int N){
+ static inline void lu_decomp(const gene_matrix & X, gene_matrix & C, int /*N*/){
C = X.fullPivLu().matrixLU();
}
- static inline void partial_lu_decomp(const gene_matrix & X, gene_matrix & C, int N){
+ static inline void partial_lu_decomp(const gene_matrix & X, gene_matrix & C, int N){
Matrix<DenseIndex,1,Dynamic> piv(N);
DenseIndex nb;
C = X;
@@ -223,13 +225,13 @@ public :
// C = X.partialPivLu().matrixLU();
}
- static inline void tridiagonalization(const gene_matrix & X, gene_matrix & C, int N){
+ static inline void tridiagonalization(const gene_matrix & X, gene_matrix & C, int N){
typename Tridiagonalization<gene_matrix>::CoeffVectorType aux(N-1);
C = X;
internal::tridiagonalization_inplace(C, aux);
}
- static inline void hessenberg(const gene_matrix & X, gene_matrix & C, int N){
+ static inline void hessenberg(const gene_matrix & X, gene_matrix & C, int /*N*/){
C = HessenbergDecomposition<gene_matrix>(X).packedMatrix();
}
diff --git a/eigen/bench/btl/libs/eigen3/main_adv.cpp b/eigen/bench/btl/libs/eigen3/main_adv.cpp
index efe5857..9586535 100644
--- a/eigen/bench/btl/libs/eigen3/main_adv.cpp
+++ b/eigen/bench/btl/libs/eigen3/main_adv.cpp
@@ -29,14 +29,14 @@ BTL_MAIN;
int main()
{
- bench<Action_trisolve<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
- bench<Action_trisolve_matrix<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
- bench<Action_cholesky<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
- bench<Action_lu_decomp<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
- bench<Action_partial_lu<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
+ bench<Action_trisolve<eigen3_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
+ bench<Action_trisolve_matrix<eigen3_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
+ bench<Action_cholesky<eigen3_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
+// bench<Action_lu_decomp<eigen3_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
+ bench<Action_partial_lu<eigen3_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
- bench<Action_hessenberg<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
- bench<Action_tridiagonalization<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
+// bench<Action_hessenberg<eigen3_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
+ bench<Action_tridiagonalization<eigen3_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
return 0;
}
diff --git a/eigen/bench/btl/libs/eigen3/main_matmat.cpp b/eigen/bench/btl/libs/eigen3/main_matmat.cpp
index 926fa2b..052810a 100644
--- a/eigen/bench/btl/libs/eigen3/main_matmat.cpp
+++ b/eigen/bench/btl/libs/eigen3/main_matmat.cpp
@@ -25,7 +25,7 @@ BTL_MAIN;
int main()
{
bench<Action_matrix_matrix_product<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
-// bench<Action_ata_product<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
+ bench<Action_ata_product<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
bench<Action_aat_product<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
bench<Action_trmm<eigen3_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
diff --git a/eigen/bench/btl/libs/tensors/CMakeLists.txt b/eigen/bench/btl/libs/tensors/CMakeLists.txt
new file mode 100644
index 0000000..09d6d8e
--- /dev/null
+++ b/eigen/bench/btl/libs/tensors/CMakeLists.txt
@@ -0,0 +1,44 @@
+
+
+if((NOT TENSOR_INCLUDE_DIR) AND Eigen_SOURCE_DIR)
+ # unless TENSOR_INCLUDE_DIR is defined, let's use current Eigen version
+ set(TENSOR_INCLUDE_DIR ${Eigen_SOURCE_DIR})
+ set(TENSOR_FOUND TRUE)
+else()
+ find_package(Tensor)
+endif()
+
+if (TENSOR_FOUND)
+
+ include_directories(${TENSOR_INCLUDE_DIR})
+ btl_add_bench(btl_tensor_linear main_linear.cpp)
+ btl_add_bench(btl_tensor_vecmat main_vecmat.cpp)
+ btl_add_bench(btl_tensor_matmat main_matmat.cpp)
+
+ btl_add_target_property(btl_tensor_linear COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=tensor")
+ btl_add_target_property(btl_tensor_vecmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=tensor")
+ btl_add_target_property(btl_tensor_matmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=tensor")
+
+ option(BTL_BENCH_NOGCCVEC "also bench Eigen explicit vec without GCC's auto vec" OFF)
+ if(CMAKE_COMPILER_IS_GNUCXX AND BTL_BENCH_NOGCCVEC)
+ btl_add_bench(btl_tensor_nogccvec_linear main_linear.cpp)
+ btl_add_bench(btl_tensor_nogccvec_vecmat main_vecmat.cpp)
+ btl_add_bench(btl_tensor_nogccvec_matmat main_matmat.cpp)
+
+ btl_add_target_property(btl_tensor_nogccvec_linear COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=tensor_nogccvec")
+ btl_add_target_property(btl_tensor_nogccvec_vecmat COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=tensor_nogccvec")
+ btl_add_target_property(btl_tensor_nogccvec_matmat COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=tensor_nogccvec")
+ endif()
+
+
+ if(NOT BTL_NOVEC)
+ btl_add_bench(btl_tensor_novec_linear main_linear.cpp OFF)
+ btl_add_bench(btl_tensor_novec_vecmat main_vecmat.cpp OFF)
+ btl_add_bench(btl_tensor_novec_matmat main_matmat.cpp OFF)
+ btl_add_target_property(btl_tensor_novec_linear COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=tensor_novec")
+ btl_add_target_property(btl_tensor_novec_vecmat COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=tensor_novec")
+ btl_add_target_property(btl_tensor_novec_matmat COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=tensor_novec")
+
+ endif(NOT BTL_NOVEC)
+
+endif (TENSOR_FOUND)
diff --git a/eigen/bench/btl/libs/tensors/main_linear.cpp b/eigen/bench/btl/libs/tensors/main_linear.cpp
new file mode 100644
index 0000000..e257f1e
--- /dev/null
+++ b/eigen/bench/btl/libs/tensors/main_linear.cpp
@@ -0,0 +1,23 @@
+// This file is part of Eigen, a lightweight C++ template library
+// for linear algebra.
+//
+// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#include "utilities.h"
+#include "tensor_interface.hh"
+#include "bench.hh"
+#include "basic_actions.hh"
+
+BTL_MAIN;
+
+int main()
+{
+ bench<Action_axpy<tensor_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
+ bench<Action_axpby<tensor_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
+
+ return 0;
+}
diff --git a/eigen/bench/btl/libs/tensors/main_matmat.cpp b/eigen/bench/btl/libs/tensors/main_matmat.cpp
new file mode 100644
index 0000000..675fcfc
--- /dev/null
+++ b/eigen/bench/btl/libs/tensors/main_matmat.cpp
@@ -0,0 +1,21 @@
+//=====================================================
+// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
+//=====================================================
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+//
+#include "utilities.h"
+#include "tensor_interface.hh"
+#include "bench.hh"
+#include "basic_actions.hh"
+
+BTL_MAIN;
+
+int main()
+{
+ bench<Action_matrix_matrix_product<tensor_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
+
+ return 0;
+}
diff --git a/eigen/bench/btl/libs/tensors/main_vecmat.cpp b/eigen/bench/btl/libs/tensors/main_vecmat.cpp
new file mode 100644
index 0000000..1af00c8
--- /dev/null
+++ b/eigen/bench/btl/libs/tensors/main_vecmat.cpp
@@ -0,0 +1,21 @@
+//=====================================================
+// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
+//=====================================================
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+//
+#include "utilities.h"
+#include "tensor_interface.hh"
+#include "bench.hh"
+#include "basic_actions.hh"
+
+BTL_MAIN;
+
+int main()
+{
+ bench<Action_matrix_vector_product<tensor_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
+
+ return 0;
+}
diff --git a/eigen/bench/btl/libs/tensors/tensor_interface.hh b/eigen/bench/btl/libs/tensors/tensor_interface.hh
new file mode 100644
index 0000000..97b8e0f
--- /dev/null
+++ b/eigen/bench/btl/libs/tensors/tensor_interface.hh
@@ -0,0 +1,105 @@
+//=====================================================
+// Copyright (C) 2014 Benoit Steiner <benoit.steiner.goog@gmail.com>
+//=====================================================
+//
+// This Source Code Form is subject to the terms of the Mozilla
+// Public License v. 2.0. If a copy of the MPL was not distributed
+// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
+//
+#ifndef TENSOR_INTERFACE_HH
+#define TENSOR_INTERFACE_HH
+
+#include <unsupported/Eigen/CXX11/Tensor>
+#include <vector>
+#include "btl.hh"
+
+using namespace Eigen;
+
+template<class real>
+class tensor_interface
+{
+public :
+ typedef real real_type;
+ typedef typename Eigen::Tensor<real,2>::Index Index;
+
+ typedef std::vector<real> stl_vector;
+ typedef std::vector<stl_vector> stl_matrix;
+
+ typedef Eigen::Tensor<real,2> gene_matrix;
+ typedef Eigen::Tensor<real,1> gene_vector;
+
+
+ static inline std::string name( void )
+ {
+ return EIGEN_MAKESTRING(BTL_PREFIX);
+ }
+
+ static void free_matrix(gene_matrix & /*A*/, int /*N*/) {}
+
+ static void free_vector(gene_vector & /*B*/) {}
+
+ static BTL_DONT_INLINE void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){
+ A.resize(Eigen::array<Index,2>(A_stl[0].size(), A_stl.size()));
+
+ for (unsigned int j=0; j<A_stl.size() ; j++){
+ for (unsigned int i=0; i<A_stl[j].size() ; i++){
+ A.coeffRef(Eigen::array<Index,2>(i,j)) = A_stl[j][i];
+ }
+ }
+ }
+
+ static BTL_DONT_INLINE void vector_from_stl(gene_vector & B, stl_vector & B_stl){
+ B.resize(B_stl.size());
+
+ for (unsigned int i=0; i<B_stl.size() ; i++){
+ B.coeffRef(i) = B_stl[i];
+ }
+ }
+
+ static BTL_DONT_INLINE void vector_to_stl(gene_vector & B, stl_vector & B_stl){
+ for (unsigned int i=0; i<B_stl.size() ; i++){
+ B_stl[i] = B.coeff(i);
+ }
+ }
+
+ static BTL_DONT_INLINE void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){
+ int N=A_stl.size();
+
+ for (int j=0;j<N;j++){
+ A_stl[j].resize(N);
+ for (int i=0;i<N;i++){
+ A_stl[j][i] = A.coeff(Eigen::array<Index,2>(i,j));
+ }
+ }
+ }
+
+ static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int /*N*/){
+ typedef typename Eigen::Tensor<real_type, 1>::DimensionPair DimPair;
+ const Eigen::array<DimPair, 1> dims(DimPair(1, 0));
+ X/*.noalias()*/ = A.contract(B, dims);
+ }
+
+ static inline void matrix_vector_product(const gene_matrix & A, const gene_vector & B, gene_vector & X, int /*N*/){
+ typedef typename Eigen::Tensor<real_type, 1>::DimensionPair DimPair;
+ const Eigen::array<DimPair, 1> dims(DimPair(1, 0));
+ X/*.noalias()*/ = A.contract(B, dims);
+ }
+
+ static inline void axpy(real coef, const gene_vector & X, gene_vector & Y, int /*N*/){
+ Y += X.constant(coef) * X;
+ }
+
+ static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int /*N*/){
+ Y = X.constant(a)*X + Y.constant(b)*Y;
+ }
+
+ static EIGEN_DONT_INLINE void copy_matrix(const gene_matrix & source, gene_matrix & cible, int /*N*/){
+ cible = source;
+ }
+
+ static EIGEN_DONT_INLINE void copy_vector(const gene_vector & source, gene_vector & cible, int /*N*/){
+ cible = source;
+ }
+};
+
+#endif