Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
- use orderd_json instead of json
- File size was not calculated correctly when -L was large
- When not outputting files, do not display results for writing
  • Loading branch information
range3 committed Oct 1, 2022
1 parent 9ba9b99 commit d61a5b7
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions src/rdbench/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "rdbench/version.h"
#include "stopwatch.hpp"

using json = nlohmann::json;
using orderd_json = nlohmann::ordered_json;

const double F = 0.04;
const double k = 0.06075;
Expand Down Expand Up @@ -460,7 +460,7 @@ bool validate_file_io(vd &u, int index, RdbenchInfo &info) {
void print_result(const std::vector<std::pair<RdbenchPhase, Stopwatch::duration>> &phase_durations,
RdbenchInfo &info) {
size_t nfiles = info.write_phase_count;
size_t file_size = info.L * info.L * sizeof(double);
size_t file_size = static_cast<size_t>(info.L) * static_cast<size_t>(info.L) * sizeof(double);
size_t total_write_size = nfiles * file_size;

std::vector<std::pair<RdbenchPhase, int64_t>> phase_durations_i8;
Expand Down Expand Up @@ -507,29 +507,29 @@ void print_result(const std::vector<std::pair<RdbenchPhase, Stopwatch::duration>
double calc_time_sec = to_sec(max_tc);
double write_time_sec = to_sec(max_tw);

json rdbench_result = {{"version", RDBENCH_VERSION},
{"nprocs", info.nprocs},
{"topology", info.topo},
{"xnp", info.xnp},
{"ynp", info.ynp},
{"L", info.L},
{"chunkSizeX", info.chunk_size_x},
{"chunkSizeY", info.chunk_size_y},
{"collective", info.collective},
{"iotype", info.iot},
{"sync", info.sync},
{"validate", info.validate},
{"steps", info.total_steps},
{"interval", info.interval},
{"fixedX", info.fixed_x},
{"fixedY", info.fixed_y},
{"initialOutput", info.initial_output},
{"nfiles", nfiles},
{"fileSize", file_size},
{"totalWriteSizeByte", total_write_size},
{"calcTimeSec", calc_time_sec}};

if (info.interval != 0) {
orderd_json rdbench_result = {{"version", RDBENCH_VERSION},
{"nprocs", info.nprocs},
{"topology", info.topo},
{"xnp", info.xnp},
{"ynp", info.ynp},
{"L", info.L},
{"chunkSizeX", info.chunk_size_x},
{"chunkSizeY", info.chunk_size_y},
{"collective", info.collective},
{"iotype", info.iot},
{"sync", info.sync},
{"validate", info.validate},
{"steps", info.total_steps},
{"interval", info.interval},
{"fixedX", info.fixed_x},
{"fixedY", info.fixed_y},
{"initialOutput", info.initial_output},
{"nfiles", nfiles},
{"fileSize", file_size},
{"totalWriteSizeByte", total_write_size},
{"calcTimeSec", calc_time_sec}};

if (nfiles > 0) {
rdbench_result["wrieTimeSec"] = write_time_sec;
rdbench_result["writeBandwidthByte"]
= std::stod(fmt::format("{:.2f}", total_write_size / write_time_sec));
Expand Down

0 comments on commit d61a5b7

Please sign in to comment.