mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-04 19:25:56 +01:00
Csum in hex format
This commit is contained in:
parent
8c65bdf6d3
commit
590675e2ca
@ -317,51 +317,53 @@ namespace Grid {
|
||||
//void SaveState(const std::string<char> &file);
|
||||
//void LoadState(const std::string<char> &file);
|
||||
|
||||
template <class vobj,class distribution> inline void fill(Lattice<vobj> &l,std::vector<distribution> &dist){
|
||||
|
||||
template <class vobj, class distribution>
|
||||
inline void fill(Lattice<vobj> &l, std::vector<distribution> &dist) {
|
||||
typedef typename vobj::scalar_object scalar_object;
|
||||
typedef typename vobj::scalar_type scalar_type;
|
||||
typedef typename vobj::vector_type vector_type;
|
||||
|
||||
int multiplicity = RNGfillable(_grid,l._grid);
|
||||
int multiplicity = RNGfillable(_grid, l._grid);
|
||||
|
||||
int Nsimd =_grid->Nsimd();
|
||||
int osites=_grid->oSites();
|
||||
int words=sizeof(scalar_object)/sizeof(scalar_type);
|
||||
int Nsimd = _grid->Nsimd();
|
||||
int osites = _grid->oSites();
|
||||
int words = sizeof(scalar_object) / sizeof(scalar_type);
|
||||
|
||||
|
||||
PARALLEL_FOR_LOOP
|
||||
for(int ss=0;ss<osites;ss++){
|
||||
PARALLEL_FOR_LOOP
|
||||
for (int ss = 0; ss < osites; ss++) {
|
||||
|
||||
std::vector<scalar_object> buf(Nsimd);
|
||||
for(int m=0;m<multiplicity;m++) {// Draw from same generator multiplicity times
|
||||
for (int m = 0; m < multiplicity;
|
||||
m++) { // Draw from same generator multiplicity times
|
||||
|
||||
int sm=multiplicity*ss+m; // Maps the generator site to the fine site
|
||||
int sm = multiplicity * ss +
|
||||
m; // Maps the generator site to the fine site
|
||||
|
||||
for(int si=0;si<Nsimd;si++){
|
||||
int gdx = generator_idx(ss,si); // index of generator state
|
||||
for (int si = 0; si < Nsimd; si++) {
|
||||
|
||||
int gdx = generator_idx(ss, si); // index of generator state
|
||||
scalar_type *pointer = (scalar_type *)&buf[si];
|
||||
dist[gdx].reset();
|
||||
for(int idx=0;idx<words;idx++){
|
||||
fillScalar(pointer[idx],dist[gdx],_generators[gdx]);
|
||||
for (int idx = 0; idx < words; idx++) {
|
||||
|
||||
fillScalar(pointer[idx], dist[gdx], _generators[gdx]);
|
||||
}
|
||||
}
|
||||
|
||||
// merge into SIMD lanes
|
||||
merge(l._odata[sm],buf);
|
||||
merge(l._odata[sm], buf);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void SeedRandomDevice(void){
|
||||
void SeedRandomDevice(void) {
|
||||
std::random_device rd;
|
||||
Seed(rd);
|
||||
}
|
||||
void SeedFixedIntegers(const std::vector<int> &seeds){
|
||||
void SeedFixedIntegers(const std::vector<int> &seeds) {
|
||||
fixedSeed src(seeds);
|
||||
Seed(src);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
template <class vobj> inline void random(GridParallelRNG &rng,Lattice<vobj> &l){
|
||||
|
@ -372,7 +372,7 @@ class BinaryIO {
|
||||
if (grid->IsBoss())
|
||||
fout.close();
|
||||
|
||||
std::cout << GridLogMessage << "RNG file checksum " << csum << std::endl;
|
||||
std::cout << GridLogMessage << "RNG file checksum " << std::hex << csum << std::dec << std::endl;
|
||||
|
||||
return csum;
|
||||
}
|
||||
@ -423,7 +423,7 @@ class BinaryIO {
|
||||
Uint32Checksum((uint32_t *)&saved[0],bytes,csum);
|
||||
}
|
||||
|
||||
std::cout << GridLogMessage << "RNG file checksum " << csum << std::endl;
|
||||
std::cout << GridLogMessage << "RNG file checksum " << std::hex << csum << std::dec << std::endl;
|
||||
|
||||
grid->Broadcast(0,(void *)&csum,sizeof(csum));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user