This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Unstability in the same computation

Tags: None
(comma "," separated)
testfly
Registered Member
Posts
1
Karma
0

Unstability in the same computation

Mon Jun 27, 2016 9:15 am
I have used eigen to do the following computation in a deep learning programme,
Code: Select all
  cur->i = this->bi;
  cur->i.noalias() += this->Wxi*xt + this->Whi*prev->h;
  cur->f = this->bf;
  cur->f.noalias() += this->Wxf*xt + this->Whf*prev->h;
  cur->o = this->bo;
  cur->o.noalias() += this->Wxo*xt + this->Who*prev->h;
  cur->u = this->bu;
  cur->u.noalias() += this->Wxu*xt + this->Whu*prev->h;

W* is a matrix, and h, f, i, o, u are all vectors.

But I tried several times with the same input data, the time consuming is much different.
Some times it costs 0.4 second to get the output, but some times it cost 2.1 second to get the output.

Does anyone meet the same problem with me? How can I solve this problem to get stable time cost ?
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS
Prior to Eigen 3.3, it's better if you split:

v3.noalias() += A*v1 + B*v2;

as:

v3.noalias() += A*v1;
v3.noalias() += B*v2;

otherwise one (or two) temporaries will be issued. (in theory, Eigen 3.3 does this splitting for you).

Then, performance of matrix-vector products highly depends on whether the matrices are already in cache. If they are too large, that's never possible, but if they are small enough to fit in L1 or L3, then the performance will be impacted by the evaluation context and the system load. For instance, is your application multi-threaded?


Bookmarks



Who is online

Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]