How could I ask tensorflow use specific gpu to do the inference?
Part of the source codes
std::unique_ptr<tensorflow::Session> session;
Status const load_graph_status = LoadGraph(graph_path, &session);
if (!load_graph_status.ok()) {
LOG(ERROR) << "LoadGraph ERROR!!!!"<< load_graph_status;
return -1;
}
std::vector<Tensor> resized_tensors;
Status const read_tensor_status = ReadTensorFromImageFile(image_path, &resized_tensors);
if (!read_tensor_status.ok()) {
LOG(ERROR) << read_tensor_status;
return -1;
}
std::vector<Tensor> outputs;
Status run_status = session->Run({{input_layer, resized_tensor}},
output_layer, {}, &outputs);
So far so good, but tensorflow always select the same gpu when I execute Run, do I have a way to specify which gpu to execute?
In case you need complete source codes, I placed them at pastebin
Edit : Looks like options.config.mutable_gpu_options()->set_visible_device_list("0") work, but I am not sure.