DFT-EFE
 
Loading...
Searching...
No Matches
ElpaScalapackOperations.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#ifndef elpaScalapackOperations_h
23#define elpaScalapackOperations_h
24
25#include "ProcessGrid.h"
26#include "ScalapackWrapper.h"
27#include <elpa/elpa.h>
28#include <unordered_map>
29#include <iostream>
30#include "LinAlgOpContext.h"
31
32namespace dftefe
33{
34 namespace linearAlgebra
35 {
36 namespace elpaScalaOpInternal
37 {
46 void
48 const utils::mpi::MPIComm & mpi_communicator,
49 utils::mpi::MPIComm & processGridCommunicatorActive,
50 const std::shared_ptr<const ProcessGrid> &processGrid,
51 const size_type na,
52 const size_type nev,
53 const size_type blockSize,
54 elpa_t & elpaHandle,
55 const bool useELPADeviceKernel = false);
56
61 void
63 const utils::mpi::MPIComm & mpi_communicator,
64 const size_type size,
65 std::shared_ptr<const ProcessGrid> &processGrid,
66 const size_type scalapackParalProcs,
67 const bool useELPA,
68 const bool useOnlyThumbRule = false);
69
74 void
76 const utils::mpi::MPIComm & mpi_communicator,
77 const size_type sizeRows,
78 const size_type sizeColumns,
79 std::shared_ptr<const ProcessGrid> &processGrid);
80
81
85 template <typename T>
86 void
88 const std::shared_ptr<const ProcessGrid> &processGrid,
89 const ScaLAPACKMatrix<T> & mat,
90 std::unordered_map<size_type, size_type> &globalToLocalRowIdMap,
91 std::unordered_map<size_type, size_type> &globalToLocalColumnIdMap);
92
97 template <typename T>
98 void
99 scaleScaLAPACKMat(const std::shared_ptr<const ProcessGrid> &processGrid,
100 /*const std::shared_ptr<
101 linearAlgebra::BLASWrapper<utils::MemorySpace::HOST>>
102 & BLASWrapperPtr,*/
103 ScaLAPACKMatrix<T> &mat,
104 const T scalar);
105
115 template <typename T>
116 void
118 const T *X,
119 /*const std::shared_ptr<
120 linearAlgebra::BLASWrapper<utils::MemorySpace::HOST>>
121 & BLASWrapperPtr,*/
122 const size_type XLocalSize,
123 const size_type numberVectors,
124 const std::shared_ptr<const ProcessGrid> &processGrid,
125 const utils::mpi::MPIComm & mpiComm,
126 const size_type wfcBlockSize,
127 ScaLAPACKMatrix<T> & overlapMatPar);
128
138 template <typename ValueType, typename utils::MemorySpace memorySpace>
139 void
141 ValueType * X,
142 const size_type M,
143 const size_type N,
144 /*std::shared_ptr<
145 linearAlgebra::BLASWrapper<memorySpace>> &BLASWrapperPtr,*/
146 const std::shared_ptr<const ProcessGrid> &processGrid,
147 const utils::mpi::MPIComm & mpiCommDomain,
148 LinAlgOpContext<memorySpace> & linAlgOpContext,
149 const ScaLAPACKMatrix<ValueType> & rotationMatPar,
150 const size_type subspaceRotDofsBlockSize,
151 const size_type wfcBlockSize,
152 const bool rotationMatTranspose = false,
153 const bool isRotationMatLowerTria = false);
154
155 } // namespace elpaScalaOpInternal
156 } // namespace linearAlgebra
157} // namespace dftefe
159#endif
void scaleScaLAPACKMat(const std::shared_ptr< const ProcessGrid > &processGrid, ScaLAPACKMatrix< T > &mat, const T scalar)
scale a ScaLAPACKMat with a scalar
Definition: ElpaScalapackOperations.t.cpp:56
void createProcessGridSquareMatrix(const utils::mpi::MPIComm &mpi_communicator, const size_type size, std::shared_ptr< const ProcessGrid > &processGrid, const size_type scalapackParalProcs, const bool useELPA, const bool useOnlyThumbRule)
Wrapper function to create a two dimensional processor grid for a square matrix in ScaLAPACKMatrix st...
Definition: ElpaScalapackOperations.cpp:243
void createGlobalToLocalIdMapsScaLAPACKMat(const std::shared_ptr< const ProcessGrid > &processGrid, const ScaLAPACKMatrix< T > &mat, std::unordered_map< size_type, size_type > &globalToLocalRowIdMap, std::unordered_map< size_type, size_type > &globalToLocalColumnIdMap)
Creates global row/column id to local row/column ids for ScaLAPACKMatrix.
Definition: ElpaScalapackOperations.t.cpp:36
void fillParallelOverlapMatrix(const T *X, const size_type XLocalSize, const size_type numberVectors, const std::shared_ptr< const ProcessGrid > &processGrid, const utils::mpi::MPIComm &mpiComm, const size_type wfcBlockSize, ScaLAPACKMatrix< T > &overlapMatPar)
Computes Sc=X^{T}*Xc and stores in a parallel ScaLAPACK matrix. X^{T} is the subspaceVectorsArray sto...
Definition: ElpaScalapackOperations.t.cpp:70
void subspaceRotation(ValueType *X, const size_type M, const size_type N, const std::shared_ptr< const ProcessGrid > &processGrid, const utils::mpi::MPIComm &mpiCommDomain, LinAlgOpContext< memorySpace > &linAlgOpContext, const ScaLAPACKMatrix< ValueType > &rotationMatPar, const size_type subspaceRotDofsBlockSize, const size_type wfcBlockSize, const bool rotationMatTranspose=false, const bool isRotationMatLowerTria=false)
Computes X^{T}=Q*X^{T} inplace. X^{T} is the subspaceVectorsArray stored in the column major format (...
Definition: ElpaScalapackOperations.t.cpp:187
void setupELPAHandleParameters(const utils::mpi::MPIComm &mpi_communicator, utils::mpi::MPIComm &processGridCommunicatorActive, const std::shared_ptr< const ProcessGrid > &processGrid, const size_type na, const size_type nev, const size_type blockSize, elpa_t &elpaHandle, const bool useELPADeviceKernel)
Contains internal functions used in linearAlgebra.
Definition: ElpaScalapackOperations.cpp:35
void createProcessGridRectangularMatrix(const utils::mpi::MPIComm &mpi_communicator, const size_type sizeRows, const size_type sizeColumns, std::shared_ptr< const ProcessGrid > &processGrid)
Wrapper function to create a two dimensional processor grid for a rectangular matrix in ScaLAPACKMatr...
Definition: ElpaScalapackOperations.cpp:284
int MPIComm
Definition: MPITypes.h:84
dealii includes
Definition: AtomFieldDataSpherical.cpp:31
unsigned int size_type
Definition: TypeConfig.h:8