From 8eef3f4939e0f0aa4e7f3ba4d0dc6824b7629d46 Mon Sep 17 00:00:00 2001 From: Tomasz Grel Date: Thu, 20 May 2021 18:14:34 +0200 Subject: [PATCH] Set fixed double print precision in logging --- HugeCTR/include/common.hpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/HugeCTR/include/common.hpp b/HugeCTR/include/common.hpp index ce09ad457f..b78a5d1693 100644 --- a/HugeCTR/include/common.hpp +++ b/HugeCTR/include/common.hpp @@ -368,11 +368,20 @@ typedef struct DataSetHeader_ { } while (0) template -inline void print_func(T& t) { +inline void print_func(T const& t) { std::cout << t << ", "; return; } +// Set precision for double type +template <> +inline void print_func(double const& t) { + std::stringstream ss; + ss << std::fixed << std::setprecision(2) << t << ", "; + std::cout << ss.str(); + return; +} + template inline void LOG(const Args&... args) { std::cout << "[";