Skip to content

Commit

Permalink
fabtests: Support TX first pingpong test
Browse files Browse the repository at this point in the history
The new pingpong test allows for TX operations to be posted and
processed, if necessary, before post the RX buffer. This better aligns
to how OSU latency works. By doing this, fi_rdm_tagged_latency is now
lower than OSU latency which makes sense since less SW is involved.

The TX first pingpong can be enabled by used the -T option.

Signed-off-by: Ian Ziemba <[email protected]>
  • Loading branch information
iziemba committed Sep 18, 2024
1 parent 0c15330 commit 7110984
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 4 deletions.
109 changes: 106 additions & 3 deletions fabtests/benchmarks/benchmark_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ void ft_parse_benchmark_opts(int op, char *optarg)
case 'W':
opts.window_size = atoi(optarg);
break;
case 'T':
opts.options |= FT_OPT_NO_PRE_POSTED_RX;
break;
default:
break;
}
Expand All @@ -84,6 +87,11 @@ void ft_benchmark_usage(void)
"* The following condition is required to have at least "
"one window\nsize # of messsages to be sent: "
"# of iterations > window size");
FT_PRINT_OPTS_USAGE("-T", "Post transmit operations (e.g. fi_send, fi_tsend) before receives");
FT_PRINT_OPTS_USAGE("", "Using this option requires out-of-band address exchange and synchronization (i.e. -b must be used)");
FT_PRINT_OPTS_USAGE("", "Only the following tests support this option for now:");
FT_PRINT_OPTS_USAGE("", "\tfi_rdm_tagged_pingpong");
FT_PRINT_OPTS_USAGE("", "\tfi_rdm_pingpong");
}

/* Pingpong latency test with pre-posted receive buffers. */
Expand Down Expand Up @@ -133,6 +141,68 @@ static int pingpong_pre_posted_rx(size_t inject_size)
return FI_SUCCESS;
}

/* Pingpong latency test without pre-posted receive buffers. */
static int pingpong_no_pre_posted_rx(size_t inject_size)
{
int ret, i;

if (opts.dst_addr) {
for (i = 0; i < opts.iterations + opts.warmup_iterations; i++) {
if (i == opts.warmup_iterations)
ft_start();

if (opts.transfer_size <= inject_size)
ret = ft_inject(ep, remote_fi_addr,
opts.transfer_size);
else
ret = ft_tx(ep, remote_fi_addr,
opts.transfer_size, &tx_ctx);
if (ret)
return ret;

ret = ft_post_rx(ep, opts.transfer_size, &rx_ctx);
if (ret)
return ret;

ret = ft_get_rx_comp(rx_seq);
if (ret)
return ret;
}
} else {
for (i = 0; i < opts.iterations + opts.warmup_iterations; i++) {
if (i == opts.warmup_iterations)
ft_start();

ret = ft_post_rx(ep, opts.transfer_size, &rx_ctx);
if (ret)
return ret;

ret = ft_get_rx_comp(rx_seq);
if (ret)
return ret;

if (ft_check_opts(FT_OPT_VERIFY_DATA | FT_OPT_ACTIVE)) {
ret = ft_check_buf((char *) rx_buf + ft_rx_prefix_size(),
opts.transfer_size);
if (ret)
return ret;
}

if (opts.transfer_size <= inject_size)
ret = ft_inject(ep, remote_fi_addr,
opts.transfer_size);
else
ret = ft_tx(ep, remote_fi_addr,
opts.transfer_size, &tx_ctx);
if (ret)
return ret;
}
}
ft_stop();

return FI_SUCCESS;
}

int pingpong(void)
{
int ret;
Expand All @@ -155,9 +225,42 @@ int pingpong(void)
if (ret)
return ret;

ret = pingpong_pre_posted_rx(inject_size);
if (ret)
return ret;
if (ft_check_opts(FT_OPT_NO_PRE_POSTED_RX)) {
/* Consume pre-posted RX buffers on client and server. */
if (opts.dst_addr) {
ret = ft_tx(ep, remote_fi_addr, opts.transfer_size,
&tx_ctx);
if (ret)
return ret;

ret = ft_get_rx_comp(rx_seq);
if (ret)
return ret;
} else {
ret = ft_get_rx_comp(rx_seq);
if (ret)
return ret;


ret = ft_tx(ep, remote_fi_addr, opts.transfer_size,
&tx_ctx);
if (ret)
return ret;
}

ret = pingpong_no_pre_posted_rx(inject_size);
if (ret)
return ret;

/* Repost pre-posted RX buffers to support inband sync. */
ret = ft_post_rx(ep, rx_size, &rx_ctx);
if (ret)
return ret;
} else {
ret = pingpong_pre_posted_rx(inject_size);
if (ret)
return ret;
}

if (opts.machr)
show_perf_mr(opts.transfer_size, opts.iterations, &start, &end, 2,
Expand Down
2 changes: 1 addition & 1 deletion fabtests/benchmarks/benchmark_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ extern "C" {

#include <rdma/fi_rma.h>

#define BENCHMARK_OPTS "vkj:W:"
#define BENCHMARK_OPTS "Tvkj:W:"
#define FT_BENCHMARK_MAX_MSG_SIZE (test_size[TEST_CNT - 1].size)

void ft_parse_benchmark_opts(int op, char *optarg);
Expand Down
1 change: 1 addition & 0 deletions fabtests/include/shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ enum {
FT_OPT_DISABLE_TAG_VALIDATION = 1 << 25,
FT_OPT_ADDR_IS_OOB = 1 << 26,
FT_OPT_REG_DMABUF_MR = 1 << 27,
FT_OPT_NO_PRE_POSTED_RX = 1 << 28,
FT_OPT_OOB_CTRL = FT_OPT_OOB_SYNC | FT_OPT_OOB_ADDR_EXCH,
};

Expand Down

0 comments on commit 7110984

Please sign in to comment.