ABACUS develop
Atomic-orbital Based Ab-initio Computation at UStc
Loading...
Searching...
No Matches
dist_bcd_matrix.h
Go to the documentation of this file.
1#ifndef DISTBCDMATRIX_H
2#define DISTBCDMATRIX_H
3
4#include <mpi.h>
5
7// a Block Cyclic Data Distribution matrix
8// http://www.netlib.org/utk/papers/factor/node3.html
9// local matrix elements is stored in column major
10// used for pexsi
11namespace pexsi
12{
14{
15 public:
16 DistBCDMatrix(MPI_Comm comm, MPI_Group group, int blacs_ctxt, int size, int nblk, int nrow, int ncol, char layout);
18
19 int globalRow(const int localRow);
20 int globalCol(const int localCol);
21 int localRow(const int globalRow, int& myprow);
22 int localCol(const int globalCol, int& mypcol);
23 int pnum(const int prow, const int pcol);
24
25 const MPI_Comm get_comm() const
26 {
27 return comm;
28 };
29 const MPI_Group get_group() const
30 {
31 return group;
32 };
33 const int get_nrow() const
34 {
35 return nrow;
36 };
37 const int get_ncol() const
38 {
39 return ncol;
40 };
41 const char get_layout() const
42 {
43 return layout;
44 };
45
46 private:
47 // MPI communicator
48 MPI_Comm comm;
49 MPI_Group group;
50
51 // blacs context
53
54 // row and column of process grid
55 int nprows;
56 int npcols;
57
58 // total number of processes
59 int nprocs;
60
61 // Matrix size
62 int size;
63
64 // block size
65 int nblk;
66
67 // row and c0lumn of Local matrix part
68 int nrow;
69 int ncol;
70
71 // current process row and column
72 int myprow;
73 int mypcol;
74
75 // current process id
76 int myproc;
77
79 // the local data layout
80 // 'R' or 'r' for row-major, which is used in C/C++
81 // 'C' or 'c' for column-major, which is used in Fortran
82 char layout;
83};
84} // namespace pexsi
85#endif // DISTBCDMATRIX_H
Definition dist_bcd_matrix.h:14
const MPI_Group get_group() const
Definition dist_bcd_matrix.h:29
int ncol
Definition dist_bcd_matrix.h:69
MPI_Comm comm
Definition dist_bcd_matrix.h:48
MPI_Group group
Definition dist_bcd_matrix.h:49
int npcols
Definition dist_bcd_matrix.h:56
int globalRow(const int localRow)
const MPI_Comm get_comm() const
Definition dist_bcd_matrix.h:25
int nblk
Definition dist_bcd_matrix.h:65
DistBCDMatrix(MPI_Comm comm, MPI_Group group, int blacs_ctxt, int size, int nblk, int nrow, int ncol, char layout)
char layout
Definition dist_bcd_matrix.h:82
int globalCol(const int localCol)
int nprocs
Definition dist_bcd_matrix.h:59
int mypcol
Definition dist_bcd_matrix.h:73
int nrow
Definition dist_bcd_matrix.h:68
const int get_nrow() const
Definition dist_bcd_matrix.h:33
int blacs_ctxt
Definition dist_bcd_matrix.h:52
int localRow(const int globalRow, int &myprow)
int localCol(const int globalCol, int &mypcol)
int pnum(const int prow, const int pcol)
const int get_ncol() const
Definition dist_bcd_matrix.h:37
int nprows
Definition dist_bcd_matrix.h:55
int myproc
Definition dist_bcd_matrix.h:76
const char get_layout() const
Definition dist_bcd_matrix.h:41
int * prowpcol2pnum
Definition dist_bcd_matrix.h:78
int myprow
Definition dist_bcd_matrix.h:72
int size
Definition dist_bcd_matrix.h:62
Definition dist_bcd_matrix.h:12