26int entry(
const int argc,
char **argv)
30 arser.add_argument(
"--input_model")
32 .type(arser::DataType::STR)
34 .help(
"Input model filepath (.circle)");
36 arser.add_argument(
"--input_data")
38 .type(arser::DataType::STR)
39 .help(
"Input data filepath (.h5) (if not given, random data will be used)");
41 arser.add_argument(
"--analysis")
43 .type(arser::DataType::STR)
45 .help(
"Analysis code filepath (.py)");
47 arser.add_argument(
"--analysis_args")
49 .type(arser::DataType::STR)
50 .help(
"String argument passed to the analysis code");
54 arser.parse(argc, argv);
56 catch (
const std::runtime_error &err)
58 std::cout << err.what() << std::endl;
63 auto input_model_path =
arser.get<std::string>(
"--input_model");
64 auto analysis_path =
arser.get<std::string>(
"--analysis");
65 std::string analysis_args =
"";
66 if (
arser[
"--analysis_args"])
67 analysis_args =
arser.get<std::string>(
"--analysis_args");
70 py::scoped_interpreter guard{};
75 dalgona.initialize(input_model_path);
78 if (
arser[
"--input_data"])
80 const auto input_data_path =
arser.get<std::string>(
"--input_data");
81 dalgona.runAnalysisWithH5Input(input_data_path, analysis_path, analysis_args);
85 std::cout <<
"--input_data was not specified. Run with a random input." << std::endl;
86 dalgona.runAnalysisWithRandomInput(analysis_path, analysis_args);