簡體   English   中英

tensorflow.python.framework.errors_impl.InternalError:無法創建會話

[英]tensorflow.python.framework.errors_impl.InternalError: Failed to create session

我無法創建會話。 這是錯誤:

Python 3.5.5 (default, May 11 2018, 11:52:15)
[GCC 6.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
>>> tensorflow.Session()
2018-05-11 15:29:35.690831: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2018-05-11 15:29:35.690867: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2018-05-11 15:29:35.690874: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2018-05-11 15:29:35.690879: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2018-05-11 15:29:35.690884: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX512F instructions, but these are available on your machine and could speed up CPU computations.
2018-05-11 15:29:35.690889: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use FMA instructions, but these are available on your machine and could speed up CPU computations.
2018-05-11 15:29:35.710595: E tensorflow/core/common_runtime/direct_session.cc:138] Internal: failed initializing StreamExecutor for CUDA device ordinal 0: Internal: failed call to cuDevicePrimaryCtxRetain: CUDA_ERROR_INVALID_DEVICE
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/iu0987810505/python/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 1292, in __init__
    super(Session, self).__init__(target, graph, config=config)
  File "/home/iu0987810505/python/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 562, in __init__
    self._session = tf_session.TF_NewDeprecatedSession(opts, status)
  File "/home/iu0987810505/python/Python-3.5.5/Lib/contextlib.py", line 66, in __exit__
    next(self.gen)
  File "/home/iu0987810505/python/lib/python3.5/site-packages/tensorflow/python/framework/errors_impl.py", line 466, in raise_exception_on_not_ok_status
    pywrap_tensorflow.TF_GetCode(status))
tensorflow.python.framework.errors_impl.InternalError: Failed to create session.

我可以運行CUDA示例。

以下是一些GPU信息:

Fri May 11 15:36:24 2018
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 375.51                 Driver Version: 375.51                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Tesla P100-SXM2...  On   | 0000:3D:00.0     Off |                    0 |
| N/A   31C    P0    42W / 300W |    301MiB / 16276MiB |      0%   E. Process |
+-------------------------------+----------------------+----------------------+
|   1  Tesla P100-SXM2...  On   | 0000:3E:00.0     Off |                    0 |
| N/A   34C    P0    42W / 300W |    301MiB / 16276MiB |      0%   E. Process |
+-------------------------------+----------------------+----------------------+
|   2  Tesla P100-SXM2...  On   | 0000:B1:00.0     Off |                    0 |
| N/A   33C    P0    42W / 300W |    301MiB / 16276MiB |      0%   E. Process |
+-------------------------------+----------------------+----------------------+
|   3  Tesla P100-SXM2...  On   | 0000:B2:00.0     Off |                    0 |
| N/A   34C    P0    41W / 300W |    301MiB / 16276MiB |      0%   E. Process |
+-------------------------------+----------------------+----------------------+
  • tensorflow-gpu版本:1.2.1
  • CUDA:8.0
  • cudnn:5.1

有人知道嗎

嘗試安裝cudnn 6,似乎對8.0穩定,並檢查兼容的nvidia驅動程序,理想情況下,驅動程序版本:387.26(帶CUDnn6和CUDA 8.0)

同時,像這樣分離所有GPU設備

 export CUDA_VISIBLE_DEVICES=''

並再次啟動會話,問題仍然存在,然后是您的張量流問題。 如果成功啟動會話,則它的CUDA相關問題,主要是與CUDNN(5)和CUDA(8)兼容。 以我的經驗,CUDA 8與CUDNN 6更好地配合

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM