Expression Templates Library (ETL)
apxdbpy_3.hpp
Go to the documentation of this file.
1 //=======================================================================
2 // Copyright (c) 2014-2023 Baptiste Wicht
3 // Distributed under the terms of the MIT License.
4 // (See accompanying file LICENSE or copy at
5 // http://opensource.org/licenses/MIT)
6 //=======================================================================
7 
13 #pragma once
14 
15 #ifdef ETL_EGBLAS_MODE
16 
17 #include "etl/impl/cublas/cuda.hpp"
18 
19 #include <egblas.hpp>
20 
21 #endif
22 
23 namespace etl::impl::egblas {
24 
25 #ifdef EGBLAS_HAS_SAPXDBPY_3
26 static constexpr bool has_sapxdbpy_3 = true;
27 #else
28 static constexpr bool has_sapxdbpy_3 = false;
29 #endif
30 
40 inline void apxdbpy_3([[maybe_unused]] size_t n, [[maybe_unused]] float alpha, [[maybe_unused]] float* A, [[maybe_unused]] size_t lda, [[maybe_unused]] float beta, [[maybe_unused]] float* B, [[maybe_unused]] size_t ldb, [[maybe_unused]] float* C, [[maybe_unused]] size_t ldc) {
41 #ifdef EGBLAS_HAS_SAPXDBPY_3
42  inc_counter("egblas");
43  egblas_sapxdbpy_3(n, alpha, A, lda, beta, B, ldb, C, ldc);
44 #else
45  cpp_unreachable("Invalid call to egblas::apxdbpy_3");
46 #endif
47 }
48 
49 #ifdef EGBLAS_HAS_DAPXDBPY_3
50 static constexpr bool has_dapxdbpy_3 = true;
51 #else
52 static constexpr bool has_dapxdbpy_3 = false;
53 #endif
54 
64 inline void apxdbpy_3([[maybe_unused]] size_t n, [[maybe_unused]] double alpha, [[maybe_unused]] double* A, [[maybe_unused]] size_t lda, [[maybe_unused]] double beta, [[maybe_unused]] double* B, [[maybe_unused]] size_t ldb, [[maybe_unused]] double* C, [[maybe_unused]] size_t ldc) {
65 #ifdef EGBLAS_HAS_DAPXDBPY_3
66  inc_counter("egblas");
67  egblas_dapxdbpy_3(n, alpha, A, lda, beta, B, ldb, C, ldc);
68 #else
69  cpp_unreachable("Invalid call to egblas::apxdbpy_3");
70 #endif
71 }
72 
73 #ifdef EGBLAS_HAS_CAPXDBPY_3
74 static constexpr bool has_capxdbpy_3 = true;
75 #else
76 static constexpr bool has_capxdbpy_3 = false;
77 #endif
78 
88 inline void apxdbpy_3([[maybe_unused]] size_t n,
89  [[maybe_unused]] std::complex<float> alpha,
90  [[maybe_unused]] std::complex<float>* A,
91  [[maybe_unused]] size_t lda,
92  [[maybe_unused]] std::complex<float> beta,
93  [[maybe_unused]] std::complex<float>* B,
94  [[maybe_unused]] size_t ldb,
95  [[maybe_unused]] std::complex<float>* C,
96  [[maybe_unused]] size_t ldc) {
97 #ifdef EGBLAS_HAS_CAPXDBPY_3
98  inc_counter("egblas");
99  egblas_capxdbpy_3(n, complex_cast(alpha), reinterpret_cast<cuComplex*>(A), lda, complex_cast(beta), reinterpret_cast<cuComplex*>(B), ldb,
100  reinterpret_cast<cuComplex*>(C), ldc);
101 #else
102  cpp_unreachable("Invalid call to egblas::apxdbpy_3");
103 #endif
104 }
105 
115 inline void apxdbpy_3([[maybe_unused]] size_t n,
116  [[maybe_unused]] etl::complex<float> alpha,
117  [[maybe_unused]] etl::complex<float>* A,
118  [[maybe_unused]] size_t lda,
119  [[maybe_unused]] etl::complex<float> beta,
120  [[maybe_unused]] etl::complex<float>* B,
121  [[maybe_unused]] size_t ldb,
122  [[maybe_unused]] etl::complex<float>* C,
123  [[maybe_unused]] size_t ldc) {
124 #ifdef EGBLAS_HAS_CAPXDBPY_3
125  inc_counter("egblas");
126  egblas_capxdbpy_3(n, complex_cast(alpha), reinterpret_cast<cuComplex*>(A), lda, complex_cast(beta), reinterpret_cast<cuComplex*>(B), ldb,
127  reinterpret_cast<cuComplex*>(C), ldc);
128 #else
129  cpp_unreachable("Invalid call to egblas::apxdbpy");
130 #endif
131 }
132 
133 #ifdef EGBLAS_HAS_ZAPXDBPY_3
134 static constexpr bool has_zapxdbpy_3 = true;
135 #else
136 static constexpr bool has_zapxdbpy_3 = false;
137 #endif
138 
148 inline void apxdbpy_3([[maybe_unused]] size_t n,
149  [[maybe_unused]] std::complex<double> alpha,
150  [[maybe_unused]] std::complex<double>* A,
151  [[maybe_unused]] size_t lda,
152  [[maybe_unused]] std::complex<double> beta,
153  [[maybe_unused]] std::complex<double>* B,
154  [[maybe_unused]] size_t ldb,
155  [[maybe_unused]] std::complex<double>* C,
156  [[maybe_unused]] size_t ldc) {
157 #ifdef EGBLAS_HAS_ZAPXDBPY_3
158  inc_counter("egblas");
159  egblas_zapxdbpy_3(n, complex_cast(alpha), reinterpret_cast<cuDoubleComplex*>(A), lda, complex_cast(beta), reinterpret_cast<cuDoubleComplex*>(B), ldb,
160  reinterpret_cast<cuDoubleComplex*>(C), ldc);
161 #else
162  cpp_unreachable("Invalid call to egblas::apxdbpy_3");
163 #endif
164 }
165 
175 inline void apxdbpy_3([[maybe_unused]] size_t n,
176  [[maybe_unused]] etl::complex<double> alpha,
177  [[maybe_unused]] etl::complex<double>* A,
178  [[maybe_unused]] size_t lda,
179  [[maybe_unused]] etl::complex<double> beta,
180  [[maybe_unused]] etl::complex<double>* B,
181  [[maybe_unused]] size_t ldb,
182  [[maybe_unused]] etl::complex<double>* C,
183  [[maybe_unused]] size_t ldc) {
184 #ifdef EGBLAS_HAS_ZAPXDBPY_3
185  inc_counter("egblas");
186  egblas_zapxdbpy_3(n, complex_cast(alpha), reinterpret_cast<cuDoubleComplex*>(A), lda, complex_cast(beta), reinterpret_cast<cuDoubleComplex*>(B), ldb,
187  reinterpret_cast<cuDoubleComplex*>(C), ldc);
188 #else
189  cpp_unreachable("Invalid call to egblas::apxdbpy_3");
190 #endif
191 }
192 
193 } //end of namespace etl::impl::egblas
Complex number implementation.
Definition: complex.hpp:31
Definition: abs.hpp:23
void apxdbpy_3([[maybe_unused]] size_t n, [[maybe_unused]] float alpha, [[maybe_unused]] float *A, [[maybe_unused]] size_t lda, [[maybe_unused]] float beta, [[maybe_unused]] float *B, [[maybe_unused]] size_t ldb, [[maybe_unused]] float *C, [[maybe_unused]] size_t ldc)
Wrappers for single-precision egblas apxdbpy operation.
Definition: apxdbpy_3.hpp:40
void inc_counter([[maybe_unused]] const char *name)
Increase the given counter.
Definition: counters.hpp:25