dolfin team mailing list archive
-
dolfin team
-
Mailing list archive
-
Message #22498
Re: [Bug 747318] Re: Python: Make algebra faster by using pool of vectors
Sure. It's a wishlist "bug". Feel free to reject if these are unwanted. I
have only very limited internet connection here, but can do the blueprint
thing later in the summer.
-j.
Den 5. apr. 2011 23.50 skrev "Garth Wells" <747318@xxxxxxxxxxxxxxxxxx>
følgende:
> This isn't a bug. It should be turned into a Blueprint (for discussion).
>
> --
> You received this bug notification because you are a direct subscriber
> of the bug.
> https://bugs.launchpad.net/bugs/747318
>
> Title:
> Python: Make algebra faster by using pool of vectors
>
> Status in DOLFIN:
> New
>
> Bug description:
> In Python, the natural way to write matrix algebra involves a lot of
> temporary vector creation. By implementing a pool of vectors, I see a
> 15-20% performance improvement in a matrix-algebra heavy workload. The
> basic idea is to add a method to the GenericMatrix interface (Python
> only, probably). Then Matrix.__mul__ (and everywhere else a vector is
> needed) can use this method whenever they need to create a vector, and
> they are transparently re-used whenever they go out of scope.
>
> @vec_pool
> def create_vec(self, dim=1):
> vec = dolfin.Vector()
> self.resize(vec, dim)
> return vec
>
> The implementation of the vec_pool decorator is found here:
http://bazaar.launchpad.net/~jobh/cbc.block/trunk/download/head:/block/object__pool.py/object_pool.py
> (code copyright me, LGPL or whatever you prefer.)
>
> To unsubscribe from this bug, go to:
> https://bugs.launchpad.net/dolfin/+bug/747318/+subscribe
--
You received this bug notification because you are a member of DOLFIN
Team, which is subscribed to DOLFIN.
https://bugs.launchpad.net/bugs/747318
Title:
Python: Make algebra faster by using pool of vectors
Status in DOLFIN:
New
Bug description:
In Python, the natural way to write matrix algebra involves a lot of
temporary vector creation. By implementing a pool of vectors, I see a
15-20% performance improvement in a matrix-algebra heavy workload. The
basic idea is to add a method to the GenericMatrix interface (Python
only, probably). Then Matrix.__mul__ (and everywhere else a vector is
needed) can use this method whenever they need to create a vector, and
they are transparently re-used whenever they go out of scope.
@vec_pool
def create_vec(self, dim=1):
vec = dolfin.Vector()
self.resize(vec, dim)
return vec
The implementation of the vec_pool decorator is found here: http://bazaar.launchpad.net/~jobh/cbc.block/trunk/download/head:/block/object__pool.py/object_pool.py
(code copyright me, LGPL or whatever you prefer.)
References