| 1 |
|
| 2 |
#ifndef _VAPI_H |
| 3 |
#define _VAPI_H |
| 4 |
|
| 5 |
#ifdef OPENIB |
| 6 |
#include <infiniband/verbs.h> |
| 7 |
#endif |
| 8 |
|
| 9 |
|
| 10 |
#define DSCRID_NBDSCR 10000 |
| 11 |
|
| 12 |
#define MAX_RDMA_SIZE (8388608) |
| 13 |
#define DEFAULT_ADDR_LEN (8) |
| 14 |
|
| 15 |
#define DEFAULT_PORT (1) |
| 16 |
#define DEFAULT_MTU (MTU1024) |
| 17 |
#define DEFAULT_PSN (0) |
| 18 |
#define DEFAULT_PKEY_IX (0) |
| 19 |
#define DEFAULT_P_KEY (0x0) |
| 20 |
#define DEFAULT_MIN_RNR_TIMER (5) |
| 21 |
#define DEFAULT_SERVICE_LEVEL (0) |
| 22 |
#define DEFAULT_TIME_OUT (5) |
| 23 |
#define DEFAULT_STATIC_RATE (2) |
| 24 |
#define DEFAULT_SRC_PATH_BITS (0) |
| 25 |
#define DEFAULT_RETRY_COUNT (1) |
| 26 |
#define DEFAULT_RNR_RETRY (1) |
| 27 |
|
| 28 |
|
| 29 |
#define DEFAULT_R_KEY (0x0) |
| 30 |
#define DEFAULT_L_KEY (0x0) |
| 31 |
|
| 32 |
#define DEFAULT_MAX_WQE 2048 |
| 33 |
|
| 34 |
typedef struct { |
| 35 |
void *data_ptr; |
| 36 |
long ack; |
| 37 |
void *ack_ptr; |
| 38 |
#if defined(PEND_BUFS) |
| 39 |
unsigned int imm_msg:1; |
| 40 |
unsigned int data_len:31; |
| 41 |
#endif |
| 42 |
} msg_tag_t; |
| 43 |
|
| 44 |
typedef struct { |
| 45 |
#ifdef OPENIB |
| 46 |
struct ibv_send_wr sdscr; |
| 47 |
struct ibv_sge ssg_entry; |
| 48 |
struct ibv_recv_wr rdscr; |
| 49 |
struct ibv_sge rsg_entry; |
| 50 |
#endif |
| 51 |
} armci_vapi_field_t; |
| 52 |
|
| 53 |
typedef struct { |
| 54 |
#ifdef OPENIB |
| 55 |
uint32_t rkey; |
| 56 |
uint32_t lkey; |
| 57 |
struct ibv_mr *memhndl; |
| 58 |
#endif |
| 59 |
}armci_vapi_memhndl_t; |
| 60 |
|
| 61 |
extern char * armci_vapi_client_mem_alloc(int); |
| 62 |
|
| 63 |
typedef struct { |
| 64 |
int tag; |
| 65 |
int issg; |
| 66 |
#ifdef OPENIB |
| 67 |
struct ibv_send_wr sdescr; |
| 68 |
struct ibv_recv_wr rdescr; |
| 69 |
struct ibv_sge sg_entry[56]; |
| 70 |
#endif |
| 71 |
int numofsends; |
| 72 |
int numofrecvs; |
| 73 |
int myindex; |
| 74 |
} sr_descr_t; |
| 75 |
|
| 76 |
typedef struct { |
| 77 |
int tag; |
| 78 |
int issg; |
| 79 |
#ifdef OPENIB |
| 80 |
struct ibv_recv_wr descr; |
| 81 |
struct ibv_send_wr sg_entry[56]; |
| 82 |
#endif |
| 83 |
int numofrecvs; |
| 84 |
int myindex; |
| 85 |
} rdescr_t; |
| 86 |
|
| 87 |
#if defined(PEND_BUFS) |
| 88 |
#ifdef OPENIB |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
|
| 98 |
#define IMMBUF_NW_T \ |
| 99 |
struct ibv_recv_wr dscr; \ |
| 100 |
struct ibv_sge sg_entry; \ |
| 101 |
int send_pending; |
| 102 |
#define PENDBUF_NW_T \ |
| 103 |
struct ibv_sge sg_entry; \ |
| 104 |
struct ibv_recv_wr rdscr; \ |
| 105 |
struct ibv_send_wr sdscr; |
| 106 |
|
| 107 |
#define IS_IMM_MSG(msginfo) ((msginfo).tag.imm_msg) |
| 108 |
|
| 109 |
void armci_complete_immbuf(void *vbuf); |
| 110 |
void armci_complete_pendbuf(void *buf); |
| 111 |
|
| 112 |
|
| 113 |
|
| 114 |
void armci_pbuf_start_put(void *src, void *dst, int bytes, int proc, |
| 115 |
int bufid); |
| 116 |
void armci_pbuf_start_get(void *msg_info, |
| 117 |
void *src, void *dst, int bytes, int proc, |
| 118 |
int bufid); |
| 119 |
#else |
| 120 |
#error "PEND_BUFS only implemented for OPENIB" |
| 121 |
#endif |
| 122 |
#endif |
| 123 |
|
| 124 |
void armci_client_nbcall_complete(sr_descr_t *,int,int); |
| 125 |
void armci_vapi_set_mark_buf_send_complete(int); |
| 126 |
|
| 127 |
#define ARMCI_MEMHDL_T armci_vapi_memhndl_t |
| 128 |
|
| 129 |
#define REGIONS_REQUIRE_MEMHDL |
| 130 |
|
| 131 |
#define PIPE_BUFSIZE__ (4096) |
| 132 |
#define PIPE_MIN_BUFSIZE 1024 |
| 133 |
#define PIPE_MEDIUM_BUFSIZE (2*1024) |
| 134 |
|
| 135 |
|
| 136 |
#define VBUF_DLEN 4*64*1023 |
| 137 |
#define MSG_BUFLEN_DBL ((VBUF_DLEN)>>3) |
| 138 |
|
| 139 |
#if defined(PEND_BUFS) |
| 140 |
#define IMM_BUF_NUM_DEFAULT 4 |
| 141 |
#define IMM_BUF_LEN_DEFAULT 2048 |
| 142 |
#define PENDING_BUF_NUM_DEFAULT 20 |
| 143 |
#define PENDING_BUF_LEN_DEFAULT (VBUF_DLEN) |
| 144 |
#endif |
| 145 |
|
| 146 |
#ifdef PIPE_BUFSIZE |
| 147 |
# define STRIDED_GET_BUFLEN_DBL 31*1024 |
| 148 |
# define STRIDED_GET_BUFLEN (STRIDED_GET_BUFLEN_DBL<<3) |
| 149 |
# define MAX_BUFLEN (STRIDED_GET_BUFLEN+EXTRA_MSG_BUFLEN) |
| 150 |
#else |
| 151 |
# define MAX_BUFLEN (MSG_BUFLEN+EXTRA_MSG_BUFLEN) |
| 152 |
#endif |
| 153 |
#define BALANCE_BUFFERS |
| 154 |
#ifdef BALANCE_BUFFERS |
| 155 |
# define BALANCE_FACTOR 1.6 |
| 156 |
|
| 157 |
# define BALANCE_BUFSIZE 25000 |
| 158 |
#endif |
| 159 |
|
| 160 |
#define BUF_EXTRA_FIELD_T armci_vapi_field_t |
| 161 |
#define GET_SEND_BUFFER _armci_buf_get |
| 162 |
#define FREE_SEND_BUFFER _armci_buf_release |
| 163 |
|
| 164 |
#ifdef OPENIB |
| 165 |
#define INIT_SEND_BUF(_field,_snd,_rcv) _snd=1;_rcv=1;memset(&((_field).sdscr),0,sizeof(struct ibv_send_wr));(_field).sdscr.wr_id=avail+1;armci_vapi_set_mark_buf_send_complete(avail+1) |
| 166 |
#endif |
| 167 |
#define BUF_ALLOCATE armci_vapi_client_mem_alloc |
| 168 |
|
| 169 |
#define CLEAR_SEND_BUF_FIELD(_field,_snd,_rcv,_to,_op) armci_vapi_complete_buf((armci_vapi_field_t *)(&(_field)),(_snd),(_rcv),(_to),(_op));_snd=0;_rcv=0;_to=0 |
| 170 |
|
| 171 |
#define TEST_SEND_BUF_FIELD(_field,_snd,_rcv,_to,_op,_pret) armci_vapi_test_buf((armci_vapi_field_t *)(&(_field)),(_snd),(_rcv),(_to),(_op),(_pret)) |
| 172 |
|
| 173 |
#define CLIENT_BUF_BYPASS 1 |
| 174 |
|
| 175 |
#define _armci_bypass 1 |
| 176 |
|
| 177 |
#define COMPLETE_HANDLE _armci_buf_complete_nb_request |
| 178 |
|
| 179 |
#if defined(ALLOW_PIN) |
| 180 |
# define NB_CMPL_T sr_descr_t* |
| 181 |
# define ARMCI_NB_WAIT(_cntr) if(_cntr)if(nb_handle->tag==(_cntr)->tag)\ |
| 182 |
armci_client_nbcall_complete(_cntr,nb_handle->tag,nb_handle->op); |
| 183 |
# define CLEAR_HNDL_FIELD(_x) _x=NULL |
| 184 |
#endif |
| 185 |
|
| 186 |
|
| 187 |
#define DIRECT_PUT_MIN_SIZE 0 |
| 188 |
|
| 189 |
#define LONG_GET_THRESHOLD 2147483648 |
| 190 |
#define LONG_GET_THRESHOLD_STRIDED 2147483648 |
| 191 |
#ifndef ARMCI_STAMP |
| 192 |
#error "ARMCI_STAMP used to define ARMCI_VAPI_COMPLETE not found!" |
| 193 |
#define ARMCI_VAPI_COMPLETE 1088451863 |
| 194 |
#else |
| 195 |
#define ARMCI_VAPI_COMPLETE ARMCI_STAMP |
| 196 |
#endif |
| 197 |
#define ARMCI_POST_SCATTER 1000000001 |
| 198 |
#define ARMCI_VAPI_CLEAR 0 |
| 199 |
|
| 200 |
#ifdef OPENIB |
| 201 |
|
| 202 |
#define VAPI_SGPUT_MIN_COLUMN 2147483648 |
| 203 |
#define VAPI_SGGET_MIN_COLUMN 10 |
| 204 |
|
| 205 |
#endif |
| 206 |
#define DSCRID_SCATTERCLIENT 70000 |
| 207 |
#define DSCRID_SCATTERCLIENT_END 70000+9999 |
| 208 |
|
| 209 |
#define MAX_PENDING 32 |
| 210 |
|
| 211 |
#define HAS_RDMA_GET |
| 212 |
|
| 213 |
#if defined(OPENIB) |
| 214 |
#if 1 |
| 215 |
#define PUT_NO_SRV_COPY |
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
#define GET_NO_SRV_COPY |
| 220 |
|
| 221 |
|
| 222 |
int no_srv_copy_nsegs_ulimit(); |
| 223 |
#endif |
| 224 |
#define GET_STRIDED_COPY_PIPELINED |
| 225 |
|
| 226 |
|
| 227 |
#define GET_STRIDED_COPY_PIPELINED_SIZE (1*1024) |
| 228 |
#endif |
| 229 |
|
| 230 |
#endif |
| 231 |
|
| 232 |
extern void armci_wait_ack(char *buffer); |
| 233 |
extern void armci_complete_multi_sglist_sends(int proc); |
| 234 |
extern void armci_client_direct_send(int p,void *src_buf, void *dst_buf, int len,void** contextptr,int nbtag,ARMCI_MEMHDL_T *lochdl,ARMCI_MEMHDL_T *remhdl); |