Skip to content

Commit c5dc8ce

Browse files
committed
change name
1 parent 7c4410e commit c5dc8ce

29 files changed

+120
-133
lines changed

source/driver.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ void Driver::reading()
152152
GlobalV::MY_RANK,
153153
PARAM.inp.bndpar,
154154
GlobalV::KPAR,
155-
GlobalV::NPROC_IN_STOGROUP,
155+
GlobalV::NPROC_IN_BNDGROUP,
156156
GlobalV::RANK_IN_BPGROUP,
157-
GlobalV::MY_STOGROUP,
157+
GlobalV::MY_BNDGROUP,
158158
GlobalV::NPROC_IN_POOL,
159159
GlobalV::RANK_IN_POOL,
160160
GlobalV::MY_POOL);

source/module_base/global_variable.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ int NPROC = 1; ///< global number of process
2020
int KPAR = 1; ///< global number of pools
2121
int MY_RANK = 0; ///< global index of process
2222
int MY_POOL = 0; ///< global index of pool (count in pool)
23-
int MY_STOGROUP = 0;
23+
int MY_BNDGROUP = 0;
2424
int NPROC_IN_POOL = 1; ///< local number of process in a pool
25-
int NPROC_IN_STOGROUP = 1;
25+
int NPROC_IN_BNDGROUP = 1;
2626
int RANK_IN_POOL = 0; ///< global index of pool (count in process), my_rank in each pool
2727
int RANK_IN_BPGROUP = 0;
2828
int DRANK = -1; ///< mohan add 2012-01-13, must be -1, so we can recognize who

source/module_base/global_variable.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ extern int NPROC;
3333
extern int KPAR;
3434
extern int MY_RANK;
3535
extern int MY_POOL;
36-
extern int MY_STOGROUP;
36+
extern int MY_BNDGROUP;
3737
extern int NPROC_IN_POOL;
38-
extern int NPROC_IN_STOGROUP;
38+
extern int NPROC_IN_BNDGROUP;
3939
extern int RANK_IN_POOL;
4040
extern int RANK_IN_BPGROUP;
4141
extern int DRANK;

source/module_base/parallel_global.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,9 @@ void Parallel_Global::init_pools(const int& NPROC,
253253
const int& MY_RANK,
254254
const int& BNDPAR,
255255
const int& KPAR,
256-
int& NPROC_IN_STOGROUP,
256+
int& NPROC_IN_BNDGROUP,
257257
int& RANK_IN_BPGROUP,
258-
int& MY_STOGROUP,
258+
int& MY_BNDGROUP,
259259
int& NPROC_IN_POOL,
260260
int& RANK_IN_POOL,
261261
int& MY_POOL)
@@ -268,9 +268,9 @@ void Parallel_Global::init_pools(const int& NPROC,
268268
MY_RANK,
269269
BNDPAR,
270270
KPAR,
271-
NPROC_IN_STOGROUP,
271+
NPROC_IN_BNDGROUP,
272272
RANK_IN_BPGROUP,
273-
MY_STOGROUP,
273+
MY_BNDGROUP,
274274
NPROC_IN_POOL,
275275
RANK_IN_POOL,
276276
MY_POOL);
@@ -316,16 +316,16 @@ void Parallel_Global::divide_pools(const int& NPROC,
316316
const int& MY_RANK,
317317
const int& BNDPAR,
318318
const int& KPAR,
319-
int& NPROC_IN_STOGROUP,
319+
int& NPROC_IN_BNDGROUP,
320320
int& RANK_IN_BPGROUP,
321-
int& MY_STOGROUP,
321+
int& MY_BNDGROUP,
322322
int& NPROC_IN_POOL,
323323
int& RANK_IN_POOL,
324324
int& MY_POOL)
325325
{
326326
// note: the order of k-point parallelization and band parallelization is important
327327
// The order will not change the behavior of INTER_POOL or PARAPW_WORLD, and MY_POOL
328-
// and MY_STOGROUP will be the same as well.
328+
// and MY_BNDGROUP will be the same as well.
329329
if(BNDPAR > 1 && NPROC %(BNDPAR * KPAR) != 0)
330330
{
331331
std::cout << "Error: When BNDPAR = " << BNDPAR << " > 1, number of processes (" << NPROC << ") must be divisible by the number of groups ("
@@ -358,17 +358,17 @@ void Parallel_Global::divide_pools(const int& NPROC,
358358

359359
if(BNDPAR > 1)
360360
{
361-
NPROC_IN_STOGROUP = kpar_group.ngroups * bndpar_group.nprocs_in_group;
361+
NPROC_IN_BNDGROUP = kpar_group.ngroups * bndpar_group.nprocs_in_group;
362362
RANK_IN_BPGROUP = kpar_group.my_group * bndpar_group.nprocs_in_group + bndpar_group.rank_in_group;
363-
MY_STOGROUP = bndpar_group.my_group;
364-
MPI_Comm_split(MPI_COMM_WORLD, MY_STOGROUP, RANK_IN_BPGROUP, &STO_WORLD);
363+
MY_BNDGROUP = bndpar_group.my_group;
364+
MPI_Comm_split(MPI_COMM_WORLD, MY_BNDGROUP, RANK_IN_BPGROUP, &STO_WORLD);
365365
MPI_Comm_dup(bndpar_group.inter_comm, &PARAPW_WORLD);
366366
}
367367
else
368368
{
369-
NPROC_IN_STOGROUP = NPROC;
369+
NPROC_IN_BNDGROUP = NPROC;
370370
RANK_IN_BPGROUP = MY_RANK;
371-
MY_STOGROUP = 0;
371+
MY_BNDGROUP = 0;
372372
MPI_Comm_dup(MPI_COMM_WORLD, &STO_WORLD);
373373
MPI_Comm_split(MPI_COMM_WORLD, MY_RANK, 0, &PARAPW_WORLD);
374374
}

source/module_base/parallel_global.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ void init_pools(const int& NPROC,
4848
const int& MY_RANK,
4949
const int& BNDPAR,
5050
const int& KPAR,
51-
int& NPROC_IN_STOGROUP,
51+
int& NPROC_IN_BNDGROUP,
5252
int& RANK_IN_BPGROUP,
53-
int& MY_STOGROUP,
53+
int& MY_BNDGROUP,
5454
int& NPROC_IN_POOL,
5555
int& RANK_IN_POOL,
5656
int& MY_POOL);
@@ -59,9 +59,9 @@ void divide_pools(const int& NPROC,
5959
const int& MY_RANK,
6060
const int& BNDPAR,
6161
const int& KPAR,
62-
int& NPROC_IN_STOGROUP,
62+
int& NPROC_IN_BNDGROUP,
6363
int& RANK_IN_BPGROUP,
64-
int& MY_STOGROUP,
64+
int& MY_BNDGROUP,
6565
int& NPROC_IN_POOL,
6666
int& RANK_IN_POOL,
6767
int& MY_POOL);

source/module_cell/cal_atoms_info.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,16 @@ class CalAtomsInfo
6868
nelec_spin[1] = (para.inp.nelec - para.inp.nupdown ) / 2.0;
6969
}
7070
elecstate::cal_nbands(para.inp.nelec, para.sys.nlocal, nelec_spin, para.input.nbands);
71+
// calculate the number of nbands_local
72+
para.sys.nbands_l = para.inp.nbands;
73+
if (inp.ks_solver == "bpcg") // only bpcg support band parallel
74+
{
75+
para.sys.nbands_l = para.inp.nbands / para.inp.bndpar;
76+
if (GlobalV::RANK_IN_BPGROUP < para.inp.nbands % para.inp.bndpar)
77+
{
78+
para.sys.nbands_l++;
79+
}
80+
}
7181
return;
7282
}
7383
};

source/module_cell/test/klist_test_para.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ TEST_F(KlistParaTest, Set)
229229
GlobalV::MY_RANK,
230230
PARAM.input.bndpar,
231231
GlobalV::KPAR,
232-
GlobalV::NPROC_IN_STOGROUP,
232+
GlobalV::NPROC_IN_BNDGROUP,
233233
GlobalV::RANK_IN_BPGROUP,
234234
GlobalV::MY_STOGROUP,
235235
GlobalV::NPROC_IN_POOL,
@@ -286,7 +286,7 @@ TEST_F(KlistParaTest, SetAfterVC)
286286
GlobalV::MY_RANK,
287287
PARAM.input.bndpar,
288288
GlobalV::KPAR,
289-
GlobalV::NPROC_IN_STOGROUP,
289+
GlobalV::NPROC_IN_BNDGROUP,
290290
GlobalV::RANK_IN_BPGROUP,
291291
GlobalV::MY_STOGROUP,
292292
GlobalV::NPROC_IN_POOL,

source/module_elecstate/elecstate_print.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ void ElecState::print_eigenvalue(std::ofstream& ofs)
205205
#ifdef __MPI
206206
MPI_Barrier(MPI_COMM_WORLD);
207207
#endif
208-
bool ip_flag = PARAM.inp.out_alllog || (GlobalV::RANK_IN_POOL == 0 && GlobalV::MY_STOGROUP == 0);
208+
bool ip_flag = PARAM.inp.out_alllog || (GlobalV::RANK_IN_POOL == 0 && GlobalV::MY_BNDGROUP == 0);
209209
if (GlobalV::MY_POOL == ip && ip_flag)
210210
{
211211
const int start_ik = nks_np * is;

source/module_elecstate/elecstate_pw_sdft.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void ElecStatePW_SDFT<T, Device>::psiToRho(const psi::Psi<T, Device>& psi)
1919
setmem_var_op()(this->rho[is], 0, this->charge->nrxx);
2020
}
2121

22-
if (GlobalV::MY_STOGROUP == 0)
22+
if (GlobalV::MY_BNDGROUP == 0 || PARAM.inp.ks_solver == "bpcg")
2323
{
2424
for (int ik = 0; ik < psi.get_nk(); ++ik)
2525
{

source/module_elecstate/test_mpi/charge_mpi_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ TEST_F(ChargeMpiTest, reduce_diff_pools1)
7070
GlobalV::MY_RANK,
7171
PARAM.input.bndpar,
7272
GlobalV::KPAR,
73-
GlobalV::NPROC_IN_STOGROUP,
73+
GlobalV::NPROC_IN_BNDGROUP,
7474
GlobalV::RANK_IN_BPGROUP,
7575
GlobalV::MY_STOGROUP,
7676
GlobalV::NPROC_IN_POOL,
@@ -116,7 +116,7 @@ TEST_F(ChargeMpiTest, reduce_diff_pools2)
116116
GlobalV::MY_RANK,
117117
PARAM.input.bndpar,
118118
GlobalV::KPAR,
119-
GlobalV::NPROC_IN_STOGROUP,
119+
GlobalV::NPROC_IN_BNDGROUP,
120120
GlobalV::RANK_IN_BPGROUP,
121121
GlobalV::MY_STOGROUP,
122122
GlobalV::NPROC_IN_POOL,
@@ -171,7 +171,7 @@ TEST_F(ChargeMpiTest, rho_mpi)
171171
GlobalV::MY_RANK,
172172
PARAM.input.bndpar,
173173
GlobalV::KPAR,
174-
GlobalV::NPROC_IN_STOGROUP,
174+
GlobalV::NPROC_IN_BNDGROUP,
175175
GlobalV::RANK_IN_BPGROUP,
176176
GlobalV::MY_STOGROUP,
177177
GlobalV::NPROC_IN_POOL,

0 commit comments

Comments
 (0)