2017-05-12 4 views
2

Ich habe Probleme, Keras die GPU-Version von Tensorflow anstelle von CPU zu verwenden. Jedes Mal, wenn ich importieren Keras es nur sagt:Verwenden von GPU anstelle von CPU mit Keras mit Tensorflow Backend für Linux

>>> import keras 
Using TensorFlow backend 

... was bedeutet, dass es funktioniert, aber auf CPU, GPU nicht. Ich installierte Cuda und cuDNN und diese Umgebung verwenden:

conda create -n tensorflow python=3.5 anaconda 

Ich glaube, ich die CPU-Version von tensorflow zuerst installiert - ich erinnere mich nicht, weil ich den ganzen Tag nur immer CUDA und cudnn zu arbeiten. Auch Wie auch immer, installierte ich die GPU-Version:

pip install --ignore-installed --upgrade \ https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.1.0-cp35-cp35m-linux_x86_64.whl 

und es gibt immer noch die gleiche Meldung. Ich habe versucht, zu überprüfen, welches Gerät durch den folgenden Code verwendet wird:

sess = tf.Session(config=tf.ConfigProto(log_device_placement=True)) 

aber ich diese Ausgabe zu erhalten, was anzeigt, ich bin mit Gerät 0, meine GPU:

2017-05-12 02:14:10.746679: 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. 
2017-05-12 02:14:10.746735: 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. 
2017-05-12 02:14:10.746751: 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. 
2017-05-12 02:14:10.746764: 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. 
2017-05-12 02:14:10.746777: 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. 
2017-05-12 02:14:10.926330: I 
tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:901] successful 
NUMA node read from SysFS had negative value (-1), but there must be 
at least one NUMA node, so returning NUMA node zero 
2017-05-12 02:14:10.926614: I 
tensorflow/core/common_runtime/gpu/gpu_device.cc:887] Found device 0 
with properties: 
name: GeForce GTX 1060 6GB 
major: 6 minor: 1 memoryClockRate (GHz) 1.7845 
pciBusID 0000:01:00.0 
Total memory: 5.93GiB 
Free memory: 5.51GiB 
2017-05-12 02:14:10.926626: I 
tensorflow/core/common_runtime/gpu/gpu_device.cc:908] DMA: 0 
2017-05-12 02:14:10.926629: I 
tensorflow/core/common_runtime/gpu/gpu_device.cc:918] 0: Y 
2017-05-12 02:14:10.926637: I 
tensorflow/core/common_runtime/gpu/gpu_device.cc:977] Creating 
TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1060 6GB, 
pci bus id: 0000:01:00.0) 
Device mapping: 
/job:localhost/replica:0/task:0/gpu:0 -> device: 0, name: GeForce GTX 
1060 6GB, pci bus id: 0000:01:00.0 
2017-05-12 02:14:10.949871: I 
tensorflow/core/common_runtime/direct_session.cc:257] Device mapping: 
/job:localhost/replica:0/task:0/gpu:0 -> device: 0, name: GeForce GTX 
1060 6GB, pci bus id: 0000:01:00.0 

ich wirklich aus den Dingen lief machen. Das Einzige, was ich noch habe, ist Anaconda zu deinstallieren und alles neu zu installieren, was ich wirklich nicht tun will, da ich buchstäblich den ganzen Tag damit verbracht habe, mit Keras und allem zu arbeiten (nur noch nicht mit der GPU)

+0

Konnten Sie dieses Problem lösen? Ich stehe genau vor dem gleichen Problem? – rjmessibarca

Antwort

1

Es besteht die Möglichkeit, dass die Installation von Keras mit Standardoptionen die CPU-Version von Tensorflow installiert. Sie könnten diese Version deinstallieren und dann laufen ...

pip install --upgrade --no-deps keras 

https://github.com/fchollet/keras/issues/5766

+0

Anforderung bereits aktuell: keras in ./anaconda3/envs/tensorflow/lib/python3.5/site-packages - wie deinstalliert man keras? sorry Ich bin neu in Linux – Shooth

+0

ok Ich habe es deinstalliert und neu installiert mit Ihrem Link und noch nichts geändert – Shooth

+0

haben Sie CPU-Version von Tensorflow deinstallieren? – MattMcKnight

0

haben Sie versucht bereits mit pip install tensorflow? Dies wird die CPU-Version installieren, während pip install tensorflow-gpu die GPU-Version installieren wird. https://www.tensorflow.org/install/

Verwandte Themen