[mpich-discuss] Existence of something like MPI_Type_compare()?

Jed Brown jedbrown at mcs.anl.gov
Tue Dec 13 13:56:42 CST 2011


On Tue, Dec 13, 2011 at 11:40, Rajeev Thakur <thakur at mcs.anl.gov> wrote:

> Can you not just compare the value of the datatype handle passed by the
> user with the value you previously stashed away in your cache along with
> the duped type?
>
> One problem is that if the user frees the type and recreates a new one
> that happens to have the same handle, the handle could now point to a
> different type. The way to deal with that is to attach an attribute on the
> user type, with an attribute delete function that will be called when the
> user frees the datatype. In the delete function, you can clean up the value
> that is going to get stale in your cache.
>

This would work, but if the user creates and destroys their "unit" type on
each iteration of some algorithm, I will identify it as being different
each time (even though it is actually the same) and end up allocating new
composite types on each iteration. These composite types can be pretty
heavy (typically MPI_Type_create_indexed_block() with a few thousand
entries), so it would be a critical storage leak if there were thousands or
millions of them. I'll have to limit the cache size anyway, but since the
point was to reuse the types when possible, I would rather compare by value
instead of by reference.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20111213/9090ac1e/attachment.htm>


More information about the mpich-discuss mailing list