所以我试图让tensorflow在我的计算机上运行。我成功安装了ubuntu,cuda,cudnn和anaconda并为Tensorflow GPU设置了环境。我有最新的gtx 970m可用的nvidia驱动程序。 这是我用来测试程序的代码:
<pre><font color="#8AE234"><b>alejandro@alejandro-GL502VT</b></font>:<font color="#729FCF"><b>~</b></font>$ conda activate tensorflow_gpuenv
(tensorflow_gpuenv) <font color="#8AE234"><b>alejandro@alejandro-GL502VT</b></font>:<font color="#729FCF"><b>~</b></font>$ python
Python 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 17:14:51)
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> hello = tf.constant('Hello Stack Overflow!!')
>>> sess = tf.Session()
2018-10-03 23:23:05.722821: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA
2018-10-03 23:23:05.804766: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:897] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2018-10-03 23:23:05.805564: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1405] Found device 0 with properties:
name: GeForce GTX 970M major: 5 minor: 2 memoryClockRate(GHz): 1.038
pciBusID: 0000:01:00.0
totalMemory: 2.95GiB freeMemory: 2.57GiB
2018-10-03 23:23:05.805579: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1484] Adding visible gpu devices: 0
2018-10-03 23:23:05.805780: E tensorflow/core/common_runtime/direct_session.cc:158] Internal: cudaGetDevice() failed. Status: CUDA driver version is insufficient for CUDA runtime version
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/alejandro/anaconda3/envs/tensorflow_gpuenv/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1494, in __init__
super(Session, self).__init__(target, graph, config=config)
File "/home/alejandro/anaconda3/envs/tensorflow_gpuenv/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 626, in __init__
self._session = tf_session.TF_NewSession(self._graph._c_graph, opts)
tensorflow.python.framework.errors_impl.InternalError: Failed to create session.
</pre>
这是我的司机信息
<pre>+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.48 Driver Version: 390.48 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 970M Off | 00000000:01:00.0 Off | N/A |
| N/A 51C P8 7W / N/A | 334MiB / 3024MiB | 0% Default |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 980 G /usr/lib/xorg/Xorg 227MiB |
| 0 1248 G /usr/bin/gnome-shell 102MiB |
| 0 2671 G /usr/lib/firefox/firefox 2MiB |
+-----------------------------------------------------------------------------+</pre>