← Back to team overview

dolfin team mailing list archive

Re: [Bug 668862] Re: Sparsity pattern computation dead slow with 'real' spaces

 

On Tue, Nov 30, 2010 at 07:08:07PM +0100, Martin Sandve Alnæs wrote:
> I haven't looked at the code, but just some general STL advice:
> - Never use std::find on map and set types in stl, use their member
> function find instead. std::find could be a linear search in this
> case...
> - Don't use the [] operator to read elements from maps and sets, use
> mymap.find instead.

When we're on this topic, we should avoid using std::set entirely.
Using std::vector+std::find+push_back is much faster than
std::set+insert as I found out when I optimized the topology
computation a couple of days back.

--
Anders


> Martin
>
>
>
> 2010/11/20 Garth Wells <668862@xxxxxxxxxxxxxxxxxx>:
> > I've done some testing, and using unordered_set appears to not perform
> > as well as Set for standard problems.
> >
> > Each dof (matrix row) has its own set. The sets are usually small, and
> > independent of the mesh size. The problem is that the size of set that
> > belongs to the global dof is equal to the number of columns in the
> > matrix, and when looping over this set (which becomes very large)
> > std::find is called a lot.
> >
> > I don't see simple solution from the SparsityPattern side. What's
> > probably needed is an extension to UFC to distinguish between local and
> > global dofs.
> >
> >
> > Status in DOLFIN: Confirmed
> >
> > Bug description:
> > The computation of the sparsity pattern is dead slow when real spaces are used, i.e.,
> >
> >    R = FunctionSpace(mesh, 'R', 0)
> >
> > To see the problem, compare the neumann-poisson and poisson demos with fine meshes (256x256)
> >
> >
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~dolfin
> > Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~dolfin
> > More help   : https://help.launchpad.net/ListHelp
> >
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dolfin
> Post to     : dolfin@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dolfin
> More help   : https://help.launchpad.net/ListHelp



Follow ups

References