Skip to content

Commit 630dcfd

Browse files
committed
fix bug
1 parent 6a337eb commit 630dcfd

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

source/module_base/parallel_global.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -346,15 +346,16 @@ void Parallel_Global::divide_pools(const int& NPROC,
346346
NPROC_IN_POOL = bndpar_group.nprocs_in_group;
347347
RANK_IN_POOL = bndpar_group.rank_in_group;
348348
MY_POOL = kpar_group.my_group;
349-
// INTER_POOL = kpar_group.inter_comm;
350-
// POOL_WORLD = bndpar_group.group_comm;
351349
MPI_Comm_dup(bndpar_group.group_comm, &POOL_WORLD);
352-
MPI_Comm_dup(kpar_group.inter_comm, &INTER_POOL);
353-
354-
if (KPAR > 1)
350+
if(kpar_group.inter_comm != MPI_COMM_NULL)
351+
{
352+
MPI_Comm_dup(kpar_group.inter_comm, &INTER_POOL);
353+
}
354+
355+
if(BNDPAR > 1)
355356
{
356357
NPROC_IN_STOGROUP = kpar_group.ngroups * bndpar_group.nprocs_in_group;
357-
RANK_IN_STOGROUP = kpar_group.rank_in_group * bndpar_group.nprocs_in_group + bndpar_group.rank_in_group;
358+
RANK_IN_STOGROUP = kpar_group.my_group * bndpar_group.nprocs_in_group + bndpar_group.rank_in_group;
358359
MY_STOGROUP = bndpar_group.my_group;
359360
MPI_Comm_split(MPI_COMM_WORLD, MY_STOGROUP, RANK_IN_STOGROUP, &STO_WORLD);
360361
MPI_Comm_dup(bndpar_group.inter_comm, &PARAPW_WORLD);
@@ -364,7 +365,6 @@ void Parallel_Global::divide_pools(const int& NPROC,
364365
NPROC_IN_STOGROUP = NPROC;
365366
RANK_IN_STOGROUP = MY_RANK;
366367
MY_STOGROUP = 0;
367-
// STO_WORLD = MPI_COMM_WORLD;
368368
MPI_Comm_dup(MPI_COMM_WORLD, &STO_WORLD);
369369
MPI_Comm_split(MPI_COMM_WORLD, MY_RANK, 0, &PARAPW_WORLD);
370370
}

source/module_hamilt_pw/hamilt_stodft/sto_wf.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void Stochastic_WF<T, Device>::init_sto_orbitals(const int seed_in)
7272
}
7373
else
7474
{
75-
srand((unsigned)std::abs(seed_in) + GlobalV::MY_RANK * 10000);
75+
srand((unsigned)std::abs(seed_in) + (GlobalV::MY_STOGROUP * GlobalV::NPROC_IN_STOGROUP + GlobalV::RANK_IN_STOGROUP) * 10000);
7676
}
7777

7878
this->allocate_chi0();

0 commit comments

Comments
 (0)