FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
scale_dense_mkl.cpp
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
8#include <kernel/lafem/arch/scale_dense.hpp>
9
10FEAT_DISABLE_WARNINGS
11#include <mkl.h>
12FEAT_RESTORE_WARNINGS
13
14namespace FEAT::LAFEM::Arch
15{
16 void ScaleDense::exec_mkl_impl(float * r, const float * const x, const float alpha, const Index size)
17 {
18 if (r == x)
19 {
20 cblas_sscal(static_cast<MKL_INT>(size), alpha, r, 1);
21 }
22 else
23 {
24 Memory::memcopy_main(r, x, size * sizeof(float));
25 cblas_sscal(static_cast<MKL_INT>(size), alpha, r, 1);
26 }
27 }
28
29 void ScaleDense::exec_mkl_impl(double * r, const double * const x, const double alpha, const Index size)
30 {
31 if (r == x)
32 {
33 cblas_dscal(static_cast<MKL_INT>(size), alpha, r, 1);
34 }
35 else
36 {
37 Memory::memcopy_main(r, x, size * sizeof(double));
38 cblas_dscal(static_cast<MKL_INT>(size), alpha, r, 1);
39 }
40 }
41} // namespace FEAT::LAFEM::Arch
FEAT Kernel base header.
void memcopy_main(void *dst, const void *src, std::size_t bytes)
Copies a region of a main memory block into another main memory block.
std::uint64_t Index
Index data type.