~ubuntu-branches/ubuntu/hardy/openmpi/hardy-updates

« back to all changes in this revision

Viewing changes to ompi/peruse/peruse.h

  • Committer: Bazaar Package Importer
  • Author(s): Mark Hymers
  • Date: 2006-10-15 00:46:11 UTC
  • Revision ID: james.westby@ubuntu.com-20061015004611-uuhxnaxyjmuxfd5h
Tags: upstream-1.1
ImportĀ upstreamĀ versionĀ 1.1

Show diffs side-by-side

added added

removed removed

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