ompt.h

Go to the documentation of this file.
00001 #ifndef __OMPT___
00002 #define __OMPT___
00003 
00004 /*****************************************************************************
00005  * system include files
00006  *****************************************************************************/
00007 
00008 #include <stdint.h>
00009 
00010 
00011 /*****************************************************************************
00012  * data types
00013  *****************************************************************************/
00014 
00015 /*---------------------
00016  * identifiers
00017  *---------------------*/
00018 
00019 typedef uint64_t ompt_task_id_t;
00020 #define ompt_task_id_none ((ompt_task_id_t) 0) /* non-standard */
00021 
00022 typedef uint64_t ompt_parallel_id_t;
00023 #define ompt_parallel_id_none ((ompt_parallel_id_t) 0) /* non-standard */
00024 
00025 typedef uint64_t ompt_wait_id_t;
00026 #define ompt_wait_id_none ((ompt_wait_id_t) 0) /* non-standard */
00027 
00028 
00029 /*---------------------
00030  * ompt_frame_t
00031  *---------------------*/
00032 
00033 typedef struct ompt_frame_s {
00034    void *exit_runtime_frame;    /* next frame is user code     */
00035    void *reenter_runtime_frame; /* previous frame is user code */
00036 } ompt_frame_t;
00037 
00038 
00039 
00040 /*****************************************************************************
00041  * enumerations for thread states and runtime events 
00042  *****************************************************************************/
00043 
00044 /*---------------------
00045  * runtime states
00046  *---------------------*/
00047 
00048 typedef enum {
00049 #define ompt_state(state, code) state = code,
00050 #include "ompt-state.h"
00051 } ompt_state_t;
00052 
00053 
00054 /*---------------------
00055  * runtime events
00056  *---------------------*/
00057 
00058 typedef enum {
00059 #define ompt_event(event, callback, eventid, is_impl) event = eventid,
00060 #include "ompt-event.h"
00061 } ompt_event_t;
00062 
00063 
00064 
00065 /*****************************************************************************
00066  * callback signatures
00067  *****************************************************************************/
00068 
00069 /* threads */
00070 typedef void (*ompt_callback_t)(void);
00071 
00072 typedef void (*ompt_wait_callback_t) (
00073   ompt_wait_id_t wait_id            /* wait id                      */
00074   );
00075 
00076 
00077 /* parallel and workshares */
00078 typedef void (*ompt_parallel_callback_t) (
00079   ompt_parallel_id_t parallel_id,    /* id of parallel region       */
00080   ompt_task_id_t task_id             /* id of task                  */
00081   );
00082 
00083 
00084 typedef void (*ompt_new_workshare_callback_t) (
00085   ompt_task_id_t parent_task_id,    /* id of parent task            */
00086   ompt_parallel_id_t parallel_id,   /* id of parallel region        */
00087   void *workshare_function          /* pointer to outlined function */
00088   );
00089 
00090 typedef void (*ompt_new_parallel_callback_t) (
00091   ompt_task_id_t parent_task_id,    /* id of parent task            */
00092   ompt_frame_t *parent_task_frame,  /* frame data of parent task    */
00093   ompt_parallel_id_t parallel_id,   /* id of parallel region        */
00094   void *parallel_function           /* pointer to outlined function */
00095   );
00096 
00097 
00098 /* tasks */
00099 typedef void (*ompt_task_callback_t) (
00100   ompt_task_id_t task_id            /* id of task                   */
00101   );
00102 
00103 typedef void (*ompt_task_switch_callback_t) (
00104   ompt_task_id_t suspended_task_id, /* tool data for suspended task */
00105   ompt_task_id_t resumed_task_id    /* tool data for resumed task   */
00106   );
00107 
00108 typedef void (*ompt_new_task_callback_t) (
00109   ompt_task_id_t parent_task_id,    /* id of parent task            */
00110   ompt_frame_t *parent_task_frame,  /* frame data for parent task   */
00111   ompt_task_id_t  new_task_id,      /* id of created task           */
00112   void *task_function               /* pointer to outlined function */
00113   );
00114 
00115 
00116 /* program */
00117 typedef void (*ompt_control_callback_t) (
00118   uint64_t command,                /* command of control call      */
00119   uint64_t modifier                /* modifier of control call     */
00120   );
00121 
00122 
00123 
00124 /****************************************************************************
00125  * ompt API 
00126  ***************************************************************************/
00127 
00128 #ifdef  __cplusplus
00129 extern "C" {
00130 #endif 
00131 
00132 
00133 
00134 /****************************************************************************
00135  * INQUIRY FUNCTIONS
00136  ***************************************************************************/
00137 
00138 /* state */
00139 extern ompt_state_t ompt_get_state(
00140   ompt_wait_id_t *ompt_wait_id
00141 );
00142 
00143 /* thread */
00144 extern void *ompt_get_idle_frame(void);
00145 
00146 /* parallel region */
00147 extern ompt_parallel_id_t ompt_get_parallel_id(
00148   int ancestor_level
00149 );
00150 
00151 /* task */
00152 extern ompt_task_id_t ompt_get_task_id(
00153   int ancestor_level
00154 );
00155 
00156 extern ompt_frame_t *ompt_get_task_frame(
00157   int ancestor_level
00158 );
00159 
00160 
00161 /****************************************************************************
00162  * INITIALIZATION FUNCTIONS
00163  ***************************************************************************/
00164 
00165 extern int ompt_initialize(void); /* to be defined by tool */
00166 
00167 typedef enum opt_init_mode_e {
00168   ompt_init_mode_never  = 0,
00169   ompt_init_mode_false  = 1,
00170   ompt_init_mode_true   = 2,
00171   ompt_init_mode_always = 3
00172 } ompt_init_mode_t;
00173 
00174 extern int ompt_set_callback(
00175   ompt_event_t event, 
00176   ompt_callback_t callback
00177 );
00178 
00179 typedef enum ompt_set_callback_rc_e {  /* non-standard */
00180   ompt_set_callback_error      = 0,
00181   ompt_has_event_no_callback   = 1,
00182   ompt_no_event_no_callback    = 2,
00183   ompt_has_event_may_callback  = 3,
00184   ompt_has_event_must_callback = 4,
00185 } ompt_set_callback_rc_t;
00186 
00187 
00188 extern int ompt_get_callback(
00189   ompt_event_t event, 
00190   ompt_callback_t *callback
00191 );
00192 
00193 /****************************************************************************
00194  * MISCELLANEOUS FUNCTIONS
00195  ***************************************************************************/
00196 
00197 /* control */
00198 extern void ompt_control(
00199   uint64_t command, 
00200   uint64_t modifier);
00201 
00202 /* library inquiry */
00203 extern int ompt_get_ompt_version(void);
00204 
00205 extern int ompt_get_runtime_version(
00206   char *buffer, 
00207   int length
00208 );
00209 
00210 extern int ompt_enumerate_state(
00211   int current_state, 
00212   int *next_state, 
00213   const char **next_state_name
00214 );
00215 
00216 
00217 #ifdef  __cplusplus
00218 };
00219 #endif
00220 
00221 
00222 /****************************************************************************
00223  * public variables 
00224  ***************************************************************************/
00225 
00226 /* debugger interface */
00227 extern char **ompd_dll_locations; 
00228 
00229 
00230 
00231 #endif
00232 

Generated on 25 Aug 2013 for libomp_oss by  doxygen 1.6.1