FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
triple_dot_product_dense.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_>
18 static DT_ exec_generic_impl(const DT_ * const x, const DT_ * const y, const DT_ * const z, const Index size);
19
20 template <typename DT_>
21 static DT_ exec_cuda_impl(const DT_ * const x, const DT_ * const y, const DT_ * const z, const Index size);
22
23 template <typename DT_>
24 static DT_ exec_generic(const Memory::Arbiter& x, const Memory::Arbiter& y, const Memory::Arbiter& z, const Index size)
25 {
29 return exec_generic_impl(x_view.get_r(), y_view.get_r(), z_view.get_r(), size);
30 }
31
32 template <typename DT_>
33 static DT_ exec_cuda(const Memory::Arbiter& x, const Memory::Arbiter& y, const Memory::Arbiter& z, const Index size)
34 {
38 return exec_cuda_impl(x_view.get_r(), y_view.get_r(), z_view.get_r(), size);
39 }
40
41 template <typename DT_>
42 static DT_ exec(const Memory::Arbiter& x, const Memory::Arbiter& y, const Memory::Arbiter& z, const Index size)
43 {
45 {
47 return exec_generic<DT_>(x, y, z, size);
48 break;
49
51#ifdef FEAT_HAVE_MKL
52 Backend::warn_missing("LAFEM::Arch::TripleDotProductDense::exec");
53 return exec_generic<DT_>(x, y, z, size);
54#else
55 XABORTM("LAFEM::Arch::TripleDotProductDense::exec: MKL backend not available!");
56#endif
57 break;
58
60#ifdef FEAT_HAVE_CUDA
61 return exec_cuda<DT_>(x, y, z, size);
62#else
63 XABORTM("LAFEM::Arch::TripleDotProductDense::exec: CUDA backend not available!");
64#endif
65 break;
66
67 default:
68 XABORTM("LAFEM::Arch::TripleDotProductDense::exec: unknown backend!");
69 break;
70 }
71 }
72 };
73
74#ifdef FEAT_EICKT
75 extern template float TripleDotProductDense::exec_generic_impl(const float * const, const float * const, const float * const, const Index);
76 extern template double TripleDotProductDense::exec_generic_impl(const double * const, const double * const, const double * const, const Index);
77#endif
78} // namespace FEAT::LAFEM::Arch
79
80#ifndef __CUDACC__
81#define KERNEL_LAFEM_ARCH_TRIPLE_DOT_PRODUCT_DENSE_HPP 1
82#include <kernel/lafem/arch/triple_dot_product_dense_generic.hpp>
83#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.