OpenMPI  0.1.1
peruse.h
1 /*
2  * Copyright (c) 2004-2009 The University of Tennessee and The University
3  * of Tennessee Research Foundation. All rights
4  * reserved.
5  * Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
6  * University of Stuttgart. All rights reserved.
7  * Copyright (c) 2007 Los Alamos National Security, LLC. All rights
8  * reserved.
9  * $COPYRIGHT$
10  *
11  * Additional copyrights may follow
12  *
13  * $HEADER$
14  */
15 
16 #ifndef _PERUSE_H_
17 #define _PERUSE_H_
18 
19 #include "mpi.h"
20 
21 /* PERUSE type declarations */
22 typedef void* peruse_event_h; /* Opaque event handle XXX */
23 
24 typedef struct _peruse_comm_spec_t {
25  MPI_Comm comm;
26  void * buf;
27  int count;
28  MPI_Datatype datatype;
29  int peer;
30  int tag;
31  int operation;
33 
34 typedef int (peruse_comm_callback_f)(peruse_event_h event_h,
35  MPI_Aint unique_id, peruse_comm_spec_t * spec, void * param);
36 
37 /* PERUSE constants */
38 enum {
39  PERUSE_SUCCESS = 0, /* Success *//* XXX Devation from 1.11 */
40  PERUSE_ERR_INIT, /* PERUSE initialization failure */
41  PERUSE_ERR_GENERIC, /* Generic unspecified error */
42  PERUSE_ERR_MALLOC, /* Memory-related error */
43  PERUSE_ERR_EVENT, /* Invalid event descriptor */
44  PERUSE_ERR_EVENT_HANDLE, /* Invalid event handle */
45  PERUSE_ERR_PARAMETER, /* Invalid input parameter */
46  PERUSE_ERR_MPI_INIT, /* MPI has not been initialized */
47  PERUSE_ERR_COMM, /* MPI_ERR_COMM class */
48  PERUSE_ERR_MPI_OBJECT /* Error with associated MPI object */
49 };
50 
51 enum {
52  PERUSE_EVENT_INVALID = -1, /* Must differ in value from PERUSE_SUCCESS. Devation from 1.11 */
53 
54  /* Point-to-point request events */
55  PERUSE_COMM_REQ_ACTIVATE,
56  PERUSE_COMM_REQ_MATCH_UNEX,
57  PERUSE_COMM_REQ_INSERT_IN_POSTED_Q,
58  PERUSE_COMM_REQ_REMOVE_FROM_POSTED_Q,
59  PERUSE_COMM_REQ_XFER_BEGIN,
60  PERUSE_COMM_REQ_XFER_CONTINUE, /* Open MPI extension */
61  PERUSE_COMM_REQ_XFER_END,
62  PERUSE_COMM_REQ_COMPLETE,
63  PERUSE_COMM_REQ_NOTIFY,
64  PERUSE_COMM_MSG_ARRIVED,
65  PERUSE_COMM_MSG_INSERT_IN_UNEX_Q,
66  PERUSE_COMM_MSG_REMOVE_FROM_UNEX_Q,
67  PERUSE_COMM_MSG_MATCH_POSTED_REQ,
68 
69  /* Queue events*/
70  PERUSE_COMM_SEARCH_POSTED_Q_BEGIN,
71  PERUSE_COMM_SEARCH_POSTED_Q_END,
72  PERUSE_COMM_SEARCH_UNEX_Q_BEGIN, /* XXX Deviation from 1.11 */
73  PERUSE_COMM_SEARCH_UNEX_Q_END,
74 
75  /* Collective events */
76  /* IO events */
77  /* One-sided events */
78  PERUSE_CUSTOM_EVENT
79 };
80 
81 /* Scope of message queues */
82 enum {
83  PERUSE_PER_COMM=0, /* XXX Devation from 1.11 */
84  PERUSE_GLOBAL
85 };
86 
87 /* Operation values */
88 enum {
89  PERUSE_SEND=0, /* XXX Devation from 1.11 */
90  PERUSE_RECV
91 };
92 
93 #define PERUSE_EVENT_HANDLE_NULL ((peruse_event_h)0)
94 
95 /*
96  * I. Environment
97  */
98 
99 /* PERUSE initialization */
100 OMPI_DECLSPEC int PERUSE_Init( void );
101 
102 /* Query all implemented events */
103 OMPI_DECLSPEC int PERUSE_Query_supported_events( int* num_supported,
104  char*** event_names,
105  int** events );
106 
107 /* Query supported events */
108 OMPI_DECLSPEC int PERUSE_Query_event( const char* event_name, int* event );
109 
110 /* Query event name */
111 OMPI_DECLSPEC int PERUSE_Query_event_name( int event, char** event_name );
112 
113 /* Get environment variables that affect MPI library behavior */
114 OMPI_DECLSPEC int PERUSE_Query_environment( int* env_size, char*** env );
115 
116 /* Query the scope of queue metrics - global or per communicator */
117 OMPI_DECLSPEC int PERUSE_Query_queue_event_scope( int* scope );
118 
119 /*
120  * II. Events, objects initialization and manipulation
121  */
122 /* Initialize event associated with an MPI communicator */
123 OMPI_DECLSPEC int PERUSE_Event_comm_register( int event,
124  MPI_Comm comm,
125  peruse_comm_callback_f * callback_fn,
126  void * param,
127  peruse_event_h * event_h );
128 
129 /* Start collecting data (activate event) */
130 OMPI_DECLSPEC int PERUSE_Event_activate( peruse_event_h event_h );
131 
132 /* Stop collecting data (deactivate event) */
133 OMPI_DECLSPEC int PERUSE_Event_deactivate( peruse_event_h event_h );
134 
135 /* Free event handle */
136 OMPI_DECLSPEC int PERUSE_Event_release( peruse_event_h* event_h );
137 
138 /* Set a new comm callback */
139 OMPI_DECLSPEC int PERUSE_Event_comm_callback_set( peruse_event_h event_h,
140  peruse_comm_callback_f* callback_fn,
141  void * param);
142 
143 /* Get the current comm callback */
144 OMPI_DECLSPEC int PERUSE_Event_comm_callback_get( peruse_event_h event_h,
145  peruse_comm_callback_f** callback_fn,
146  void ** param );
147 
148 /* Obtain event descriptor from an event handle (reverse lookup) */
149 OMPI_DECLSPEC int PERUSE_Event_get( peruse_event_h event_h, int* event );
150 
151 /* Obtain MPI object associated with event handle */
152 OMPI_DECLSPEC int PERUSE_Event_object_get( peruse_event_h event_h, void** mpi_object );
153 
154 /* Propagation mode */
155 OMPI_DECLSPEC int PERUSE_Event_propagate( peruse_event_h event_h, int mode );
156 
157 #endif
Definition: ompi_datatype.h:68
Structure to represent a single event.
Definition: event_struct.h:87
Definition: peruse.h:24
Definition: communicator.h:118