← Back to team overview

dolfin team mailing list archive

Re: Failed multicore assembly

 

For more complicated equations where the element matrix is heavy to
compute, I think something like that should be possible. But it's
probably not worth it for mass/stiffness matrices computed by the
efficient generated code from ffc or syfi, since insertion is
dominating anyway. Thus the dolfin Assembler should support selecting
which algorithm to use run-time.

-- 
Martin


2008/1/24, Matthew Knepley <knepley@xxxxxxxxx>:
> We have thought about this a little. I don't think you should use MC to
> do anything that touches memory. I would suggest something like
> dividing cells into groups, using each core to calculate an element matrix,
> aggregating on the main core, and then inserting.
>
>   Thanks,
>
>      Matt
>
> On Jan 24, 2008 3:07 AM, Martin Sandve Alnæs <martinal@xxxxxxxxx> wrote:
> > I've tried to implement multicore assembly using openmp in dolfin, but
> > it was a big failure. I've attached the hg bundle. The code is
> > protected by #ifdef _OPENMP, so it should be safe to merge into dolfin
> > if anyone wants to pursue this further (I won't).
> >
> > To compile with openMP, I did:
> > CXX=g++-4.2 CXXFLAGS='-fopenmp -O3' ./configure ....
> > (I didn't manage to import pydolfin with this build, it missed some symbol.)
> >
> > The problem is that the matrix insertion "A.add(...)" must be in a
> > critical section such that only one thread inserts at the same time.
> > Since the matrix insertion is a dominating part, this only introduces
> > a lot of overhead. Although I didn't expect much for the stiffness
> > matrix which I tested with, the result is a surprisingly large
> > slowdown when running two threads (although both cores were active).
> >
> > To fix this, one might split the matrix in one datastructure for each
> > thread, and do "communication" between the matrix structures like with
> > the MPI-based program. The difference is that the matrices would be in
> > the memory of the same process, thus the communication overhead is
> > much smaller.
> >
> > --
> > Martin
> >
> > _______________________________________________
> > DOLFIN-dev mailing list
> > DOLFIN-dev@xxxxxxxxxx
> > http://www.fenics.org/mailman/listinfo/dolfin-dev
> >
> >
>
>
>
> --
> What most experimenters take for granted before they begin their
> experiments is infinitely more interesting than any results to which
> their experiments lead.
> -- Norbert Wiener
>


References