Difference between revisions of "Function Name Prefix Convention"

From Mpich
Jump to: navigation, search
Line 1: Line 1:
This page describes the convention for function names in MPICH2.  The prefixes to function names indicate at which level the function is implemented, and by which level it is intended to be used.
+
This page describes the convention for function names in MPICH.  The prefixes to function names indicate at which level the function is implemented, and by which level it is intended to be used.
  
 
I believe that this is how the prefixes were intended to be used:
 
I believe that this is how the prefixes were intended to be used:

Revision as of 16:15, 10 November 2012

This page describes the convention for function names in MPICH. The prefixes to function names indicate at which level the function is implemented, and by which level it is intended to be used.

I believe that this is how the prefixes were intended to be used:

An interface (e.g., MPI, ADI3, channel) is identified by a prefix (e.g., MPI, MPID, MPIDI_CH3). For a particular interface with prefix XXX, functions with the XXX_ prefix and XXXU_ prefix are part of the API, with the XXX_ functions being implemented by the lower layer and called by the upper layer, and the XXXU_ functions being implemented by the upper layer to be called by the lower layer (U may stand for "upcall"). Functions with the XXXI_ prefix are not part of the API and are implemented by the lower layer to be used internally by the lower layer, and so should not be called directly by the upper layer. E.g. For the ADI3 interface, MPID_ functions are implemented by CH3 and are called by the MPI layer. MPIDU_ functions are implemented by the MPI layer and are called by CH3. CH3 has internal functions which have the MPIDI_ prefix. Note that channels are part of the CH3 implementation, and so all channel functions should have MPIDI_ prefixes (specifically MPIDI_CH3_, MPIDI_CH3I_, etc.).

A little more specifically:

  • MPI_ functions are implemented by the MPI level to be used by the application
  • MPIU_ functions are implemented by the MPI level in src/util/ to be used by the MPI level and below
  • MPID_ functions are implemented by the device to be used by the MPI level in src/mpid/<device>
  • MPIDU_ functions are implemented at the device level (only?) in src/mpid/common or src/mpid/include to be used by the device level and below, but not above.
  • MPIDI_ functions are implemented at the device level (in src/mpid/<device>) to be used in the specific device implementing it and below, (not above).
  • In the CH3 device:
    • MPIDI_CH3_ functions are implemented by the channel in src/mpid/ch3/<channel> used by CH3
    • MPIDI_CH3U_ functions are implemented by the CH3 used by the channel (and probably CH3?) but not above
    • MPIDI_CH3I_ functions are implemented by the channel used by the channel but not above.

Reality

So that was what was supposed to be the naming convention, but when one looks at the code, it doesn't match up:

  • MPIDI_FUNC_ENTER is defined in src/include/mpiimpl.h: This should be MPIU_FUNC_ENTER
  • MPIDI_Sock_update_sock_set and many other MPIDI_ macros are defined in src/mpid/common: These should have the MPIDU_ prefix
  • There are also MPIDU_CH3I_ and MPIDU_CH3U_ prefixes which don't match any of the rules
  • Oh, and just forget about prefix conventions in Nemesis :-)

Considering there are many places where this isn't followed, and that changing function names or moving functions could really mess up external collaborators who are trying to track our code, what do we want to do?

  • Nothing, just follow the correct convention from here on
  • Change it all and hope collaborators can keep up
  • Fix particularly bad cases, and leave the rest
  • Relax the prefix rules to closer match reality