static int run_test(void) { int ret, i; ret = sync_test(); if (ret) return ret; clock_gettime(CLOCK_MONOTONIC, &start); for (i = 0; i < opts.iterations; i++) { ret = opts.dst_addr ? send_xfer(opts.transfer_size) : recv_xfer(opts.transfer_size); if (ret) return ret; ret = opts.dst_addr ? recv_xfer(opts.transfer_size) : send_xfer(opts.transfer_size); if (ret) return ret; } clock_gettime(CLOCK_MONOTONIC, &end); if (opts.machr) show_perf_mr(opts.transfer_size, opts.iterations, &start, &end, 2, opts.argc, opts.argv); else show_perf(test_name, opts.transfer_size, opts.iterations, &start, &end, 2); return 0; }
static int run_test(void) { int ret, i, t; ret = sync_test(); if (ret) goto out; gettimeofday(&start, NULL); for (i = 0; i < iterations; i++) { for (t = 0; t < transfer_count; t++) { ret = dst_addr ? send_xfer(transfer_size) : recv_xfer(transfer_size); if (ret) goto out; } for (t = 0; t < transfer_count; t++) { ret = dst_addr ? recv_xfer(transfer_size) : send_xfer(transfer_size); if (ret) goto out; } } gettimeofday(&end, NULL); show_perf(); ret = 0; out: return ret; }
static int run_test(void) { int ret, i; ret = sync_test(); if (ret) goto out; clock_gettime(CLOCK_MONOTONIC, &start); for (i = 0; i < iterations; i++) { ret = dst_addr ? send_xfer(transfer_size) : recv_xfer(transfer_size); if (ret) goto out; ret = dst_addr ? recv_xfer(transfer_size) : send_xfer(transfer_size); if (ret) goto out; } clock_gettime(CLOCK_MONOTONIC, &end); show_perf(test_name, transfer_size, iterations, &start, &end, 2); ret = 0; out: return ret; }
static int sync_test(void) { int ret; ret = dst_addr ? send_xfer(16) : recv_xfer(16); if (ret) return ret; return dst_addr ? recv_xfer(16) : send_xfer(16); }
static int run_test(void) { int ret, i, t; off_t offset; uint8_t marker = 0; poll_byte = buf + transfer_size - 1; *poll_byte = -1; offset = riomap(rs, buf, transfer_size, PROT_WRITE, 0, 0); if (offset == -1) { perror("riomap"); ret = -1; goto out; } ret = sync_test(); if (ret) goto out; gettimeofday(&start, NULL); for (i = 0; i < iterations; i++) { if (dst_addr) { for (t = 0; t < transfer_count - 1; t++) { ret = send_xfer(transfer_size); if (ret) goto out; } *poll_byte = (uint8_t) marker++; ret = send_xfer(transfer_size); if (ret) goto out; ret = recv_xfer(transfer_size, marker++); } else { ret = recv_xfer(transfer_size, marker++); if (ret) goto out; for (t = 0; t < transfer_count - 1; t++) { ret = send_xfer(transfer_size); if (ret) goto out; } *poll_byte = (uint8_t) marker++; ret = send_xfer(transfer_size); } if (ret) goto out; } gettimeofday(&end, NULL); show_perf(); ret = riounmap(rs, buf, transfer_size); out: return ret; }
static int sync_test(void) { int ret; while (credits < max_credits) poll_all_sends(); ret = opts.dst_addr ? send_xfer(16) : recv_xfer(16); if (ret) return ret; return opts.dst_addr ? recv_xfer(16) : send_xfer(16); }
static int sync_test(void) { int ret; ret = wait_for_completion(scq, max_credits - credits); if (ret) { return ret; } credits = max_credits; ret = opts.dst_addr ? send_xfer(16) : recv_xfer(16); if (ret) return ret; return opts.dst_addr ? recv_xfer(16) : send_xfer(16); }
static int exchange_addr_key(void) { local.addr = (uintptr_t) buf; local.key = fi_mr_key(mr); if (opts.dst_addr) { *(struct fi_rma_iov *)buf = local; send_xfer(sizeof local); recv_xfer(sizeof remote); remote = *(struct fi_rma_iov *)buf; } else { recv_xfer(sizeof remote); remote = *(struct fi_rma_iov *)buf; *(struct fi_rma_iov *)buf = local; send_xfer(sizeof local); } return 0; }
static int sync_test(void) { int ret = 0; if (client) { *((uint64_t *)buf) = (uint64_t)buf; *((uint64_t *)buf + 1) = fi_mr_key(mr); if ((ret = send_xfer(sizeof(uint64_t)*2))) { return ret; } if ((ret = poll_all_sends())) { return ret; } if ((ret = recv_xfer(sizeof(uint64_t)*2))) { return ret; } if ((ret = poll_all_recvs())) { return ret; } rembuf = *((uint64_t *)buf); rkey = *((uint64_t *)buf + 1); } else { if ((ret = recv_xfer(sizeof(uint64_t)*2))) { return ret; } if ((ret = poll_all_recvs())) { return ret; } rembuf = *((uint64_t *)buf); rkey = *((uint64_t *)buf + 1); *((uint64_t *)buf) = (uint64_t)buf; *((uint64_t *)buf + 1) = fi_mr_key(mr); if ((ret = send_xfer(sizeof(uint64_t)*2))) { return ret; } if ((ret = poll_all_sends())) { return ret; } } return ret; }
static int client_connect(void) { int ret; socklen_t addrlen; struct sockaddr *sin; ret = common_setup(); if (ret != 0) goto err; ret = getaddr(dst_addr, port, (struct sockaddr **) &sin, (socklen_t *) &addrlen); if (ret != 0) goto err; ret = fi_connect(ep, sin, NULL, 0); if (ret) { printf("fi_connect %s\n", fi_strerror(-ret)); goto err; } // send initial message to server ret = send_xfer(4); if (ret != 0) goto err; // wait for reply to know server is ready ret = recv_xfer(4); if (ret != 0) goto err; return 0; err: free_ep_res(); fi_close(&av->fid); fi_close(&ep->fid); fi_close(&dom->fid); fi_close(&fab->fid); return ret; }
static int client_connect(void) { int ret; ret = common_setup(); if (ret != 0) return ret; ret = ft_getdestaddr(opts.dst_addr, opts.dst_port, hints); if (ret != 0) goto err1; ret = fi_av_insert(av, hints->dest_addr, 1, &remote_fi_addr, 0, NULL); if (ret != 1) { FT_PRINTERR("fi_av_insert", ret); goto err2; } // send initial message to server with our local address memcpy(buf_ptr, fi->src_addr, fi->src_addrlen); ret = send_xfer(fi->src_addrlen); if (ret != 0) goto err2; // wait for reply to know server is ready ret = recv_xfer(4); if (ret != 0) goto err2; return 0; err2: free(hints->dest_addr); err1: free_ep_res(); fi_close(&av->fid); fi_close(&dom->fid); fi_close(&fab->fid); return ret; }