Re: Timing (Re: conjugate() and adjoint() bug example (Re: [eigen] Lazy evaluation and adjoint())) |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
Dear All,
I've changed my code to output the time in seconds, and added a G-Flops output
NumOps = dim*dim*dim * NumSamples;
GFlOps = 1e-9*NumOps / time;
If we account for 4 DP operations for a complex multiply and the fastest DP benchmark of just below 6 DP-GFlOps
I found for my Laptop there is (1) no degration by the patch (2) and probably not much room for improvement,
as it already beats those benchmarks slightly.
Best regards,
Peter
: g++ -std=c++11 -O3 -ffast-math -march=native -DNDEBUG AdjointTime.C -I $HOME/Eigen/eigen-eigen-fbc536aef564-PS -o AdjointTime && ./AdjointTime
2 14.6201 0.0683989
3 8.19889 0.121968
4 4.71591 0.212048
5 3.64257 0.274531
7 2.01085 0.497303
10 1.27777 0.782612
15 1.03498 0.966204
20 0.805027 1.24219
30 0.759311 1.31698
32 0.73972 1.35184
50 0.660631 1.51371
64 0.666139 1.50091
70 0.632084 1.58182
90 0.613966 1.62787
100 0.652823 1.53181
200 0.63864 1.56583
256 0.628364 1.57529
: g++ -std=c++11 -O3 -ffast-math -march=native -DNDEBUG AdjointTime.C -I $HOME/Eigen/eigen-eigen-fbc536aef564 -o AdjointTimeOld && ./AdjointTimeOld
2 14.714 0.0679627
3 8.22533 0.121576
4 4.72782 0.211514
5 3.57511 0.279712
7 1.97326 0.506775
10 1.24607 0.802522
15 1.04549 0.956493
20 0.798319 1.25263
30 0.71862 1.39155
32 0.688415 1.45259
50 0.657336 1.52129
64 0.638218 1.56658
70 0.636407 1.57108
90 0.611682 1.63395
100 0.655434 1.52571
200 0.639165 1.56454
256 0.639712 1.54735
#include <stdlib.h>
#include <complex>
#include <iostream>
#include <complex>
#include <chrono>
#include <Eigen/Dense>
// g++ -std=c++11 -O3 -DNDEBUG AdjointTime.C -I $HOME/Eigen/eigen -o AdjointTime && ./AdjointTime
// g++ -std=c++11 -O3 -DNDEBUG AdjointTime.C -I $HOME/Eigen/eigen-eigen-fbc536aef564 -o AdjointTime && ./AdjointTime
// g++ -std=c++11 -O3 -ffast-math -march=native -DNDEBUG AdjointTime.C -I $HOME/Eigen/eigen -o AdjointTime && ./AdjointTime
// g++ -std=c++11 -O3 -ffast-math -march=native -DNDEBUG AdjointTime.C -I $HOME/Eigen/eigen-eigen-fbc536aef564 -o AdjointTimeOld && ./AdjointTimeOld
typedef Eigen::Matrix< std::complex<double> , Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor> TpMatrix;
int main( const int argc, const char *argv[] )
{
const int NumCost = (argc>1) ? atoi(argv[1]) : 1000000000;
const int Dims[] = { 2,3 ,4,5,7,10,15,20,30,32,50,64,70,90,100 ,200, 256};
const int NumRounds = sizeof(Dims) / sizeof(int);
auto t0 = std::chrono::high_resolution_clock::now();
auto t1 = std::chrono::high_resolution_clock::now();
TpMatrix A;
TpMatrix U;
int NumSamples;
double NumOps, GFlOps;
double time;
for( int s=0, dim; s<NumRounds;++s)
{
dim = Dims[s];
A = TpMatrix::Random( dim, dim);
U = TpMatrix::Random( dim, dim);
NumSamples = NumCost/( dim*dim*dim);
t0 = std::chrono::high_resolution_clock::now();
for( int n=0; n<NumSamples; ++n)
{
A = U.adjoint() * A;
}
t1 = std::chrono::high_resolution_clock::now();
time = 1e-9 * std::chrono::duration_cast<std::chrono::nanoseconds>(t1 - t0).count();
NumOps = dim*dim*dim * NumSamples;
GFlOps = 1e-9*NumOps / time;
std::cout << dim << '\t' << time << '\t' << GFlOps << std::endl;
}
}