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.
7#include <kernel/base_header.hpp>
8#include <kernel/lafem/arch/axpy_dense.hpp>
9#include <kernel/util/assertion.hpp>
10#include <kernel/util/exception.hpp>
11#include <kernel/util/cuda_util.hpp>
12#include <kernel/util/half.hpp>
17namespace FEAT::LAFEM::Arch
19 template <typename DT_>
20 void AxpyDense::exec_cuda_impl(DT_ * r, const DT_ alpha, const DT_ * const x, const Index size)
24 if (typeid(DT_) == typeid(double))
29 else if (typeid(DT_) == typeid(float))
34#ifdef FEAT_HAVE_HALFMATH
35 else if (typeid(DT_) == typeid(Half))
43 XABORTM("unsupported data type");
46 cublasStatus_t status = cublasAxpyEx(Util::Intern::cublas_handle, int(size), &alpha, et, x, dt, 1, r, dt, 1, et);
49 if (status != CUBLAS_STATUS_SUCCESS)
50 throw InternalError(__func__, __FILE__, __LINE__, "cuda error: " + stringify(cublasGetStatusString(status)));
55#ifdef FEAT_HAVE_HALFMATH
56 template void AxpyDense::exec_cuda_impl(Half *, const Half, const Half * const, const Index);
58 template void AxpyDense::exec_cuda_impl(float *, const float, const float * const, const Index);
59 template void AxpyDense::exec_cuda_impl(double *, const double, const double * const, const Index);
60} // namespace FEAT::LAFEM::Arch