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/copy_stride.hpp>
9#include <kernel/util/exception.hpp>
10#include <kernel/util/cuda_util.hpp>
11#include <kernel/util/half.hpp>
16namespace FEAT::LAFEM::Arch
18 template <typename DT_>
19 void CopyStride::exec_cuda_impl(DT_ * r, const DT_ * const x, const int stride_r, const int comp_r, const int stride_x, const int comp_x, const Index count)
22 if (typeid(DT_) == typeid(double))
26 else if (typeid(DT_) == typeid(float))
30#ifdef FEAT_HAVE_HALFMATH
31 else if (typeid(DT_) == typeid(Half))
38 XABORTM("unsupported data type");
41 cublasStatus_t status = cublasCopyEx(Util::Intern::cublas_handle, int(count), &x[comp_x], dt, stride_x, &r[comp_r], dt, stride_r);
43 if (CUBLAS_STATUS_SUCCESS != status)
44 throw InternalError(__func__, __FILE__, __LINE__, "cuda error: " + stringify(cublasGetStatusString(status)));
49#ifdef FEAT_HAVE_HALFMATH
50 template void CopyStride::exec_cuda_impl(Half *, const Half * const, const int, const int, const int, const int, const Index);
52 template void CopyStride::exec_cuda_impl(float *, const float * const, const int, const int, const int, const int, const Index);
53 template void CopyStride::exec_cuda_impl(double *, const double * const, const int, const int, const int, const int, const Index);
55} // namespace FEAT::LAFEM::Arch