28 #ifndef SPLA_STORAGE_MAANGER_VECTOR_HPP
29 #define SPLA_STORAGE_MAANGER_VECTOR_HPP
38 #if defined(SPLA_BUILD_OPENCL)
76 auto* dok = s.template get<CpuDokVec<T>>();
77 auto* coo = s.template get<CpuCooVec<T>>();
82 auto* dok = s.template get<CpuDokVec<T>>();
83 auto* dense = s.template get<CpuDenseVec<T>>();
88 auto* coo = s.template get<CpuCooVec<T>>();
89 auto* dok = s.template get<CpuDokVec<T>>();
94 auto* dense = s.template get<CpuDenseVec<T>>();
95 auto* dok = s.template get<CpuDokVec<T>>();
101 #if defined(SPLA_BUILD_OPENCL)
107 auto* cl_dense = s.template get<CLDenseVec<T>>();
112 auto* cl_coo = s.template get<CLCooVec<T>>();
116 auto* cl_dense = s.template get<CLDenseVec<T>>();
121 auto* cpu_dense = s.template get<CpuDenseVec<T>>();
122 auto* cl_dense = s.template get<CLDenseVec<T>>();
126 auto* cl_acc = get_acc_cl();
127 auto* cl_dense = s.template get<CLDenseVec<T>>();
128 auto* cpu_dense = s.template get<CpuDenseVec<T>>();
129 if (!cl_acc->is_img()) {
130 cl_dense_vec_read(s.get_n_rows(), cpu_dense->Ax.data(), *cl_dense, cl_acc->get_queue_default());
135 cl_dense_vec_read(s.get_n_rows(), cpu_dense->Ax.data(), *cl_dense, cl_acc->get_queue_default(),
136 CL_MEM_HOST_READ_ONLY | CL_MEM_ALLOC_HOST_PTR);
140 auto* cpu_coo = s.template get<CpuCooVec<T>>();
141 auto* cl_coo = s.template get<CLCooVec<T>>();
142 cl_coo_vec_init(cpu_coo->values, cpu_coo->Ai.data(), cpu_coo->Ax.data(), *cl_coo);
145 auto* cl_acc = get_acc_cl();
146 auto* cl_coo = s.template get<CLCooVec<T>>();
147 auto* cpu_coo = s.template get<CpuCooVec<T>>();
149 if (!cl_acc->is_img()) {
150 cl_coo_vec_read(cl_coo->values, cpu_coo->Ai.data(), cpu_coo->Ax.data(), *cl_coo, cl_acc->get_queue_default());
155 cl_coo_vec_read(cl_coo->values, cpu_coo->Ai.data(), cpu_coo->Ax.data(), *cl_coo, cl_acc->get_queue_default(),
156 CL_MEM_HOST_READ_ONLY | CL_MEM_ALLOC_HOST_PTR);
160 auto* cl_acc = get_acc_cl();
161 auto* cl_coo = s.template get<CLCooVec<T>>();
162 auto* cl_dense = s.template get<CLDenseVec<T>>();
163 cl_coo_vec_to_dense(s.get_n_rows(), s.get_fill_value(), *cl_coo, *cl_dense, cl_acc->get_queue_default());
166 auto* cl_acc = get_acc_cl();
167 auto* cl_dense = s.template get<CLDenseVec<T>>();
168 auto* cl_coo = s.template get<CLCooVec<T>>();
169 cl_dense_vec_to_coo(s.get_n_rows(), s.get_fill_value(), *cl_dense, *cl_coo, cl_acc->get_queue_default());
CPU list-of-coordinates sparse vector representation.
Definition: cpu_formats.hpp:90
CPU one-dim array for dense vector representation.
Definition: cpu_formats.hpp:74
Definition: cpu_formats.hpp:55
General format converter for vector or matrix decoration storage.
Definition: storage_manager.hpp:57
Storage for decorators with data of a particular vector or matrix object.
Definition: tdecoration.hpp:70
void cl_coo_vec_read(const std::size_t n_values, uint *Ai, T *Ax, const CLCooVec< T > &storage, cl::CommandQueue &queue, cl_mem_flags staging_flags=CL_MEM_READ_ONLY|CL_MEM_HOST_READ_ONLY|CL_MEM_ALLOC_HOST_PTR, bool blocking=true)
Definition: cl_format_coo_vec.hpp:103
void cpu_coo_vec_clear(CpuCooVec< T > &vec)
Definition: cpu_format_coo_vec.hpp:69
void cpu_dok_vec_to_dense(const uint n_rows, const CpuDokVec< T > &in, CpuDenseVec< T > &out)
Definition: cpu_format_dok_vec.hpp:72
void cl_dense_vec_to_coo(const std::size_t n_rows, const T fill_value, const CLDenseVec< T > &in, CLCooVec< T > &out, cl::CommandQueue &queue)
Definition: cl_format_dense_vec.hpp:90
void register_converter(F from, F to, Function function)
Definition: storage_manager.hpp:112
void cl_coo_vec_to_dense(const std::size_t n_rows, const T fill_value, const CLCooVec< T > &in, CLDenseVec< T > &out, cl::CommandQueue &queue)
Definition: cl_format_coo_vec.hpp:128
void cl_coo_vec_clear(CLCooVec< T > &storage)
Definition: cl_format_coo_vec.hpp:96
void cpu_coo_vec_resize(const uint n_values, CpuCooVec< T > &vec)
Definition: cpu_format_coo_vec.hpp:61
void cl_dense_vec_read(const std::size_t n_rows, T *values, CLDenseVec< T > &storage, cl::CommandQueue &queue, cl_mem_flags staging_flags=CL_MEM_READ_ONLY|CL_MEM_HOST_READ_ONLY|CL_MEM_ALLOC_HOST_PTR, bool blocking=true)
Definition: cl_format_dense_vec.hpp:76
void cl_dense_vec_init(const std::size_t n_rows, const T *values, CLDenseVec< T > &storage)
Definition: cl_format_dense_vec.hpp:63
void cl_dense_vec_fill_value(const std::size_t n_rows, const T value, CLDenseVec< T > &storage)
Definition: cl_format_dense_vec.hpp:56
void cl_coo_vec_init(const std::size_t n_values, const uint *Ai, const T *Ax, CLCooVec< T > &storage)
Definition: cl_format_coo_vec.hpp:45
void cpu_dense_vec_fill(const T fill_value, CpuDenseVec< T > &vec)
Definition: cpu_format_dense_vec.hpp:48
void cpu_dok_vec_clear(CpuDokVec< T > &vec)
Definition: cpu_format_dok_vec.hpp:99
void cpu_dense_vec_resize(const uint n_rows, CpuDenseVec< T > &vec)
Definition: cpu_format_dense_vec.hpp:41
void cpu_dok_vec_to_coo(const CpuDokVec< T > &in, CpuCooVec< T > &out)
Definition: cpu_format_dok_vec.hpp:43
void cl_dense_vec_resize(const std::size_t n_rows, CLDenseVec< T > &storage)
Definition: cl_format_dense_vec.hpp:46
void register_validator(F format, Function function)
Definition: storage_manager.hpp:97
void cpu_dense_vec_to_dok(const uint n_rows, const T fill_value, const CpuDenseVec< T > &in, CpuDokVec< T > &out)
Definition: cpu_format_dense_vec.hpp:54
void register_validator_discard(F format, Function function)
Definition: storage_manager.hpp:107
void cpu_coo_vec_to_dok(const CpuCooVec< T > &in, CpuDokVec< T > &out)
Definition: cpu_format_coo_vec.hpp:76
void register_constructor(F format, Function function)
Definition: storage_manager.hpp:92
ref_ptr< T > make_ref(TArgs &&... args)
Definition: ref.hpp:246
Definition: algorithm.hpp:37
void register_formats_vector(StorageManagerVector< T > &manager)
Definition: storage_manager_vector.hpp:51