1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-10 07:55:35 +00:00

Improved comms benchmark, same as benchmark_comms_host_device

This commit is contained in:
Peter Boyle 2021-08-10 05:16:30 -07:00
parent fe5aaf7677
commit 75030637cc

View File

@ -144,23 +144,19 @@ public:
int ncomm; int ncomm;
double dbytes; double dbytes;
for(int dir=0;dir<8;dir++) {
int mu =dir % 4;
if (mpi_layout[mu]>1 ) {
std::vector<double> times(Nloop); std::vector<double> times(Nloop);
for(int i=0;i<Nloop;i++){ for(int i=0;i<Nloop;i++){
double start=usecond();
dbytes=0; dbytes=0;
ncomm=0; double start=usecond();
for(int dir=0;dir<8;dir++) {
double tbytes;
int mu =dir % 4;
if (mpi_layout[mu]>1 ) {
int xmit_to_rank; int xmit_to_rank;
int recv_from_rank; int recv_from_rank;
if ( dir == mu ) { if ( dir == mu ) {
int comm_proc=1; int comm_proc=1;
Grid.ShiftedRanks(mu,comm_proc,xmit_to_rank,recv_from_rank); Grid.ShiftedRanks(mu,comm_proc,xmit_to_rank,recv_from_rank);
@ -171,23 +167,16 @@ public:
Grid.SendToRecvFrom((void *)&xbuf[dir][0], xmit_to_rank, Grid.SendToRecvFrom((void *)&xbuf[dir][0], xmit_to_rank,
(void *)&rbuf[dir][0], recv_from_rank, (void *)&rbuf[dir][0], recv_from_rank,
bytes); bytes);
tbytes = bytes; dbytes+=bytes;
thread_critical {
ncomm++;
dbytes+=tbytes;
}
}
};
Grid.Barrier();
double stop=usecond(); double stop=usecond();
t_time[i] = stop-start; // microseconds t_time[i] = stop-start; // microseconds
}
}
timestat.statistics(t_time); timestat.statistics(t_time);
dbytes=dbytes*ppn; dbytes=dbytes*ppn;
double xbytes = dbytes*0.5; double xbytes = dbytes*0.5;
// double rbytes = dbytes*0.5;
double bidibytes = dbytes; double bidibytes = dbytes;
std::cout<<GridLogMessage << lat<<"\t"<<Ls<<"\t " std::cout<<GridLogMessage << lat<<"\t"<<Ls<<"\t "
@ -196,14 +185,14 @@ public:
<<xbytes/timestat.max <<" "<< xbytes/timestat.min <<xbytes/timestat.max <<" "<< xbytes/timestat.min
<< "\t\t"<< bidibytes/timestat.mean<< " " << bidibytes*timestat.err/(timestat.mean*timestat.mean) << " " << "\t\t"<< bidibytes/timestat.mean<< " " << bidibytes*timestat.err/(timestat.mean*timestat.mean) << " "
<< bidibytes/timestat.max << " " << bidibytes/timestat.min << std::endl; << bidibytes/timestat.max << " " << bidibytes/timestat.min << std::endl;
}
}
for(int d=0;d<8;d++){ for(int d=0;d<8;d++){
acceleratorFreeDevice(xbuf[d]); acceleratorFreeDevice(xbuf[d]);
acceleratorFreeDevice(rbuf[d]); acceleratorFreeDevice(rbuf[d]);
} }
} }
} }
return; return;
} }
@ -449,7 +438,7 @@ public:
// 1344= 3*(2*8+6)*2*8 + 8*3*2*2 + 3*4*2*8 // 1344= 3*(2*8+6)*2*8 + 8*3*2*2 + 3*4*2*8
// 1344 = Nc* (6+(Nc-1)*8)*2*Nd + Nd*Nc*2*2 + Nd*Nc*Ns*2 // 1344 = Nc* (6+(Nc-1)*8)*2*Nd + Nd*Nc*2*2 + Nd*Nc*Ns*2
// double flops=(1344.0*volume)/2; // double flops=(1344.0*volume)/2;
#if 1 #if 0
double fps = Nc* (6+(Nc-1)*8)*Ns*Nd + Nd*Nc*Ns + Nd*Nc*Ns*2; double fps = Nc* (6+(Nc-1)*8)*Ns*Nd + Nd*Nc*Ns + Nd*Nc*Ns*2;
#else #else
double fps = Nc* (6+(Nc-1)*8)*Ns*Nd + 2*Nd*Nc*Ns + 2*Nd*Nc*Ns*2; double fps = Nc* (6+(Nc-1)*8)*Ns*Nd + 2*Nd*Nc*Ns + 2*Nd*Nc*Ns*2;
@ -720,12 +709,12 @@ int main (int argc, char ** argv)
if ( do_su4 ) { if ( do_su4 ) {
std::cout<<GridLogMessage << "=================================================================================="<<std::endl; std::cout<<GridLogMessage << "=================================================================================="<<std::endl;
std::cout<<GridLogMessage << " Memory benchmark " <<std::endl; std::cout<<GridLogMessage << " SU(4) benchmark " <<std::endl;
std::cout<<GridLogMessage << "=================================================================================="<<std::endl; std::cout<<GridLogMessage << "=================================================================================="<<std::endl;
Benchmark::SU4(); Benchmark::SU4();
} }
if ( do_comms && (NN>1) ) { if ( do_comms ) {
std::cout<<GridLogMessage << "=================================================================================="<<std::endl; std::cout<<GridLogMessage << "=================================================================================="<<std::endl;
std::cout<<GridLogMessage << " Communications benchmark " <<std::endl; std::cout<<GridLogMessage << " Communications benchmark " <<std::endl;
std::cout<<GridLogMessage << "=================================================================================="<<std::endl; std::cout<<GridLogMessage << "=================================================================================="<<std::endl;