1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-07-28 10:17:08 +01:00

Timing hooks

This commit is contained in:
paboyle
2016-10-06 09:25:12 +01:00
parent 98439847cf
commit 4089984431
4 changed files with 82 additions and 14 deletions

View File

@@ -301,6 +301,39 @@
double gathermtime;
double splicetime;
double nosplicetime;
double calls;
void ZeroCounters(void) {
gathertime=0;
jointime=0;
commtime=0;
halogtime=0;
mergetime=0;
spintime=0;
gathermtime=0;
splicetime=0;
nosplicetime=0;
comms_bytes=0;
calls=0;
};
void Report(void) {
#define PRINTIT(A) \
std::cout << GridLogMessage << " Stencil " << #A << " "<< A/calls<<std::endl;
if ( calls > 0 ) {
std::cout << GridLogMessage << " Stencil calls "<<calls<<std::endl;
PRINTIT(jointime);
PRINTIT(gathertime);
PRINTIT(commtime);
PRINTIT(halogtime);
PRINTIT(mergetime);
PRINTIT(spintime);
PRINTIT(comms_bytes);
PRINTIT(gathermtime);
PRINTIT(splicetime);
PRINTIT(nosplicetime);
}
};
#endif
CartesianStencil(GridBase *grid,
@@ -310,18 +343,6 @@
const std::vector<int> &distances)
: _permute_type(npoints), _comm_buf_size(npoints)
{
#ifdef TIMING_HACK
gathertime=0;
jointime=0;
commtime=0;
halogtime=0;
mergetime=0;
spintime=0;
gathermtime=0;
splicetime=0;
nosplicetime=0;
comms_bytes=0;
#endif
_npoints = npoints;
_grid = grid;
_directions = directions;
@@ -623,6 +644,7 @@
template<class compressor>
void HaloExchange(const Lattice<vobj> &source,compressor &compress)
{
calls++;
Mergers.resize(0);
Packets.resize(0);
HaloGather(source,compress);

View File

@@ -175,6 +175,35 @@ WilsonFermion5D<Impl>::WilsonFermion5D(int simd,GaugeField &_Umu,
}
*/
template<class Impl>
void WilsonFermion5D<Impl>::Report(void)
{
if ( Calls > 0 ) {
std::cout << GridLogMessage << "WilsonFermion5D Dhop Calls " <<Calls <<std::endl;
std::cout << GridLogMessage << "WilsonFermion5D CommTime " <<CommTime/Calls<<" us" <<std::endl;
std::cout << GridLogMessage << "WilsonFermion5D ComputeTime " <<ComputeTime/Calls<<" us" <<std::endl;
std::cout << GridLogMessage << "WilsonFermion5D Stencil"<<std::endl;
Stencil.Report();
std::cout << GridLogMessage << "WilsonFermion5D StencilEven"<<std::endl;
StencilEven.Report();
std::cout << GridLogMessage << "WilsonFermion5D StencilOdd"<<std::endl;
StencilOdd.Report();
}
}
template<class Impl>
void WilsonFermion5D<Impl>::ZeroCounters(void) {
Calls=0;
CommTime=0;
ComputeTime=0;
Stencil.ZeroCounters();
StencilEven.ZeroCounters();
StencilOdd.ZeroCounters();
}
template<class Impl>
void WilsonFermion5D<Impl>::ImportGauge(const GaugeField &_Umu)
{
@@ -326,13 +355,17 @@ void WilsonFermion5D<Impl>::DhopInternal(StencilImpl & st, LebesgueOrder &lo,
DoubledGaugeField & U,
const FermionField &in, FermionField &out,int dag)
{
Calls++;
// assert((dag==DaggerNo) ||(dag==DaggerYes));
Compressor compressor(dag);
int LLs = in._grid->_rdimensions[0];
CommTime-=usecond();
st.HaloExchange(in,compressor);
CommTime+=usecond();
ComputeTime-=usecond();
// Dhop takes the 4d grid from U, and makes a 5d index for fermion
if ( dag == DaggerYes ) {
PARALLEL_FOR_LOOP
@@ -349,6 +382,7 @@ PARALLEL_FOR_LOOP
Kernels::DiracOptDhopSite(st,lo,U,st.comm_buf,sF,sU,LLs,1,in,out);
}
}
ComputeTime+=usecond();
}

View File

@@ -61,6 +61,12 @@ namespace Grid {
INHERIT_IMPL_TYPES(Impl);
typedef WilsonKernels<Impl> Kernels;
void Report(void);
void ZeroCounters(void);
double Calls;
double CommTime;
double ComputeTime;
///////////////////////////////////////////////////////////////
// Implement the abstract base
///////////////////////////////////////////////////////////////