[eigen] [Fwd: eigen cwise] unexpected performance regression with eigen's cwise() |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: [eigen] [Fwd: eigen cwise] unexpected performance regression with eigen's cwise()
- From: Rohit Garg <rpg.314@xxxxxxxxx>
- Date: Wed, 19 Aug 2009 11:01:26 -0700
- Cc: sriram kashyap <sriramkashyap@xxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:cc:content-type; bh=o/B/DVOQLXispqwh86G6czqv5GqozydaPK5g7vU7VQE=; b=m+Wjg53QDCen6E0ygds6bPWCcO4vKDPVUxNX8QwQZanXd5S2fWpX4l3BoLBEMPLq25 elLuTtSBZIWlozFy3lax+i8kuA9Bxk/pT5kDclv+Pr9VxkZMR1EFvXGDsBOi5UJJf6Tq VKlmZUm4BIZYHSsjMQDYeWqb/lxN/Gxr4T81M=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type; b=VXoxzoumS3DUqkIUE6nfvUKMtN0pcelNlKcvSLXQS8RfG1h/j3Zc3FSDyoAfAXPZHm 3HxGdLvB2PwZ9qAMibvg2yt1SCfIfsd28gJz1MOVzUQx3iHThZM7X5kmO1TU6376d9iH 7NAQih70WxM8cQElovwHXmQ2SpmouQW4dFqjQ=
A freind of mine who is using eigen for his code, hit this unexpected
speed bump. I have no idea why.
gcc 4.3.3
Opteron 144, 1.8 ghz
OS: ubuntu, 9.04, 32 bit
eigen: unstable
---------- Forwarded message ----------
From: <sriramkashyap@xxxxxxxxx>
Date: Wed, Aug 19, 2009 at 10:16 AM
Subject: eigen cwise
To: Rohit Garg <rpg.314@xxxxxxxxx>
Results for 3 runs of the attached code (50000 cwise muls, done 50000 times):
compile flags; -msse -msse2 -msse3 -DEIGEN_NO_DEBUG -O3
My cwise: 7.56, 7.84, 7.7
Eigen cwise: 8.3, 8.17, 8.39
--
Rohit Garg
http://rpg-314.blogspot.com/
Senior Undergraduate
Department of Physics
Indian Institute of Technology
Bombay
#include<iostream>
#include<Eigen/Core>
#include<Eigen/AlignedVector3>
#include<ctime>
using namespace Eigen;
using namespace std;
#define SIZE 50000
#define ITER 50000
Vector3f blah[SIZE];
void initBlah(){
for (int i=0;i<SIZE;i++){
blah[i]=Vector3f((i%100)/2.0f,(i%100)/3.0f,(i%100)/4.0f);
}
}
Vector3f cwiseop(const Vector3f& a, const Vector3f& b){
return Vector3f(a.x()*b.x(),a.y()*b.y(),a.z()*b.z());
}
void doMul(){
for (int i=0;i<ITER;i++)
for (int j=0;j<SIZE-2;j++)
blah[i]=cwiseop(blah[i+1],blah[i+2]);
// blah[i]=blah[i+1].cwise()*blah[i+2];
}
int main(){
initBlah();
clock_t start = std::clock();
doMul();
clock_t end = std::clock();
cout<<"Time: "<<((double)end-(double)start)/CLOCKS_PER_SEC<<endl;
return 0;
}