【问题标题】:specificy gpu devices failed when using tensorflow c++ api使用 tensorflow c++ api 时,特定的 gpu 设备失败
【发布时间】:2017-07-17 04:57:21
【问题描述】:

我在 python 中训练了我的 tf 模型:

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

并使用命令行抽象模型:

  freeze_graph.py --clear_devices False

在测试阶段,我将设备设置如下:

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

但有些地方不对:

  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

那么,我怎样才能正确使用gpu i??

有人可以帮忙吗??

【问题讨论】:

    标签: python c++ tensorflow gpu


    【解决方案1】:

    您是否可以使用未启用 GPU 支持的 TensorFlow 版本?如果您正在构建二进制文件,您可能需要从 //tensorflow 添加额外的 BUILD 规则以启用 GPU 支持。还要确保在运行配置时启用 GPU 支持。

    编辑:您能否在 TF 的 github 问题上提交错误:

    1) 你的 BUILD 规则

    2) 更多代码,以便我们了解您如何构建模型和创建会话

    3) 你如何运行配置

    虽然此 API 尚未标记为“公开”;我们想看看您是否确实遇到了错误,以便我们修复它。

    【讨论】:

    • 非常感谢,您的建议很有帮助,bazel build --config=cuda & change the cc_library's deps works
    猜你喜欢
    • 1970-01-01
    • 2013-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-02-20
    • 2018-07-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多