log iso-timestamp instead of seconds-since-start

This commit is contained in:
Simon Bürger 2023-06-28 13:29:58 +01:00
parent 5103c2a592
commit 2351edf3f7

View File

@ -22,15 +22,20 @@ json json_results;
using namespace quda;
// timestamp = seconds since program start.
// these are written to the json output with the goal of later matching them against
// power-measurments to determine energy efficiency.
using Clock = std::chrono::steady_clock;
Clock::time_point program_start_time = Clock::now();
double get_timestamp()
// thanks chatGPT :)
std::string get_timestamp()
{
auto dur = Clock::now() - program_start_time;
return std::chrono::duration_cast<std::chrono::microseconds>(dur).count() * 1.0e-6;
// Get the current time
auto now = std::chrono::system_clock::now();
// Convert the current time to a time_t object
std::time_t currentTime = std::chrono::system_clock::to_time_t(now);
// Format the time using std::put_time
std::stringstream ss;
ss << std::put_time(std::localtime(&currentTime), "%Y%m%d %H:%M:%S");
return ss.str();
}
// This is the MPI grid, i.e. the layout of ranks
@ -235,9 +240,9 @@ void benchmark_wilson(std::vector<int> const &L_list, double target_time)
double flops = 1.0 * dirac.Flops();
// actual benchmarking
double start_time = get_timestamp();
auto start_time = get_timestamp();
double secs = bench(f, target_time);
double end_time = get_timestamp();
auto end_time = get_timestamp();
#ifdef FLOP_COUNTING_GRID
// this is the flop counting from Benchmark_Grid
@ -297,9 +302,9 @@ void benchmark_dwf(std::vector<int> const &L_list, double target_time)
double flops = 1.0 * dirac.Flops();
// actual benchmarking
double start_time = get_timestamp();
auto start_time = get_timestamp();
double secs = bench(f, target_time);
double end_time = get_timestamp();
auto end_time = get_timestamp();
#ifdef FLOP_COUNTING_GRID
// this is the flop counting from Benchmark_Grid
@ -385,9 +390,9 @@ void benchmark_axpy(std::vector<int> const &L_list, double target_time)
f();
// actual benchmarking
double start_time = get_timestamp();
auto start_time = get_timestamp();
double secs = bench(f, target_time);
double end_time = get_timestamp();
auto end_time = get_timestamp();
double mem_MiB = memory / 1024. / 1024.;
double GBps = mem_MiB / 1024 / secs;