FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
triple_dot_product_dense.cu
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// includes, FEAT
7#include <kernel/base_header.hpp>
8#include <kernel/lafem/arch/triple_dot_product_dense.hpp>
9#include <kernel/lafem/arch/dot_product_dense.hpp>
10#include <kernel/lafem/arch/component_product_dense.hpp>
11#include <kernel/util/exception.hpp>
12#include <kernel/util/cuda_util.hpp>
13#include <kernel/util/half.hpp>
14
15namespace FEAT::LAFEM::Arch
16{
17 template <typename DT_>
18 DT_ TripleDotProductDense::exec_cuda_impl(const DT_ * const x, const DT_ * const y, const DT_ * const z, const Index size)
19 {
20 DT_ * temp = (DT_*)Util::cuda_get_static_memory(size * sizeof(DT_));
21 ComponentProductDense::exec_cuda_impl(temp, y, z, size);
22 DT_ result = DotProductDense::exec_cuda_impl(x, temp, size);
23
24 #ifdef DEBUG
25 cudaDeviceSynchronize();
26 cudaError_t last_error(cudaGetLastError());
27 if (cudaSuccess != last_error)
28 throw InternalError(__func__, __FILE__, __LINE__, "CUDA error occurred in execution!\n" + stringify(cudaGetErrorString(last_error)));
29 #endif
30 return result;
31 }
32
33 #ifdef FEAT_HAVE_HALFMATH
34 template Half TripleDotProductDense::exec_cuda_impl(const Half * const x, const Half * const y, const Half * const z, const Index size);
35 #endif
36 template float TripleDotProductDense::exec_cuda_impl(const float * const x, const float * const y, const float * const z, const Index size);
37 template double TripleDotProductDense::exec_cuda_impl(const double * const x, const double * const y, const double * const z, const Index size);
38} // namespace FEAT::LAFEM::Arch