mardi 2 avril 2019

calls to tensorflow::graph::SetDefaultDevice are ignored

On a system with 2 NVidia 1080 ti (Tensorflow 1.12/Cuda 10) calling tensorflow::graph::SetDefaultDevice to select a particular 1080 is ignored and the graph is always executed on gpu:0 (accoring to nvidia-smi)

called tensorflow::graph::SetDefaultDevice as described by documentation on the internet.

if (check_status(ReadBinaryProto(tf::Env::Default(),graphFilePath, &graph_))) {

tf::SessionOptions options;
options.config.set_log_device_placement(true);
options.config.set_allow_soft_placement(true);
if (check_status(tf::NewSession(tf::SessionOptions(), &session_)))
{

  if (check_status(session_->Create(graph_)))
  {
    tensorflow::graph::SetDefaultDevice("/gpu:1", &(graph_));
    success = true;
  }
  else
  {
    session_->Close();
    session_= nullptr;
  }
}

}

The expected behaviour is that the graph would be executed on gpu:1 but according to nvidia-smi the graph is always executed on gpu:0.

Aucun commentaire:

Enregistrer un commentaire