10#include <kernel/backend.hpp>
11#include <kernel/util/memory_arbiter.hpp>
14namespace FEAT::LAFEM::Arch
16 struct SlipFilterBlock
18 template <
typename DT_,
typename IT_>
19 static void exec_generic_impl(DT_ * v,
const DT_ *
const f_nu,
const IT_ *
const f_idx,
const Index f_nzes,
const int bs);
21 template <
typename DT_,
typename IT_>
22 static void exec_cuda_impl(DT_ * v,
const DT_ *
const f_nu,
const IT_ *
const f_idx,
const Index f_nzes,
const int bs);
24 template <
typename DT_,
typename IT_,
int block_size_>
25 static void exec_generic(Memory::Arbiter& v,
const Memory::Arbiter& f_nu,
const Memory::Arbiter& f_idx,
const Index f_nzes)
27 Memory::TypedView<DT_> v_view(v.view(Memory::Location::main, Memory::Access::read_write));
28 Memory::TypedView<DT_> n_view(f_nu.view(Memory::Location::main, Memory::Access::read));
29 Memory::TypedView<IT_> i_view(f_idx.view(Memory::Location::main, Memory::Access::read));
30 exec_generic_impl(v_view.get_w(), n_view.get_r(), i_view.get_r(), f_nzes, block_size_);
33 template <
typename DT_,
typename IT_,
int block_size_>
34 static void exec_cuda(Memory::Arbiter& v,
const Memory::Arbiter& f_nu,
const Memory::Arbiter& f_idx,
const Index f_nzes)
36 Memory::TypedView<DT_> v_view(v.view(Memory::Location::cuda, Memory::Access::read_write));
37 Memory::TypedView<DT_> n_view(f_nu.view(Memory::Location::cuda, Memory::Access::read));
38 Memory::TypedView<IT_> i_view(f_idx.view(Memory::Location::cuda, Memory::Access::read));
39 exec_cuda_impl(v_view.get_w(), n_view.get_r(), i_view.get_r(), f_nzes, block_size_);
42 template <
typename DT_,
typename IT_,
int block_size_>
43 static void exec(Memory::Arbiter& v,
const Memory::Arbiter& f_nu,
const Memory::Arbiter& f_idx,
const Index f_nzes)
45 switch(Backend::get_preferred_backend())
47 case PreferredBackend::generic:
48 exec_generic<DT_, IT_, block_size_>(v, f_nu, f_idx, f_nzes);
51 case PreferredBackend::mkl:
53 Backend::warn_missing(
"LAFEM::Arch::SlipFilterBlock::exec");
54 exec_generic<DT_, IT_, block_size_>(v, f_nu, f_idx, f_nzes);
56 XABORTM(
"LAFEM::Arch::SlipFilterBlock::exec: MKL backend not available!");
60 case PreferredBackend::cuda:
62 exec_cuda<DT_, IT_, block_size_>(v, f_nu, f_idx, f_nzes);
64 XABORTM(
"LAFEM::Arch::SlipFilterBlock::exec: CUDA backend not available!");
69 XABORTM(
"LAFEM::Arch::SlipFilterBlock::exec: unknown backend!");
76 extern template void SlipFilterBlock::exec_generic_impl<float, std::uint64_t>(
float * v,
const float *
const f_nu,
const std::uint64_t *
const f_idx,
const Index f_nzes,
const int bs);
77 extern template void SlipFilterBlock::exec_generic_impl<double, std::uint64_t>(
double * v,
const double *
const f_nu,
const std::uint64_t *
const f_idx,
const Index f_nzes,
const int bs);
78 extern template void SlipFilterBlock::exec_generic_impl<float, std::uint32_t>(
float * v,
const float *
const f_nu,
const std::uint32_t *
const f_idx,
const Index f_nzes,
const int bs);
79 extern template void SlipFilterBlock::exec_generic_impl<double, std::uint32_t>(
double * v,
const double *
const f_nu,
const std::uint32_t *
const f_idx,
const Index f_nzes,
const int bs);
85#define KERNEL_LAFEM_ARCH_SLIP_FILTER_BLOCK_HPP 1
86#include <kernel/lafem/arch/slip_filter_block_generic.hpp>
#define XABORTM(msg)
Abortion macro definition with custom message.
std::uint64_t Index
Index data type.