[Mpi3-tools] MPIR_PROCDESC

Jeff Squyres jsquyres at cisco.com
Mon Aug 9 12:18:25 CDT 2010


Should there be an "advice to implementors" sidenote about this issue in the text?


On Aug 9, 2010, at 12:28 PM, John DelSignore wrote:

> I was wondering when someone was going notice this...
> 
> Originally, MPIR_PROCDESC was defined as a typedef, so that's what I put into the document. The "typedef struct {...} MPIR_PROCDESC;" style allows MPIR_PROCDESC to be use as a type in both C and C++, but experience taught us that defining MPIR_PROCDESC as a typedef was a mistake.
> 
> The reason it was a mistake is that typedef names have internal linkage, and that might make it difficult, inefficient, or impossible for the debugger to find its definition. But, when defined as a struct, that gives the name external linkage, and that usually means that the name is included in symbol table indexes, such as DWARF's .debug_pubnames, making it easier for the debugger to find the definition by name.
> 
> However, experience has also taught us that looking up MPIR_PROCDESC by name is a losing proposition no matter how it's defined, so we don't do that. Instead, we look up the MPIR_proctable variable, fully resolve the symbols for compilation unit containing the variable, and then look at the type of the variable, which should be a pointer to an MPIR_PROCDESC. The target type of the pointer might be the structure, or the typedef, so we have to peel away any intervening typedefs to get to the structure definition.
> 
> So, I think that the way Open MPI defines MPIR_PROCDESC as a struct is actually *better* than using a typedef, because that makes MPIR_PROCDESC more easily findable by name. But, any experienced debugger developer would know that looking it up by name would be unreliable, and wouldn't do that, so IMHO it doesn't matter how MPIR_PROCDESC is defined.
> 
> Cheers, John D.
> 
> 
> David Lecomber wrote:
> > Hi Jeff and all,
> >
> > We just noticed that Open MPI doesn't strictly meet the MPIR_PROCDESC
> > requirement: it must just due to our forgiving natures that both TTV and
> > DDT work with it ;-) 
> >
> > struct MPIR_PROCDESC {
> >     char *host_name;        /* something that can be passed to inet_addr
> > */
> >     char *executable_name;  /* name of binary */
> >     int pid;                /* process pid */
> > };
> >
> > Compare and contrast to John's MPIR doc:
> >
> > typedef struct {
> >     char *host_name;
> >     char *executable_name;
> >     int pid;
> > } MPIR_PROCDESC;
> >
> > and ..
> >
> >> [..]
> >> MPIR_PROCDESC is a typedef name for an anonymous structure that holds process descriptor
> >> information for a single MPI process. The structure must contain three members with the same
> >> names and types as specified above. [..]
> >
> > Ok, tell me I'm being pedantic ;)  -- the MPIR_PROCDESC in OMPI is not a
> > typedef to an anonymous structure - it is actually a struct - a named
> > structure type.  Does the spec need relaxing, or is this a 'bug'?
> >
> > Cheers
> > David.
> >
> _______________________________________________
> Mpi3-tools mailing list
> Mpi3-tools at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi3-tools
> 


-- 
Jeff Squyres
jsquyres at cisco.com
For corporate legal information go to:
http://www.cisco.com/web/about/doing_business/legal/cri/





More information about the mpiwg-tools mailing list