Blame src/mpi/debugger/mpi2_interface.txt

Packit Service c5cf8c
This file contains the current DRAFT description of the structures used 
Packit Service c5cf8c
in the MPI2 debugger interface.  The author of this interface was
Packit Service c5cf8c
Rob Faught <rtf@etnus.com>
Packit Service c5cf8c
Packit Service c5cf8c
AN INTERFACE BETWEEN A DEBUGGER AND AN MPI IMPLEMENTATION
Packit Service c5cf8c
(DRAFT)
Packit Service c5cf8c
Packit Service c5cf8c
Jan 18 2007 RTF: The executable name has been added to several
Packit Service c5cf8c
   structures. It is needed along with the pid and hostname to attach
Packit Service c5cf8c
   to a process.
Packit Service c5cf8c
Jan 18 2007 RTF: Pull the breakpoint out of the info type.
Packit Service c5cf8c
Jan 22 2007 RTF: At Bill Gropp's request: Changed name of defines for
Packit Service c5cf8c
   debugger_flags and mpi_flags to resp. MPI2DD_FLAGS_xxx and 
Packit Service c5cf8c
MPI2DD_MPIFLAGS_xxx.
Packit Service c5cf8c
Packit Service c5cf8c
Types
Packit Service c5cf8c
_________________________________________________________
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_ADDR_T  is the type of an address on the target machine.
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_INT32_T is the type of a signed integer with a size of four
Packit Service c5cf8c
               bytes on the target machine
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_UINT32_T is the type of an unsigned integer with a size of four
Packit Service c5cf8c
               bytes on the target machine
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_BYTE_T is the type of an unsigned integer the size of one byte.
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
Process Info
Packit Service c5cf8c
_________________________________________________________
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
extern "C" struct MPI2DD_INFO MPI2DD_info;
Packit Service c5cf8c
Packit Service c5cf8c
This structure is defined in each rank process and starter. The symbol
Packit Service c5cf8c
"MPI2DD_info" is associated with the address of this structure and
Packit Service c5cf8c
must be visible to the attached debugger.
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
struct MPI2DD_INFO {
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_BYTE_T magic[5]
Packit Service c5cf8c
Packit Service c5cf8c
     magic[0] == 'M', magic[1] = 'P', magic[2] = 'I',
Packit Service c5cf8c
     magic[3] = '2', magic[4] = 0x7f
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_BYTE_T version
Packit Service c5cf8c
Packit Service c5cf8c
     A version number for this interface. This will be one(1) for all
Packit Service c5cf8c
     instances defined by this document. It can only be changed by
Packit Service c5cf8c
     general agreement of the formal or informal organization that
Packit Service c5cf8c
     maintains this document and interface.
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_BYTE_T variant
Packit Service c5cf8c
Packit Service c5cf8c
     A code that allows for small variations in layout of the
Packit Service c5cf8c
     structures defined here or small changes in the standard
Packit Service c5cf8c
     interaction of debugger and mpi application. This field should be
Packit Service c5cf8c
     one(1) unless it is changed by general agreement between a
Packit Service c5cf8c
     debugger and MPI implementation.
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_BYTE_T debug_state
Packit Service c5cf8c
Packit Service c5cf8c
     This byte contains an indication of why a MPI2DD_Breakpoint was
Packit Service c5cf8c
     triggered and is written by the MPI implementation before the
Packit Service c5cf8c
     breakpoint function is called. It is not changed by the debugger.
Packit Service c5cf8c
Packit Service c5cf8c
     #define MPI2DD_DEBUG_START                     1
Packit Service c5cf8c
     #define MPI2DD_DEBUG_SPAWN                     2
Packit Service c5cf8c
     #define MPI2DD_DEBUG_CONNECT                   3
Packit Service c5cf8c
     #define MPI2DD_DEBUG_ACCEPT                    4
Packit Service c5cf8c
     #define MPI2DD_DEBUG_JOIN                      5
Packit Service c5cf8c
     #define MPI2DD_DEBUG_DIRECTORY_CHANGED         6
Packit Service c5cf8c
     #define MPI2DD_DEBUG_METADIRECTORY_CHANGED     7
Packit Service c5cf8c
     #define MPI2DD_DEBUG_ABORT                     8
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_UINT32_T debugger_flags
Packit Service c5cf8c
Packit Service c5cf8c
     The bits in this field are initalized by the MPI implementation
Packit Service c5cf8c
     and may be modified by the debugger.
Packit Service c5cf8c
Packit Service c5cf8c
     #define MPI2DD_FLAG_GATE    0x01
Packit Service c5cf8c
Packit Service c5cf8c
     This bit is initialized to zero by the MPI implementation and
Packit Service c5cf8c
     set to one by the debugger after it has acquired a process. This
Packit Service c5cf8c
     is used in some implementations to allow rank processes to run
Packit Service c5cf8c
     out of MPI_Init. Implementations are not required to use this
Packit Service c5cf8c
     method.
Packit Service c5cf8c
Packit Service c5cf8c
     #define MPI2DD_FLAG_BEING_DEBUGGED    0x02
Packit Service c5cf8c
Packit Service c5cf8c
     This bit is initialized to zero by the MPI implementation and set
Packit Service c5cf8c
     to one by the debugger to tell the starter program the a debugger
Packit Service c5cf8c
     is attached.
Packit Service c5cf8c
Packit Service c5cf8c
     #define MPI2DD_FLAG_REQUEST_DIRECTORY_EVENTS 0x04
Packit Service c5cf8c
Packit Service c5cf8c
     Set by the debugger if it would like to receive breakpoint events
Packit Service c5cf8c
     when changes occur to a directory or metadirectory.
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_UINT32_T mpi_flags
Packit Service c5cf8c
Packit Service c5cf8c
     The bits in this field are set by the MPI implementation and are
Packit Service c5cf8c
     not modified by the debugger.
Packit Service c5cf8c
Packit Service c5cf8c
     #define MPI2DD_MPIFLAG_I_AM_METADIR      0x01 Set if process is a 
Packit Service c5cf8c
metadirectory
Packit Service c5cf8c
     #define MPI2DD_MPIFLAG_I_AM_DIR          0x02 Set if process is a 
Packit Service c5cf8c
directory
Packit Service c5cf8c
     #define MPI2DD_MPIFLAG_I_AM_STARTER      0x04 Set if this is a 
Packit Service c5cf8c
starter process
Packit Service c5cf8c
     #define MPI2DD_MPIFLAG_FORCE_TO_MAIN     0x08 Set if this process 
Packit Service c5cf8c
is acquired before running its main procedure.
Packit Service c5cf8c
     #define MPI2DD_MPIFLAG_IGNORE_QUEUE      0x10 Set if message queue 
Packit Service c5cf8c
debugging is not implemented.
Packit Service c5cf8c
     #define MPI2DD_MPIFLAG_ACQUIRED_PRE_MAIN 0x20 Set if the rank 
Packit Service c5cf8c
processes are attached before main.
Packit Service c5cf8c
     #define MPI2DD_MPIFLAG_PARTIAL_ATTACH_OK 0x40 Set if job can be 
Packit Service c5cf8c
started by continuing the initial process.
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_ADDR_T dll_name_32;
Packit Service c5cf8c
Packit Service c5cf8c
     The address of an ascii null-terminated string containing the
Packit Service c5cf8c
     pathname of the message queue debug library that is dynamically
Packit Service c5cf8c
     loaded by the debugger. This library is used by debuggers that
Packit Service c5cf8c
     are built as 32 bit executables. If there is no 32 bit message
Packit Service c5cf8c
     queue debug library, this field is null;
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_ADDR_T dll_name_64;
Packit Service c5cf8c
Packit Service c5cf8c
     The address of an ascii null-terminated string containing the
Packit Service c5cf8c
     pathname of the message queue debug library that is dynamically
Packit Service c5cf8c
     loaded by the debugger. This library is used by debuggers that
Packit Service c5cf8c
     are built as 64 bit executables. If there is no 64 bit message
Packit Service c5cf8c
     queue debug library, this field is null;
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_ADDR_T meta_host_name;
Packit Service c5cf8c
Packit Service c5cf8c
     The address of an ascii null-terminated string containing the
Packit Service c5cf8c
     address or name of the network node where a metadirectory process
Packit Service c5cf8c
     is running.
Packit Service c5cf8c
Packit Service c5cf8c
     The host_name is either a host name, or an IPv4 address in
Packit Service c5cf8c
     standard dot notation, or an IPv6 address in colon (and possibly
Packit Service c5cf8c
     dot) notation.  (See RFC 1884 for the description of IPv6
Packit Service c5cf8c
     addresses.)
Packit Service c5cf8c
Packit Service c5cf8c
     The debugger needs meta_pid and this field to locate a
Packit Service c5cf8c
     metadirectory from an arbitrarily selected rank process.
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_ADDR_T meta_executable_name;
Packit Service c5cf8c
Packit Service c5cf8c
     The address of an ascii null-terminated string containing the
Packit Service c5cf8c
     path name of the metadirectory executable. The executable is
Packit Service c5cf8c
     opened by the debugger to read symbol tables, so the path should
Packit Service c5cf8c
     be accessible to the debugger.
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_ADDR_T abort_string
Packit Service c5cf8c
Packit Service c5cf8c
     The address of an ascii null-terminated string that holds an
Packit Service c5cf8c
     abort message that is shown to the user when the breakpoint at
Packit Service c5cf8c
     MPIDD_info.breakpoint is triggered and the MPIDD_info.debug_state
Packit Service c5cf8c
     is set to MPI2DD_DEBUG_ABORT. MPI implementations are not
Packit Service c5cf8c
     required to implement this feature.
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_ADDR_T proctable;
Packit Service c5cf8c
Packit Service c5cf8c
     This field is null except in directory processes. In a directory
Packit Service c5cf8c
     process this field contains the address of an array of proctable
Packit Service c5cf8c
     structures.
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_ADDR_T directory_table;
Packit Service c5cf8c
Packit Service c5cf8c
     This field is null except in metadirectory processes. In a
Packit Service c5cf8c
     metadirectory process this field contains the address of an array
Packit Service c5cf8c
     of directory entry structures. Each directory entry in the array
Packit Service c5cf8c
     allows the debugger to find one directory process. The process
Packit Service c5cf8c
     that contains this info structure should not have an entry for
Packit Service c5cf8c
     itself in its directory table. It is possible that the value of
Packit Service c5cf8c
     this field is null in a metadirectory process, if the
Packit Service c5cf8c
     metadirectory process is also a directory process and there are
Packit Service c5cf8c
     no other directory processes.
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_ADDR_T metadirectory_table;
Packit Service c5cf8c
Packit Service c5cf8c
     This field is null except in metadirectory processes. In a
Packit Service c5cf8c
     metadirectory process this field contains the address of an array
Packit Service c5cf8c
     of directory entry structures. Each directory entry in the array
Packit Service c5cf8c
     allows the debugger to find one metadirectory process. The process
Packit Service c5cf8c
     that contains this info structure should not have an entry for
Packit Service c5cf8c
     itself in its metadirectory table. It is possible that the value of
Packit Service c5cf8c
     this field is null in a metadirectory process, if there are no other
Packit Service c5cf8c
     metadirectory processes in the application.
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_INT32_T proctable_size
Packit Service c5cf8c
Packit Service c5cf8c
     If this is a directory process, this field contains a count of
Packit Service c5cf8c
     the entries in the proctable, otherwise it is zero.
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_INT32_T directory_size
Packit Service c5cf8c
Packit Service c5cf8c
     The number of entries in the array indicated by
Packit Service c5cf8c
     directory_table;
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_INT32_T metadirectory_size
Packit Service c5cf8c
Packit Service c5cf8c
     The number of entries in the array indicated by
Packit Service c5cf8c
     MPI2DD_metadirectory_table;
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_INT32_T meta_pid;
Packit Service c5cf8c
Packit Service c5cf8c
     The process id or task id of the metadirectory process on the node 
Packit Service c5cf8c
given
Packit Service c5cf8c
     by the meta_host_name field. On UNIX this will be a pid.
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_INT32_T padding[8];
Packit Service c5cf8c
Packit Service c5cf8c
     Thirty-two bytes of padding. Reserved for future expansion and 
Packit Service c5cf8c
vendor use.
Packit Service c5cf8c
};
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
Breakpoint address symbol
Packit Service c5cf8c
_________________________________________________________
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
void MPI2DD_breakpoint() { }
Packit Service c5cf8c
Packit Service c5cf8c
     This function provides an address where the debugger can set a
Packit Service c5cf8c
     breakpoint. It will be a routine that MPI calls at points of
Packit Service c5cf8c
     interest. When the debugger gets the breakpoint trap, it can use
Packit Service c5cf8c
     the MPI2DD_debug_state field to determine why the breakpoint was
Packit Service c5cf8c
     triggered. (It was pulled out of the info structure because its
Packit Service c5cf8c
     address may be needed before a process runs any instructions.)
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
Proctable
Packit Service c5cf8c
_________________________________________________________
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
The new proctable will be read without first having to find its type
Packit Service c5cf8c
in the debug information of the MPI executable. The order of fields is
Packit Service c5cf8c
fixed. These structures are packed with no intervening padding bytes
Packit Service c5cf8c
allowed. There will be a version field in the MPI2DD_INFO structure to
Packit Service c5cf8c
indicate future changes to this structure. Each instance of a struct
Packit Service c5cf8c
MPI2DD_PROCDESC has attributes to locate one rank process. Any process
Packit Service c5cf8c
with a entries in its proctable is, by definition, a directory
Packit Service c5cf8c
process.
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
struct MPI2DD_PROCDESC {
Packit Service c5cf8c
Packit Service c5cf8c
  MPI2DD_ADDR_T host_name;
Packit Service c5cf8c
Packit Service c5cf8c
                        The address of an ascii null-terminated string
Packit Service c5cf8c
                        containing the address or name of the network
Packit Service c5cf8c
                        node where this process is running. More
Packit Service c5cf8c
                        precisely, it is the IP address of the network
Packit Service c5cf8c
                        node where a debugger server can be run to
Packit Service c5cf8c
                        control this process.
Packit Service c5cf8c
Packit Service c5cf8c
                        The host_name is either a host name, or an
Packit Service c5cf8c
                        IPv4 address in standard dot notation, or an
Packit Service c5cf8c
                        IPv6 address in colon (and possibly dot)
Packit Service c5cf8c
                        notation.  (See RFC 1884 for the description
Packit Service c5cf8c
                        of IPv6 addresses.)
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
  MPI2DD_ADDR_T executable_name;
Packit Service c5cf8c
Packit Service c5cf8c
                        The address of an ascii null-terminated string
Packit Service c5cf8c
                        containing the path name of the
Packit Service c5cf8c
                        executable. The executable is opened by the
Packit Service c5cf8c
                        debugger to read symbol tables, so the path
Packit Service c5cf8c
                        should be accessible to the debugger.
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
  MPI2DD_ADDR_T spawn_desc;
Packit Service c5cf8c
Packit Service c5cf8c
                        (new) There are two ways that processes are
Packit Service c5cf8c
                        created in an MPI job. They are created by a
Packit Service c5cf8c
                        starter program or they are spawned by an
Packit Service c5cf8c
                        existing MPI group. This field is either the
Packit Service c5cf8c
                        address of a MPI2DD_SPAWNDESC structure that has
Packit Service c5cf8c
                        the context for the spawn, or null if this
Packit Service c5cf8c
                        process is part of the MPI_COMM_WORLD created
Packit Service c5cf8c
                        by a starter program. [To save space it is
Packit Service c5cf8c
                        possible that this field could be moved to a
Packit Service c5cf8c
                        separate table that is indexed by the
Packit Service c5cf8c
                        comm_world_id field below.]
Packit Service c5cf8c
Packit Service c5cf8c
  MPI2DD_ADDR_T comm_world_id;
Packit Service c5cf8c
Packit Service c5cf8c
                        This field is the address of a ascii
Packit Service c5cf8c
                        null-terminated string that identifies the
Packit Service c5cf8c
                        MPI_COMM_WORLD associated with this rank
Packit Service c5cf8c
                        process. It should distinguish this comm world
Packit Service c5cf8c
                        from any other comm worlds spawned in this job
Packit Service c5cf8c
                        and any job that this job join/connects to.
Packit Service c5cf8c
Packit Service c5cf8c
  MPI2DD_INT32_T pid;
Packit Service c5cf8c
Packit Service c5cf8c
                        The process id or task id of the rank process
Packit Service c5cf8c
                        on the node given by the hostname field. On
Packit Service c5cf8c
                        UNIX this will be a pid.
Packit Service c5cf8c
Packit Service c5cf8c
  MPI2DD_INT32_T rank;
Packit Service c5cf8c
Packit Service c5cf8c
                        (new) The rank of the process in the
Packit Service c5cf8c
                        MPI_COMM_WORLD. [The table index can no longer
Packit Service c5cf8c
                        be used as the rank indicator because the
Packit Service c5cf8c
                        proctable for a job may be distributed across
Packit Service c5cf8c
                        multiple directory nodes, processes may appear
Packit Service c5cf8c
                        in more than one proctable, and it may be
Packit Service c5cf8c
                        possible for a rank process to remove itself
Packit Service c5cf8c
                        from its MPI_COMM_WORLD (?)].
Packit Service c5cf8c
Packit Service c5cf8c
 };
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
struct MPI2DD_SPAWNDESC {
Packit Service c5cf8c
Packit Service c5cf8c
  MPI2DD_ADDR_T parent_comm_world_id;
Packit Service c5cf8c
Packit Service c5cf8c
                        This field is the address of a ascii
Packit Service c5cf8c
                        null-terminated string that identifies the
Packit Service c5cf8c
                        MPI_COMM_WORLD associated with the parent_rank
Packit Service c5cf8c
                        process. It should distinguish this comm world
Packit Service c5cf8c
                        from any other comm worlds spawned in this job
Packit Service c5cf8c
                        and any job that this job join/connects to.
Packit Service c5cf8c
Packit Service c5cf8c
  MPI2DD_INT32_T parent_rank;
Packit Service c5cf8c
Packit Service c5cf8c
                        Rank of the parent process.
Packit Service c5cf8c
Packit Service c5cf8c
  MPI2DD_INT32_T sequence;
Packit Service c5cf8c
Packit Service c5cf8c
                        The sequence of this spawn command among those
Packit Service c5cf8c
                        rooted on the parent process. This should
Packit Service c5cf8c
                        start at zero and increment by one for each
Packit Service c5cf8c
                        spawn that is rooted at the parent_rank
Packit Service c5cf8c
                        process.
Packit Service c5cf8c
Packit Service c5cf8c
};
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
Directory and MetaDirectory Tables
Packit Service c5cf8c
_________________________________________________________
Packit Service c5cf8c
Packit Service c5cf8c
A metadirectory process will have two tables that allow a debugger to
Packit Service c5cf8c
find metadirectory processes and directory processes. A process should
Packit Service c5cf8c
not be in its own metadirectory or directory tables. These tables both
Packit Service c5cf8c
have the same format.
Packit Service c5cf8c
Packit Service c5cf8c
In a simple job, where there are no other metadirectory processes and
Packit Service c5cf8c
the metadirectory process is also the only directory process, these
Packit Service c5cf8c
tables might both be empty.
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
struct MPI2DD_DIRECTORYENTRY {
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_ADDR_T host_name;
Packit Service c5cf8c
Packit Service c5cf8c
     The address of an ascii null-terminated string containing the
Packit Service c5cf8c
     address or name of the network node where a directory or
Packit Service c5cf8c
     metadirectory process is running.
Packit Service c5cf8c
Packit Service c5cf8c
     The host_name is either a host name, or an IPv4 address in
Packit Service c5cf8c
     standard dot notation, or an IPv6 address in colon (and possibly
Packit Service c5cf8c
     dot) notation.  (See RFC 1884 for the description of IPv6
Packit Service c5cf8c
     addresses.)
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_ADDR_T executable_name;
Packit Service c5cf8c
Packit Service c5cf8c
     The address of an ascii null-terminated string containing the
Packit Service c5cf8c
     path name of the directory or metadirectory executable. The
Packit Service c5cf8c
     executable is opened by the debugger to read symbol tables, so
Packit Service c5cf8c
     the path should be accessible to the debugger.
Packit Service c5cf8c
Packit Service c5cf8c
Packit Service c5cf8c
MPI2DD_INT32_T pid;
Packit Service c5cf8c
Packit Service c5cf8c
     The process id or task id of the directory or metadirectory
Packit Service c5cf8c
     process on the node given by the host_name field. On UNIX this
Packit Service c5cf8c
     will be a pid.
Packit Service c5cf8c
Packit Service c5cf8c
};
Packit Service c5cf8c