FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
matvecmult_cscr_dense.hpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#pragma once
7
8// includes, FEAT
10#include <kernel/backend.hpp>
11#include <kernel/util/memory_arbiter.hpp>
12
13namespace FEAT::LAFEM::Arch
14{
17 {
18 template <typename DT_, typename IT_>
19 static void exec_generic_impl(DT_ * r, const DT_ alpha, const DT_ * const x, const DT_ * const y, const DT_ * const val,
20 const IT_ * const col_idx, const IT_ * const row_ptr, const IT_ * const row_idx, const Index, const Index, const Index, const Index, const bool);
21
22 template <typename DT_, typename IT_>
23 static void exec_generic(Memory::Arbiter& r, const DT_ alpha, const Memory::Arbiter& x, const Memory::Arbiter& y, const Memory::Arbiter& a, const Memory::Arbiter& col_idx, const Memory::Arbiter& row_ptr, const Memory::Arbiter& row_idx, const Index rows, const Index cols, const Index nonzero_rows, const Index nonzeros, const bool transposed)
24 {
31 if(y)
32 {
34 exec_generic_impl(r_view.get_w(), alpha, x_view.get_r(), y_view.get_r(), a_view.get_r(),
35 ci_view.get_r(), rp_view.get_r(), ri_view.get_r(), rows, cols, nonzero_rows, nonzeros, transposed);
36 }
37 else
38 {
39 exec_generic_impl(r_view.get_w(), alpha, x_view.get_r(), (DT_*)nullptr, a_view.get_r(),
40 ci_view.get_r(), rp_view.get_r(), ri_view.get_r(), rows, cols, nonzero_rows, nonzeros, transposed);
41 }
42 }
43
44 template <typename DT_, typename IT_>
45 static void exec(Memory::Arbiter& r, const DT_ alpha, const Memory::Arbiter& x, const Memory::Arbiter& y, const Memory::Arbiter& a, const Memory::Arbiter& col_idx, const Memory::Arbiter& row_ptr, const Memory::Arbiter& row_idx, const Index rows, const Index cols, const Index nonzero_rows, const Index nonzeros, const bool transposed)
46 {
48 {
50 exec_generic<DT_, IT_>(r, alpha, x, y, a, col_idx, row_ptr, row_idx, rows, cols, nonzero_rows, nonzeros, transposed);
51 break;
52
54#ifdef FEAT_HAVE_MKL
55 Backend::warn_missing("LAFEM::Arch::MatVecMultCSCRDense::exec");
56 exec_generic<DT_, IT_>(r, alpha, x, y, a, col_idx, row_ptr, row_idx, rows, cols, nonzero_rows, nonzeros, transposed);
57#else
58 XABORTM("LAFEM::Arch::MatVecMultCSCRDense::exec: MKL backend not available!");
59#endif
60 break;
61
63 XABORTM("LAFEM::Arch::MatVecMultCSCRDense::exec: CUDA backend not available!");
64 break;
65
66 default:
67 XABORTM("LAFEM::Arch::MatVecMultCSCRDense::exec: unknown backend!");
68 break;
69 }
70 }
71 }; // struct MatVecMultCSCRDense
72
73#ifdef FEAT_EICKT
74 extern template void MatVecMultCSCRDense::exec_generic_impl(float *, const float, const float * const, const float * const, const float * const, const std::uint64_t * const, const std::uint64_t * const, const std::uint64_t * const, const Index, const Index, const Index, const Index, const bool);
75 extern template void MatVecMultCSCRDense::exec_generic_impl(float *, const float, const float * const, const float * const, const float * const, const std::uint32_t * const, const std::uint32_t * const, const std::uint32_t * const, const Index, const Index, const Index, const Index, const bool);
76 extern template void MatVecMultCSCRDense::exec_generic_impl(double *, const double, const double * const, const double * const, const double * const, const std::uint64_t * const, const std::uint64_t * const, const std::uint64_t * const, const Index, const Index, const Index, const Index, const bool);
77 extern template void MatVecMultCSCRDense::exec_generic_impl(double *, const double, const double * const, const double * const, const double * const, const std::uint32_t * const, const std::uint32_t * const, const std::uint32_t * const, const Index, const Index, const Index, const Index, const bool);
78#endif
79
80} // namespace FEAT::LAFEM::Arch
81
82#ifndef __CUDACC__
83#define KERNEL_LAFEM_ARCH_MATVECMULT_CSCR_DENSE_HPP 1
84#include <kernel/lafem/arch/matvecmult_cscr_dense_generic.hpp>
85#endif
#define XABORTM(msg)
Abortion macro definition with custom message.
Definition: assertion.hpp:192
FEAT Kernel base header.
static PreferredBackend get_preferred_backend()
get current preferred backend
Definition: backend.cpp:32
static void warn_missing(const char *operation, PreferredBackend preferred_backend, PreferredBackend fallback_backend=PreferredBackend::generic)
issues a warning about unsupported backend usage
Definition: backend.cpp:77
Memory arbiter class.
View view(Location mem_loc, Access access)
Maps a raw view to a memory block.
Typed memory view class.
const T_ * get_r() const
Returns a const typed pointer to the array that grants read access.
T_ * get_w()
Returns a typed pointer to the array that grants write (and read) access.
@ overlap
explicitly allow overlapping writes (see Overlapping Memory Views)
@ read
read-only access
@ write
write-only access (see attention note above)
std::uint64_t Index
Index data type.
r[i] <- y[i] + alpha * sum_{j=0..n-1} A[i][j] * x[j]