1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-11-15 02:05:37 +00:00
Grid/benchmarks/Benchmark_IO_vs_dir.cc

103 lines
2.8 KiB
C++
Raw Normal View History

2018-10-15 17:25:08 +01:00
#include "Benchmark_IO.hpp"
2020-11-17 12:41:15 +00:00
#ifdef HAVE_LIME
2018-10-15 17:25:08 +01:00
using namespace Grid;
int main (int argc, char ** argv)
{
std::vector<std::string> dir;
unsigned int Ls;
bool rb;
if (argc < 4)
{
std::cerr << "usage: " << argv[0] << " <Ls> <RB {0|1}> <dir1> [<dir2> ... <dirn>] [Grid options]";
std::cerr << std::endl;
}
Ls = std::stoi(argv[1]);
rb = (std::string(argv[2]) == "1");
for (unsigned int i = 3; i < argc; ++i)
{
std::string a = argv[i];
if (a[0] != '-')
{
dir.push_back(std::string(argv[i]));
}
else
{
break;
}
}
Grid_init(&argc,&argv);
int64_t threads = GridThread::GetThreads();
2020-10-07 15:31:51 +01:00
auto mpi = GridDefaultMpi();
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;
2018-10-15 17:25:08 +01:00
2020-10-07 15:38:41 +01:00
MSG << SEP << std::endl;
MSG << "Benchmark Grid std write" << std::endl;
MSG << SEP << std::endl;
for (auto &d: dir)
{
MSG << "-- Directory " << d << std::endl;
writeBenchmark<LatticeFermion>(GridDefaultLatt(), d + "/ioBench",
stdWrite<LatticeFermion>, Ls, rb);
}
MSG << SEP << std::endl;
MSG << "Benchmark Grid std read" << std::endl;
MSG << SEP << std::endl;
for (auto &d: dir)
{
MSG << "-- Directory " << d << std::endl;
readBenchmark<LatticeFermion>(GridDefaultLatt(), d + "/ioBench",
stdRead<LatticeFermion>, Ls, rb);
}
#ifdef HAVE_LIME
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;
for (auto &d: dir)
{
MSG << "-- Directory " << d << std::endl;
2020-10-07 15:31:51 +01:00
writeBenchmark<LatticeFermion>(GridDefaultLatt(), d + "/ioBench",
limeWrite<LatticeFermion>, Ls, rb);
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 read" << std::endl;
MSG << SEP << std::endl;
for (auto &d: dir)
{
MSG << "-- Directory " << d << std::endl;
2020-10-07 15:31:51 +01:00
readBenchmark<LatticeFermion>(GridDefaultLatt(), d + "/ioBench",
limeRead<LatticeFermion>, Ls, rb);
}
2020-10-07 15:38:41 +01:00
#endif
2020-10-07 15:31:51 +01:00
// MSG << SEP << std::endl;
// MSG << "Benchmark single precision Lime write" << std::endl;
// MSG << SEP << std::endl;
// for (auto &d: dir)
// {
// MSG << "-- Directory " << d << std::endl;
// writeBenchmark<LatticeFermionF>(GridDefaultLatt(), d + "/ioBench", limeWrite<LatticeFermionF>, Ls, rb);
// }
// MSG << SEP << std::endl;
// MSG << "Benchmark single precision Lime read" << std::endl;
// MSG << SEP << std::endl;
// for (auto &d: dir)
// {
// MSG << "-- Directory " << d << std::endl;
// readBenchmark<LatticeFermionF>(GridDefaultLatt(), d + "/ioBench", limeRead<LatticeFermionF>, Ls, rb);
// }
2018-10-15 17:25:08 +01:00
Grid_finalize();
2020-10-07 15:38:41 +01:00
2018-10-15 17:25:08 +01:00
return EXIT_SUCCESS;
}
2020-11-17 12:41:15 +00:00
#else
int main(int argc,char ** argv){}
#endif