dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #07952
Re: profiling an assembly
On Sun, May 18, 2008 at 09:38:57PM +0200, Murtazo Nazarov wrote:
> > On Sun, May 18, 2008 at 01:24:19PM -0500, Matthew Knepley wrote:
> >> On Sat, May 17, 2008 at 9:40 AM, Johan Hoffman <jhoffman@xxxxxxxxxx>
> >> wrote:
> >> > If the petsc sparse matrix structure works as I expect; to insert/add
> >> an
> >> > element you go to the particular row and search all non-zero entries
> >> of
> >> > that row until you find your column. So the complexity would be =
> >> #dofs x
> >> > #row non-zero entries
> >>
> >> Not exactly. We maintain sorted columns, so the expected time for all
> >> insertions
> >> is smaller. The numbers that Murtazo gets do not match our own, which
> >> suggests
> >> to me that the wrapper is taking non-trivial time for these small
> >> matrices.
> >>
> >> Matt
> >
> > We might be doing something stupid in the wrapper (like giving PETSc
> > the wrong options), but I'm pretty sure the overhead the wrapper adds
> > when calling MatSetValues is small.
> >
> > Here's the full code for PETScMatrix::add():
> >
> > void PETScMatrix::add(const real* block,
> > uint m, const uint* rows,
> > uint n, const uint* cols)
> > {
> > dolfin_assert(A);
> > MatSetValues(A,
> > static_cast<int>(m),
> > reinterpret_cast<int*>(const_cast<uint*>(rows)),
> > static_cast<int>(n),
> > reinterpret_cast<int*>(const_cast<uint*>(cols)),
> > block, ADD_VALUES);
> > }
> >
> > This should be easy to check when profiling the code. Murtazo: What's
> > the difference between PETScMatrix::add and MatSetValues?
> >
>
> I think there is no difference. When we call PETScMatrix::add it basically
> calls MatSetValues. Or is it going something else there?
>
> murtazo
That's my point. Nothing else is going on, but it would be good to get
this confirmed from the profile.
--
Anders
Follow ups
References