Skip to content

Commit cd4d234

Browse files
authored
Refactor and Fix Parallel Handling of Plane Wave Counts in Eigenvalue Output (#6844)
* remove dependency on shell * fix compile error * fix gtest error * fix system call in the gtest * fix MPI error * reset test * delete useless code
1 parent 8ec123c commit cd4d234

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

source/source_io/write_eig_occ.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,6 @@ void ModuleIO::write_eig_iter(const ModuleBase::matrix &ekb,const ModuleBase::ma
2020
const int nspin = PARAM.inp.nspin;
2121
const int nks = kv.get_nks();
2222
const int nkstot = kv.get_nkstot();
23-
24-
std::vector<int> ngk_tot = kv.ngk;
25-
26-
#ifdef __MPI
27-
MPI_Allreduce(MPI_IN_PLACE, ngk_tot.data(), nks, MPI_INT, MPI_SUM, POOL_WORLD);
28-
#endif
29-
3023
const int nk_fac = nspin == 2 ? 2 : 1;
3124
const int nks_np = nks / nk_fac;
3225
const int nkstot_np = nkstot / nk_fac;
@@ -205,11 +198,10 @@ void ModuleIO::write_eig_file(const ModuleBase::matrix &ekb,
205198
{
206199
ModuleBase::WARNING_QUIT("ModuleIO::write_eig_file", "Eigenvalues are too large!");
207200
}
208-
209201
std::vector<int> ngk_tot = kv.ngk;
210-
211202
#ifdef __MPI
212-
MPI_Allreduce(MPI_IN_PLACE, ngk_tot.data(), nks, MPI_INT, MPI_SUM, POOL_WORLD);
203+
std::vector<int> send_ngk_tot = kv.ngk;
204+
MPI_Allreduce(send_ngk_tot.data(), ngk_tot.data(), nks, MPI_INT, MPI_SUM, POOL_WORLD);
213205
#endif
214206

215207
// file name to store eigenvalues

0 commit comments

Comments
 (0)