[Mpi3-tools] MPI handles debugging interface

Jeff Squyres jsquyres at cisco.com
Wed Jun 3 07:59:03 CDT 2009

In chatting with David Lecomber while we're working on revising the  
MPI3 handle debugging interface per the recent discussions in this  
group (moving away from the One Big Struct approach), David asked a me  
a question that I thought might be appropriate for the larger group.

Why use a bunch of individual query functions when we could have a  
single, much more general form that is more easily extensible?  The  
query function would essentially be driven by an enum indicating the  
specific request, and the OUT arguments could be varargs.  Perhaps  
something like this:

int mpidbg_comm_query_element(mpidbg_comm_handle_t handle,
                               enum mpidbg_comm_query_element_t element,

Here's a sample use case:

/* initial query to allow the DLL to bundle up *all* the data into a  
handle */
mpidbg_comm_query(image, image_info, ..., mpi_communicator, &handle);

/* Query the "basic" communicator info from the handle */
mpidbg_comm_query_element(handle, MPIDBG_COMM_QUERY_BASIC, &flags,  
&rank, &size, ...etc.);

/* Query the communicator process info from the handle */
mpidbg_comm_query_element(handle, MPIDBG_COMM_QUERY_PROCS,  
&num_local_procs, &local_procs,
                           &num_remote_procs, &remote_procs);

+++ Advantage: this one function can be extended simply by adding new  
enum values, possibly in an MPI implementation-specific way (e.g.,  
have some non-standard / value-add functions)

--- Disadvantage: lose compiler type safety checking when building/ 
debugging tools that use this interface.

I don't have strong feelings either way.  I think I'm marginally in  
favor of individual functions just because it gives type safety for  
tools authors.  But I could be convinced to go the enum/varargs route  
if people feel strongly.


Jeff Squyres
Cisco Systems

More information about the mpiwg-tools mailing list