Skip to content

Commit a7ae170

Browse files
VadimKutovoiJuliaRS
authored andcommitted
IMB-MPI1: add -msgsize option for mpitune_fast per msg size tuning
1 parent 20d0985 commit a7ae170

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src_cpp/MPI1/MPI1_suite.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ extern "C" {
5353

5454
#include "helper_IMB_functions.h"
5555

56+
void split_string(const std::string &str, std::vector<int> &out, char delimiter) {
57+
std::stringstream ss(str);
58+
std::string token;
59+
while (std::getline(ss, token, delimiter)) {
60+
out.push_back(std::stoi(token));
61+
}
62+
}
63+
5664
using namespace std;
5765

5866
DECLARE_BENCHMARK_SUITE_STUFF(BS_MPI1, IMB-MPI1)
@@ -265,6 +273,13 @@ template <> bool BenchmarkSuite<BS_MPI1>::declare_args(args_parser &parser, std:
265273
"\n"
266274
"Default:\n"
267275
"no lengths_file, lengths defined by settings.h, settings_io.h\n");
276+
parser.add<string>("msgsize", "").set_caption("Lengths list").
277+
set_description(
278+
"The argument after -msgsize is a comma separated list of integer numbers\n"
279+
"each number represents a message size in bytes\n"
280+
"\n"
281+
"Default:\n"
282+
"no lengths list, lengths defined by settings.h, settings_io.h\n");
268283
parser.add_vector<int>("map", "1x1", 'x', 2, 2).set_caption("PxQ").
269284
set_description(
270285
"The argument after -map is PxQ, P,Q are integer numbers with P*Q <= NP\n"
@@ -582,6 +597,17 @@ template <> bool BenchmarkSuite<BS_MPI1>::prepare(const args_parser &parser, con
582597
}
583598
}
584599

600+
string given_msglen_list = parser.get<string>("msgsize");
601+
if (given_msglen_list != "") {
602+
vector<int> msglen_list;
603+
split_string(given_msglen_list, msglen_list, ',');
604+
c_info.n_lens = msglen_list.size();
605+
c_info.msglen = (int *)malloc(c_info.n_lens * sizeof(int));
606+
for (int i = 0; i < c_info.n_lens; i++) {
607+
c_info.msglen[i] = msglen_list[i];
608+
}
609+
}
610+
585611
// msglog
586612
vector<int> given_msglog;
587613
parser.get<int>("msglog", given_msglog);

0 commit comments

Comments
 (0)