3#include <cusparse_v2.h>
8#include <muda/literal/unit.h>
9#include <muda/mstl/span.h>
10#include <muda/ext/linear_system/dense_vector_view.h>
11#include <muda/ext/linear_system/dense_matrix_view.h>
12#include <muda/ext/linear_system/matrix_format_converter.h>
13#include <muda/ext/linear_system/linear_system_handles.h>
14#include <muda/ext/linear_system/linear_system_solve_tolerance.h>
15#include <muda/ext/linear_system/linear_system_solve_reorder.h>
21 cudaStream_t stream =
nullptr;
25 size_t buffer_byte_size_base = 256_M;
31 std::list<DeviceBuffer<std::byte>> m_buffers;
32 std::list<std::vector<std::byte>> m_host_buffers;
36 std::list<std::function<void()>> m_sync_callbacks;
37 std::string m_current_label;
39 void set_pointer_mode_device();
40 void set_pointer_mode_host();
41 void shrink_temp_buffers();
42 void add_sync_callback(std::function<
void()>&& callback);
44 span<std::byte> temp_host_buffer(
size_t size);
48 span<T> temp_host_buffer(
size_t size);
50 std::vector<T*> temp_buffers(
size_t size_in_buffer,
size_t num_buffer);
52 std::vector<T*> temp_host_buffers(
size_t size_in_buffer,
size_t num_buffer);
59 auto cublas()
const {
return m_handles.cublas(); }
60 auto cusparse()
const {
return m_handles.cusparse(); }
61 auto cusolver_dn()
const {
return m_handles.cusolver_dn(); }
62 auto cusolver_sp()
const {
return m_handles.cusolver_sp(); }
72 void label(std::string_view label) { m_current_label = label; }
73 auto label()
const -> std::string_view {
return m_current_label; }
74 auto stream()
const {
return m_handles.stream(); }
75 void stream(cudaStream_t stream);
82 auto& tolerance() {
return m_tolerance; }
83 auto& reorder() {
return m_reorder; }
84 auto reserve_ratio()
const {
return m_handles.m_reserve_ratio; }
85 void reserve_ratio(
float ratio) { m_handles.m_reserve_ratio = ratio; }
93 template <
typename T,
int N>
97 template <
typename T,
int N>
100 bool clear_dense_matrix =
true);
103 template <
typename T,
int N>
107 template <
typename T,
int N>
111 template <
typename T,
int N>
115 template <
typename T,
int N>
118 bool clear_dense_vector =
true);
121 template <
typename T,
int N>
124 bool clear_dense_vector =
true);
127 template <
typename T,
int N>
131 template <
typename T>
135 template <
typename T>
138 bool clear_dense_matrix =
true);
141 template <
typename T>
143 template <
typename T>
147 template <
typename T>
151 template <
typename T>
154 bool clear_dense_vector =
true);
157 template <
typename T>
160 bool clear_dense_vector =
true);
166 template <
typename T>
168 template <
typename T>
170 template <
typename T>
176 template <
typename T>
178 template <
typename T>
180 template <
typename T>
194 template <
typename T>
197 template <
typename T>
200 template <
typename T>
208 template <
typename T,
int N>
209 void spmv(
const T& a,
214 template <
typename T,
int N>
217 template <
typename T>
219 template <
typename T>
222 template <
typename T,
int N>
223 void spmv(
const T& a,
228 template <
typename T,
int N>
231 template <
typename T>
233 template <
typename T>
241 template <
typename T>
247 template <
typename T>
253 template <
typename T>
262 template <
typename T>
266 template <
typename T>
270 template <
typename T>
271 void generic_spmv(
const T& a,
272 cusparseOperation_t op,
273 cusparseSpMatDescr_t A,
274 const cusparseDnVecDescr* x,
276 cusparseDnVecDescr_t y);
277 template <
typename T>
279 template <
typename T>
284#include "details/linear_system_context.inl"
285#include "details/routines/convert.inl"
286#include "details/routines/norm.inl"
287#include "details/routines/dot.inl"
288#include "details/routines/axpby.inl"
289#include "details/routines/spmv.inl"
290#include "details/routines/mv.inl"
291#include "details/routines/solve.inl"
292#include "details/routines/mm.inl"
Definition bsr_matrix_view.h:8
Definition dense_matrix_view.h:93
Definition bcoo_matrix_view.h:15
Definition csr_matrix_view.h:8
Definition dense_matrix_view.h:108
Definition dense_vector_view.h:10
Definition device_bcoo_matrix.h:18
Definition device_bcoo_vector.h:28
Definition device_bcoo_vector.h:10
Definition device_bsr_matrix.h:16
A std::vector like wrapper of cuda device memory, allows user to:
Definition device_buffer.h:46
Definition device_csr_matrix.h:16
Definition device_dense_matrix.h:16
Definition device_dense_vector.h:16
Definition device_doublet_vector.h:16
Definition device_triplet_matrix.h:14
Definition linear_system_context.h:19
Definition linear_system_context.h:28
Definition linear_system_handles.h:16
Definition linear_system_solve_reorder.h:11
Definition linear_system_solve_tolerance.h:7
Definition triplet_matrix_view.h:10
A light-weight wrapper of cuda device memory. Like std::vector, allow user to resize,...