mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-09 23:45:36 +00:00
Compare commits
3 Commits
a4d11a630f
...
2704b82084
Author | SHA1 | Date | |
---|---|---|---|
2704b82084 | |||
cf8632bbac | |||
d224297972 |
@ -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
|
||||
|
@ -90,11 +90,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)
|
||||
@ -397,7 +469,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);
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#PBS -q EarlyAppAccess
|
||||
#PBS -l select=16
|
||||
#PBS -l walltime=01:00:00
|
||||
#PBS -l walltime=02:00:00
|
||||
#PBS -A LatticeQCD_aesp_CNDA
|
||||
|
||||
#export OMP_PROC_BIND=spread
|
||||
@ -36,5 +36,6 @@ export MPICH_OFI_NIC_POLICY=GPU
|
||||
CMD="mpiexec -np 192 -ppn 12 -envall \
|
||||
./gpu_tile_compact.sh \
|
||||
./Test_dwf_mixedcg_prec --mpi 2.4.4.6 --grid 64.128.128.192 \
|
||||
--shm-mpi 1 --shm 4096 --device-mem 32000 --accelerator-threads 32 --seconds 3000"
|
||||
--shm-mpi 1 --shm 4096 --device-mem 32000 --accelerator-threads 32 --seconds 6000 "
|
||||
#--comms-overlap
|
||||
$CMD
|
||||
|
@ -36,5 +36,5 @@ export MPICH_OFI_NIC_POLICY=GPU
|
||||
CMD="mpiexec -np 192 -ppn 12 -envall \
|
||||
./gpu_tile_compact.sh \
|
||||
./Test_staggered_cg_prec --mpi 2.4.4.6 --grid 128.128.128.192 \
|
||||
--shm-mpi 1 --shm 4096 --device-mem 32000 --accelerator-threads 32 --seconds 3000"
|
||||
--shm-mpi 1 --shm 4096 --device-mem 32000 --accelerator-threads 32 --seconds 3000 --comms-overlap"
|
||||
$CMD
|
||||
|
@ -108,6 +108,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();
|
||||
@ -139,6 +144,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