29 #ifndef LBANN_SUMMARY_HPP_INCLUDED 30 #define LBANN_SUMMARY_HPP_INCLUDED 37 #ifdef LBANN_HAS_TBINF 43 template <
typename T,
typename U>
44 using BiggerOf =
typename std::conditional<(sizeof(T) >
sizeof(U)), T, U>::type;
46 #ifdef LBANN_HAS_TBINF 76 template <
typename TensorDataType>
78 const El::AbstractDistMatrix<TensorDataType>& mat,
81 template <
typename TensorDataType>
83 const El::AbstractDistMatrix<TensorDataType>& mat,
86 template <
typename TensorDataType>
88 const El::AbstractDistMatrix<TensorDataType>& mat,
91 template <
typename TensorDataType>
93 const El::AbstractDistMatrix<TensorDataType>& mat,
96 template <
typename TensorDataType>
97 void reduce_scalar(
const std::string tag, TensorDataType s,
int step);
99 template <
typename TensorDataType>
102 template <
typename TensorDataType>
105 template <
typename TensorDataType>
107 const El::AbstractDistMatrix<TensorDataType>& mat,
110 template <
typename TensorDataType>
112 const El::AbstractDistMatrix<TensorDataType>& mat,
117 std::vector<int>
const& ,
128 TBinf::SummaryWriter* m_sw;
135 pending_op(
const std::string tag_,
138 float local2_ = 0.0f,
140 : tag(tag_), step(step_),
local(local_), local2(local2_), num(num_)
143 const std::string tag;
156 struct pending_histogram
158 pending_histogram(
const std::string tag_,
160 std::vector<double> buckets_,
176 const std::string tag;
180 std::vector<double> buckets;
194 std::vector<pending_op> m_pending_means;
196 std::vector<pending_op> m_pending_mins;
198 std::vector<pending_op> m_pending_maxes;
200 std::vector<pending_op> m_pending_stdevs;
202 std::vector<pending_op> m_pending_scalars;
204 std::vector<pending_op> m_pending_sum_scalars;
206 std::vector<pending_op> m_pending_scalar_alls;
208 std::vector<double> m_histogram_buckets;
210 std::vector<pending_histogram> m_pending_histograms;
221 void flush_scalars();
223 void flush_sum_scalars();
225 void flush_scalar_alls();
227 void flush_histograms();
230 template <
typename TensorDataType>
231 auto local_sum(
const El::AbstractMatrix<TensorDataType>& mat)
const 234 template <
typename TensorDataType,
typename AccumT>
235 void local_sum_sqsum(
const El::AbstractMatrix<TensorDataType>& mat,
237 AccumT& sqsum)
const;
239 template <
typename TensorDataType>
240 auto local_min(
const El::AbstractMatrix<TensorDataType>& mat)
const 243 template <
typename TensorDataType>
244 auto local_max(
const El::AbstractMatrix<TensorDataType>& mat)
const 247 template <
typename TensorDataType>
248 auto local_2norm(
const El::AbstractMatrix<TensorDataType>& mat)
const 251 std::string prepend_model(
const std::string tag,
int model)
const;
253 void gather_scalar_summary(
const std::string tag,
float s,
int step);
255 void gather_scalar_summary(
const std::vector<pending_op>& ops,
256 std::vector<float>& scalars);
268 std::string
const& img_format,
270 std::vector<int>
const& dims,
274 template <
typename TensorDataType>
276 const El::AbstractDistMatrix<TensorDataType>& mat,
279 template <
typename TensorDataType>
281 const El::AbstractDistMatrix<TensorDataType>& mat,
284 template <
typename TensorDataType>
286 const El::AbstractDistMatrix<TensorDataType>& mat,
289 template <
typename TensorDataType>
291 const El::AbstractDistMatrix<TensorDataType>& mat,
294 template <
typename TensorDataType>
297 template <
typename TensorDataType>
300 template <
typename TensorDataType>
303 template <
typename TensorDataType>
305 const El::AbstractDistMatrix<TensorDataType>& mat,
308 template <
typename TensorDataType>
310 const El::AbstractDistMatrix<TensorDataType>& mat,
316 #endif // LBANN_HAS_TBINF 320 #endif // LBANN_SUMMARY_HPP_INCLUDED void reduce_mean(const std::string tag, const El::AbstractDistMatrix< TensorDataType > &mat, int step)
void reduce_stdev(const std::string tag, const El::AbstractDistMatrix< TensorDataType > &mat, int step)
void reduce_scalar(const std::string tag, TensorDataType s, int step)
lbann_summary(std::string logdir, lbann_comm *comm)
void sum_reduce_scalar(const std::string tag, TensorDataType s, int step)
void reduce_2norm(const std::string tag, const El::AbstractDistMatrix< TensorDataType > &mat, int step)
Abstract base class for neural network models.
void report_image(std::string const &tag, std::string const &img_format, CPUMat const &image, std::vector< int > const &dims, int step)
El::Matrix< DataType, El::Device::CPU > CPUMat
typename std::conditional<(sizeof(T) > sizeof(U)), T, U >::type BiggerOf
void reduce_histogram(const std::string tag, const El::AbstractDistMatrix< TensorDataType > &mat, int step)
void reduce_scalar_all(const std::string tag, TensorDataType s, int step)
void reduce_min(const std::string tag, const El::AbstractDistMatrix< TensorDataType > &mat, int step)
void reduce_max(const std::string tag, const El::AbstractDistMatrix< TensorDataType > &mat, int step)