1
/* ---------------------------------------------------------------------------------------------- *\
3
\* ---------------------------------------------------------------------------------------------- */
7
# define PORTALS_INDEX 1
10
# define ONE_MB 1048576
12
# define MAX_DS_MSG_SIZE ONE_MB
14
# define PORTALS_MAX_DESCRIPTORS (MAX_BUFS+MAX_SMALL_BUFS)
15
# define PORTALS_MAX_BUFS MAX_BUFS
16
# define PORTALS_MAX_SMALL_BUFS MAX_SMALL_BUFS
17
# define PORTALS_BUF_SIZE MSG_BUFLEN /* defined in requesh.h */
19
/* define small buf length here - formerly request.h */
20
# ifdef PORTALS_USE_RENDEZ_VOUS
21
# define PORTALS_SMALL_BUF_SIZE 1024 /* for use with nwchem only -- will not pass armci test.x */
22
# define PORTALS_MAX_EAGER_MESSAGE_SIZE PORTALS_SMALL_BUF_SIZE
24
# define PORTALS_SMALL_BUF_SIZE 1024
25
# define PORTALS_MAX_EAGER_MESSAGE_SIZE PORTALS_BUF_SIZE
28
# define PORTALS_NREQUEST_BUFFERS 40
29
# define PORTALS_REQUEST_BUFFER_SIZE_WARNING (128*ONE_MB)
31
# define PORTALS_READ_ACCESS 1
32
# define PORTALS_WRITE_ACCESS 1000
34
# define MATCH_ALL_MBITS 0x8000000000000000 /* should be set for all data requests */
35
# define MATCH_ALL_IBITS ~MATCH_ALL_MBITS /* used to mask out all other bits, but MATCH_ALL */
38
# define STATE_SEND_START 0x1
39
# define STATE_SEND_END 0x2
40
# define STATE_REPLY_START 0x4
41
# define STATE_REPLY_END 0x8
42
# define STATE_ACK 0x10
43
# define STATE_PUT_START 0x20
44
# define STATE_PUT_END 0x40
45
# define STATE_GET_START 0x80
46
# define STATE_GET_END 0x100
47
# define STATE_UNLINK 0x200
50
# define DS_RESPONSE_ACK 0x100000000000000
51
# define DS_RESPONSE_PUT 0x200000000000000
52
# define DS_RESPONSE_GET 0x400000000000000
54
# define PORTALS_ALLOW_NBGETS
55
# define PORTALS_USE_ARMCI_CLIENT_BUFFERS
57
# define PORTALS_PUT_USE_ACK_TURNED_OFF
58
# define PORTALS_PUT_USE_START_TURNED_OFF
59
# define PORTALS_GET_USE_START_TURNED_OFF
61
/* ---------------------------------------------------------------------------------------------- *\
63
\* ---------------------------------------------------------------------------------------------- */
64
typedef struct portals_desc_s {
65
void* buffer; // used for the md
66
ptl_size_t length; // used for the md
67
ptl_process_id_t id; // on whom the operation is acting on
68
ptl_match_bits_t mbits; // operations destination mbits
69
ptl_hdr_data_t hdr; // used for puts/unique counter value
71
ptl_handle_ni_t nih; // network interface handle
72
ptl_handle_eq_t eqh; // event handler
73
ptl_handle_me_t meh; // me handle (if necessary)
74
ptl_handle_md_t mdh; // md handle (if necessary)
76
int state; // track outstanding events remaining on the descriptor
77
int done; // flag to test whether all work on the descriptor is finished
78
int noperations; // the number of remote operations allowed on buffer
79
// this is only used when preposting/pinning CP memory
80
// for remote operations initiated by the data server
84
typedef struct portals_ds_req_s {
85
portals_desc_t req_desc;
86
portals_desc_t ack_desc;
87
portals_desc_t data_desc;
88
ptl_process_id_t dsid;
95
/* ---------------------------------------------------------------------------------------------- *\
96
portals global variables
97
\* ---------------------------------------------------------------------------------------------- */
98
/*ptl_handle_ni_t cp_nih;*/
99
/*ptl_handle_ni_t ds_nih;*/
100
/*ptl_handle_eq_t cp_eqh;*/
101
/*ptl_handle_eq_t ds_eqh;*/
102
ptl_process_id_t *portals_id_map;
103
ptl_process_id_t *portals_cloned_id_map;
105
int portals_ds_ready;
106
int portals_cp_finished;
108
size_t portalsMaxEagerMessageSize;
111
/* ---------------------------------------------------------------------------------------------- *\
113
\* ---------------------------------------------------------------------------------------------- */
114
int portals_init(ptl_handle_ni_t*);
115
int portals_finalize(ptl_handle_ni_t);
116
int portals_getid(ptl_handle_ni_t,ptl_process_id_t *);
117
int portals_free_eq(ptl_handle_eq_t);
118
int portals_create_eq(ptl_handle_ni_t, ptl_size_t, ptl_handle_eq_t*);
119
int portals_create_matchall_me(ptl_handle_me_t*);
120
int portals_me_attach(ptl_handle_ni_t,ptl_process_id_t,ptl_match_bits_t,ptl_match_bits_t,ptl_handle_me_t*);
121
int portals_me_insert(ptl_handle_me_t,ptl_process_id_t,ptl_match_bits_t,ptl_match_bits_t,ptl_handle_me_t*);
122
int portals_me_unlink(ptl_handle_me_t);
123
int portals_md_attach(ptl_handle_me_t,ptl_md_t,ptl_unlink_t,ptl_handle_md_t*);
124
int portals_md_bind(ptl_handle_ni_t,ptl_md_t,ptl_unlink_t,ptl_handle_md_t*);
126
int portals_eqwait(ptl_handle_eq_t,ptl_event_t*);
127
int portals_put(portals_desc_t*);
128
int portals_get(portals_desc_t*);
129
int portals_wait(portals_desc_t*);
132
void* portalsCloneDataServer(void *(*func)(void*));
133
void portalsSpinLockOnInt(volatile int*, int, int);
135
void portals_print_event_details(ptl_event_t *ev);
137
void Fatal_error(int);
138
const char *Portals_ID();
140
void bit_print(const char *,int);
141
void hex_print(const char *,int);
142
void portals_print_summary();
144
/* ---------------------------------------------------------------------------------------------- *\
145
portals data server prototypes
146
\* ---------------------------------------------------------------------------------------------- */
147
void* portals_ds_thread(void* args);
148
int portals_ds_init(void);
149
int portals_ds(void);
150
int portal_send_test_ack(int to,int val);
151
int portals_ds_requeue_md(int);
153
void portals_ds_get_from_cp(void*,ptl_size_t,ptl_process_id_t,ptl_match_bits_t);
155
//void ds_handler(DDI_Patch*,ptl_process_id_t);
157
/* ---------------------------------------------------------------------------------------------- *\
158
portals compute process prototypes
159
\* ---------------------------------------------------------------------------------------------- */
160
int portals_cp_init(void);
161
int portals_cp_getid(ptl_process_id_t *id);
163
void portals_req_send(void *buffer, size_t size, portals_ds_req_t *req);
164
void portals_req_nbsend(void *buffer, size_t size, portals_ds_req_t *req);
165
void portals_req_wait(portals_ds_req_t *req);
167
void portals_remote_get(void *buffer, request_header_t *msginfo, int remote_node);
168
void portals_remote_put(void *buffer, request_header_t *msginfo, int remote_node);
169
void portals_remote_acc(void *buffer, request_header_t *msginfo, int remote_node);
170
void portals_remote_rmw(void *buffer, request_header_t *msginfo, int remote_node, portals_ds_req_t *req);
171
void portals_remote_nbget(void *buffer, request_header_t *msginfo, int remote_node, portals_ds_req_t *req);
172
void portals_remote_nbput(void *buffer, request_header_t *msginfo, int remote_node, portals_ds_req_t *req);
173
void portals_remote_nbacc(void *buffer, request_header_t *msginfo, int remote_node, portals_ds_req_t *req);
176
void portalsRemoteOperation(void*,size_t,ptl_process_id_t,portals_ds_req_t*);
177
void portalsRemoteOperationToRank(void*,size_t,int,portals_ds_req_t*);
178
void portalsRemoteOperationToNode(void*,size_t,int,portals_ds_req_t*);
180
void portalsBlockingRemoteOperationToNode(void*,size_t,int);
183
static inline unsigned int cpuid_ebx(unsigned int op)
185
unsigned int eax, ebx;
188
: "=a" (eax), "=b" (ebx)