1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Reverting the broadcast change

This commit is contained in:
Guido Cossu 2016-10-22 13:26:43 +01:00
parent 4b740fc8fd
commit 3e990c9d0a
2 changed files with 6 additions and 7 deletions

View File

@ -130,14 +130,14 @@ namespace Grid {
ss<<_generators[gen]; ss<<_generators[gen];
ss.seekg(0,ss.beg); ss.seekg(0,ss.beg);
for(int i=0;i<RngStateCount;i++){ for(int i=0;i<RngStateCount;i++){
ss>>saved[i]; ss>>saved[i];
} }
} }
void SetState(std::vector<RngStateType> & saved,int gen){ void SetState(std::vector<RngStateType> & saved,int gen){
assert(saved.size()==RngStateCount); assert(saved.size()==RngStateCount);
std::stringstream ss; std::stringstream ss;
for(int i=0;i<RngStateCount;i++){ for(int i=0;i<RngStateCount;i++){
ss<< saved[i]<<" "; ss<< saved[i]<<" ";
} }
ss.seekg(0,ss.beg); ss.seekg(0,ss.beg);
ss>>_generators[gen]; ss>>_generators[gen];

View File

@ -348,12 +348,12 @@ class BinaryIO {
grid->GlobalIndexToGlobalCoor(gidx, gcoor); grid->GlobalIndexToGlobalCoor(gidx, gcoor);
grid->GlobalCoorToRankIndex(rank, o_idx, i_idx, gcoor); grid->GlobalCoorToRankIndex(rank, o_idx, i_idx, gcoor);
int l_idx = parallel.generator_idx(o_idx, i_idx); int l_idx = parallel.generator_idx(o_idx, i_idx);
std::cout << GridLogDebug << "l_idx "<< l_idx << " o_idx " << o_idx << " i_idx " << i_idx << std::endl;
if (rank == grid->ThisRank()) { if (rank == grid->ThisRank()) {
parallel.GetState(saved, l_idx); parallel.GetState(saved, l_idx);
grid->Broadcast(rank, (void *)&saved[0], bytes);
} }
grid->Broadcast(rank, (void *)&saved[0], bytes);
if (grid->IsBoss()) { if (grid->IsBoss()) {
Uint32Checksum((uint32_t *)&saved[0], bytes, csum); Uint32Checksum((uint32_t *)&saved[0], bytes, csum);
@ -419,14 +419,13 @@ class BinaryIO {
grid->GlobalIndexToGlobalCoor(gidx,gcoor); grid->GlobalIndexToGlobalCoor(gidx,gcoor);
grid->GlobalCoorToRankIndex(rank,o_idx,i_idx,gcoor); grid->GlobalCoorToRankIndex(rank,o_idx,i_idx,gcoor);
int l_idx=parallel.generator_idx(o_idx,i_idx); int l_idx=parallel.generator_idx(o_idx,i_idx);
std::cout << GridLogDebug << "l_idx "<< l_idx << " o_idx " << o_idx << " i_idx " << i_idx << std::endl;
if ( grid->IsBoss() ) { if ( grid->IsBoss() ) {
fin.read((char *)&saved[0],bytes); fin.read((char *)&saved[0],bytes);
Uint32Checksum((uint32_t *)&saved[0],bytes,csum); Uint32Checksum((uint32_t *)&saved[0],bytes,csum);
grid->Broadcast(0,(void *)&saved[0],bytes);
} }
grid->Broadcast(0,(void *)&saved[0],bytes);
if( rank == grid->ThisRank() ){ if( rank == grid->ThisRank() ){
parallel.SetState(saved,l_idx); parallel.SetState(saved,l_idx);