Skip to content

Commit

Permalink
preliminary work to pass in backend arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
mabruzzo committed Sep 6, 2024
1 parent 49326dc commit befe0e8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/grcli/cmd_bench.C
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#endif

#include "args/CliParser.h"
#include "args/EscapedArgsConfig.h"
#include "cmd_bench.h"
#include "executor.h"
#include "grid_problem.h"
Expand All @@ -31,6 +32,9 @@
std::optional<CliParamSpec> gr_param_spec;
scenario::CliGridSpec grid_spec;
std::optional<OperationSpec> op_spec;
args::EscapedArgsConfig backend_arg_spec(true,
"--backend-start",
"--backend-stop");

const char* ptr;
while ((ptr = parser.next()) != nullptr) {
Expand All @@ -42,6 +46,8 @@
continue;
} else if (try_parse_op_spec(ptr, op_spec)) {
continue;
} else if (backend_arg_spec.try_parse(ptr, parser)) {
continue;
}
err_unrecognized_arg(ptr);
}
Expand Down Expand Up @@ -82,10 +88,10 @@
auto my_test = [&driver](benchmark::State& st) { driver(st); };
benchmark::RegisterBenchmark("scenario", my_test);

// we should rethink this so we can pass arguments through to benchmark
int argc = 1;
char* argv[2] = {parser.bin_name(), nullptr};
benchmark::Initialize(&argc, argv);
const char * const * argv = backend_arg_spec.begin();
int argc = backend_arg_spec.end() - argv;

benchmark::Initialize(&argc, (char**)(argv));
benchmark::RunSpecifiedBenchmarks();
benchmark::Shutdown();

Expand Down
1 change: 1 addition & 0 deletions src/grcli/handle_gr_parameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include "ChemistryData.h"
#include "args/CliParser.h"
#include "args/EscapedArgsConfig.h"
#include "utils.h"


Expand Down

0 comments on commit befe0e8

Please sign in to comment.