FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
mirror_sparse_block_gather.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 bs, const Index boff, const Index nidx, const IT_* idx, DT_* buf, const Index nvec, const DT_* vval, const IT_* vidx);
19
20 template<typename DT_, typename IT_, int block_size_>
21 static void exec_generic(const Index boff, const Index nidx, const Memory::Arbiter& idx, Memory::Arbiter& buf, Index nvec, const Memory::Arbiter& vec, const Memory::Arbiter& vi)
22 {
27 return exec_generic_impl(Index(block_size_), boff, nidx, i_view.get_r(), b_view.get_w(), nvec, x_view.get_r(), vi_view.get_r());
28 }
29
30 template<typename DT_, typename IT_, int block_size_>
31 static void exec(const Index boff, const Index nidx, const Memory::Arbiter& idx, Memory::Arbiter& buf, Index nvec, const Memory::Arbiter& vec, const Memory::Arbiter& vi)
32 {
34 {
36 exec_generic<DT_, IT_, block_size_>(boff, nidx, idx, buf, nvec, vec, vi);
37 break;
38
40#ifdef FEAT_HAVE_MKL
41 Backend::warn_missing("LAFEM::Arch::MirrorSparseBlockGather::exec");
42 exec_generic<DT_, IT_, block_size_>(boff, nidx, idx, buf, nvec, vec, vi);
43#else
44 XABORTM("LAFEM::Arch::MirrorSparseBlockGather::exec: MKL backend not available!");
45#endif
46 break;
47
49 XABORTM("LAFEM::Arch::MirrorSparseBlockGather::exec: CUDA backend not available!");
50 break;
51
52 default:
53 XABORTM("LAFEM::Arch::MirrorSparseBlockGather::exec: unknown backend!");
54 break;
55 }
56 }
57 }; // struct MirrorSparseBlockGather
58} // namespace FEAT::LAFEM::Arch
59
60#ifndef __CUDACC__
61#define KERNEL_LAFEM_ARCH_MIRROR_SPARSE_BLOCK_GATHER_HPP 1
62#include <kernel/lafem/arch/mirror_sparse_block_gather_generic.hpp>
63#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.
@ read
read-only access
@ write
write-only access (see attention note above)
std::uint64_t Index
Index data type.