Compare commits

..

No commits in common. "f7e607eae4a15f9a19d82d69b770f63742e50a9c" and "a1ec08cdb33f632a510c431881ea5d02d87954e0" have entirely different histories.

View File

@ -264,17 +264,16 @@ class Benchmark
return; return;
} }
static void Latency(void) static void PointToPoint(void)
{ {
int Nwarmup = 100; int Nloop = 200;
int Nloop = 1000;
Coordinate simd_layout = GridDefaultSimd(Nd, vComplexD::Nsimd()); Coordinate simd_layout = GridDefaultSimd(Nd, vComplexD::Nsimd());
Coordinate mpi_layout = GridDefaultMpi(); Coordinate mpi_layout = GridDefaultMpi();
std::cout << GridLogMessage << "Benchmarking point-to-point latency" << std::endl; std::cout << GridLogMessage << "Benchmarking point-to-point latency" << std::endl;
grid_small_sep(); grid_small_sep();
grid_printf("from to mean(usec) err min\n"); grid_printf("from to mean(usec) err min\n");
int lat = 8; // dummy lattice size. Not actually used. int lat = 8; // dummy lattice size. Not actually used.
Coordinate latt_size({lat * mpi_layout[0], lat * mpi_layout[1], lat * mpi_layout[2], Coordinate latt_size({lat * mpi_layout[0], lat * mpi_layout[1], lat * mpi_layout[2],
@ -292,7 +291,7 @@ class Benchmark
int bytes = 8; int bytes = 8;
void *buf_from = acceleratorAllocDevice(bytes); void *buf_from = acceleratorAllocDevice(bytes);
void *buf_to = acceleratorAllocDevice(bytes); void *buf_to = acceleratorAllocDevice(bytes);
nlohmann::json json_latency; nlohmann::json json_p2p;
for (int from = 0; from < ranks; ++from) for (int from = 0; from < ranks; ++from)
for (int to = 0; to < ranks; ++to) for (int to = 0; to < ranks; ++to)
{ {
@ -303,7 +302,7 @@ class Benchmark
time_statistics timestat; time_statistics timestat;
MPI_Status status; MPI_Status status;
for (int i = -Nwarmup; i < Nloop; ++i) for (int i = 0; i < Nloop; ++i)
{ {
double start = usecond(); double start = usecond();
if (from == me) if (from == me)
@ -322,8 +321,7 @@ class Benchmark
assert(err == MPI_SUCCESS); assert(err == MPI_SUCCESS);
} }
double stop = usecond(); double stop = usecond();
if (i >= 0) t_time[i] = stop - start;
t_time[i] = stop - start;
} }
// important: only the 'from' rank has a trustworthy time // important: only the 'from' rank has a trustworthy time
MPI_Bcast(t_time.data(), Nloop, MPI_DOUBLE, from, Grid.communicator); MPI_Bcast(t_time.data(), Nloop, MPI_DOUBLE, from, Grid.communicator);
@ -337,9 +335,9 @@ class Benchmark
tmp["time_usec"] = timestat.mean; tmp["time_usec"] = timestat.mean;
tmp["time_usec_error"] = timestat.err; tmp["time_usec_error"] = timestat.err;
tmp["time_usec_max"] = timestat.min; tmp["time_usec_max"] = timestat.min;
json_latency.push_back(tmp); json_p2p.push_back(tmp);
} }
json_results["latency"] = json_latency; json_results["latency"] = json_p2p;
acceleratorFreeDevice(buf_from); acceleratorFreeDevice(buf_from);
acceleratorFreeDevice(buf_to); acceleratorFreeDevice(buf_to);
@ -886,7 +884,7 @@ int main(int argc, char **argv)
int do_su4 = 1; int do_su4 = 1;
int do_memory = 1; int do_memory = 1;
int do_comms = 1; int do_comms = 1;
int do_latency = 1; int do_p2p = 1;
int do_flops = 1; int do_flops = 1;
int Ls = 1; int Ls = 1;
@ -922,12 +920,12 @@ int main(int argc, char **argv)
Benchmark::Comms(); Benchmark::Comms();
} }
if (do_latency) if (do_p2p)
{ {
grid_big_sep(); grid_big_sep();
std::cout << GridLogMessage << " Latency benchmark " << std::endl; std::cout << GridLogMessage << " Point-to-Point benchmark " << std::endl;
grid_big_sep(); grid_big_sep();
Benchmark::Latency(); Benchmark::PointToPoint();
} }
if (do_flops) if (do_flops)