Skip to content

Commit

Permalink
review updates
Browse files Browse the repository at this point in the history
- don't install nlohmann-json
- simplify code
- improve config description formatting

Co-authored-by: Yuhsiang M. Tsai <yhmtsai@gmail.com>
  • Loading branch information
upsj and yhmtsai committed Aug 29, 2023
1 parent a725d3c commit 7b482dc
Show file tree
Hide file tree
Showing 21 changed files with 36 additions and 39 deletions.
3 changes: 1 addition & 2 deletions benchmark/preconditioner/preconditioner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,8 @@ struct PreconditionerBenchmark : Benchmark<preconditioner_benchmark_state> {
json& precond_case) const override
{
auto decoded_precond_name = precond_decoder.at(encoded_precond_name);
precond_case["generate"] = json::object();
precond_case["apply"] = json::object();
for (auto stage : {"generate", "apply"}) {
precond_case[stage] = json::object();
precond_case[stage]["components"] = json::object();
}

Expand Down
3 changes: 0 additions & 3 deletions benchmark/spmv/spmv_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,6 @@ struct SpmvBenchmark : Benchmark<spmv_benchmark_state<Generator>> {
std::string best_format;
// find the fastest among all formats we tested
for (const auto& format : formats) {
if (!test_case[name].contains(format)) {
continue;
}
auto& format_case = test_case[name][format];
if (format_case.contains("completed") &&
format_case["completed"].template get<bool>()) {
Expand Down
2 changes: 1 addition & 1 deletion benchmark/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ if (GINKGO_BUILD_MPI)
add_benchmark_test(multi_vector_distributed)
add_benchmark_test(spmv_distributed)
add_benchmark_test(solver_distributed)
endif()
endif()
2 changes: 1 addition & 1 deletion benchmark/test/reference/conversion.all.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Running on reference(0)
Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
The formats are coo,csr,ell,sellp,hybrid
Running test case stencil(100,7pt)
Running test case stencil(100, 7pt)
Matrix is of size (125, 125), 725
Running conversion: coo-read
Running conversion: coo-csr
Expand Down
6 changes: 3 additions & 3 deletions benchmark/test/reference/conversion.profile.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Running on reference(0)
Running with 0 warm iterations and 1 running iterations
The random seed for right hand sides is 42
The formats are coo,csr
Running test case stencil(100,7pt)
Running test case stencil(100, 7pt)
Matrix is of size (125, 125), 725
DEBUG: begin components::aos_to_soa
DEBUG: end components::aos_to_soa
DEBUG: begin stencil(100,7pt)
DEBUG: begin stencil(100, 7pt)
Running conversion: coo-read
DEBUG: begin coo-read
DEBUG: begin repetition
Expand Down Expand Up @@ -79,4 +79,4 @@ DEBUG: end components::convert_ptrs_to_idxs
DEBUG: end copy(<typename>)
DEBUG: end repetition
DEBUG: end csr-coo
DEBUG: end stencil(100,7pt)
DEBUG: end stencil(100, 7pt)
2 changes: 1 addition & 1 deletion benchmark/test/reference/conversion.simple.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Running on reference(0)
Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
The formats are coo,csr
Running test case stencil(100,7pt)
Running test case stencil(100, 7pt)
Matrix is of size (125, 125), 725
Running conversion: coo-read
Running conversion: coo-csr
Expand Down
6 changes: 3 additions & 3 deletions benchmark/test/reference/distributed_solver.profile.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Running with 0 warm iterations and 1 running iterations
The random seed for right hand sides is 42
Running cg with 1000 iterations and residual goal of 1.000000e-06
The number of right hand sides is 1
Running test case stencil(100,7pt,stencil)
Running test case stencil(100, 7pt, stencil)
DEBUG: begin partition::build_ranges_from_global_size
DEBUG: end partition::build_ranges_from_global_size
DEBUG: begin components::fill_array
Expand Down Expand Up @@ -77,7 +77,7 @@ DEBUG: begin dense::copy
DEBUG: end dense::copy
DEBUG: end copy(<typename>)
Matrix is of size (125, 125)
DEBUG: begin stencil(100,7pt,stencil)
DEBUG: begin stencil(100, 7pt, stencil)
Running solver: cg
DEBUG: begin cg
DEBUG: begin dense::compute_squared_norm2
Expand Down Expand Up @@ -445,4 +445,4 @@ DEBUG: end dense::compute_sqrt
DEBUG: begin copy
DEBUG: end copy
DEBUG: end cg
DEBUG: end stencil(100,7pt,stencil)
DEBUG: end stencil(100, 7pt, stencil)
2 changes: 1 addition & 1 deletion benchmark/test/reference/distributed_solver.simple.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ Running with 2 warm iterations and 1 running iterations
The random seed for right hand sides is 42
Running cg with 1000 iterations and residual goal of 1.000000e-06
The number of right hand sides is 1
Running test case stencil(100,7pt,stencil)
Running test case stencil(100, 7pt, stencil)
Matrix is of size (125, 125)
Running solver: cg
2 changes: 1 addition & 1 deletion benchmark/test/reference/matrix_statistics.simple.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This is Ginkgo 1.7.0 (develop)
running with core module 1.7.0 (develop)
Running test case stencil(100,7pt)
Running test case stencil(100, 7pt)
Matrix is of size (125, 125), 725
6 changes: 3 additions & 3 deletions benchmark/test/reference/preconditioner.profile.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Running on reference(0)
Running with 0 warm iterations and 1 running iterations
The random seed for right hand sides is 42
Running with preconditioners: none
Running test case stencil(100,7pt)
Running test case stencil(100, 7pt)
DEBUG: begin components::fill_array
DEBUG: end components::fill_array
DEBUG: begin components::aos_to_soa
Expand All @@ -24,7 +24,7 @@ DEBUG: end dense::fill
DEBUG: begin dense::fill_in_matrix_data
DEBUG: end dense::fill_in_matrix_data
Matrix is of size (125, 125), 725
DEBUG: begin stencil(100,7pt)
DEBUG: begin stencil(100, 7pt)
Running preconditioner: none
DEBUG: begin none
DEBUG: begin copy(<typename>)
Expand All @@ -44,4 +44,4 @@ DEBUG: end copy(<typename>)
DEBUG: end apply(<typename>)
DEBUG: end repetition apply
DEBUG: end none
DEBUG: end stencil(100,7pt)
DEBUG: end stencil(100, 7pt)
2 changes: 1 addition & 1 deletion benchmark/test/reference/preconditioner.simple.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ Running on reference(0)
Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
Running with preconditioners: none
Running test case stencil(100,7pt)
Running test case stencil(100, 7pt)
Matrix is of size (125, 125), 725
Running preconditioner: none
6 changes: 3 additions & 3 deletions benchmark/test/reference/solver.profile.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Running with 0 warm iterations and 1 running iterations
The random seed for right hand sides is 42
Running cg with 1000 iterations and residual goal of 1.000000e-06
The number of right hand sides is 1
Running test case stencil(100,7pt)
Running test case stencil(100, 7pt)
DEBUG: begin components::fill_array
DEBUG: end components::fill_array
DEBUG: begin components::aos_to_soa
Expand All @@ -23,7 +23,7 @@ DEBUG: begin dense::copy
DEBUG: end dense::copy
DEBUG: end copy(<typename>)
Matrix is of size (125, 125)
DEBUG: begin stencil(100,7pt)
DEBUG: begin stencil(100, 7pt)
Running solver: cg
DEBUG: begin cg
DEBUG: begin dense::compute_norm2_dispatch
Expand Down Expand Up @@ -297,4 +297,4 @@ DEBUG: end dense::compute_norm2_dispatch
DEBUG: begin copy
DEBUG: end copy
DEBUG: end cg
DEBUG: end stencil(100,7pt)
DEBUG: end stencil(100, 7pt)
2 changes: 1 addition & 1 deletion benchmark/test/reference/solver.simple.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ Running with 2 warm iterations and 1 running iterations
The random seed for right hand sides is 42
Running cg with 1000 iterations and residual goal of 1.000000e-06
The number of right hand sides is 1
Running test case stencil(100,7pt)
Running test case stencil(100, 7pt)
Matrix is of size (125, 125)
Running solver: cg
6 changes: 3 additions & 3 deletions benchmark/test/reference/sparse_blas.profile.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ Running on reference(0)
Running with 0 warm iterations and 1 running iterations
The random seed for right hand sides is 42
The operations are transpose
Running test case stencil(100,7pt)
Running test case stencil(100, 7pt)
Matrix is of size (125, 125), 725
DEBUG: begin components::fill_array
DEBUG: end components::fill_array
DEBUG: begin components::aos_to_soa
DEBUG: end components::aos_to_soa
DEBUG: begin components::convert_idxs_to_ptrs
DEBUG: end components::convert_idxs_to_ptrs
DEBUG: begin stencil(100,7pt)
DEBUG: begin stencil(100, 7pt)
Running sparse_blas: transpose
DEBUG: begin transpose
DEBUG: begin repetition
Expand All @@ -22,4 +22,4 @@ DEBUG: begin csr::transpose
DEBUG: end csr::transpose
DEBUG: end repetition
DEBUG: end transpose
DEBUG: end stencil(100,7pt)
DEBUG: end stencil(100, 7pt)
2 changes: 1 addition & 1 deletion benchmark/test/reference/sparse_blas.simple.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ Running on reference(0)
Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
The operations are transpose
Running test case stencil(100,7pt)
Running test case stencil(100, 7pt)
Matrix is of size (125, 125), 725
Running sparse_blas: transpose
6 changes: 3 additions & 3 deletions benchmark/test/reference/spmv.profile.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Running with 0 warm iterations and 1 running iterations
The random seed for right hand sides is 42
The formats are coo
The number of right hand sides is 1
Running test case stencil(100,7pt)
Running test case stencil(100, 7pt)
DEBUG: begin components::aos_to_soa
DEBUG: end components::aos_to_soa
DEBUG: begin dense::fill
Expand All @@ -19,7 +19,7 @@ DEBUG: end dense::fill
DEBUG: begin dense::fill_in_matrix_data
DEBUG: end dense::fill_in_matrix_data
Matrix is of size (125, 125), 725
DEBUG: begin stencil(100,7pt)
DEBUG: begin stencil(100, 7pt)
Running spmv: coo
DEBUG: begin coo
DEBUG: begin components::aos_to_soa
Expand All @@ -35,4 +35,4 @@ DEBUG: end coo::spmv
DEBUG: end apply(<typename>)
DEBUG: end repetition
DEBUG: end coo
DEBUG: end stencil(100,7pt)
DEBUG: end stencil(100, 7pt)
2 changes: 1 addition & 1 deletion benchmark/test/reference/spmv.simple.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
The formats are coo
The number of right hand sides is 1
Running test case stencil(100,7pt)
Running test case stencil(100, 7pt)
Matrix is of size (125, 125), 725
Running spmv: coo
6 changes: 3 additions & 3 deletions benchmark/test/reference/spmv_distributed.profile.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Running with 0 warm iterations and 1 running iterations
The random seed for right hand sides is 42
The formats are [csr]x[csr]
The number of right hand sides is 1
Running test case stencil(100,7pt,stencil)
Running test case stencil(100, 7pt, stencil)
DEBUG: begin partition::build_ranges_from_global_size
DEBUG: end partition::build_ranges_from_global_size
DEBUG: begin components::fill_array
Expand Down Expand Up @@ -55,7 +55,7 @@ DEBUG: end dense::fill
DEBUG: begin dense::fill_in_matrix_data
DEBUG: end dense::fill_in_matrix_data
Matrix is of size (81, 81), 144
DEBUG: begin stencil(100,7pt,stencil)
DEBUG: begin stencil(100, 7pt, stencil)
Running spmv: csr-csr
DEBUG: begin csr-csr
DEBUG: begin partition::build_ranges_from_global_size
Expand Down Expand Up @@ -137,4 +137,4 @@ DEBUG: end advanced_apply(<typename>)
DEBUG: end apply(<typename>)
DEBUG: end repetition
DEBUG: end csr-csr
DEBUG: end stencil(100,7pt,stencil)
DEBUG: end stencil(100, 7pt, stencil)
2 changes: 1 addition & 1 deletion benchmark/test/reference/spmv_distributed.simple.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ Running with 2 warm iterations and 10 running iterations
The random seed for right hand sides is 42
The formats are [csr]x[csr]
The number of right hand sides is 1
Running test case stencil(100,7pt,stencil)
Running test case stencil(100, 7pt, stencil)
Matrix is of size (81, 81), 144
Running spmv: csr-csr
6 changes: 3 additions & 3 deletions benchmark/utils/generator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ struct DefaultSystemGenerator {
return config["filename"].get<std::string>();
} else if (config.contains("stencil")) {
std::stringstream ss;
ss << "stencil(" << config["size"].get<gko::int64>() << ","
ss << "stencil(" << config["size"].get<gko::int64>() << ", "
<< config["stencil"].get<std::string>() << ")";
return ss.str();
} else {
Expand Down Expand Up @@ -231,8 +231,8 @@ struct DistributedDefaultSystemGenerator {
return config["filename"].get<std::string>();
} else if (config.contains("stencil")) {
std::stringstream ss;
ss << "stencil(" << config["size"].get<gko::int64>() << ","
<< config["stencil"].get<std::string>() << ","
ss << "stencil(" << config["size"].get<gko::int64>() << ", "
<< config["stencil"].get<std::string>() << ", "
<< config["comm_pattern"].get<std::string>() << ")";
return ss.str();
} else {
Expand Down
1 change: 1 addition & 0 deletions third_party/nlohmann_json/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ FetchContent_Declare(
GIT_TAG v3.9.1
)
set(JSON_BuildTests OFF CACHE INTERNAL "")
set(JSON_Install OFF CACHE INTERNAL "")
FetchContent_MakeAvailable(nlohmann_json)

0 comments on commit 7b482dc

Please sign in to comment.