33#ifndef GKO_PUBLIC_CORE_LOG_BATCH_LOGGER_HPP_
34#define GKO_PUBLIC_CORE_LOG_BATCH_LOGGER_HPP_
40#include <ginkgo/core/base/batch_multi_vector.hpp>
41#include <ginkgo/core/base/types.hpp>
42#include <ginkgo/core/log/logger.hpp>
61template <
typename ValueType>
62struct log_data
final {
66 : res_norms(exec), iter_counts(exec)
74 GKO_INVALID_STATE(
"Invalid num batch items passed in");
80 : res_norms(exec), iter_counts(exec)
88 reinterpret_cast<int*
>(workspace.
get_data()));
91 reinterpret_cast<real_type*
>(workspace.
get_data() +
94 GKO_INVALID_STATE(
"invalid workspace or num batch items passed in");
125template <
typename ValueType = default_precision>
129 using mask_type = gko::log::Logger::mask_type;
131 void on_batch_solver_completed(
147 static std::unique_ptr<BatchConvergence>
create(
149 gko::log::Logger::batch_solver_completed_mask)
151 return std::unique_ptr<BatchConvergence>(
160 return iteration_count_;
168 return residual_norm_;
173 gko::log::Logger::batch_solver_completed_mask)
An array is a container which encapsulates fixed-sized arrays, stored on the Executor tied to the arr...
Definition array.hpp:187
value_type * get_data() noexcept
Returns a pointer to the block of memory used to store the elements of the array.
Definition array.hpp:646
bool is_owning()
Tells whether this array owns its data or not.
Definition array.hpp:696
size_type get_num_elems() const noexcept
Returns the number of elements in the array.
Definition array.hpp:637
static array view(std::shared_ptr< const Executor > exec, size_type num_elems, value_type *data)
Creates an array from existing memory.
Definition array.hpp:388
Logs the final residuals and iteration counts for a batch solver.
Definition batch_logger.hpp:126
const array< real_type > & get_residual_norm() const noexcept
Definition batch_logger.hpp:166
const array< int > & get_num_iterations() const noexcept
Definition batch_logger.hpp:158
static std::unique_ptr< BatchConvergence > create(const mask_type &enabled_events=gko::log::Logger::batch_solver_completed_mask)
Creates a convergence logger.
Definition batch_logger.hpp:147
Definition logger.hpp:104
The Ginkgo namespace.
Definition abstract_factory.hpp:48
constexpr T one()
Returns the multiplicative identity for T.
Definition math.hpp:803
typename detail::remove_complex_s< T >::type remove_complex
Obtain the type which removed the complex of complex/scalar type or the template parameter of class b...
Definition math.hpp:354
std::size_t size_type
Integral type used for allocation quantities.
Definition types.hpp:120