File: pmix_server_internal.h

package info (click to toggle)
openmpi 2.0.2-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 99,912 kB
  • ctags: 55,589
  • sloc: ansic: 525,999; f90: 18,307; makefile: 12,062; sh: 6,583; java: 6,278; asm: 3,515; cpp: 2,227; perl: 2,136; python: 1,350; lex: 734; fortran: 52; tcl: 12
file content (196 lines) | stat: -rw-r--r-- 8,220 bytes parent folder | download
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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
/*
 * Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
 *                         University Research and Technology
 *                         Corporation.  All rights reserved.
 * Copyright (c) 2004-2006 The University of Tennessee and The University
 *                         of Tennessee Research Foundation.  All rights
 *                         reserved.
 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
 *                         University of Stuttgart.  All rights reserved.
 * Copyright (c) 2004-2005 The Regents of the University of California.
 *                         All rights reserved.
 * Copyright (c) 2006-2013 Los Alamos National Security, LLC.
 *                         All rights reserved.
 * Copyright (c) 2010-2011 Cisco Systems, Inc.  All rights reserved.
 * Copyright (c) 2013-2015 Intel, Inc.  All rights reserved.
 * Copyright (c) 2014      Mellanox Technologies, Inc.
 *                         All rights reserved.
 * Copyright (c) 2014      Research Organization for Information Science
 *                         and Technology (RIST). All rights reserved.
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

#ifndef _PMIX_SERVER_INTERNAL_H_
#define _PMIX_SERVER_INTERNAL_H_

#include "orte_config.h"
#include "orte/types.h"

#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_SYS_UN_H
#include <sys/un.h>
#endif

#include "opal/types.h"
#include "opal/class/opal_hotel.h"
#include "opal/mca/base/base.h"
#include "opal/mca/event/event.h"
#include "opal/mca/pmix/pmix.h"
#include "opal/util/proc.h"

#include "orte/mca/grpcomm/base/base.h"

 BEGIN_C_DECLS

/* object for tracking requests so we can
 * correctly route the eventual reply */
 typedef struct {
    opal_object_t super;
    opal_event_t ev;
    int status;
    int timeout;
    int room_num;
    int remote_room_num;
    orte_process_name_t proxy;
    opal_process_name_t target;
    orte_job_t *jdata;
    opal_buffer_t msg;
    opal_pmix_op_cbfunc_t opcbfunc;
    opal_pmix_modex_cbfunc_t mdxcbfunc;
    opal_pmix_spawn_cbfunc_t spcbfunc;
    opal_pmix_lookup_cbfunc_t lkcbfunc;
    opal_pmix_release_cbfunc_t rlcbfunc;
    void *cbdata;
} pmix_server_req_t;
OBJ_CLASS_DECLARATION(pmix_server_req_t);

/* object for thread-shifting server operations */
typedef struct {
    opal_object_t super;
    opal_event_t ev;
    opal_list_t *procs;
    opal_list_t *info;
    opal_pmix_op_cbfunc_t cbfunc;
    void *cbdata;
} orte_pmix_server_op_caddy_t;
OBJ_CLASS_DECLARATION(orte_pmix_server_op_caddy_t);

typedef struct {
    opal_object_t super;
    orte_grpcomm_signature_t *sig;
    opal_pmix_modex_cbfunc_t cbfunc;
    void *cbdata;
} orte_pmix_mdx_caddy_t;
OBJ_CLASS_DECLARATION(orte_pmix_mdx_caddy_t);

#define ORTE_DMX_REQ(p, cf, ocf, ocd)                    \
do {                                                     \
    pmix_server_req_t *_req;                             \
    _req = OBJ_NEW(pmix_server_req_t);                   \
    _req->target = (p);                                  \
    _req->mdxcbfunc = (ocf);                             \
    _req->cbdata = (ocd);                                \
    opal_event_set(orte_event_base, &(_req->ev),         \
                   -1, OPAL_EV_WRITE, (cf), _req);       \
    opal_event_set_priority(&(_req->ev), ORTE_MSG_PRI);  \
    opal_event_active(&(_req->ev), OPAL_EV_WRITE, 1);    \
} while(0);

#define ORTE_SPN_REQ(j, cf, ocf, ocd)                    \
do {                                                     \
    pmix_server_req_t *_req;                             \
    _req = OBJ_NEW(pmix_server_req_t);                   \
    _req->jdata = (j);                                   \
    _req->spcbfunc = (ocf);                              \
    _req->cbdata = (ocd);                                \
    opal_event_set(orte_event_base, &(_req->ev),         \
                   -1, OPAL_EV_WRITE, (cf), _req);       \
    opal_event_set_priority(&(_req->ev), ORTE_MSG_PRI);  \
    opal_event_active(&(_req->ev), OPAL_EV_WRITE, 1);    \
} while(0);

#define ORTE_PMIX_OPERATION(p, i, fn, cf, cb)               \
do {                                                        \
    orte_pmix_server_op_caddy_t *_cd;                       \
    _cd = OBJ_NEW(orte_pmix_server_op_caddy_t);             \
    _cd->procs = (p);                                       \
    _cd->info = (i);                                        \
    _cd->cbfunc = (cf);                                     \
    _cd->cbdata = (cb);                                     \
    opal_event_set(orte_event_base, &(_cd->ev), -1,         \
                   OPAL_EV_WRITE, (fn), _cd);               \
    opal_event_set_priority(&(_cd->ev), ORTE_MSG_PRI);      \
    opal_event_active(&(_cd->ev), OPAL_EV_WRITE, 1);        \
} while(0);


/* define the server module functions */
extern int pmix_server_client_connected_fn(opal_process_name_t *proc, void* server_object);
extern int pmix_server_client_finalized_fn(opal_process_name_t *proc, void* server_object,
                                           opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
extern int pmix_server_abort_fn(opal_process_name_t *proc, void *server_object,
                                int status, const char msg[],
                                opal_list_t *procs_to_abort,
                                opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
extern int pmix_server_fencenb_fn(opal_list_t *procs, opal_list_t *info,
                                  char *data, size_t ndata,
                                  opal_pmix_modex_cbfunc_t cbfunc, void *cbdata);
extern int pmix_server_dmodex_req_fn(opal_process_name_t *proc, opal_list_t *info,
                                     opal_pmix_modex_cbfunc_t cbfunc, void *cbdata);
extern int pmix_server_publish_fn(opal_process_name_t *proc,
                                  opal_list_t *info,
                                  opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
extern int pmix_server_lookup_fn(opal_process_name_t *proc, char **keys,
                                 opal_list_t *info,
                                 opal_pmix_lookup_cbfunc_t cbfunc, void *cbdata);
extern int pmix_server_unpublish_fn(opal_process_name_t *proc, char **keys,
                                    opal_list_t *info,
                                    opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
extern int pmix_server_spawn_fn(opal_process_name_t *requestor,
                                opal_list_t *job_info, opal_list_t *apps,
                                opal_pmix_spawn_cbfunc_t cbfunc, void *cbdata);
extern int pmix_server_connect_fn(opal_list_t *procs, opal_list_t *info,
                                  opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
extern int pmix_server_disconnect_fn(opal_list_t *procs, opal_list_t *info,
                                     opal_pmix_op_cbfunc_t cbfunc, void *cbdata);
extern int pmix_server_register_events_fn(opal_list_t *info,
                                          opal_pmix_op_cbfunc_t cbfunc,
                                          void *cbdata);
extern int pmix_server_deregister_events_fn(opal_list_t *info,
                                            opal_pmix_op_cbfunc_t cbfunc,
                                            void *cbdata);

/* declare the RML recv functions for responses */
extern void pmix_server_launch_resp(int status, orte_process_name_t* sender,
                                    opal_buffer_t *buffer,
                                    orte_rml_tag_t tg, void *cbdata);

extern void pmix_server_keyval_client(int status, orte_process_name_t* sender,
                                      opal_buffer_t *buffer,
                                      orte_rml_tag_t tg, void *cbdata);

/* exposed shared variables */
typedef struct {
    bool initialized;
    int verbosity;
    int output;
    opal_hotel_t reqs;
    int num_rooms;
    int timeout;
    char *server_uri;
    bool wait_for_server;
    orte_process_name_t server;
} pmix_server_globals_t;

extern pmix_server_globals_t orte_pmix_server_globals;

END_C_DECLS

#endif /* PMIX_SERVER_INTERNAL_H_ */