Skip to content

Commit

Permalink
Maintain numerical consistency for ABACUS while enabling the __CUDA f…
Browse files Browse the repository at this point in the history
…lag (#1461)
  • Loading branch information
denghuilu committed Nov 2, 2022
1 parent 65c4461 commit d4634c5
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions source/src_pw/wf_atomic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,12 +523,12 @@ void WF_atomic::random(ModuleBase::ComplexMatrix &psi,const int iw_start,const i
assert(psi.nr >= iw_end);
const int ng = GlobalC::kv.ngk[ik];
#ifdef __MPI
#if ((defined __CUDA) || (defined __ROCM))
if(pw_seed > 0)//qianrui add 2021-8-13
{
srand(unsigned(pw_seed + GlobalC::Pkpoints.startk_pool[GlobalV::MY_POOL] + ik));
}
#else
// #if ((defined __CUDA) || (defined __ROCM))
// if(pw_seed > 0)//qianrui add 2021-8-13
// {
// srand(unsigned(pw_seed + GlobalC::Pkpoints.startk_pool[GlobalV::MY_POOL] + ik));
// }
// #else
if(pw_seed > 0)//qianrui add 2021-8-13
{
srand(unsigned(pw_seed + GlobalC::Pkpoints.startk_pool[GlobalV::MY_POOL] + ik));
Expand Down Expand Up @@ -578,13 +578,13 @@ void WF_atomic::random(ModuleBase::ComplexMatrix &psi,const int iw_start,const i
}
else
{
#endif
#else
// #endif
#else // !__MPI
if(pw_seed > 0)//qianrui add 2021-8-13
{
srand(unsigned(pw_seed + GlobalC::Pkpoints.startk_pool[GlobalV::MY_POOL] + ik));
}
#endif
#endif // __MPI
for (int iw = iw_start ;iw < iw_end;iw++)
{
for (int ig = 0;ig < ng;ig++)
Expand All @@ -603,12 +603,10 @@ void WF_atomic::random(ModuleBase::ComplexMatrix &psi,const int iw_start,const i
}
}
#ifdef __MPI
#if ((!defined __CUDA) && (!defined __ROCM))
// #if ((!defined __CUDA) && (!defined __ROCM))
}
#endif
#endif

return;
// #endif // ((!defined __CUDA) && (!defined __ROCM))
#endif // __MPI
}

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
Expand Down

0 comments on commit d4634c5

Please sign in to comment.