1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-09-20 09:15:38 +01:00

Added profiling messages to pick and set checkerboard functions

This commit is contained in:
Henrique B. R. 2021-04-08 16:58:47 +01:00
parent d38ae2fd18
commit 3e2ae1e9af

View File

@ -49,10 +49,15 @@ inline void subdivides(GridBase *coarse,GridBase *fine)
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////
template<class vobj> inline void pickCheckerboard(int cb,Lattice<vobj> &half,const Lattice<vobj> &full) template<class vobj> inline void pickCheckerboard(int cb,Lattice<vobj> &half,const Lattice<vobj> &full)
{ {
static double time_autoview = 0;
static double time_loop = 0;
half.Checkerboard() = cb; half.Checkerboard() = cb;
double start = usecond();
autoView( half_v, half, CpuWrite); autoView( half_v, half, CpuWrite);
autoView( full_v, full, CpuRead); autoView( full_v, full, CpuRead);
time_autoview += usecond()-start;
start = usecond();
thread_for(ss, full.Grid()->oSites(),{ thread_for(ss, full.Grid()->oSites(),{
int cbos; int cbos;
Coordinate coor; Coordinate coor;
@ -64,12 +69,24 @@ template<class vobj> inline void pickCheckerboard(int cb,Lattice<vobj> &half,con
half_v[ssh] = full_v[ss]; half_v[ssh] = full_v[ss];
} }
}); });
time_loop += usecond()-start;
std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl;
std::cout << "pickCheckerboard" << std::endl;
std::cout << "AutoView cumulative time (s) = " << time_autoview/1000000. << "(" << 100*time_autoview/(time_autoview+time_loop) << "% of pickCheckerboard)" << std::endl;
std::cout << "Loop cumulative time (s) = " << time_loop/1000000. << "(" << 100*time_loop/(time_autoview+time_loop) << "% of pickCheckerboard)" << std::endl;
} }
template<class vobj> inline void setCheckerboard(Lattice<vobj> &full,const Lattice<vobj> &half) template<class vobj> inline void setCheckerboard(Lattice<vobj> &full,const Lattice<vobj> &half)
{ {
static double time_autoview = 0;
static double time_loop = 0;
int cb = half.Checkerboard(); int cb = half.Checkerboard();
double start = usecond();
autoView( half_v , half, CpuRead); autoView( half_v , half, CpuRead);
autoView( full_v , full, CpuWrite); autoView( full_v , full, CpuWrite);
time_autoview += usecond()-start;
start = usecond();
thread_for(ss,full.Grid()->oSites(),{ thread_for(ss,full.Grid()->oSites(),{
Coordinate coor; Coordinate coor;
@ -83,6 +100,13 @@ template<class vobj> inline void setCheckerboard(Lattice<vobj> &full,const Latti
full_v[ss]=half_v[ssh]; full_v[ss]=half_v[ssh];
} }
}); });
time_loop += usecond()-start;
std::cout << "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" << std::endl;
std::cout << "setCheckerboard" << std::endl;
std::cout << "AutoView cumulative time (s) = " << time_autoview/1000000. << "(" << 100*time_autoview/(time_autoview+time_loop) << "% of setCheckerboard)" << std::endl;
std::cout << "Loop cumulative time (s) = " << time_loop/1000000. << "(" << 100*time_loop/(time_autoview+time_loop) << "% of setCheckerboard)" << std::endl;
} }
//////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////