Ginkgo Generated from branch based on main. Ginkgo version 1.9.0
A numerical linear algebra library targeting many-core architectures
 
Loading...
Searching...
No Matches
vector_cache.hpp
1// SPDX-FileCopyrightText: 2017 - 2024 The Ginkgo authors
2//
3// SPDX-License-Identifier: BSD-3-Clause
4
5#ifndef GKO_PUBLIC_CORE_DISTRIBUTED_VECTOR_CACHE_HPP_
6#define GKO_PUBLIC_CORE_DISTRIBUTED_VECTOR_CACHE_HPP_
7
8
9#include <memory>
10
11#include <ginkgo/config.hpp>
12#include <ginkgo/core/base/executor.hpp>
13#include <ginkgo/core/base/mpi.hpp>
14#include <ginkgo/core/distributed/vector.hpp>
15
16
17#if GINKGO_BUILD_MPI
18
19
20namespace gko {
21namespace experimental {
22namespace distributed {
23namespace detail {
24
25
35template <typename ValueType>
36struct VectorCache {
37 VectorCache() = default;
38 ~VectorCache() = default;
39 VectorCache(const VectorCache&) {}
40 VectorCache(VectorCache&&) noexcept {}
41 VectorCache& operator=(const VectorCache&) { return *this; }
42 VectorCache& operator=(VectorCache&&) noexcept { return *this; }
43 mutable std::unique_ptr<Vector<ValueType>> vec{};
44
45
60 void init_from(const Vector<ValueType>* template_vec) const;
61
74 void init(std::shared_ptr<const Executor> exec,
75 gko::experimental::mpi::communicator comm, dim<2> global_size,
76 dim<2> local_size) const;
77
83 Vector<ValueType>& operator*() const { return *vec; }
84
89 Vector<ValueType>* operator->() const { return vec.get(); }
90
95 Vector<ValueType>* get() const { return vec.get(); }
96};
97
98
99} // namespace detail
100} // namespace distributed
101} // namespace experimental
102} // namespace gko
103
104
105#endif // GINKGO_BUILD_MPI
106#endif // GKO_PUBLIC_CORE_DISTRIBUTED_VECTOR_CACHE_HPP_
The distributed namespace.
Definition precision_dispatch.hpp:309
The Ginkgo namespace.
Definition abstract_factory.hpp:20