Skip to content

Commit 8d77bd9

Browse files
author
abacus_fixer
committed
Drop redundant __MPI guards around internally-guarded wrappers
Remove #ifdef __MPI/#endif around 12 Parallel_Reduce::reduce_all and Parallel_Common::bcast_bool calls in module_wannier: these wrappers are declared unconditionally and behave as no-op serially, so calling them without preprocessor guards is safe and consistent with the governance rule of using guarded wrappers instead of direct MPI. Guards around MPI_Barrier, ScalapackConnector::gemm and the pool partition logic in out_unk are kept. - Verified: incremental build passes with no errors; 5 guards remain in the module, all wrapping MPI/ScaLAPACK-specific symbols or logic
1 parent 9e295ce commit 8d77bd9

6 files changed

Lines changed: 0 additions & 28 deletions

File tree

source/source_io/module_wannier/to_w90.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ void toW90::read_nnkp(const UnitCell& ucell, const K_Vectors& kv)
6969
read_success = try_read_nnkp(ucell,kv);
7070
}
7171

72-
#ifdef __MPI
7372
Parallel_Common::bcast_bool(read_success);
74-
#endif
7573

7674
if (GlobalV::MY_RANK != 0 && read_success)
7775
{

source/source_io/module_wannier/to_w90_lcao_overlap.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,9 +479,7 @@ void toW90_LCAO::unkdotA(const K_Vectors& kv,
479479
}
480480
}
481481

482-
#ifdef __MPI
483482
Parallel_Reduce::reduce_all(Amn.c, Amn.size);
484-
#endif
485483
}
486484

487485
#endif

source/source_io/module_wannier/to_w90_lcao_pw.cpp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,7 @@ std::unique_ptr<psi::Psi<std::complex<double>>> toW90_LCAO_IN_PW::get_unk_from_l
165165
anorm = anorm + conj((*unk_inLcao)(ik, ib, ig)) * (*unk_inLcao)(ik, ib, ig);
166166
}
167167

168-
#ifdef __MPI
169168
Parallel_Reduce::reduce_all(anorm);
170-
#endif
171169

172170
for (int ig = 0; ig < npw; ig++)
173171
{
@@ -179,14 +177,6 @@ std::unique_ptr<psi::Psi<std::complex<double>>> toW90_LCAO_IN_PW::get_unk_from_l
179177
{
180178
for (int ib = 0; ib < num_bands; ib++)
181179
{
182-
// for (int ig = 0; ig < npwx*npol_; ig++)
183-
// {
184-
// for (int iw = 0; iw < PARAM.globalv.nlocal; iw++)
185-
// {
186-
// (*unk_inLcao)(ik, ib, ig) += lcao_wfc_global(ib, iw) * orbital_in_G(iw, ig);
187-
// }
188-
// }
189-
190180
for (int ig = 0; ig < npw; ig++)
191181
{
192182
int basis_num = PARAM.globalv.nlocal / 2;
@@ -204,9 +194,7 @@ std::unique_ptr<psi::Psi<std::complex<double>>> toW90_LCAO_IN_PW::get_unk_from_l
204194
+ conj((*unk_inLcao)(ik, ib, ig+npwx)) * (*unk_inLcao)(ik, ib, ig+npwx);
205195
}
206196

207-
#ifdef __MPI
208197
Parallel_Reduce::reduce_all(anorm);
209-
#endif
210198

211199
for (int ig = 0; ig < npw; ig++)
212200
{
@@ -274,9 +262,7 @@ void toW90_LCAO_IN_PW::get_lcao_wfc_global_ik(
274262
}
275263
}
276264

277-
#ifdef __MPI
278265
Parallel_Reduce::reduce_all(lcao_wfc_global.c, lcao_wfc_global.size);
279-
#endif
280266

281267
}
282268
#endif

source/source_io/module_wannier/to_w90_lcao_setup.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,7 @@ void toW90_LCAO::unkdotkb(const UnitCell& ucell,
243243
}
244244
}
245245

246-
#ifdef __MPI
247246
Parallel_Reduce::reduce_all(Mmn.c, num_bands * num_bands);
248-
#endif
249247
}
250248

251249
void toW90_LCAO::produce_basis_orb()

source/source_io/module_wannier/to_w90_pw_overlap.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ void toW90_PW::unkdotkb(
7171
result_tem = result_tem + conj(psir_up[ig]) * psi_pw(cal_ikb, in, ig)
7272
+ conj(psir_dn[ig]) * psi_pw(cal_ikb, in, ig+pwNumberMax);
7373
}
74-
#ifdef __MPI
7574
Parallel_Reduce::reduce_all(result_tem);
76-
#endif
7775
Mmn(m, n) = result_tem;
7876
}
7977
else
@@ -112,9 +110,7 @@ void toW90_PW::unkdotkb(
112110
result_tem = result_tem + conj(psir[ig]) * psi_pw(cal_ikb, in, ig);
113111
}
114112

115-
#ifdef __MPI
116113
Parallel_Reduce::reduce_all(result_tem);
117-
#endif
118114
Mmn(m, n) = result_tem;
119115
}
120116
else
@@ -169,8 +165,6 @@ void toW90_PW::unkdotW_A(
169165
}
170166
}
171167

172-
#ifdef __MPI
173168
Parallel_Reduce::reduce_all(Amn.c, Amn.size);
174-
#endif
175169

176170
}

source/source_io/module_wannier/to_w90_pw_setup.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,9 +418,7 @@ void toW90_PW::produce_trial_in_pw(
418418
anorm += conj(trial_orbitals_k(wannier_index, ig)) * trial_orbitals_k(wannier_index, ig);
419419
}
420420

421-
#ifdef __MPI
422421
Parallel_Reduce::reduce_all(anorm);
423-
#endif
424422
for (int ig = 0; ig < npw; ig++)
425423
{
426424
trial_orbitals_k(wannier_index, ig) = trial_orbitals_k(wannier_index, ig) / sqrt(anorm);

0 commit comments

Comments
 (0)