Skip to content
Marc-Andre Hermanns edited this page Apr 27, 2017 · 21 revisions

Interface Requirements

  • Should cover the capabilities of current MPI Peruse implementations
  • Should be thread safe

Callback requirements (adopted from PERUSE for now)

  • When a callback is invoked, it is undefined whether the MPI library is under a lock or not and the callback code should not make any assumptions about the lock state of the MPI library
  • Callbacks should be prepared to be invoked from different threads when used with MPI implementations with independent progress engine using internal system threads
  • Callbacks should be signal safe as some MPI libraries use signals for their progress engine and the callback could be invoked from within a signal handler
  • Callbacks should not make any MPI library calls with the exception of MPI timing routines (MPI_Wtime(), MPI_Wtick(), and potential successors) and event data queries.
  • Callbacks should not hold any locks that are placed around MPI calls in the main code.
  • Callbacks should be limited to read-only operations on MPI_T event handles.
  • Event information could be encoded as an array of datatypes.

State of discussion

  • Callback info must enable unambiguous identification to which thread/process it belongs to
  • The callback information should contain pointer (void*) to tool-specific storage that was provided to MPI by the tool during event registration
  • Event subsystem is initialized with MPI_T_init_thread
  • Event subsystem is finalized with MPI_T_finalize
  • Support buffered events
    • Callback functions are triggered by the runtime system
    • Event meta data may include a timestamp for a buffered event
    • Tool queries MPI_T_event_get_time to either get the buffered timestamp or generate a new one on the fly
    • Querying event time is transparent for tool

Open Questions

  • Should we semantically connect events through the definition of stages? How would those stages be queried?

Example code

void my_event_read_handler( MPI_T_event     event,
                            MPI_T_cb_safety cb_safety,
                            void*           data) {

   // cast user-data point back to its correct type
   MyTool_data* tool_data = (MyTool_data*) data;
   // Query time of event
   MPI_Time mytime;
   MPI_T_event_get_time(event, &mytime);
   // Query source of event
   int event_source;
   MPI_T_event_get_source( event, &event_source );
   // Identify event
   int event_index;
   MPI_T_event_get_index_by_handle( event, &event_index );
   // dispatch handler
   switch (event_index) {
      ...
      case 42:
         int rank, tag;
         MPI_T_event_read( event, 0, &rank );
         MPI_T_event_read( event, 1, &tag );
         MyTool_write_event_42( mydata, source, time, rank, tag ); 
         break;
      ...
      default:
         // handle unknown event
   };
}

Meeting Notes

References

Clone this wiki locally