Skip to content

Commit

Permalink
TOOLS: add root and rootshift to perftest (openucx#692)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergei-Lebedev authored Dec 20, 2022
1 parent 014992c commit 32451ed
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/components/tl/ucp/tl_ucp_coll.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void ucc_tl_ucp_recv_completion_cb(void *request, ucs_status_t status,
{
ucc_tl_ucp_task_t *task = (ucc_tl_ucp_task_t *)user_data;
if (ucc_unlikely(UCS_OK != status)) {
tl_error(UCC_TASK_LIB(task), "failure in send completion %s",
tl_error(UCC_TASK_LIB(task), "failure in recv completion %s",
ucs_status_string(status));
task->super.status = ucs_status_to_ucc_status(status);
}
Expand Down
2 changes: 2 additions & 0 deletions tools/perf/ucc_pt_benchmark.cc
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ ucc_status_t ucc_pt_benchmark::run_single_coll_test(ucc_coll_args_t args,
comp_ev.ev_context_size = 0;
}

args.root = config.root % comm->get_size();
for (int i = 0; i < nwarmup + niter; i++) {
double s = get_time_us();
UCCCHECK_GOTO(ucc_collective_init(&args, &req, team), exit_err, st);
Expand All @@ -172,6 +173,7 @@ ucc_status_t ucc_pt_benchmark::run_single_coll_test(ucc_coll_args_t args,
if (i >= nwarmup) {
time += f - s;
}
args.root = (args.root + config.root_shift) % comm->get_size();
UCCCHECK_GOTO(comm->barrier(), exit_err, st);
}
if (niter != 0) {
Expand Down
1 change: 0 additions & 1 deletion tools/perf/ucc_pt_benchmark.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ class ucc_pt_benchmark {
ucc_pt_comm *comm;
ucc_pt_coll *coll;

ucc_status_t barrier();
void print_header();
void print_time(size_t count, ucc_pt_test_args_t args, double time);
public:
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/ucc_pt_comm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ ucc_status_t ucc_pt_comm::init()
UCCCHECK_GOTO(ucc_init(&lib_params, lib_config, &lib), free_lib_config, st);

if (UCC_OK != ucc_mc_available(cfg.mt)) {
std::cerr << "Selected memory type " << ucc_mem_type_str(cfg.mt) <<
std::cerr << "selected memory type " << ucc_mem_type_str(cfg.mt) <<
" is not available" << std::endl;
return UCC_ERR_INVALID_PARAM;
}
Expand Down
14 changes: 12 additions & 2 deletions tools/perf/ucc_pt_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ ucc_pt_config::ucc_pt_config() {
bench.large_thresh = 64 * 1024;
bench.full_print = false;
bench.n_bufs = 2;
bench.root = 0;
bench.root_shift = 0;
comm.mt = bench.mt;
}

Expand Down Expand Up @@ -81,11 +83,11 @@ ucc_status_t ucc_pt_config::process_args(int argc, char *argv[])
int c;
ucc_status_t st;

while ((c = getopt(argc, argv, "c:b:e:d:m:n:w:o:N:ihFT")) != -1) {
while ((c = getopt(argc, argv, "c:b:e:d:m:n:w:o:N:r:S:ihFT")) != -1) {
switch (c) {
case 'c':
if (ucc_pt_op_map.count(optarg) == 0) {
std::cerr << "invalid opeartion: " << optarg
std::cerr << "invalid operation: " << optarg
<< std::endl;
return UCC_ERR_INVALID_PARAM;
}
Expand Down Expand Up @@ -130,6 +132,12 @@ ucc_status_t ucc_pt_config::process_args(int argc, char *argv[])
return st;
}
break;
case 'r':
std::stringstream(optarg) >> bench.root;
break;
case 'S':
std::stringstream(optarg) >> bench.root_shift;
break;
case 'n':
std::stringstream(optarg) >> bench.n_iter_small;
bench.n_iter_large = bench.n_iter_small;
Expand Down Expand Up @@ -168,12 +176,14 @@ void ucc_pt_config::print_help()
std::cout << " -i: inplace collective"<<std::endl;
std::cout << " -d <dt name>: datatype"<<std::endl;
std::cout << " -o <op name>: reduction operation type"<<std::endl;
std::cout << " -r <number>: root for rooted collectives"<<std::endl;
std::cout << " -m <mtype name>: memory type"<<std::endl;
std::cout << " -n <number>: number of iterations"<<std::endl;
std::cout << " -w <number>: number of warmup iterations"<<std::endl;
std::cout << " -N <number>: number of buffers"<<std::endl;
std::cout << " -T: triggered collective"<<std::endl;
std::cout << " -F: enable full print"<<std::endl;
std::cout << " -S: <number>: root shift for rooted collectives"<<std::endl;
std::cout << " -h: show this help message"<<std::endl;
std::cout << std::endl;
}
2 changes: 2 additions & 0 deletions tools/perf/ucc_pt_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ struct ucc_pt_benchmark_config {
int n_warmup_large;
int n_bufs;
bool full_print;
int root;
int root_shift;
};

struct ucc_pt_config {
Expand Down

0 comments on commit 32451ed

Please sign in to comment.