Skip to content

Commit d483952

Browse files
denghuiludyzheng
authored andcommitted
Maintain numerical consistency for ABACUS while enabling the __CUDA flag (#1461)
1 parent ee03d3b commit d483952

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

source/src_pw/wf_atomic.cpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -523,12 +523,12 @@ void WF_atomic::random(ModuleBase::ComplexMatrix &psi,const int iw_start,const i
523523
assert(psi.nr >= iw_end);
524524
const int ng = GlobalC::kv.ngk[ik];
525525
#ifdef __MPI
526-
#if ((defined __CUDA) || (defined __ROCM))
527-
if(pw_seed > 0)//qianrui add 2021-8-13
528-
{
529-
srand(unsigned(pw_seed + GlobalC::Pkpoints.startk_pool[GlobalV::MY_POOL] + ik));
530-
}
531-
#else
526+
// #if ((defined __CUDA) || (defined __ROCM))
527+
// if(pw_seed > 0)//qianrui add 2021-8-13
528+
// {
529+
// srand(unsigned(pw_seed + GlobalC::Pkpoints.startk_pool[GlobalV::MY_POOL] + ik));
530+
// }
531+
// #else
532532
if(pw_seed > 0)//qianrui add 2021-8-13
533533
{
534534
srand(unsigned(pw_seed + GlobalC::Pkpoints.startk_pool[GlobalV::MY_POOL] + ik));
@@ -578,13 +578,13 @@ void WF_atomic::random(ModuleBase::ComplexMatrix &psi,const int iw_start,const i
578578
}
579579
else
580580
{
581-
#endif
582-
#else
581+
// #endif
582+
#else // !__MPI
583583
if(pw_seed > 0)//qianrui add 2021-8-13
584584
{
585585
srand(unsigned(pw_seed + GlobalC::Pkpoints.startk_pool[GlobalV::MY_POOL] + ik));
586586
}
587-
#endif
587+
#endif // __MPI
588588
for (int iw = iw_start ;iw < iw_end;iw++)
589589
{
590590
for (int ig = 0;ig < ng;ig++)
@@ -603,12 +603,10 @@ void WF_atomic::random(ModuleBase::ComplexMatrix &psi,const int iw_start,const i
603603
}
604604
}
605605
#ifdef __MPI
606-
#if ((!defined __CUDA) && (!defined __ROCM))
606+
// #if ((!defined __CUDA) && (!defined __ROCM))
607607
}
608-
#endif
609-
#endif
610-
611-
return;
608+
// #endif // ((!defined __CUDA) && (!defined __ROCM))
609+
#endif // __MPI
612610
}
613611

614612
void WF_atomic::atomicrandom(ModuleBase::ComplexMatrix &psi,const int iw_start,const int iw_end,const int ik, ModulePW::PW_Basis_K* wfc_basis)const

0 commit comments

Comments
 (0)