简体   繁体   中英

specificy gpu devices failed when using tensorflow c++ api

I trained my tf model in python:

  with sv.managed_session(master='') as sess:
    with tf.device("/gpu:1"):#my systerm has 4 nvidia cards

and use the command line to abstract the model:

  freeze_graph.py --clear_devices False

and during test phase, I set the device as follow:

  tensorflow::graph::SetDefaultDevice("/gpu:1", &tensorflow_graph);

but someting is wrong:

  ould not create Tensorflow Graph: 
  Invalid argument: Cannot assign a device to node '.../RNN_backword/while/Enter': 
  Could not satisfy explicit device specification '/gpu:1' 
  because no devices matching that specification are registered in this process; 
  available devices: /job:localhost/replica:0/task:0/cpu:0

so,how can I use gpu i correctly??

anyone could help??

Is it possible you're using a version of TensorFlow without GPU support enabled? If you're building a binary you may need to add additional BUILD rules from //tensorflow that enable GPU support. Also ensure you enabled GPU support when running configure.

EDIT : Can you file a bug on TF's github issues with:

1) your BUILD rule

2) much more of your code so we can see how you're building your model and creating your session

3) how you ran configure

While this API is not yet marked "public"; we want to see if there's indeed a bug you are running into so we can fix it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM