File: peruse.h

package info (click to toggle)
openmpi 5.0.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 202,312 kB
  • sloc: ansic: 612,441; makefile: 42,495; sh: 11,230; javascript: 9,244; f90: 7,052; java: 6,404; perl: 5,154; python: 1,856; lex: 740; fortran: 61; cpp: 20; tcl: 12
file content (157 lines) | stat: -rw-r--r-- 5,573 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
/*
 * Copyright (c) 2004-2009 The University of Tennessee and The University
 *                         of Tennessee Research Foundation.  All rights
 *                         reserved.
 * Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
 *                         University of Stuttgart.  All rights reserved.
 * Copyright (c) 2007      Los Alamos National Security, LLC.  All rights
 *                         reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

#ifndef _PERUSE_H_
#define _PERUSE_H_

#include "mpi.h"

/* PERUSE type declarations */
typedef void* peruse_event_h;    /* Opaque event handle XXX */

typedef struct _peruse_comm_spec_t {
    MPI_Comm      comm;
    void *        buf;
    int           count;
    MPI_Datatype  datatype;
    int           peer;
    int           tag;
    int           operation;
} peruse_comm_spec_t;

typedef int (peruse_comm_callback_f)(peruse_event_h event_h,
              MPI_Aint unique_id, peruse_comm_spec_t * spec, void * param);

/* PERUSE constants */
enum {
    PERUSE_SUCCESS = 0,       /* Success *//* XXX Deviation from 1.11 */
    PERUSE_ERR_INIT,          /* PERUSE initialization failure */
    PERUSE_ERR_GENERIC,       /* Generic unspecified error */
    PERUSE_ERR_MALLOC,        /* Memory-related error */
    PERUSE_ERR_EVENT,         /* Invalid event descriptor */
    PERUSE_ERR_EVENT_HANDLE,  /* Invalid event handle */
    PERUSE_ERR_PARAMETER,     /* Invalid input parameter */
    PERUSE_ERR_MPI_INIT,      /* MPI has not been initialized */
    PERUSE_ERR_COMM,          /* MPI_ERR_COMM class */
    PERUSE_ERR_MPI_OBJECT     /* Error with associated MPI object */
};

enum {
    PERUSE_EVENT_INVALID = -1, /* Must differ in value from PERUSE_SUCCESS. Deviation from 1.11 */

    /* Point-to-point request events */
    PERUSE_COMM_REQ_ACTIVATE,
    PERUSE_COMM_REQ_MATCH_UNEX,
    PERUSE_COMM_REQ_INSERT_IN_POSTED_Q,
    PERUSE_COMM_REQ_REMOVE_FROM_POSTED_Q,
    PERUSE_COMM_REQ_XFER_BEGIN,
    PERUSE_COMM_REQ_XFER_CONTINUE,      /* Open MPI extension */
    PERUSE_COMM_REQ_XFER_END,
    PERUSE_COMM_REQ_COMPLETE,
    PERUSE_COMM_REQ_NOTIFY,
    PERUSE_COMM_MSG_ARRIVED,
    PERUSE_COMM_MSG_INSERT_IN_UNEX_Q,
    PERUSE_COMM_MSG_REMOVE_FROM_UNEX_Q,
    PERUSE_COMM_MSG_MATCH_POSTED_REQ,

    /* Queue events*/
    PERUSE_COMM_SEARCH_POSTED_Q_BEGIN,
    PERUSE_COMM_SEARCH_POSTED_Q_END,
    PERUSE_COMM_SEARCH_UNEX_Q_BEGIN,    /* XXX Deviation from 1.11 */
    PERUSE_COMM_SEARCH_UNEX_Q_END,

    /* Collective events */
    /* IO events */
    /* One-sided events */
    PERUSE_CUSTOM_EVENT
};

/* Scope of message queues */
enum {
    PERUSE_PER_COMM=0,                  /* XXX Deviation from 1.11 */
    PERUSE_GLOBAL
};

/* Operation values */
enum {
    PERUSE_SEND=0,                      /* XXX Deviation from 1.11 */
    PERUSE_RECV
};

#define PERUSE_EVENT_HANDLE_NULL ((peruse_event_h)0)

/*
 * I. Environment
 */

/* PERUSE initialization */
OMPI_DECLSPEC int PERUSE_Init( void );

/* Query all implemented events */
OMPI_DECLSPEC int PERUSE_Query_supported_events( int* num_supported,
                                                 char*** event_names,
                                                 int** events );

/* Query supported events */
OMPI_DECLSPEC int PERUSE_Query_event( const char* event_name, int* event );

/* Query event name */
OMPI_DECLSPEC int PERUSE_Query_event_name( int event, char** event_name );

/* Get environment variables that affect MPI library behavior */
OMPI_DECLSPEC int PERUSE_Query_environment( int* env_size, char*** env );

/* Query the scope of queue metrics - global or per communicator */
OMPI_DECLSPEC int PERUSE_Query_queue_event_scope( int* scope );

/*
 * II. Events, objects initialization and manipulation
 */
/* Initialize event associated with an MPI communicator */
OMPI_DECLSPEC int PERUSE_Event_comm_register( int                       event,
                                              MPI_Comm                  comm,
                                              peruse_comm_callback_f *  callback_fn,
                                              void *                    param,
                                              peruse_event_h *          event_h );

/* Start collecting data (activate event) */
OMPI_DECLSPEC int PERUSE_Event_activate( peruse_event_h event_h );

/* Stop collecting data (deactivate event) */
OMPI_DECLSPEC int PERUSE_Event_deactivate( peruse_event_h event_h );

/* Free event handle */
OMPI_DECLSPEC int PERUSE_Event_release( peruse_event_h* event_h );

/* Set a new comm callback */
OMPI_DECLSPEC int PERUSE_Event_comm_callback_set( peruse_event_h            event_h,
                                                  peruse_comm_callback_f*   callback_fn,
                                                  void *                    param);

/* Get the current comm callback */
OMPI_DECLSPEC int PERUSE_Event_comm_callback_get( peruse_event_h            event_h,
                                                  peruse_comm_callback_f**  callback_fn,
                                                  void **                   param );

/* Obtain event descriptor from an event handle (reverse lookup) */
OMPI_DECLSPEC int PERUSE_Event_get( peruse_event_h event_h, int* event );

/* Obtain MPI object associated with event handle */
OMPI_DECLSPEC int PERUSE_Event_object_get( peruse_event_h event_h, void** mpi_object );

/* Propagation mode */
OMPI_DECLSPEC int PERUSE_Event_propagate( peruse_event_h event_h, int mode );

#endif