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

76 lines
1.9 KiB
C++
Raw Normal View History

2018-03-29 19:57:41 +01:00
2018-10-15 17:25:08 +01:00
#include "Benchmark_IO.hpp"
2018-03-29 19:57:41 +01:00
#ifndef BENCH_IO_LMAX
#define BENCH_IO_LMAX 40
#endif
2018-10-15 17:25:08 +01:00
using namespace Grid;
2018-03-29 19:57:41 +01:00
2018-10-15 17:25:08 +01:00
std::string filestem(const int l)
2018-03-29 19:57:41 +01:00
{
2018-10-15 17:25:08 +01:00
return "iobench_l" + std::to_string(l);
2018-03-29 19:57:41 +01:00
}
int main (int argc, char ** argv)
{
Grid_init(&argc,&argv);
2020-10-07 15:31:51 +01:00
int64_t threads = GridThread::GetThreads();
auto mpi = GridDefaultMpi();
std::vector<int> latt;
2018-10-15 17:25:08 +01:00
MSG << "Grid is setup to use " << threads << " threads" << std::endl;
2020-10-07 15:31:51 +01:00
MSG << "MPI partition " << mpi << std::endl;
2020-10-06 17:57:00 +01:00
MSG << SEP << std::endl;
2020-10-07 15:31:51 +01:00
MSG << "Benchmark std write" << std::endl;
2020-10-06 17:57:00 +01:00
MSG << SEP << std::endl;
for (int l = 4; l <= BENCH_IO_LMAX; l += 2)
{
2020-10-07 15:31:51 +01:00
latt = {l*mpi[0], l*mpi[1], l*mpi[2], l*mpi[3]};
2020-10-06 17:57:00 +01:00
MSG << "-- Local volume " << l << "^4" << std::endl;
writeBenchmark<LatticeFermion>(latt, filestem(l), stdWrite<LatticeFermion>);
}
MSG << SEP << std::endl;
2020-10-07 15:31:51 +01:00
MSG << "Benchmark std read" << std::endl;
2020-10-06 17:57:00 +01:00
MSG << SEP << std::endl;
for (int l = 4; l <= BENCH_IO_LMAX; l += 2)
{
2020-10-07 15:31:51 +01:00
latt = {l*mpi[0], l*mpi[1], l*mpi[2], l*mpi[3]};
2020-10-06 17:57:00 +01:00
MSG << "-- Local volume " << l << "^4" << std::endl;
readBenchmark<LatticeFermion>(latt, filestem(l), stdRead<LatticeFermion>);
}
2020-10-07 15:31:51 +01:00
#ifdef HAVE_LIME
2018-10-15 17:25:08 +01:00
MSG << SEP << std::endl;
2020-10-07 15:31:51 +01:00
MSG << "Benchmark Grid C-Lime write" << std::endl;
2018-10-15 17:25:08 +01:00
MSG << SEP << std::endl;
2018-03-29 19:57:41 +01:00
for (int l = 4; l <= BENCH_IO_LMAX; l += 2)
{
2020-10-07 15:31:51 +01:00
latt = {l*mpi[0], l*mpi[1], l*mpi[2], l*mpi[3]};
2018-10-15 17:25:08 +01:00
2020-10-06 17:57:00 +01:00
MSG << "-- Local volume " << l << "^4" << std::endl;
2018-10-15 17:25:08 +01:00
writeBenchmark<LatticeFermion>(latt, filestem(l), limeWrite<LatticeFermion>);
2018-03-29 19:57:41 +01:00
}
2020-10-06 17:57:00 +01:00
MSG << SEP << std::endl;
2020-10-07 15:31:51 +01:00
MSG << "Benchmark Grid C-Lime read" << std::endl;
2018-10-15 17:25:08 +01:00
MSG << SEP << std::endl;
2018-03-29 19:57:41 +01:00
for (int l = 4; l <= BENCH_IO_LMAX; l += 2)
{
2020-10-07 15:31:51 +01:00
latt = {l*mpi[0], l*mpi[1], l*mpi[2], l*mpi[3]};
2018-10-15 17:25:08 +01:00
2020-10-06 17:57:00 +01:00
MSG << "-- Local volume " << l << "^4" << std::endl;
2018-10-15 17:25:08 +01:00
readBenchmark<LatticeFermion>(latt, filestem(l), limeRead<LatticeFermion>);
2018-03-29 19:57:41 +01:00
}
2020-10-07 15:31:51 +01:00
#endif
2018-03-29 19:57:41 +01:00
Grid_finalize();
2020-10-07 15:31:51 +01:00
2018-03-29 19:57:41 +01:00
return EXIT_SUCCESS;
2018-03-30 13:39:20 +01:00
}