mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
add reordring of random number generator in IO
This commit is contained in:
parent
093d1ee21b
commit
97db2b8d20
@ -663,10 +663,15 @@ class BinaryIO {
|
|||||||
nersc_csum,scidac_csuma,scidac_csumb);
|
nersc_csum,scidac_csuma,scidac_csumb);
|
||||||
|
|
||||||
timer.Start();
|
timer.Start();
|
||||||
thread_for(lidx,lsites,{
|
thread_for(lidx,lsites,{ // FIX ME, suboptimal implementation
|
||||||
std::vector<RngStateType> tmp(RngStateCount);
|
std::vector<RngStateType> tmp(RngStateCount);
|
||||||
std::copy(iodata[lidx].begin(),iodata[lidx].end(),tmp.begin());
|
std::copy(iodata[lidx].begin(),iodata[lidx].end(),tmp.begin());
|
||||||
parallel_rng.SetState(tmp,lidx);
|
Coordinate lcoor;
|
||||||
|
grid->LocalIndexToLocalCoor(lidx, lcoor);
|
||||||
|
int o_idx=grid->oIndex(lcoor);
|
||||||
|
int i_idx=grid->iIndex(lcoor);
|
||||||
|
int gidx=parallel_rng.generator_idx(o_idx,i_idx);
|
||||||
|
parallel_rng.SetState(tmp,gidx);
|
||||||
});
|
});
|
||||||
timer.Stop();
|
timer.Stop();
|
||||||
|
|
||||||
@ -723,7 +728,12 @@ class BinaryIO {
|
|||||||
std::vector<RNGstate> iodata(lsites);
|
std::vector<RNGstate> iodata(lsites);
|
||||||
thread_for(lidx,lsites,{
|
thread_for(lidx,lsites,{
|
||||||
std::vector<RngStateType> tmp(RngStateCount);
|
std::vector<RngStateType> tmp(RngStateCount);
|
||||||
parallel_rng.GetState(tmp,lidx);
|
Coordinate lcoor;
|
||||||
|
grid->LocalIndexToLocalCoor(lidx, lcoor);
|
||||||
|
int o_idx=grid->oIndex(lcoor);
|
||||||
|
int i_idx=grid->iIndex(lcoor);
|
||||||
|
int gidx=parallel_rng.generator_idx(o_idx,i_idx);
|
||||||
|
parallel_rng.GetState(tmp,gidx);
|
||||||
std::copy(tmp.begin(),tmp.end(),iodata[lidx].begin());
|
std::copy(tmp.begin(),tmp.end(),iodata[lidx].begin());
|
||||||
});
|
});
|
||||||
timer.Stop();
|
timer.Stop();
|
||||||
|
Loading…
Reference in New Issue
Block a user