5#ifndef GKO_PUBLIC_CORE_LOG_BATCH_LOGGER_HPP_
6#define GKO_PUBLIC_CORE_LOG_BATCH_LOGGER_HPP_
12#include <ginkgo/core/base/batch_multi_vector.hpp>
13#include <ginkgo/core/base/types.hpp>
14#include <ginkgo/core/log/logger.hpp>
33template <
typename ValueType>
34struct log_data
final {
38 : res_norms(exec), iter_counts(exec)
46 GKO_INVALID_STATE(
"Invalid num batch items passed in");
52 : res_norms(exec), iter_counts(exec)
60 reinterpret_cast<int*
>(workspace.
get_data()));
63 reinterpret_cast<real_type*
>(workspace.
get_data() +
66 GKO_INVALID_STATE(
"invalid workspace or num batch items passed in");
97template <
typename ValueType = default_precision>
101 using mask_type = gko::log::Logger::mask_type;
103 void on_batch_solver_completed(
119 static std::unique_ptr<BatchConvergence>
create(
121 gko::log::Logger::batch_solver_completed_mask)
123 return std::unique_ptr<BatchConvergence>(
132 return iteration_count_;
140 return residual_norm_;
145 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:167
value_type * get_data() noexcept
Returns a pointer to the block of memory used to store the elements of the array.
Definition array.hpp:674
bool is_owning()
Tells whether this array owns its data or not.
Definition array.hpp:724
static array view(std::shared_ptr< const Executor > exec, size_type size, value_type *data)
Creates an array from existing memory.
Definition array.hpp:366
size_type get_size() const noexcept
Returns the number of elements in the array.
Definition array.hpp:657
Logs the final residuals and iteration counts for a batch solver.
Definition batch_logger.hpp:98
const array< real_type > & get_residual_norm() const noexcept
Definition batch_logger.hpp:138
const array< int > & get_num_iterations() const noexcept
Definition batch_logger.hpp:130
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:119
The Ginkgo namespace.
Definition abstract_factory.hpp:20
constexpr T one()
Returns the multiplicative identity for T.
Definition math.hpp:775
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:326
std::size_t size_type
Integral type used for allocation quantities.
Definition types.hpp:92