FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
norm2_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 Index size);
19
20 static float exec_mkl_impl(const float * const x, const Index size);
21 static double exec_mkl_impl(const double * const x, const Index size);
22
23 template <typename DT_>
24 static DT_ exec_mkl_impl(const DT_ * const, const Index)
25 {
26 XABORTM("LAFEM::Arch::Norm2Dense::exec_mkl_impl: MKL backend not available!");
27 }
28
29 template <typename DT_>
30 static DT_ exec_cuda_impl(const DT_ * const x, const Index size);
31
32 template <typename DT_>
33 static DT_ exec_generic(const Memory::Arbiter& x, const Index size)
34 {
36 return exec_generic_impl(x_view.get_r(), size);
37 }
38
39 template <typename DT_>
40 static DT_ exec_mkl(const Memory::Arbiter& x, const Index size)
41 {
43 return exec_mkl_impl(x_view.get_r(), size);
44 }
45
46 template <typename DT_>
47 static DT_ exec_cuda(const Memory::Arbiter& x, const Index size)
48 {
50 return exec_cuda_impl(x_view.get_r(), size);
51 }
52
53 template <typename DT_>
54 static DT_ exec(const Memory::Arbiter& x, const Index size)
55 {
57 {
59 return exec_generic<DT_>(x, size);
60 break;
61
63#ifdef FEAT_HAVE_MKL
64 return exec_mkl<DT_>(x, size);
65#else
66 XABORTM("LAFEM::Arch::Norm2Dense::exec: MKL backend not available!");
67#endif
68 break;
69
71#ifdef FEAT_HAVE_CUDA
72 return exec_cuda<DT_>(x, size);
73#else
74 XABORTM("LAFEM::Arch::Norm2Dense::exec: CUDA backend not available!");
75#endif
76 break;
77
78 default:
79 XABORTM("LAFEM::Arch::Norm2Dense::exec: unknown backend!");
80 break;
81 }
82 }
83 };
84
85#ifdef FEAT_EICKT
86 extern template float Norm2Dense::exec_generic_impl(const float * const, const Index);
87 extern template double Norm2Dense::exec_generic_impl(const double * const, const Index);
88#endif
89} // namespace FEAT::LAFEM::Arch
90
91#ifndef __CUDACC__
92#define KERNEL_LAFEM_ARCH_NORM2_DENSE_HPP 1
93#include <kernel/lafem/arch/norm2_dense_generic.hpp>
94#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
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.