DFT-EFE
 
Loading...
Searching...
No Matches
BlasLapack.h
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (c) 2021. *
3 * The Regents of the University of Michigan and DFT-EFE developers. *
4 * *
5 * This file is part of the DFT-EFE code. *
6 * *
7 * DFT-EFE is free software: you can redistribute it and/or modify *
8 * it under the terms of the Lesser GNU General Public License as *
9 * published by the Free Software Foundation, either version 3 of *
10 * the License, or (at your option) any later version. *
11 * *
12 * DFT-EFE is distributed in the hope that it will be useful, but *
13 * WITHOUT ANY WARRANTY; without even the implied warranty *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
15 * See the Lesser GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU Lesser General Public *
18 * License at the top level of DFT-EFE distribution. If not, see *
19 * <https://www.gnu.org/licenses/>. *
20 ******************************************************************************/
21
22/*
23 * @author Vishal Subramanian, Avirup Sircar
24 */
25
26#ifndef dftefeBlasWrappers_h
27#define dftefeBlasWrappers_h
28
32#include <utils/TypeConfig.h>
33
34namespace dftefe
35{
36 namespace linearAlgebra
37 {
38 namespace blasLapack
39 {
40 template <typename ValueType,
41 typename dftefe::utils::MemorySpace memorySpace>
44 ValueType const * x,
45 size_type incx,
47
48 template <typename ValueType,
49 typename dftefe::utils::MemorySpace memorySpace>
52 ValueType const * x,
53 size_type incx,
55
65 template <typename ValueType,
66 typename dftefe::utils::MemorySpace memorySpace>
67 std::vector<double>
69 size_type numVec,
70 ValueType const * multiVecData,
72
73
74 template <typename ValueType1,
75 typename ValueType2,
76 typename dftefe::utils::MemorySpace memorySpace>
77 void
80 ValueType1 const * x,
81 size_type incx,
82 ValueType2 * y,
83 size_type incy,
85
86 // i have neglected incx & incy parameters
98 template <typename ValueType1,
99 typename ValueType2,
100 typename dftefe::utils::MemorySpace memorySpace>
101 void
103 const ValueType1 alpha,
104 ValueType2 const * x,
107
108
116 template <typename ValueType1,
117 typename ValueType2,
118 typename dftefe::utils::MemorySpace memorySpace>
119 void
121 ValueType1 alpha,
122 const ValueType2 * x,
125
126
134 template <typename ValueType1,
135 typename ValueType2,
136 typename dftefe::utils::MemorySpace memorySpace>
137 void
139 const ValueType1 * x,
140 const ValueType2 * y,
143
144 // /*
145 // * @brief Template for performing \f$ blockedOutput_ij = blockedInput_ij * singleVectorInput_i$
146 // * @param[in] size size of the blocked Input array
147 // * @param[in] numComponets no of componets
148 // * @param[in] blockedInput blocked array
149 // * @param[in] singleVectorInput array
150 // * @param[out] blockedOutput blocked array
151 // */
152 // template <typename ValueType1,
153 // typename ValueType2,
154 // typename dftefe::utils::MemorySpace memorySpace>
155 // void
156 // blockedHadamardProduct(const size_type n,
157 // const size_type blockSize,
158 // const ValueType1 * blockedInput,
159 // const ValueType2 * singleVectorInput,
160 // scalar_type<ValueType1, ValueType2> *blockedOutput,
161 // LinAlgOpContext<memorySpace> & context);
162
163
179 template <typename ValueType1,
180 typename ValueType2,
181 typename dftefe::utils::MemorySpace memorySpace>
182 void
184 const ValueType1 * x,
185 const ValueType2 * y,
186 const ScalarOp & opx,
187 const ScalarOp & opy,
190
216 template <typename ValueType1,
217 typename ValueType2,
218 dftefe::utils::MemorySpace memorySpace>
219 void
220 scaleStridedVarBatched(const size_type numMats,
221 const Layout layout,
222 const ScalarOp & scalarOpA,
223 const ScalarOp & scalarOpB,
224 const size_type * stridea,
225 const size_type * strideb,
226 const size_type * stridec,
227 const size_type * m,
228 const size_type * n,
229 const size_type * k,
230 const ValueType1 * dA,
231 const ValueType2 * dB,
234
257 template <typename ValueType1,
258 typename ValueType2,
259 typename dftefe::utils::MemorySpace memorySpace>
260 void
261 khatriRaoProduct(const Layout layout,
262 size_type sizeI,
263 size_type sizeJ,
264 size_type sizeK,
265 const ValueType1 * A,
266 const ValueType2 * B,
269
270
293 template <typename ValueType1,
294 typename ValueType2,
295 typename dftefe::utils::MemorySpace memorySpace>
296 void
298 size_type sizeI,
299 size_type sizeJ,
300 size_type sizeK,
301 const ValueType1 * A,
302 const ValueType2 * B,
305
306
316 template <typename ValueType1,
317 typename ValueType2,
318 typename dftefe::utils::MemorySpace memorySpace>
319 void
322 ValueType1 const * x,
324 const ValueType2 * y,
327
337 template <typename ValueType1,
338 typename ValueType2,
339 typename dftefe::utils::MemorySpace memorySpace>
340 void
341 axpbyBlocked(const size_type n,
342 const size_type blockSize,
345 const ValueType1 * x,
348 const ValueType2 * y,
351
352
353 template <typename ValueType1,
354 typename ValueType2,
355 typename dftefe::utils::MemorySpace memorySpace>
357 dot(size_type n,
358 ValueType1 const * x,
359 size_type incx,
360 ValueType2 const * y,
361 size_type incy,
363
364
382 template <typename ValueType1,
383 typename ValueType2,
384 typename dftefe::utils::MemorySpace memorySpace>
385 void
387 size_type numVec,
388 const ValueType1 * multiVecDataX,
389 const ValueType2 * multiVecDataY,
390 const ScalarOp & opX,
391 const ScalarOp & opY,
392 scalar_type<ValueType1, ValueType2> *multiVecDotProduct,
394
395
396 template <typename ValueType,
397 typename dftefe::utils::MemorySpace memorySpace>
399 nrm2(size_type n,
400 ValueType const * x,
401 size_type incx,
403
413 template <typename ValueType,
414 typename dftefe::utils::MemorySpace memorySpace>
415 std::vector<double>
417 size_type numVec,
418 ValueType const * multiVecData,
420
421 template <typename ValueType1,
422 typename ValueType2,
423 typename dftefe::utils::MemorySpace memorySpace>
424 void
425 gemm(Layout layout,
426 Op transA,
427 Op transB,
428 size_type m,
429 size_type n,
430 size_type k,
432 ValueType1 const * dA,
433 size_type ldda,
434 ValueType2 const * dB,
435 size_type lddb,
438 size_type lddc,
440
447 template <typename ValueType1,
448 typename ValueType2,
449 typename dftefe::utils::MemorySpace memorySpace>
450 void
452 size_type numMats,
453 const Op * transA,
454 const Op * transB,
455 const size_type * stridea,
456 const size_type * strideb,
457 const size_type * stridec,
458 const size_type * m,
459 const size_type * n,
460 const size_type * k,
462 const ValueType1 * dA,
463 const size_type * ldda,
464 const ValueType2 * dB,
465 const size_type * lddb,
468 const size_type * lddc,
470
471
475 template <typename ValueType,
476 typename dftefe::utils::MemorySpace memorySpace>
478 inverse(size_type n, ValueType *A, LinAlgOpContext<memorySpace> &context);
479
483 template <typename ValueType,
484 typename dftefe::utils::MemorySpace memorySpace>
486 trtri(Uplo uplo,
487 Diag diag,
488 size_type n,
489 ValueType * A,
490 size_type lda,
492
496 template <typename ValueType,
497 typename dftefe::utils::MemorySpace memorySpace>
499 potrf(Uplo uplo,
500 size_type n,
501 ValueType * A,
502 size_type lda,
504
508 template <typename ValueType,
509 typename dftefe::utils::MemorySpace memorySpace>
511 steqr(Job jobz,
512 size_type n,
515 ValueType * Z,
516 size_type ldz,
518
522 template <typename ValueType,
523 typename dftefe::utils::MemorySpace memorySpace>
525 heevd(Job jobz,
526 Uplo uplo,
527 size_type n,
528 ValueType * A,
529 size_type lda,
532
536 template <typename ValueType,
537 typename dftefe::utils::MemorySpace memorySpace>
539 hegv(size_type itype,
540 Job jobz,
541 Uplo uplo,
542 size_type n,
543 ValueType * A,
544 size_type lda,
545 ValueType * B,
546 size_type ldb,
549
554 template <typename ValueType,
555 typename dftefe::utils::MemorySpace memorySpace>
557 gesv(size_type n,
558 size_type nrhs,
559 ValueType * A,
560 size_type lda,
561 LapackInt * ipiv,
562 ValueType * B,
563 size_type ldb,
565
566 } // namespace blasLapack
567 } // namespace linearAlgebra
568} // namespace dftefe
569
570#include "BlasLapack.t.cpp"
571#endif // dftefeBlasWrappers_h
Definition: LinAlgOpContext.h:38
void transposedKhatriRaoProduct(const Layout layout, const size_type sizeI, const size_type sizeJ, const size_type sizeK, const ValueType1 *A, const ValueType2 *B, scalar_type< ValueType1, ValueType2 > *Z, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:215
real_type< ValueType > amax(size_type n, ValueType const *x, size_type incx, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:31
blas::Diag Diag
Definition: BlasLapackTypedef.h:44
void gemmStridedVarBatched(const Layout layout, const size_type numMats, const Op *transA, const Op *transB, const size_type *stridea, const size_type *strideb, const size_type *stridec, const size_type *m, const size_type *n, const size_type *k, const scalar_type< ValueType1, ValueType2 > alpha, const ValueType1 *dA, const size_type *ldda, const ValueType2 *dB, const size_type *lddb, const scalar_type< ValueType1, ValueType2 > beta, scalar_type< ValueType1, ValueType2 > *dC, const size_type *lddc, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:415
void dotMultiVector(const size_type vecSize, const size_type numVec, const ValueType1 *multiVecDataX, const ValueType2 *multiVecDataY, const ScalarOp &opX, const ScalarOp &opY, scalar_type< ValueType1, ValueType2 > *multiVecDotProduct, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:289
LapackError gesv(size_type n, size_type nrhs, ValueType *A, size_type lda, LapackInt *ipiv, ValueType *B, size_type ldb, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:682
void hadamardProduct(size_type n, const ValueType1 *x, const ValueType2 *y, scalar_type< ValueType1, ValueType2 > *z, LinAlgOpContext< memorySpace > &context)
Template for performing alpha z_i = x_i * y_i$.
Definition: BlasLapack.t.cpp:113
void axpy(size_type n, scalar_type< ValueType1, ValueType2 > alpha, ValueType1 const *x, size_type incx, ValueType2 *y, size_type incy, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:65
blas::Uplo Uplo
Definition: BlasLapackTypedef.h:45
blas::Layout Layout
Definition: BlasLapackTypedef.h:46
std::vector< double > amaxsMultiVector(size_type vecSize, size_type numVec, ValueType const *multiVecData, LinAlgOpContext< memorySpace > &context)
Template for computing norms of all the numVec vectors in a multi Vector.
Definition: BlasLapack.t.cpp:47
void khatriRaoProduct(const Layout layout, const size_type sizeI, const size_type sizeJ, const size_type sizeK, const ValueType1 *A, const ValueType2 *B, scalar_type< ValueType1, ValueType2 > *Z, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:198
blas::Op Op
Definition: BlasLapackTypedef.h:43
LapackError steqr(Job jobz, size_type n, real_type< ValueType > *D, real_type< ValueType > *E, ValueType *Z, size_type ldz, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:595
int64_t LapackInt
Definition: BlasLapackTypedef.h:53
real_type< ValueType > nrm2(const size_type n, ValueType const *x, const size_type incx, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:312
LapackError potrf(Uplo uplo, size_type n, ValueType *A, size_type lda, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:569
blas::scalar_type< ValueType1, ValueType2 > scalar_type
Definition: BlasLapackTypedef.h:70
std::vector< double > nrms2MultiVector(const size_type vecSize, const size_type numVec, const ValueType *multiVecData, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:328
LapackError hegv(size_type itype, Job jobz, Uplo uplo, size_type n, ValueType *A, size_type lda, ValueType *B, size_type ldb, real_type< ValueType > *W, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:651
real_type< ValueType > asum(size_type n, ValueType const *x, size_type incx, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:15
blas::real_type< ValueType > real_type
Definition: BlasLapackTypedef.h:64
void axpby(const size_type n, const scalar_type< ValueType1, ValueType2 > alpha, const ValueType1 *x, const scalar_type< ValueType1, ValueType2 > beta, const ValueType2 *y, scalar_type< ValueType1, ValueType2 > *z, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:233
void gemm(const Layout layout, const Op transA, const Op transB, const size_type m, const size_type n, const size_type k, const scalar_type< ValueType1, ValueType2 > alpha, ValueType1 const *dA, const size_type ldda, ValueType2 const *dB, const size_type lddb, const scalar_type< ValueType1, ValueType2 > beta, scalar_type< ValueType1, ValueType2 > *dC, const size_type lddc, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:342
scalar_type< ValueType1, ValueType2 > dot(const size_type n, ValueType1 const *x, const size_type incx, ValueType2 const *y, const size_type incy, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:269
void scaleStridedVarBatched(const size_type numMats, const Layout layout, const ScalarOp &scalarOpA, const ScalarOp &scalarOpB, const size_type *stridea, const size_type *strideb, const size_type *stridec, const size_type *m, const size_type *n, const size_type *k, const ValueType1 *dA, const ValueType2 *dB, scalar_type< ValueType1, ValueType2 > *dC, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:162
LapackError trtri(Uplo uplo, Diag diag, size_type n, ValueType *A, size_type lda, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:542
void reciprocalX(size_type n, const ValueType1 alpha, ValueType2 const *x, scalar_type< ValueType1, ValueType2 > *y, LinAlgOpContext< memorySpace > &context)
Template for computing the multiplicative inverse of all the elements of x, does not check if any ele...
Definition: BlasLapack.t.cpp:83
ScalarOp
Definition: BlasLapackTypedef.h:56
LapackError heevd(Job jobz, Uplo uplo, size_type n, ValueType *A, size_type lda, real_type< ValueType > *W, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:623
void axpbyBlocked(const size_type n, const size_type blockSize, const scalar_type< ValueType1, ValueType2 > alpha1, const scalar_type< ValueType1, ValueType2 > *alpha, const ValueType1 *x, const scalar_type< ValueType1, ValueType2 > beta1, const scalar_type< ValueType1, ValueType2 > *beta, const ValueType2 *y, scalar_type< ValueType1, ValueType2 > *z, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:249
lapack::Job Job
Definition: BlasLapackTypedef.h:49
LapackError inverse(size_type n, ValueType *A, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:516
void ascale(const size_type n, const ValueType1 alpha, const ValueType2 *x, scalar_type< ValueType1, ValueType2 > *z, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:97
MemorySpace
Definition: MemorySpaceType.h:37
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
unsigned int size_type
Definition: TypeConfig.h:8
Definition: LinearAlgebraTypes.h:113