diff options
author | Srinivas Vasudevan <srvasude@gmail.com> | 2016-12-02 14:14:45 -0800 |
---|---|---|
committer | Srinivas Vasudevan <srvasude@gmail.com> | 2016-12-02 14:14:45 -0800 |
commit | a0d3ac760f7af264bcd625a3edb6383cdb34b4f3 (patch) | |
tree | 862b3cb3fe66a83c6b6274ecbd8b3fe5d94fe224 /bench | |
parent | 218764ee1f0a21e1faf20ed314ffafeae79eb170 (diff) | |
parent | 66f65ccc364034150bdc47333e05ebbde29825e5 (diff) |
Sync from Head.
Diffstat (limited to 'bench')
-rw-r--r-- | bench/btl/actions/basic_actions.hh | 2 | ||||
-rw-r--r-- | bench/btl/libs/BLAS/blas_interface_impl.hh | 6 | ||||
-rw-r--r-- | bench/btl/libs/BLAS/main.cpp | 2 | ||||
-rw-r--r-- | bench/btl/libs/STL/STL_interface.hh | 24 | ||||
-rw-r--r-- | bench/btl/libs/blaze/blaze_interface.hh | 16 | ||||
-rw-r--r-- | bench/btl/libs/blaze/main.cpp | 6 | ||||
-rw-r--r-- | bench/btl/libs/eigen3/eigen3_interface.hh | 8 | ||||
-rw-r--r-- | bench/btl/libs/eigen3/main_matmat.cpp | 2 | ||||
-rw-r--r-- | bench/perf_monitoring/gemm/changesets.txt | 3 | ||||
-rw-r--r-- | bench/perf_monitoring/gemm/gemv.cpp | 68 | ||||
-rw-r--r-- | bench/perf_monitoring/gemm/gemv_settings.txt | 11 |
11 files changed, 116 insertions, 32 deletions
diff --git a/bench/btl/actions/basic_actions.hh b/bench/btl/actions/basic_actions.hh index a3333ea26..62442f01f 100644 --- a/bench/btl/actions/basic_actions.hh +++ b/bench/btl/actions/basic_actions.hh @@ -6,7 +6,7 @@ #include "action_atv_product.hh" #include "action_matrix_matrix_product.hh" -// #include "action_ata_product.hh" +#include "action_ata_product.hh" #include "action_aat_product.hh" #include "action_trisolve.hh" diff --git a/bench/btl/libs/BLAS/blas_interface_impl.hh b/bench/btl/libs/BLAS/blas_interface_impl.hh index fc4ba2a1f..9e0a64905 100644 --- a/bench/btl/libs/BLAS/blas_interface_impl.hh +++ b/bench/btl/libs/BLAS/blas_interface_impl.hh @@ -46,9 +46,9 @@ public : BLAS_FUNC(gemm)(¬rans,¬rans,&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,¬rans,&N,&N,&fone,A,&N,&fzero,X,&N); diff --git a/bench/btl/libs/BLAS/main.cpp b/bench/btl/libs/BLAS/main.cpp index 564d55ef2..fd991490a 100644 --- a/bench/btl/libs/BLAS/main.cpp +++ b/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); diff --git a/bench/btl/libs/STL/STL_interface.hh b/bench/btl/libs/STL/STL_interface.hh index ef4cc9233..16658c4ba 100644 --- a/bench/btl/libs/STL/STL_interface.hh +++ b/bench/btl/libs/STL/STL_interface.hh @@ -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/bench/btl/libs/blaze/blaze_interface.hh b/bench/btl/libs/blaze/blaze_interface.hh index ee1523944..3635339ef 100644 --- a/bench/btl/libs/blaze/blaze_interface.hh +++ b/bench/btl/libs/blaze/blaze_interface.hh @@ -80,35 +80,35 @@ public : } } - static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){ + 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 inline void transposed_matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){ + 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 inline void ata_product(const gene_matrix & A, gene_matrix & X, int N){ + static EIGEN_DONT_INLINE void ata_product(const gene_matrix & A, gene_matrix & X, int N){ X = (trans(A)*A); } - static inline void aat_product(const gene_matrix & A, gene_matrix & X, int N){ + static EIGEN_DONT_INLINE void aat_product(const gene_matrix & A, gene_matrix & X, int N){ X = (A*trans(A)); } - static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ + static EIGEN_DONT_INLINE void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ X = (A*B); } - static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ + static EIGEN_DONT_INLINE void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ X = (trans(A)*B); } - static inline void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N){ + static EIGEN_DONT_INLINE void axpy(const 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 EIGEN_DONT_INLINE void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int N){ Y = a*X + b*Y; } diff --git a/bench/btl/libs/blaze/main.cpp b/bench/btl/libs/blaze/main.cpp index 80e8f4eaa..ccae0cbd5 100644 --- a/bench/btl/libs/blaze/main.cpp +++ b/bench/btl/libs/blaze/main.cpp @@ -30,9 +30,9 @@ int main() 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); + 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/bench/btl/libs/eigen3/eigen3_interface.hh b/bench/btl/libs/eigen3/eigen3_interface.hh index b821fd721..2e302d072 100644 --- a/bench/btl/libs/eigen3/eigen3_interface.hh +++ b/bench/btl/libs/eigen3/eigen3_interface.hh @@ -92,9 +92,11 @@ public : 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*/){ X.template triangularView<Lower>().setZero(); diff --git a/bench/btl/libs/eigen3/main_matmat.cpp b/bench/btl/libs/eigen3/main_matmat.cpp index 926fa2b01..052810a16 100644 --- a/bench/btl/libs/eigen3/main_matmat.cpp +++ b/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/bench/perf_monitoring/gemm/changesets.txt b/bench/perf_monitoring/gemm/changesets.txt index af8eb9b8f..4bff3cc4a 100644 --- a/bench/perf_monitoring/gemm/changesets.txt +++ b/bench/perf_monitoring/gemm/changesets.txt @@ -59,3 +59,6 @@ before-evaluators 9174:d228bc282ac9 # merge 9212:c90098affa7b # Fix performance regression introduced in changeset 8aad8f35c955 9213:9f1c14e4694b # Fix performance regression in dgemm introduced by changeset 81d53c711775 +3.3-beta2 +3.3-rc1 +3.3.0 diff --git a/bench/perf_monitoring/gemm/gemv.cpp b/bench/perf_monitoring/gemm/gemv.cpp new file mode 100644 index 000000000..b7441a357 --- /dev/null +++ b/bench/perf_monitoring/gemm/gemv.cpp @@ -0,0 +1,68 @@ +#include <iostream> +#include <fstream> +#include <vector> +#include <Eigen/Core> +#include "../../BenchTimer.h" +using namespace Eigen; + +#ifndef SCALAR +#error SCALAR must be defined +#endif + +typedef SCALAR Scalar; + +typedef Matrix<Scalar,Dynamic,Dynamic> Mat; +typedef Matrix<Scalar,Dynamic,1> Vec; + +EIGEN_DONT_INLINE +void gemv(const Mat &A, const Vec &B, Vec &C) +{ + C.noalias() += A * B; +} + +EIGEN_DONT_INLINE +double bench(long m, long n) +{ + Mat A(m,n); + Vec B(n); + Vec C(m); + A.setRandom(); + B.setRandom(); + C.setZero(); + + BenchTimer t; + + double up = 1e9*4/sizeof(Scalar); + double tm0 = 4, tm1 = 10; + if(NumTraits<Scalar>::IsComplex) + { + up /= 4; + tm0 = 2; + tm1 = 4; + } + + double flops = 2. * m * n; + long rep = std::max(1., std::min(100., up/flops) ); + long tries = std::max(tm0, std::min(tm1, up/flops) ); + + BENCH(t, tries, rep, gemv(A,B,C)); + + return 1e-9 * rep * flops / t.best(); +} + +int main(int argc, char **argv) +{ + std::vector<double> results; + + std::ifstream settings("gemv_settings.txt"); + long m, n; + while(settings >> m >> n) + { + //std::cerr << " Testing " << m << " " << n << " " << k << std::endl; + results.push_back( bench(m, n) ); + } + + std::cout << RowVectorXd::Map(results.data(), results.size()); + + return 0; +} diff --git a/bench/perf_monitoring/gemm/gemv_settings.txt b/bench/perf_monitoring/gemm/gemv_settings.txt new file mode 100644 index 000000000..21a5ee051 --- /dev/null +++ b/bench/perf_monitoring/gemm/gemv_settings.txt @@ -0,0 +1,11 @@ +8 8 +9 9 +24 24 +239 239 +240 240 +2400 24 +24 2400 +24 240 +2400 2400 +4800 23 +23 4800 |