Re: MPI_TYPE_DUP (Actually, what I really wanted)

Rajeev Thakur (thakur@mcs.anl.gov)
Wed, 11 Dec 1996 14:34:37 -0600

> From: John M May <johnmay@coral.llnl.gov>
> Date: Wed, 11 Dec 1996 12:24:10 -0800 (PST)
>
> Rajeev says:
> > Well, it seems to me that what you really need is only attribute
> > caching on the datatype :-) When the buftype is passed to you for the
> > first time, you create whatever extra information out of it and cache
> > it on the datatype itself.
>
> Yes, but if there's a public interface for accessing the cache
> on the datatype, what prevents the user from messing with your
> cached data (accidentally, of course...)? I guess you could
> put a magic cookie in your data to make sure it's yours, and
> check that there was nothing already cached on the type before
> you got it.

But if you see how attribute caching is defined (for communicators),
this seems unlikely, if not impossible, to occur. Attributes are
stored by implementation-defined key values that are locally
unique in a process. The user will not know what key the library is
using.

I think attribute caching was carefully designed in MPI-1 to avoid
this kind of problem.

Rajeev