 |
Ginkgo
Generated from pipelines/2662685947 branch based on develop. Ginkgo version 2.0.0
A numerical linear algebra library targeting many-core architectures
|
5 #ifndef GKO_PUBLIC_CORE_BASE_BATCH_LIN_OP_HPP_
6 #define GKO_PUBLIC_CORE_BASE_BATCH_LIN_OP_HPP_
10 #include <type_traits>
13 #include <ginkgo/core/base/abstract_factory.hpp>
14 #include <ginkgo/core/base/batch_multi_vector.hpp>
15 #include <ginkgo/core/base/dim.hpp>
16 #include <ginkgo/core/base/exception_helpers.hpp>
17 #include <ginkgo/core/base/math.hpp>
18 #include <ginkgo/core/base/matrix_assembly_data.hpp>
19 #include <ginkgo/core/base/matrix_data.hpp>
20 #include <ginkgo/core/base/polymorphic_object.hpp>
21 #include <ginkgo/core/base/types.hpp>
22 #include <ginkgo/core/base/utils.hpp>
23 #include <ginkgo/core/log/logger.hpp>
90 template <
typename ValueType>
107 template <
typename ValueType>
130 void set_size(
const batch_dim<2>& size) { size_ = size; }
138 explicit BatchLinOp(std::shared_ptr<const Executor> exec,
151 explicit BatchLinOp(std::shared_ptr<const Executor> exec,
153 const dim<2>& common_size = dim<2>{})
154 : BatchLinOp{std::move(exec),
156 ? batch_dim<2>(num_batch_items, common_size)
161 batch_dim<2> size_{};
195 :
public AbstractFactory<BatchLinOp, std::shared_ptr<const BatchLinOp>> {
200 std::unique_ptr<BatchLinOp> generate(
201 std::shared_ptr<const BatchLinOp> input)
const
204 gko::log::Logger::batch_linop_factory_generate_started>(
207 std::unique_ptr<BatchLinOp> generated;
208 if (input->get_executor() == exec) {
215 gko::log::Logger::batch_linop_factory_generate_completed>(
216 this, input.get(), generated.get());
238 template <
typename ConcreteFactory,
typename ConcreteBatchLinOp,
321 #define GKO_ENABLE_BATCH_LIN_OP_FACTORY(_batch_lin_op, _parameters_name, \
324 const _parameters_name##_type& get_##_parameters_name() const \
326 return _parameters_name##_; \
329 class _factory_name \
330 : public ::gko::batch::EnableDefaultBatchLinOpFactory< \
331 _factory_name, _batch_lin_op, _parameters_name##_type> { \
332 friend class ::gko::enable_parameters_type<_parameters_name##_type, \
334 explicit _factory_name(std::shared_ptr<const ::gko::Executor> exec) \
335 : ::gko::batch::EnableDefaultBatchLinOpFactory< \
336 _factory_name, _batch_lin_op, _parameters_name##_type>( \
339 explicit _factory_name(std::shared_ptr<const ::gko::Executor> exec, \
340 const _parameters_name##_type& parameters) \
341 : ::gko::batch::EnableDefaultBatchLinOpFactory< \
342 _factory_name, _batch_lin_op, _parameters_name##_type>( \
343 std::move(exec), parameters) \
346 friend ::gko::batch::EnableDefaultBatchLinOpFactory< \
347 _factory_name, _batch_lin_op, _parameters_name##_type>; \
351 _parameters_name##_type _parameters_name##_; \
354 static_assert(true, \
355 "This assert is used to counter the false positive extra " \
356 "semi-colon warnings")
363 #endif // GKO_PUBLIC_CORE_BASE_BATCH_LIN_OP_HPP_
size_type get_num_batch_items() const
Get the number of batch items stored.
Definition: batch_dim.hpp:36
dim< dimensionality, dimension_type > get_common_size() const
Get the common size of the batch items.
Definition: batch_dim.hpp:43
void validate_application_parameters(const MultiVector< ValueType > *alpha, const MultiVector< ValueType > *b, const MultiVector< ValueType > *beta, MultiVector< ValueType > *x) const
Validates the sizes for the apply(alpha, b , beta, x) operation in the concrete BatchLinOp.
Definition: batch_lin_op.hpp:108
void validate_application_parameters(const MultiVector< ValueType > *b, MultiVector< ValueType > *x) const
Validates the sizes for the apply(b,x) operation in the concrete BatchLinOp.
Definition: batch_lin_op.hpp:91
A BatchLinOpFactory represents a higher order mapping which transforms one batch linear operator into...
Definition: batch_lin_op.hpp:194
The AbstractFactory is a generic interface template that enables easy implementation of the abstract ...
Definition: abstract_factory.hpp:45
Definition: batch_lin_op.hpp:59
size_type get_num_batch_items() const noexcept
Returns the number of items in the batch operator.
Definition: batch_lin_op.hpp:66
A PolymorphicObject is the abstract base for all "heavy" objects in Ginkgo that behave polymorphicall...
Definition: polymorphic_object.hpp:46
std::unique_ptr< abstract_product_type > generate(Args &&... args) const
Creates a new product from the given components.
Definition: abstract_factory.hpp:65
std::size_t size_type
Integral type used for allocation quantities.
Definition: types.hpp:90
This mixin provides a default implementation of a concrete factory.
Definition: abstract_factory.hpp:122
MultiVector stores multiple vectors in a batched fashion and is useful for batched operations.
Definition: batch_multi_vector.hpp:52
detail::cloned_type< Pointer > clone(const Pointer &p)
Creates a unique clone of the object pointed to by p.
Definition: utils_helper.hpp:425
dim< 2 > get_common_size() const
Returns the common size of the batch items.
Definition: batch_lin_op.hpp:76
The Ginkgo namespace.
Definition: abstract_factory.hpp:20
dim< 2 > get_common_size() const
Returns the common size of the batch items.
Definition: batch_multi_vector.hpp:155
size_type get_num_batch_items() const
Returns the number of batch items.
Definition: batch_multi_vector.hpp:145
std::shared_ptr< const Executor > get_executor() const noexcept
Returns the Executor of the object.
Definition: polymorphic_object.hpp:62
const batch_dim< 2 > & get_size() const noexcept
Returns the size of the batch operator.
Definition: batch_lin_op.hpp:83