Skip to content

Commit

Permalink
review updates
Browse files Browse the repository at this point in the history
* -input and -input_matrix are incompatible
* use R-strings for JSON

Co-authored-by: Marcel Koch <marcel.koch@kit.edu>
Co-authored-by: Yuhsiang M. Tsai <yhmtsai@gmail.com>
  • Loading branch information
3 people committed Aug 17, 2023
1 parent 2ae11f9 commit 4a8ea1b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion benchmark/solver/distributed/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ int main(int argc, char* argv[])
"<local_format>-<non_local_format>", where both "local_format" and
"non_local_format" can be any of the recognized spmv formats.
)";
std::string additional_json = ",\"optimal\":{\"spmv\":\"csr-csr\"}";
std::string additional_json = R"(,"optimal":{"spmv":"csr-csr"})";
initialize_argument_parsing_matrix(&argc, &argv, header, format,
additional_json);

Expand Down
2 changes: 1 addition & 1 deletion benchmark/solver/solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int main(int argc, char* argv[])
std::string format = example_config + R"(
"optimal":"spmv" can be one of the recognized spmv formats
)";
std::string additional_json = ",\"optimal\":{\"spmv\":\"csr\"}";
std::string additional_json = R"(,"optimal":{"spmv":"csr"})";
initialize_argument_parsing_matrix(&argc, &argv, header, format,
additional_json);

Expand Down
9 changes: 7 additions & 2 deletions benchmark/utils/general_matrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,16 @@ void initialize_argument_parsing_matrix(
initialize_argument_parsing(argc, argv, header, format);
std::string input_matrix_str{FLAGS_input_matrix};
if (!input_matrix_str.empty()) {
auto input_json = "[{\"filename\":\"" + input_matrix_str + "\"" +
if (input_stream) {
std::cerr
<< "-input and -input_matrix cannot be used simultaneously\n";
std::exit(1);
}
auto input_json = R"([{"filename":")" + input_matrix_str + "\"" +
additional_matrix_file_json + "}]";
input_stream = std::make_unique<std::stringstream>(input_json);
}
}


#endif // GKO_BENCHMARK_UTILS_GENERAL_MATRIX_HPP_
#endif // GKO_BENCHMARK_UTILS_GENERAL_MATRIX_HPP_

0 comments on commit 4a8ea1b

Please sign in to comment.