mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-09 23:45:36 +00:00
Britney test option
This commit is contained in:
parent
d224297972
commit
cf8632bbac
@ -281,12 +281,14 @@ inline ComplexD rankInnerProduct(const Lattice<vobj> &left,const Lattice<vobj> &
|
||||
return nrm;
|
||||
}
|
||||
|
||||
|
||||
template<class vobj>
|
||||
inline ComplexD innerProduct(const Lattice<vobj> &left,const Lattice<vobj> &right) {
|
||||
GridBase *grid = left.Grid();
|
||||
ComplexD nrm = rankInnerProduct(left,right);
|
||||
// std::cerr<<"flight log " << std::hexfloat << nrm <<" "<<crc(left)<<std::endl;
|
||||
// GridNormLog(real(nrm)); // Could log before and after global sum to distinguish local and MPI
|
||||
grid->GlobalSum(nrm);
|
||||
// GridNormLog(real(nrm));
|
||||
return nrm;
|
||||
}
|
||||
|
||||
|
@ -411,7 +411,7 @@ public:
|
||||
std::cout << GridLogMessage << "Seed SHA256: " << GridChecksum::sha256_string(seeds) << std::endl;
|
||||
SeedFixedIntegers(seeds);
|
||||
}
|
||||
void SeedFixedIntegers(const std::vector<int> &seeds){
|
||||
void SeedFixedIntegers(const std::vector<int> &seeds, int britney=0){
|
||||
|
||||
// Everyone generates the same seed_seq based on input seeds
|
||||
CartesianCommunicator::BroadcastWorld(0,(void *)&seeds[0],sizeof(int)*seeds.size());
|
||||
@ -428,7 +428,6 @@ public:
|
||||
// MT implementation does not implement fast discard even though
|
||||
// in principle this is possible
|
||||
////////////////////////////////////////////////
|
||||
#if 1
|
||||
thread_for( lidx, _grid->lSites(), {
|
||||
|
||||
int gidx;
|
||||
@ -449,29 +448,12 @@ public:
|
||||
|
||||
int l_idx=generator_idx(o_idx,i_idx);
|
||||
_generators[l_idx] = master_engine;
|
||||
Skip(_generators[l_idx],gidx); // Skip to next RNG sequence
|
||||
});
|
||||
#else
|
||||
// Everybody loops over global volume.
|
||||
thread_for( gidx, _grid->_gsites, {
|
||||
|
||||
// Where is it?
|
||||
int rank;
|
||||
int o_idx;
|
||||
int i_idx;
|
||||
|
||||
Coordinate gcoor;
|
||||
_grid->GlobalIndexToGlobalCoor(gidx,gcoor);
|
||||
_grid->GlobalCoorToRankIndex(rank,o_idx,i_idx,gcoor);
|
||||
|
||||
// If this is one of mine we take it
|
||||
if( rank == _grid->ThisRank() ){
|
||||
int l_idx=generator_idx(o_idx,i_idx);
|
||||
_generators[l_idx] = master_engine;
|
||||
if ( britney ) {
|
||||
Skip(_generators[l_idx],l_idx); // Skip to next RNG sequence
|
||||
} else {
|
||||
Skip(_generators[l_idx],gidx); // Skip to next RNG sequence
|
||||
}
|
||||
});
|
||||
#endif
|
||||
#else
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Machine and thread decomposition dependent seeding is efficient
|
||||
|
@ -86,11 +86,83 @@ NAMESPACE_BEGIN(Grid);
|
||||
static Coordinate Grid_default_latt;
|
||||
static Coordinate Grid_default_mpi;
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
// Grid Norm logging for repro testing
|
||||
///////////////////////////////////////////////////////
|
||||
int GridNormLoggingMode;
|
||||
int32_t GridNormLoggingCounter;
|
||||
std::vector<double> GridNormLogVector;
|
||||
|
||||
void SetGridNormLoggingMode(GridNormLoggingMode_t mode)
|
||||
{
|
||||
switch ( mode ) {
|
||||
case GridNormLoggingModePrint:
|
||||
SetGridNormLoggingModePrint();
|
||||
break;
|
||||
case GridNormLoggingModeRecord:
|
||||
SetGridNormLoggingModeRecord();
|
||||
break;
|
||||
case GridNormLoggingModeVerify:
|
||||
SetGridNormLoggingModeVerify();
|
||||
break;
|
||||
case GridNormLoggingModeNone:
|
||||
GridNormLoggingMode = mode;
|
||||
GridNormLoggingCounter=0;
|
||||
GridNormLogVector.resize(0);
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
void SetGridNormLoggingModePrint(void)
|
||||
{
|
||||
GridNormLoggingCounter = 0;
|
||||
GridNormLogVector.resize(0);
|
||||
GridNormLoggingMode = GridNormLoggingModePrint;
|
||||
}
|
||||
void SetGridNormLoggingModeRecord(void)
|
||||
{
|
||||
GridNormLoggingCounter = 0;
|
||||
GridNormLogVector.resize(0);
|
||||
GridNormLoggingMode = GridNormLoggingModeRecord;
|
||||
}
|
||||
void SetGridNormLoggingModeVerify(void)
|
||||
{
|
||||
GridNormLoggingCounter = 0;
|
||||
GridNormLoggingMode = GridNormLoggingModeVerify;
|
||||
}
|
||||
void GridNormLog(double value)
|
||||
{
|
||||
if(GridNormLoggingMode == GridNormLoggingModePrint) {
|
||||
std::cerr<<"GridNormLog : "<< GridNormLoggingCounter <<" " << std::hexfloat << value <<std::endl;
|
||||
GridNormLoggingCounter++;
|
||||
}
|
||||
if(GridNormLoggingMode == GridNormLoggingModeRecord) {
|
||||
GridNormLogVector.push_back(value);
|
||||
GridNormLoggingCounter++;
|
||||
}
|
||||
if(GridNormLoggingMode == GridNormLoggingModeVerify) {
|
||||
assert(GridNormLoggingCounter < GridNormLogVector.size());
|
||||
if ( value != GridNormLogVector[GridNormLoggingCounter] ) {
|
||||
fprintf(stderr,"%s Oops, I did it again! Reproduce failure for norm %d/%zu %.16e %.16e\n",GridHostname(),GridNormLoggingCounter,GridNormLogVector.size(),
|
||||
value, GridNormLogVector[GridNormLoggingCounter]); fflush(stderr);
|
||||
}
|
||||
GridNormLoggingCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
int GridThread::_threads =1;
|
||||
int GridThread::_hyperthreads=1;
|
||||
int GridThread::_cores=1;
|
||||
|
||||
char hostname[HOST_NAME_MAX+1];
|
||||
|
||||
char *GridHostname(void)
|
||||
{
|
||||
return hostname;
|
||||
}
|
||||
const Coordinate &GridDefaultLatt(void) {return Grid_default_latt;};
|
||||
const Coordinate &GridDefaultMpi(void) {return Grid_default_mpi;};
|
||||
const Coordinate GridDefaultSimd(int dims,int nsimd)
|
||||
@ -393,7 +465,6 @@ void Grid_init(int *argc,char ***argv)
|
||||
std::cout << GridLogMessage << "MPI is initialised and logging filters activated "<<std::endl;
|
||||
std::cout << GridLogMessage << "================================================ "<<std::endl;
|
||||
|
||||
char hostname[HOST_NAME_MAX+1];
|
||||
gethostname(hostname, HOST_NAME_MAX+1);
|
||||
std::cout << GridLogMessage << "This rank is running on host "<< hostname<<std::endl;
|
||||
|
||||
|
@ -34,6 +34,8 @@ NAMESPACE_BEGIN(Grid);
|
||||
void Grid_init(int *argc,char ***argv);
|
||||
void Grid_finalize(void);
|
||||
|
||||
char * GridHostname(void);
|
||||
|
||||
// internal, controled with --handle
|
||||
void Grid_sa_signal_handler(int sig,siginfo_t *si,void * ptr);
|
||||
void Grid_debug_handler_init(void);
|
||||
@ -68,5 +70,20 @@ void GridParseLayout(char **argv,int argc,
|
||||
void printHash(void);
|
||||
|
||||
|
||||
enum GridNormLoggingMode_t {
|
||||
GridNormLoggingModeNone,
|
||||
GridNormLoggingModePrint,
|
||||
GridNormLoggingModeRecord,
|
||||
GridNormLoggingModeVerify
|
||||
};
|
||||
extern int GridNormLoggingMode;
|
||||
extern int32_t GridNormLoggingCounter;
|
||||
extern std::vector<double> GridNormLogVector;
|
||||
void SetGridNormLoggingModePrint(void);
|
||||
void SetGridNormLoggingModeRecord(void);
|
||||
void SetGridNormLoggingModeVerify(void);
|
||||
void SetGridNormLoggingMode(GridNormLoggingMode_t mode);
|
||||
void GridNormLog(double value);
|
||||
|
||||
NAMESPACE_END(Grid);
|
||||
|
||||
|
@ -104,6 +104,11 @@ int main (int argc, char ** argv)
|
||||
csumref=0;
|
||||
int iter=0;
|
||||
do {
|
||||
if ( iter == 0 ) {
|
||||
SetGridNormLoggingMode(GridNormLoggingModeRecord);
|
||||
} else {
|
||||
SetGridNormLoggingMode(GridNormLoggingModeVerify);
|
||||
}
|
||||
std::cerr << "******************* SINGLE PRECISION SOLVE "<<iter<<std::endl;
|
||||
result_o = Zero();
|
||||
t1=usecond();
|
||||
@ -135,6 +140,11 @@ int main (int argc, char ** argv)
|
||||
csumref=0;
|
||||
int i=0;
|
||||
do {
|
||||
if ( iter == 0 ) {
|
||||
SetGridNormLoggingMode(GridNormLoggingModeRecord);
|
||||
} else {
|
||||
SetGridNormLoggingMode(GridNormLoggingModeVerify);
|
||||
}
|
||||
std::cerr << "******************* DOUBLE PRECISION SOLVE "<<i<<std::endl;
|
||||
result_o_2 = Zero();
|
||||
t1=usecond();
|
||||
|
Loading…
Reference in New Issue
Block a user