Skip to content

Commit

Permalink
Merge pull request #8824 from ivankochin/topic/tools/am-memcpy
Browse files Browse the repository at this point in the history
TOOLS/PERF: Add user-side memcpy option for AM benchmarks
  • Loading branch information
ivankochin committed Jan 23, 2023
2 parents b41dee7 + 3ee1786 commit 52a9394
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/tools/perf/api/libperf.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ enum ucx_perf_test_flags {
UCX_PERF_TEST_FLAG_WAKEUP = UCS_BIT(10), /* Create context with wakeup feature enabled */
UCX_PERF_TEST_FLAG_ERR_HANDLING = UCS_BIT(11), /* Create UCP eps with error handling support */
UCX_PERF_TEST_FLAG_LOOPBACK = UCS_BIT(12), /* Use loopback connection */
UCX_PERF_TEST_FLAG_PREREG = UCS_BIT(13) /* Pass pre-registered memory handle */
UCX_PERF_TEST_FLAG_PREREG = UCS_BIT(13), /* Pass pre-registered memory handle */
UCX_PERF_TEST_FLAG_AM_RECV_COPY = UCS_BIT(14) /* Do additional memcopy during AM receive */
};


Expand Down
8 changes: 7 additions & 1 deletion src/tools/perf/lib/ucp_tests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,13 @@ class ucp_perf_test_runner {
return test->am_rndv_recv(data, length, param);
}

/* TODO: Add option to do memcopy here */
if (test->m_perf.params.flags & UCX_PERF_TEST_FLAG_AM_RECV_COPY) {
ucs_assertv(length == test->m_am_rx_length,
"wrong buffer length %ld != %ld",
length, test->m_am_rx_length);
memcpy(test->m_am_rx_buffer, data, test->m_am_rx_length);
}

test->recv_completed();
return UCS_OK;
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/perf/perftest.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#define MAX_BATCH_FILES 32
#define MAX_CPUS 1024
#define TL_RESOURCE_NAME_NONE "<none>"
#define TEST_PARAMS_ARGS "t:n:s:W:O:w:D:i:H:oSCIqM:r:E:T:d:x:A:BUem:R:lz"
#define TEST_PARAMS_ARGS "t:n:s:W:O:w:D:i:H:oSCIqM:r:E:T:d:x:A:BUem:R:lyz"
#define TEST_ID_UNDEFINED -1

enum {
Expand Down
4 changes: 4 additions & 0 deletions src/tools/perf/perftest_params.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ static void usage(const struct perftest_context *ctx, const char *program)
printf(" sleep : go to sleep after posting requests\n");
printf(" -H <size> active message header size (%zu), not included in message size\n",
ctx->params.super.ucp.am_hdr_size);
printf(" -y do additional memcopy to the user memory in active message receive handler\n");
printf(" -z pass pre-registered memory handle\n");
printf("\n");
printf(" NOTE: When running UCP tests, transport and device should be specified by\n");
Expand Down Expand Up @@ -414,6 +415,9 @@ ucs_status_t parse_test_params(perftest_params_t *params, char opt,
return UCS_ERR_INVALID_PARAM;
}
return UCS_OK;
case 'y':
params->super.flags |= UCX_PERF_TEST_FLAG_AM_RECV_COPY;
return UCS_OK;
case 'z':
params->super.flags |= UCX_PERF_TEST_FLAG_PREREG;
return UCS_OK;
Expand Down
7 changes: 7 additions & 0 deletions test/gtest/ucp/test_ucp_perf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,13 @@ const test_perf::test_spec test_ucp_perf::tests[] =
ucs_offsetof(ucx_perf_result_t, latency.total_average), 1e6, 0.001, 60.0,
0 },

{ "am_lat_memcpy", "usec",
UCX_PERF_API_UCP, UCX_PERF_CMD_AM, UCX_PERF_TEST_TYPE_PINGPONG,
UCX_PERF_WAIT_MODE_POLL,
UCP_PERF_DATATYPE_CONTIG, 0, 1, { 8 }, 1, 100000lu,
ucs_offsetof(ucx_perf_result_t, latency.total_average), 1e6, 0.001, 60.0,
UCX_PERF_TEST_FLAG_AM_RECV_COPY },

{ "am_lat_b", "usec",
UCX_PERF_API_UCP, UCX_PERF_CMD_AM, UCX_PERF_TEST_TYPE_PINGPONG,
UCX_PERF_WAIT_MODE_SLEEP,
Expand Down

0 comments on commit 52a9394

Please sign in to comment.