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 ScalarOp * scalarOpA,
222 const ScalarOp * scalarOpB,
223 const size_type * stridea,
224 const size_type * strideb,
225 const size_type * stridec,
226 const size_type * m,
227 const size_type * n,
228 const size_type * k,
229 const ValueType1 * dA,
230 const ValueType2 * dB,
233
256 template <typename ValueType1,
257 typename ValueType2,
258 typename dftefe::utils::MemorySpace memorySpace>
259 void
260 khatriRaoProduct(const Layout layout,
261 size_type sizeI,
262 size_type sizeJ,
263 size_type sizeK,
264 const ValueType1 * A,
265 const ValueType2 * B,
268
269
292 template <typename ValueType1,
293 typename ValueType2,
294 typename dftefe::utils::MemorySpace memorySpace>
295 void
297 size_type sizeI,
298 size_type sizeJ,
299 size_type sizeK,
300 const ValueType1 * A,
301 const ValueType2 * B,
304
305
315 template <typename ValueType1,
316 typename ValueType2,
317 typename dftefe::utils::MemorySpace memorySpace>
318 void
321 ValueType1 const * x,
323 const ValueType2 * y,
326
336 template <typename ValueType1,
337 typename ValueType2,
338 typename dftefe::utils::MemorySpace memorySpace>
339 void
340 axpbyBlocked(const size_type n,
341 const size_type blockSize,
343 const ValueType1 * x,
345 const ValueType2 * y,
348
349
350 template <typename ValueType1,
351 typename ValueType2,
352 typename dftefe::utils::MemorySpace memorySpace>
354 dot(size_type n,
355 ValueType1 const * x,
356 size_type incx,
357 ValueType2 const * y,
358 size_type incy,
360
361
379 template <typename ValueType1,
380 typename ValueType2,
381 typename dftefe::utils::MemorySpace memorySpace>
382 void
384 size_type numVec,
385 const ValueType1 * multiVecDataX,
386 const ValueType2 * multiVecDataY,
387 const ScalarOp & opX,
388 const ScalarOp & opY,
389 scalar_type<ValueType1, ValueType2> *multiVecDotProduct,
391
392
393 template <typename ValueType,
394 typename dftefe::utils::MemorySpace memorySpace>
396 nrm2(size_type n,
397 ValueType const * x,
398 size_type incx,
400
410 template <typename ValueType,
411 typename dftefe::utils::MemorySpace memorySpace>
412 std::vector<double>
414 size_type numVec,
415 ValueType const * multiVecData,
417
418 template <typename ValueType1,
419 typename ValueType2,
420 typename dftefe::utils::MemorySpace memorySpace>
421 void
422 gemm(Layout layout,
423 Op transA,
424 Op transB,
425 size_type m,
426 size_type n,
427 size_type k,
429 ValueType1 const * dA,
430 size_type ldda,
431 ValueType2 const * dB,
432 size_type lddb,
435 size_type lddc,
437
444 template <typename ValueType1,
445 typename ValueType2,
446 typename dftefe::utils::MemorySpace memorySpace>
447 void
449 size_type numMats,
450 const Op * transA,
451 const Op * transB,
452 const size_type * stridea,
453 const size_type * strideb,
454 const size_type * stridec,
455 const size_type * m,
456 const size_type * n,
457 const size_type * k,
459 const ValueType1 * dA,
460 const size_type * ldda,
461 const ValueType2 * dB,
462 const size_type * lddb,
465 const size_type * lddc,
467
468
472 template <typename ValueType,
473 typename dftefe::utils::MemorySpace memorySpace>
475 inverse(size_type n, ValueType *A, LinAlgOpContext<memorySpace> &context);
476
480 template <typename ValueType,
481 typename dftefe::utils::MemorySpace memorySpace>
483 trtri(Uplo uplo,
484 Diag diag,
485 size_type n,
486 ValueType * A,
487 size_type lda,
489
493 template <typename ValueType,
494 typename dftefe::utils::MemorySpace memorySpace>
496 potrf(Uplo uplo,
497 size_type n,
498 ValueType * A,
499 size_type lda,
501
505 template <typename ValueType,
506 typename dftefe::utils::MemorySpace memorySpace>
508 steqr(Job jobz,
509 size_type n,
512 ValueType * Z,
513 size_type ldz,
515
519 template <typename ValueType,
520 typename dftefe::utils::MemorySpace memorySpace>
522 heevd(Job jobz,
523 Uplo uplo,
524 size_type n,
525 ValueType * A,
526 size_type lda,
529
533 template <typename ValueType,
534 typename dftefe::utils::MemorySpace memorySpace>
536 hegv(size_type itype,
537 Job jobz,
538 Uplo uplo,
539 size_type n,
540 ValueType * A,
541 size_type lda,
542 ValueType * B,
543 size_type ldb,
546
551 template <typename ValueType,
552 typename dftefe::utils::MemorySpace memorySpace>
554 gesv(size_type n,
555 size_type nrhs,
556 ValueType * A,
557 size_type lda,
558 LapackInt * ipiv,
559 ValueType * B,
560 size_type ldb,
562
563 } // namespace blasLapack
564 } // namespace linearAlgebra
565} // namespace dftefe
566
567#include "BlasLapack.t.cpp"
568#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:213
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:411
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:285
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:678
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:196
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:591
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:308
LapackError potrf(Uplo uplo, size_type n, ValueType *A, size_type lda, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:565
void axpbyBlocked(const size_type n, const size_type blockSize, 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:247
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:324
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:647
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:231
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:338
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:265
LapackError trtri(Uplo uplo, Diag diag, size_type n, ValueType *A, size_type lda, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:538
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
void scaleStridedVarBatched(const size_type numMats, 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 heevd(Job jobz, Uplo uplo, size_type n, ValueType *A, size_type lda, real_type< ValueType > *W, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:619
lapack::Job Job
Definition: BlasLapackTypedef.h:49
LapackError inverse(size_type n, ValueType *A, LinAlgOpContext< memorySpace > &context)
Definition: BlasLapack.t.cpp:512
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