mirror of
https://github.com/paboyle/Grid.git
synced 2026-06-04 11:14:38 +01:00
benchmarks: add DhopEO benchmarks to Benchmark_staggered and Benchmark_staggeredF
Also add NaiveStaggeredFermionF to Benchmark_staggeredF, and fix bug where NaiveStaggered timed loop was calling Ds.Dhop instead of Dn.Dhop. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -98,35 +98,43 @@ int main (int argc, char ** argv)
|
|||||||
ImprovedStaggeredFermionD Ds(Umu,Umu,Grid,RBGrid,mass,c1,c2,u0,params);
|
ImprovedStaggeredFermionD Ds(Umu,Umu,Grid,RBGrid,mass,c1,c2,u0,params);
|
||||||
NaiveStaggeredFermionD Dn(Umu,Grid,RBGrid,mass,c1,u0,params);
|
NaiveStaggeredFermionD Dn(Umu,Grid,RBGrid,mass,c1,u0,params);
|
||||||
|
|
||||||
std::cout<<GridLogMessage << "Calling Ds"<<std::endl;
|
FermionField src_e(&RBGrid); pickCheckerboard(Even, src_e, src);
|
||||||
int ncall=100;
|
FermionField src_o(&RBGrid); pickCheckerboard(Odd, src_o, src);
|
||||||
// warm perf only
|
FermionField res_e(&RBGrid); res_e = Zero();
|
||||||
for(int i=0;i<ncall;i++){
|
|
||||||
Ds.Dhop(src,result,0);
|
|
||||||
}
|
|
||||||
double t0=usecond();
|
|
||||||
for(int i=0;i<ncall;i++){
|
|
||||||
Ds.Dhop(src,result,0);
|
|
||||||
}
|
|
||||||
double t1=usecond();
|
|
||||||
double flops=(16*(3*(6+8+8)) + 15*3*2)*volume*ncall; // == 66*16 + 90 == 1146
|
|
||||||
std::cout<<GridLogMessage << "Called Ds"<<std::endl;
|
|
||||||
std::cout<<GridLogMessage << "norm result "<< norm2(result)<<std::endl;
|
|
||||||
std::cout<<GridLogMessage << "mflop/s = "<< flops/(t1-t0)<<std::endl;
|
|
||||||
|
|
||||||
// Warm perf only
|
int ncall=100;
|
||||||
for(int i=0;i<ncall;i++){
|
|
||||||
Dn.Dhop(src,result,0);
|
// ImprovedStaggered Dhop
|
||||||
}
|
for(int i=0;i<ncall;i++) Ds.Dhop(src,result,0);
|
||||||
|
double t0=usecond();
|
||||||
|
for(int i=0;i<ncall;i++) Ds.Dhop(src,result,0);
|
||||||
|
double t1=usecond();
|
||||||
|
double flops=(16*(3*(6+8+8)) + 15*3*2)*volume*ncall; // 1146 flops/site
|
||||||
|
std::cout<<GridLogMessage << "ImprovedStaggered Dhop mflop/s = "<< flops/(t1-t0)<<std::endl;
|
||||||
|
|
||||||
|
// ImprovedStaggered DhopEO
|
||||||
|
for(int i=0;i<ncall;i++) Ds.DhopEO(src_o,res_e,0);
|
||||||
t0=usecond();
|
t0=usecond();
|
||||||
for(int i=0;i<ncall;i++){
|
for(int i=0;i<ncall;i++) Ds.DhopEO(src_o,res_e,0);
|
||||||
Ds.Dhop(src,result,0);
|
t1=usecond();
|
||||||
}
|
flops=(16*(3*(6+8+8)) + 15*3*2)*(volume/2)*ncall;
|
||||||
|
std::cout<<GridLogMessage << "ImprovedStaggered DhopEO mflop/s = "<< flops/(t1-t0)<<std::endl;
|
||||||
|
|
||||||
|
// NaiveStaggered Dhop
|
||||||
|
for(int i=0;i<ncall;i++) Dn.Dhop(src,result,0);
|
||||||
|
t0=usecond();
|
||||||
|
for(int i=0;i<ncall;i++) Dn.Dhop(src,result,0);
|
||||||
t1=usecond();
|
t1=usecond();
|
||||||
flops=(8*(3*(6+8+8)) + 7*3*2)*volume*ncall;
|
flops=(8*(3*(6+8+8)) + 7*3*2)*volume*ncall;
|
||||||
std::cout<<GridLogMessage << "Called Dn"<<std::endl;
|
std::cout<<GridLogMessage << "NaiveStaggered Dhop mflop/s = "<< flops/(t1-t0)<<std::endl;
|
||||||
std::cout<<GridLogMessage << "norm result "<< norm2(result)<<std::endl;
|
|
||||||
std::cout<<GridLogMessage << "mflop/s = "<< flops/(t1-t0)<<std::endl;
|
// NaiveStaggered DhopEO
|
||||||
|
for(int i=0;i<ncall;i++) Dn.DhopEO(src_o,res_e,0);
|
||||||
|
t0=usecond();
|
||||||
|
for(int i=0;i<ncall;i++) Dn.DhopEO(src_o,res_e,0);
|
||||||
|
t1=usecond();
|
||||||
|
flops=(8*(3*(6+8+8)) + 7*3*2)*(volume/2)*ncall;
|
||||||
|
std::cout<<GridLogMessage << "NaiveStaggered DhopEO mflop/s = "<< flops/(t1-t0)<<std::endl;
|
||||||
|
|
||||||
Grid_finalize();
|
Grid_finalize();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,22 +96,45 @@ int main (int argc, char ** argv)
|
|||||||
RealD c2=-1.0/24.0;
|
RealD c2=-1.0/24.0;
|
||||||
RealD u0=1.0;
|
RealD u0=1.0;
|
||||||
ImprovedStaggeredFermionF Ds(Umu,Umu,Grid,RBGrid,mass,c1,c2,u0,params);
|
ImprovedStaggeredFermionF Ds(Umu,Umu,Grid,RBGrid,mass,c1,c2,u0,params);
|
||||||
|
NaiveStaggeredFermionF Dn(Umu,Grid,RBGrid,mass,c1,u0,params);
|
||||||
|
|
||||||
|
FermionField src_e(&RBGrid); pickCheckerboard(Even, src_e, src);
|
||||||
|
FermionField src_o(&RBGrid); pickCheckerboard(Odd, src_o, src);
|
||||||
|
FermionField res_e(&RBGrid); res_e = Zero();
|
||||||
|
|
||||||
std::cout<<GridLogMessage << "Calling Ds"<<std::endl;
|
|
||||||
int ncall=1000;
|
int ncall=1000;
|
||||||
for(int i=0;i<ncall;i++){
|
|
||||||
Ds.Dhop(src,result,0);
|
|
||||||
}
|
|
||||||
double t0=usecond();
|
|
||||||
for(int i=0;i<ncall;i++){
|
|
||||||
Ds.Dhop(src,result,0);
|
|
||||||
}
|
|
||||||
double t1=usecond();
|
|
||||||
double flops=(16*(3*(6+8+8)) + 15*3*2)*volume*ncall; // == 66*16 + == 1146
|
|
||||||
|
|
||||||
std::cout<<GridLogMessage << "Called Ds"<<std::endl;
|
// ImprovedStaggered Dhop
|
||||||
std::cout<<GridLogMessage << "norm result "<< norm2(result)<<std::endl;
|
for(int i=0;i<ncall;i++) Ds.Dhop(src,result,0);
|
||||||
std::cout<<GridLogMessage << "mflop/s = "<< flops/(t1-t0)<<std::endl;
|
double t0=usecond();
|
||||||
|
for(int i=0;i<ncall;i++) Ds.Dhop(src,result,0);
|
||||||
|
double t1=usecond();
|
||||||
|
double flops=(16*(3*(6+8+8)) + 15*3*2)*volume*ncall; // 1146 flops/site
|
||||||
|
std::cout<<GridLogMessage << "ImprovedStaggered Dhop mflop/s = "<< flops/(t1-t0)<<std::endl;
|
||||||
|
|
||||||
|
// ImprovedStaggered DhopEO
|
||||||
|
for(int i=0;i<ncall;i++) Ds.DhopEO(src_o,res_e,0);
|
||||||
|
t0=usecond();
|
||||||
|
for(int i=0;i<ncall;i++) Ds.DhopEO(src_o,res_e,0);
|
||||||
|
t1=usecond();
|
||||||
|
flops=(16*(3*(6+8+8)) + 15*3*2)*(volume/2)*ncall;
|
||||||
|
std::cout<<GridLogMessage << "ImprovedStaggered DhopEO mflop/s = "<< flops/(t1-t0)<<std::endl;
|
||||||
|
|
||||||
|
// NaiveStaggered Dhop
|
||||||
|
for(int i=0;i<ncall;i++) Dn.Dhop(src,result,0);
|
||||||
|
t0=usecond();
|
||||||
|
for(int i=0;i<ncall;i++) Dn.Dhop(src,result,0);
|
||||||
|
t1=usecond();
|
||||||
|
flops=(8*(3*(6+8+8)) + 7*3*2)*volume*ncall;
|
||||||
|
std::cout<<GridLogMessage << "NaiveStaggered Dhop mflop/s = "<< flops/(t1-t0)<<std::endl;
|
||||||
|
|
||||||
|
// NaiveStaggered DhopEO
|
||||||
|
for(int i=0;i<ncall;i++) Dn.DhopEO(src_o,res_e,0);
|
||||||
|
t0=usecond();
|
||||||
|
for(int i=0;i<ncall;i++) Dn.DhopEO(src_o,res_e,0);
|
||||||
|
t1=usecond();
|
||||||
|
flops=(8*(3*(6+8+8)) + 7*3*2)*(volume/2)*ncall;
|
||||||
|
std::cout<<GridLogMessage << "NaiveStaggered DhopEO mflop/s = "<< flops/(t1-t0)<<std::endl;
|
||||||
|
|
||||||
Grid_finalize();
|
Grid_finalize();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user