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

Rajeev Thakur thakur at mcs.anl.gov
Tue Dec 13 13:40:07 CST 2011


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.

Rajeev



On Dec 13, 2011, at 12:52 PM, Jed Brown wrote:

> I'm not sure if I'm blind or if something like this doesn't exist. How can I check whether two types are compatible?
> 
> Here's the scenario:
> 
> I'm implementing communication primitives for a parallel bipartite graph and want to be able to move composite types such as user-defined structs associated with each vertex in the graph. I call this the "unit" type.
> 
> Inside my communication library, I'm constructing composite datatypes for each unit that needs to be sent. I'd like to create these lazily (the first time the user tries to use that unit) and cache them for future use. I MPI_Type_dup() the unit so that lifetime of the custom type can be managed independently (shorter or longer) from lifetime of the communication graph object.
> 
> Now I need to determine whether a user-provided "unit" is already cached. I don't mind a linear search, but I don't have an "equality" test. I can call MPI_Type_get_envelope() and MPI_Type_get_contents(), but I would have to explore this backward for types that have been duped and it just doesn't seem like a robust equality test. Is there such a thing?
> 
> Do you have a different recommendation?
> _______________________________________________
> mpich-discuss mailing list     mpich-discuss at mcs.anl.gov
> To manage subscription options or unsubscribe:
> https://lists.mcs.anl.gov/mailman/listinfo/mpich-discuss



More information about the mpich-discuss mailing list