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