TensorBoard无法创建会话

时间:2018-04-11 15:33:28

标签: tensorflow tensorboard

您好

我正在使用TensorFlow v 1.4.0,当我想使用以下命令创建TensorBoard会话时:

tensorboard --logdir="folder_path"

我有一个错误:

2018-04-11 17:18:44.422839: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1344] Found device 0 with properties: 
name: TITAN Xp major: 6 minor: 1 memoryClockRate(GHz): 1.582
pciBusID: 0000:02:00.0
totalMemory: 11,91GiB freeMemory: 11,74GiB
2018-04-11 17:18:44.467559: E tensorflow/core/common_runtime/direct_session.cc:167] Internal: failed initializing StreamExecutor for CUDA device ordinal 1: Internal: failed call to cuDevicePrimaryCtxRetain: CUDA_ERROR_INVALID_DEVICE
Traceback (most recent call last):
  File "/usr/local/bin/tensorboard", line 11, in <module>
    sys.exit(run_main())
  File "/usr/local/lib/python3.5/dist-packages/tensorboard/main.py", line 36, in run_main
    tf.app.run(main)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/platform/app.py", line 126, in run
    _sys.exit(main(argv))
  File "/usr/local/lib/python3.5/dist-packages/tensorboard/main.py", line 45, in main
    default.get_assets_zip_provider())
  File "/usr/local/lib/python3.5/dist-packages/tensorboard/program.py", line 166, in main
    tb = create_tb_app(plugins, assets_zip_provider)
  File "/usr/local/lib/python3.5/dist-packages/tensorboard/program.py", line 200, in create_tb_app
    window_title=FLAGS.window_title)
  File "/usr/local/lib/python3.5/dist-packages/tensorboard/backend/application.py", line 124, in standard_tensorboard_wsgi
    plugin_instances = [constructor(context) for constructor in plugins]
  File "/usr/local/lib/python3.5/dist-packages/tensorboard/backend/application.py", line 124, in <listcomp>
    plugin_instances = [constructor(context) for constructor in plugins]
  File "/usr/local/lib/python3.5/dist-packages/tensorboard/plugins/beholder/beholder_plugin.py", line 47, in __init__
    self.most_recent_frame = im_util.get_image_relative_to_script('no-data.png')
  File "/usr/local/lib/python3.5/dist-packages/tensorboard/plugins/beholder/im_util.py", line 277, in get_image_relative_to_script
    return read_image(filename)
  File "/usr/local/lib/python3.5/dist-packages/tensorboard/plugins/beholder/im_util.py", line 265, in read_image
    return np.array(decode_png(image_file.read()))
  File "/usr/local/lib/python3.5/dist-packages/tensorboard/plugins/beholder/im_util.py", line 182, in __call__
    self._lazily_initialize()
  File "/usr/local/lib/python3.5/dist-packages/tensorboard/plugins/beholder/im_util.py", line 160, in _lazily_initialize
    self._session = tf.Session(graph=graph, config=config)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 1509, in __init__
    super(Session, self).__init__(target, graph, config=config)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 638, in __init__
    self._session = tf_session.TF_NewDeprecatedSession(opts, status)
  File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/errors_impl.py", line 516, in __exit__
    c_api.TF_GetCode(self.status.status))
tensorflow.python.framework.errors_impl.InternalError: Failed to create session.

当我使用TensorFlow 1.6时,TensorBoard工作但是我认为这不是问题,因为我今天尝试重新使用版本1.6并且它无法正常工作

我的文件夹包含一个文件“event.out.po”,我查了一下。

你知道问题出在哪里吗?

谢谢

1 个答案:

答案 0 :(得分:1)

我发现了问题。在使用TensorBoard之前的批处理中,必须运行此命令才能使用gpu:

export CUDA_VISIBLE_DEVICES=0 

如果先前命令不起作用,您可以尝试:

export CUDA_VISIBLE_DEVICES=''