Skip to content

Commit

Permalink
Set fixed double print precision in logging
Browse files Browse the repository at this point in the history
  • Loading branch information
tgrel committed May 20, 2021
1 parent f5a6e99 commit 8eef3f4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion HugeCTR/include/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,11 +368,20 @@ typedef struct DataSetHeader_ {
} while (0)

template <typename T>
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>(double const& t) {
std::stringstream ss;
ss << std::fixed << std::setprecision(2) << t << ", ";
std::cout << ss.str();
return;
}

template <typename... Args>
inline void LOG(const Args&... args) {
std::cout << "[";
Expand Down

0 comments on commit 8eef3f4

Please sign in to comment.