FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
axpy_block.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 struct AxpyBlock
17 {
18 template <typename ValueType_>
19 static void exec_generic_impl(ValueType_ * r, const ValueType_ alpha, const ValueType_ * const x, const Index size);
20
21 template<typename ValueType_>
22 static void exec_generic(Memory::Arbiter& r, const ValueType_ alpha, const Memory::Arbiter& x, const Index size)
23 {
26 exec_generic_impl(r_view.get_w(), alpha, x_view.get_r(), size);
27 }
28
29 template<typename ValueType_>
30 static void exec(Memory::Arbiter& r, const ValueType_ alpha, const Memory::Arbiter& x, const Index size)
31 {
33 {
35 exec_generic<ValueType_>(r, alpha, x, size);
36 break;
37
39#ifdef FEAT_HAVE_MKL
40 Backend::warn_missing("LAFEM::Arch::AxpyBlock::exec");
41 exec_generic<ValueType_>(r, alpha, x, size);
42#else
43 XABORTM("LAFEM::Arch::AxpyBlock::exec: MKL backend not available!");
44#endif
45 break;
46
48 XABORTM("LAFEM::Arch::AxpyBlock::exec: CUDA backend not available!");
49 break;
50
51 default:
52 XABORTM("LAFEM::Arch::AxpyBlock::exec: unknown backend!");
53 break;
54 }
55 }
56 }; // struct AxpyBlock
57} // namespace FEAT::LAFEM::Arch
58
59#ifndef __CUDACC__
60#define KERNEL_LAFEM_ARCH_AXPY_BLOCK_HPP 1
61#include <kernel/lafem/arch/axpy_block_generic.hpp>
62#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
@ overlap
explicitly allow overlapping writes (see Overlapping Memory Views)
@ read
read-only access
std::uint64_t Index
Index data type.
for 0 <= i < n, 0 <= k < blocksize: r[i][k] <- r[i][k] + alpha[k]*x[i][k]
Definition: axpy_block.hpp:17