FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
mirror_dense_scatter.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{
16 {
17 template<typename DT_, typename IT_>
18 static void exec_generic_impl(const Index boff, const Index nidx, const IT_* idx, const DT_* buf, DT_* vec, const DT_ alpha);
19
20 template<typename DT_, typename IT_>
21 static void exec_cuda_impl(const Index boff, const Index nidx, const IT_* idx, const DT_* buf, DT_* vec, const DT_ alpha);
22
23 template<typename DT_, typename IT_>
24 static void exec_generic(const Index boff, const Index nidx, const Memory::Arbiter& idx, const Memory::Arbiter& buf, Memory::Arbiter& vec, const DT_ alpha)
25 {
29 return exec_generic_impl(boff, nidx, i_view.get_r(), b_view.get_r(), x_view.get_w(), alpha);
30 }
31
32 template<typename DT_, typename IT_>
33 static void exec_cuda(const Index boff, const Index nidx, const Memory::Arbiter& idx, const Memory::Arbiter& buf, Memory::Arbiter& vec, const DT_ alpha)
34 {
38 return exec_cuda_impl(boff, nidx, i_view.get_r(), b_view.get_r(), x_view.get_w(), alpha);
39 }
40
41 template<typename DT_, typename IT_>
42 static void exec(const Index boff, const Index nidx, const Memory::Arbiter& idx, const Memory::Arbiter& buf, Memory::Arbiter& vec, const DT_ alpha)
43 {
45 {
47 exec_generic<DT_, IT_>(boff, nidx, idx, buf, vec, alpha);
48 break;
49
51#ifdef FEAT_HAVE_MKL
52 Backend::warn_missing("LAFEM::Arch::MirrorDenseScatter::exec");
53 exec_generic<DT_, IT_>(boff, nidx, idx, buf, vec, alpha);
54#else
55 XABORTM("LAFEM::Arch::MirrorDenseScatter::exec: MKL backend not available!");
56#endif
57 break;
58
60#ifdef FEAT_HAVE_CUDA
61 exec_cuda<DT_, IT_>(boff, nidx, idx, buf, vec, alpha);
62#else
63 XABORTM("LAFEM::Arch::MirrorDenseScatter::exec: CUDA backend not available!");
64#endif
65 break;
66
67 default:
68 XABORTM("LAFEM::Arch::MirrorDenseScatter::exec: unknown backend!");
69 break;
70 }
71 }
72 }; // struct MirrorDenseScatter
73} // namespace FEAT::LAFEM::Arch
74
75#ifndef __CUDACC__
76#define KERNEL_LAFEM_ARCH_MIRROR_DENSE_SCATTER_HPP 1
77#include <kernel/lafem/arch/mirror_dense_scatter_generic.hpp>
78#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.
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.
@ read_write
read-write access
@ read
read-only access
std::uint64_t Index
Index data type.