FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
dot_product.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#ifndef KERNEL_LAFEM_ARCH_DOT_PRODUCT_HPP
8#define KERNEL_LAFEM_ARCH_DOT_PRODUCT_HPP 1
9
10// includes, FEAT
12#include <kernel/backend.hpp>
13#include <kernel/util/half.hpp>
14
15namespace FEAT
16{
17 namespace LAFEM
18 {
19 namespace Arch
20 {
22 {
23 template <typename DT_>
24 static DT_ value(const DT_ * const x, const DT_ * const y, const Index size)
25 {
26 return value_generic(x, y, size);
27 }
28
29 template <typename ValueType_>
30 static ValueType_ value_blocked(const ValueType_ * const x, const ValueType_ * const y, const Index size)
31 {
32 return value_blocked_generic(x, y, size);
33 }
34
35#ifdef FEAT_HAVE_HALFMATH
36 static Half value(const Half * const x, const Half * const y, const Index size)
37 {
38 BACKEND_SKELETON_RETURN(value_cuda, value_generic, value_generic, x, y, size)
39 }
40#endif
41
42 static float value(const float * const x, const float * const y, const Index size)
43 {
44 BACKEND_SKELETON_RETURN(value_cuda, value_mkl, value_generic, x, y, size)
45 }
46
47 static double value(const double * const x, const double * const y, const Index size)
48 {
49 BACKEND_SKELETON_RETURN(value_cuda, value_mkl, value_generic, x, y, size)
50 }
51
52 template <typename DT_>
53 static DT_ value_generic(const DT_ * const x, const DT_ * const y, const Index size);
54
55 template <typename ValueType_>
56 static ValueType_ value_blocked_generic(const ValueType_ * const x, const ValueType_ * const y, const Index size);
57
58 static float value_mkl(const float * const x, const float * const y, const Index size);
59 static double value_mkl(const double * const x, const double * const y, const Index size);
60
61 template <typename DT_>
62 static DT_ value_cuda(const DT_ * const x, const DT_ * const y, const Index size);
63 };
64
65#ifdef FEAT_EICKT
66 extern template float DotProduct::value_generic(const float * const, const float * const, const Index);
67 extern template double DotProduct::value_generic(const double * const, const double * const, const Index);
68#endif
69
71 {
72 template <typename DT_>
73 static DT_ value(const DT_ * const x, const DT_ * const y, const DT_ * const z, const Index size)
74 {
75 return value_generic(x, y, z, size);
76 }
77
78 template <typename ValueType_>
79 static ValueType_ value_blocked(const ValueType_ * const x, const ValueType_ * const y, const ValueType_ * const z, const Index size)
80 {
81 return value_blocked_generic(x, y, z, size);
82 }
83
84#ifdef FEAT_HAVE_HALFMATH
85 static Half value(const Half * const x, const Half * const y, const Half * const z, const Index size)
86 {
87 BACKEND_SKELETON_RETURN(value_cuda, value_generic, value_generic, x, y, z, size)
88 }
89#endif
90
91 static float value(const float * const x, const float * const y, const float * const z, const Index size)
92 {
93 BACKEND_SKELETON_RETURN(value_cuda, value_mkl, value_generic, x, y, z, size)
94 }
95
96 static double value(const double * const x, const double * const y, const double * const z, const Index size)
97 {
98 BACKEND_SKELETON_RETURN(value_cuda, value_mkl, value_generic, x, y, z, size)
99 }
100
101 template <typename DT_>
102 static DT_ value_generic(const DT_ * const x, const DT_ * const y, const DT_ * const z, const Index size);
103
104 template <typename ValueType_>
105 static ValueType_ value_blocked_generic(const ValueType_ * const x, const ValueType_ * const y, const ValueType_ * const z, const Index size);
106
107 static float value_mkl(const float * const x, const float * const y, const float * const z, const Index size);
108 static double value_mkl(const double * const x, const double * const y, const double * const z, const Index size);
109
110 template <typename DT_>
111 static DT_ value_cuda(const DT_ * const x, const DT_ * const y, const DT_ * const z, const Index size);
112 };
113
114#ifdef FEAT_EICKT
115 extern template float TripleDotProduct::value_generic(const float * const, const float * const, const float * const, const Index);
116 extern template double TripleDotProduct::value_generic(const double * const, const double * const, const double * const, const Index);
117#endif
118 } // namespace Arch
119 } // namespace LAFEM
120} // namespace FEAT
121
122#ifndef __CUDACC__
123#include <kernel/lafem/arch/dot_product_generic.hpp>
124#endif
125#endif // KERNEL_LAFEM_ARCH_DOT_PRODUCT_HPP
FEAT Kernel base header.
FEAT namespace.
Definition: adjactor.hpp:12
__half Half
Half data type.
Definition: half.hpp:25
@ value
specifies whether the space should supply basis function values
std::uint64_t Index
Index data type.