Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to run tensorflow benchmark_model through ngraph cpu #335

Open
zhaify opened this issue Nov 19, 2019 · 0 comments
Open

How to run tensorflow benchmark_model through ngraph cpu #335

zhaify opened this issue Nov 19, 2019 · 0 comments

Comments

@zhaify
Copy link

zhaify commented Nov 19, 2019

HI ALL,
I want to run TF benchmark_model through ngraph cpu, is there some doc to guide me do these?

I have try to load libngraph_bridge.so manually in benchmark_model.cc like below:

  TF_LoadLibrary(
      "libngraph_bridge.so",
      status);

and add customize_config into SessionOptions refer UT

  tensorflow::SessionOptions options;
    options.config.mutable_graph_options()
        ->mutable_optimizer_options()
        ->set_opt_level(tensorflow::OptimizerOptions_Level_L0);
    options.config.mutable_graph_options()
        ->mutable_rewrite_options()
        ->set_constant_folding(tensorflow::RewriterConfig::OFF);
    tensorflow::ConfigProto& config = options.config;
    auto* custom_config = options.config.mutable_graph_options()
                              ->mutable_rewrite_options()
                              ->add_custom_optimizers();
    custom_config->set_name("ngraph-optimizer");
    (*custom_config->mutable_parameter_map())["ngraph_backend"].set_s("CPU");
    (*custom_config->mutable_parameter_map())["device_id"].set_s("0");   
    options.config.mutable_graph_options()
        ->mutable_rewrite_options()
        ->set_min_graph_nodes(-1);

    options.config.mutable_graph_options()
        ->mutable_rewrite_options()
        ->set_meta_optimizer_iterations(tensorflow::RewriterConfig::ONE);

  config.set_allow_soft_placement(true);


  LOG(INFO) << "Got config, " << config.device_count_size() << " devices";

  session->reset(tensorflow::NewSession(options));
  graph_def->reset(new GraphDef());
  tensorflow::GraphDef tensorflow_graph;
  Status s = ReadBinaryProto(Env::Default(), graph, graph_def->get());

but these does not work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant