struct dt_time ts;
/* defaults */
+static int all_data = 0;
+static int increment = 0;
static int failed = 0;
static int uni_direction = 0;
static int align_data=1;
static int rdma_rd_poll_count[MAX_RDMA_RD] = { 0 };
static int delay = 0;
static int buf_len = RDMA_BUFFER_SIZE;
+static int buf_len_p2;
static int use_cno = 0;
static int recv_msg_index = 0;
static int burst_msg_posted = 0;
DAT_RETURN destroy_events(void);
DAT_RETURN do_rdma_write_imm_with_msg(void);
DAT_RETURN do_rdma_write_with_msg(void);
-DAT_RETURN do_rdma_write_ping_pong(void);
+DAT_RETURN do_rdma_write_ping_pong(int p2, int bytes);
DAT_RETURN do_rdma_read_with_msg(void);
DAT_RETURN do_ping_pong_msg(void);
DAT_PROVIDER_ATTR pr_attr;
/* parse arguments */
- while ((c = getopt(argc, argv, "auwWtscvpb:d:B:h:P:S:")) != -1) {
+ while ((c = getopt(argc, argv, "auwWtscvpb:d:B:h:P:S:i:")) != -1) {
switch (c) {
+ case 'i':
+ increment = atoi(optarg);
case 'a':
- align_data = 1;
+ all_data = 1;
fflush(stdout);
break;
case 'u':
case 'W':
write_only_pp = 1;
uni_direction = 1;
- if (buf_len == RDMA_BUFFER_SIZE)
- buf_len = 1;
signal_rate = 1;
burst = 1000;
fflush(stdout);
}
fflush(stdout);
+ if (write_only_pp) {
+ /* rdma write pingpong, default == 1 byte */
+ if (!all_data) {
+ buf_len = 1;
+ } else if (!increment) { /* power of 2 */
+ buf_len_p2 = 1;
+ i = 0;
+ while (buf_len_p2 < buf_len) {
+ buf_len_p2 <<= 1;
+ i++;
+ }
+ buf_len_p2 = i;
+ }
+ }
+
if (align_data) {
/* allocate send and receive buffers */
if (posix_memalign((void**)&rbuf, 4096, max(4096, buf_len * rq_cnt)) ||
/*********** RDMA write data *************/
if (write_only_pp) {
- ret = do_rdma_write_ping_pong();
+ int max, inc;
+
+ if (all_data) {
+ if (increment) {
+ i = 1;
+ inc = increment;
+ max = buf_len/inc;
+ } else {
+ i = 0;
+ inc = 0;
+ max = buf_len_p2;
+ }
+ } else {
+ i = buf_len;
+ max = buf_len;
+ inc = buf_len;
+ }
+ printf("\n %d RDMA WRITE PINGPONG\n\n", getpid());
+ for (; i <= max; i++) {
+ if (do_rdma_write_ping_pong(i, i*inc))
+ break;
+ }
}
else if (write_immed && write_only) {
ret = do_rdma_write_imm_with_msg();
free(rbuf);
free(sbuf);
- if (ts.rtt)
+ if (!all_data) {
printf( "%d: %s PingPong: (%d x %d) Total %6.2lf us:"
" latency %3.2lf us, BW %4.2lf MB/s\n",
getpid(), write_only_pp ? "RDMA write":"Message",
write_only_pp ? ts.rtt/burst/2:ts.rtt/msg_burst/2,
write_only_pp ? (double)(1/(ts.rtt/burst/2/buf_len)):
(double)(1/(ts.rtt/msg_burst/2/buf_len)));
+ }
if (ts.rdma_wr && (!server || (server && !uni_direction))) {
int msgs = uni_direction ? burst : burst * 2;
}
/* always uni-direction */
-DAT_RETURN do_rdma_write_ping_pong(void)
+DAT_RETURN do_rdma_write_ping_pong(int p2, int bytes)
{
DAT_EVENT event;
DAT_LMR_TRIPLET l_iov[MSG_IOV_COUNT];
DAT_RMR_TRIPLET r_iov;
DAT_DTO_COOKIE cookie;
DAT_RETURN ret;
- int i, suppress = DAT_COMPLETION_SUPPRESS_FLAG;
+ int i, len, suppress = DAT_COMPLETION_SUPPRESS_FLAG;
DAT_DTO_COMPLETION_EVENT_DATA *dto_event =
&event.event_data.dto_completion_event_data;
- volatile char *tx_buf = (char*)&sbuf[buf_len-1]; /* last byte */
- volatile char *rx_buf = (char*)&rbuf[buf_len-1]; /* last byte */
+ volatile char *tx_buf, *rx_buf;
uint32_t rx_cnt = 0;
uint32_t tx_cnt = 0;
- printf("\n %d RDMA WRITE PINGPONG\n\n", getpid());
+ len = bytes ? bytes : 1 << p2;
+
+ tx_buf = (char*)&sbuf[len-1];
+ rx_buf = (char*)&rbuf[len-1];
/* RMR information from previously received message */
r_iov = p_rmr_rcv[recv_msg_index - 1];
for (i = 0; i < MSG_IOV_COUNT; i++) {
l_iov[i].lmr_context = lmr_context_send;
- l_iov[i].segment_length = buf_len / MSG_IOV_COUNT;
+ l_iov[i].segment_length = len / MSG_IOV_COUNT;
l_iov[i].virtual_address = (DAT_VADDR) (uintptr_t)
(&sbuf[l_iov[i].segment_length*i]);
LOGPRINTF("%d rdma_write iov[%d] buf=%p,len=%d\n",
return (DAT_ABORT);
}
}
+ LOGPRINTF("%d %s RW pingpong: %p, *rbuf %d rcnt %d\n",
+ getpid(), server ? "SERVER:" : "CLIENT:",
+ rx_buf, (unsigned char)*rx_buf,
+ (unsigned char)rx_cnt);
}
stop = get_time();
ts.rtt = ((stop - start) * 1.0e6);
return (DAT_ABORT);
}
+ if (all_data) {
+ printf( "%d: RDMA write PingPong: (%d x %d) Total %6.2lf us:"
+ " latency %3.2lf us, BW %4.2lf MB/s\n",
+ getpid(), burst, len, ts.rtt, ts.rtt/burst/2,
+ (double)(1/(ts.rtt/burst/2/len)));
+ }
+
return (DAT_SUCCESS);
}
printf("W: rdma write only, ping pong\n");
printf("t: performance times\n");
printf("c: use cno\n");
+ printf("a: all data sizes with rdma write pingpong \n");
+ printf("i: increment size for all data size option\n");
printf("v: verbose\n");
printf("p: polling\n");
printf("d: delay before accept\n");
- printf("b: buf length to allocate\n");
+ printf("b: buf length, upper bound for -W -a -i (WR_pp, all sizes, increment)\n");
printf("B: burst count, rdma and msgs \n");
printf("h: hostname/address of server, specified on client\n");
printf("P: provider name (default = ofa-v2-mlx4_0-1u)\n");