OmniSciDB  c07336695a
RunQueryLoop.cpp File Reference
#include "../Catalog/Catalog.h"
#include "../QueryRunner/QueryRunner.h"
#include <boost/program_options.hpp>
+ Include dependency graph for RunQueryLoop.cpp:

Go to the source code of this file.

Typedefs

using QR = QueryRunner::QueryRunner
 

Functions

int main (int argc, char **argv)
 

Typedef Documentation

◆ QR

Definition at line 22 of file RunQueryLoop.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 24 of file RunQueryLoop.cpp.

References CPU, logger::ERROR, QueryRunner::QueryRunner::get(), GPU, QueryRunner::QueryRunner::init(), LOG, anonymous_namespace{UpdateMetadataTest.cpp}::query, run-benchmark-import::required, run, and QueryRunner::QueryRunner::runSQL().

24  {
25  std::string db_path;
26  std::string query;
27  size_t iter;
28 
30 
31  boost::program_options::options_description desc("Options");
32  desc.add_options()("path",
33  boost::program_options::value<std::string>(&db_path)->required(),
34  "Directory path to Mapd catalogs")(
35  "query", boost::program_options::value<std::string>(&query)->required(), "Query")(
36  "iter", boost::program_options::value<size_t>(&iter), "Number of iterations")(
37  "cpu", "Run on CPU (run on GPU by default)");
38 
39  boost::program_options::positional_options_description positionalOptions;
40  positionalOptions.add("path", 1);
41  positionalOptions.add("query", 1);
42 
43  boost::program_options::variables_map vm;
44 
45  try {
46  boost::program_options::store(boost::program_options::command_line_parser(argc, argv)
47  .options(desc)
48  .positional(positionalOptions)
49  .run(),
50  vm);
51  boost::program_options::notify(vm);
52  } catch (boost::program_options::error& err) {
53  LOG(ERROR) << err.what();
54  return 1;
55  }
56 
57  if (!vm.count("iter")) {
58  iter = 100;
59  }
60 
61  if (vm.count("cpu")) {
62  device_type = ExecutorDeviceType::CPU;
63  }
64 
65  QR::init(db_path.c_str());
66  for (size_t i = 0; i < iter; ++i) {
67  QR::get()->runSQL(query, device_type, true, true);
68  }
69  return 0;
70 }
ExecutorDeviceType
#define LOG(tag)
Definition: Logger.h:182
static QueryRunner * init(const char *db_path, const std::string &udf_filename="", const size_t max_gpu_mem=0, const int reserved_gpu_mem=256<< 20)
Definition: QueryRunner.h:70
virtual std::shared_ptr< ResultSet > runSQL(const std::string &query_str, const ExecutorDeviceType device_type, const bool hoist_literals=true, const bool allow_loop_joins=true)
static QueryRunner * get()
Definition: QueryRunner.h:115
static bool run
+ Here is the call graph for this function: