26 const int* desca = mat_l.
desc;
31 if (myid == root_proc)
33 mat_g.
p.reset(
new T[nrows * ncols]);
37 mat_g.
p.reset(
new T[nrows * ncols]);
41 mat_g.
desc.reset(
new int[9]{1, ctxt, nrows, ncols, nrows, ncols, 0, 0, nrows});
46 Cpxgemr2d(nrows, ncols, mat_l.
p, 1, 1,
const_cast<int*
>(desca), mat_g.
p.get(), 1, 1, mat_g.
desc.get(), ctxt);
52 const int* desc_local = mat_l.
desc;
53 int ctxt = desc_local[1];
54 int nrows = desc_local[2];
55 int ncols = desc_local[3];
58 if (mat_g.
row !=
static_cast<size_t>(nrows) || mat_g.
col !=
static_cast<size_t>(ncols))
60 throw std::invalid_argument(
"module_rt::distributeMatrix: Global matrix size mismatch.");
64 Cpxgemr2d(nrows, ncols, mat_g.
p.get(), 1, 1, mat_g.
desc.get(), mat_l.
p, 1, 1,
const_cast<int*
>(desc_local), ctxt);
74 const int* desc_psi = wfc_layout.
desc();
75 int ctxt = desc_psi[1];
76 int nrows = desc_psi[2];
77 int ncols = desc_psi[3];
79 if (myid == root_proc)
81 psi_g.
p.reset(
new T[nrows * ncols]);
85 psi_g.
p.reset(
new T[nrows * ncols]);
89 psi_g.
desc.reset(
new int[9]{1, ctxt, nrows, ncols, nrows, ncols, 0, 0, nrows});
94 Cpxgemr2d(nrows, ncols, psi_l, 1, 1,
const_cast<int*
>(desc_psi), psi_g.
p.get(), 1, 1, psi_g.
desc.get(), ctxt);
100 const int* desc_psi = wfc_layout.
desc();
101 int ctxt = desc_psi[1];
102 int nrows = desc_psi[2];
103 int ncols = desc_psi[3];
106 Cpxgemr2d(nrows, ncols, psi_g.
p.get(), 1, 1, psi_g.
desc.get(), psi_l, 1, 1,
const_cast<int*
>(desc_psi), ctxt);
Parallel block-cyclic matrix distribution.
Definition parallel_blkcyc.h:25
const int * desc() const
Definition parallel_blkcyc.h:125
#define T
Definition exp.cpp:237
Definition band_energy.cpp:21
void distributePsi(const Parallel_Blkcyclic &wfc_layout, T *psi_l, const module_rt::Matrix_g< T > &psi_g)
Definition gather_mat.h:98
void gatherPsi(const int myid, const int root_proc, T *psi_l, const Parallel_Blkcyclic &wfc_layout, module_rt::Matrix_g< T > &psi_g)
Definition gather_mat.h:68
void distributeMatrix(hamilt::MatrixBlock< T > &mat_l, const module_rt::Matrix_g< T > &mat_g)
Definition gather_mat.h:50
void gatherMatrix(const int myid, const int root_proc, const hamilt::MatrixBlock< T > &mat_l, Matrix_g< T > &mat_g)
Definition gather_mat.h:24
std::enable_if< block2d_data_type< T >::value, void >::type Cpxgemr2d(int M, int N, T *A, int IA, int JA, int *DESCA, T *B, int IB, int JB, int *DESCB, int ICTXT)
Definition scalapack_connector.h:229
A non-owning description of a matrix stored in memory.
Definition matrix_block.h:23
T * p
Definition matrix_block.h:25
const int * desc
Definition matrix_block.h:28
Definition gather_mat.h:14
size_t col
Definition gather_mat.h:17
size_t row
Definition gather_mat.h:16
std::shared_ptr< T > p
Definition gather_mat.h:15
std::shared_ptr< int > desc
Definition gather_mat.h:18