← Back to team overview

dolfin team mailing list archive

Re: [Question #117960]: Matrix multiplication by vector slow with uBLAS

 

Question #117960 on DOLFIN changed:
https://answers.launchpad.net/dolfin/+question/117960

    Status: Open => Answered

Kristian B. Ølgaard proposed the following answer:
Confirmed, I got around a factor of 50 in favour of PETSc with the
development version of DOLFIN.

Kristian


On 16 July 2010 16:51, Nuno Lopes <question117960@xxxxxxxxxxxxxxxxxxxxx> wrote:
> New question #117960 on DOLFIN:
> https://answers.launchpad.net/dolfin/+question/117960
>
> Hi,
>
> I was digging in my code to try to find some  reason  for the  slowdown  I get using  the updated(>0.9.5) versions of dolfin,
> (since the dolfin demos do not reproduce the huge time differences I have in my code).
> I've found that the main issue is the matrix by vector multiplication that I use in some methods .
> When using uBLAS backend  I get a huge slowdown compared with PETSc
>
> In the simple dolfin code below PETSc is at least 40 times faster.
>
> Is this an expected behavior?
>
> I reproduced the problem in a simple code:
>
> main.cpp:
> ------------------------------------------------------------------------------
> #include <dolfin.h>
> #include "TestForm.h"
>
> using namespace dolfin;
>
> int main(int argc, char *argv[])
> {
>  parameters["linear_algebra_backend"]=argv[1];
>
>  Timer maintimer(argv[1]);
>  maintimer.start();
>
>  UnitSquare mesh(100,100);
>  TestForm::FunctionSpace V(mesh);
>  TestForm::BilinearForm  a(V,V);
>  TestForm::LinearForm L(V);
>  Constant f(1.0);
>  L.f=f;
>
>  Matrix A;
>  assemble(A,a);
>
>  Vector x;
>  assemble(x,L);
>
>  Vector y(x);
>  y.zero();
>
>  A.mult(x,y);
>
>  maintimer.stop();
>  summary();
> }
> -----------------------------------------------------------------
> with
> TestForm.ufl:
> ----------------------------------------------------------------
> scalar = FiniteElement("Lagrange", "triangle", 1)
> v  = TestFunction(scalar)
> u1 = TrialFunction(scalar)
>
> f= Coefficient(scalar);
>
> a = v*u1*dx
> L =  f*v*dx
> ------------------------------------------------------------------
>
> using uBLAS approx 2.5s and with PETSc approx 0.06s.
> Could someone please test the code...
>
> Thanks in advance.
> Nuno Lopes.
>
>
> --
> You received this question notification because you are a member of
> DOLFIN Team, which is an answer contact for DOLFIN.
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help   : https://help.launchpad.net/ListHelp
>

-- 
You received this question notification because you are a member of
DOLFIN Team, which is an answer contact for DOLFIN.