2017-04-20 5 views
0

J'ai une Nvidia GTX 1080 fonctionnant sur un Ubuntu 14.04. J'essaye d'implémenter un autoencoder convolutif en utilisant tensorflow 1.0.1 mais le programme ne semble pas du tout utiliser le GPU. J'ai vérifié cela en utilisant watch nvidia-smi et htop. La sortie après l'exécution du programme est le suivant:Code Tensorflow ne pas utiliser GPU

1 I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.8.0 locally 
    2 I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.so.5 locally 
    3 I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.8.0 locally 
    4 I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.so.1 locally 
    5 I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.8.0 locally 
    6 Extracting MNIST_data/train-images-idx3-ubyte.gz 
    7 Extracting MNIST_data/train-labels-idx1-ubyte.gz 
    8 Extracting MNIST_data/t10k-images-idx3-ubyte.gz 
    9 Extracting MNIST_data/t10k-labels-idx1-ubyte.gz 
10 getting into solving the reconstruction loss 
11 Dimension of z i.e. our latent vector is [None, 100] 
12 Dimension of the output of the decoder is [100, 28, 28, 1] 
13 W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available  on your machine and could speed up CPU computations. 
14 W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are availab le on your machine and could speed up CPU computations. 
15 W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are availab le on your machine and could speed up CPU computations. 
16 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. 
17 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. 
18 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. 
19 I tensorflow/core/common_runtime/gpu/gpu_device.cc:885] Found device 0 with properties: 
20 name: GeForce GTX 1080 
21 major: 6 minor: 1 memoryClockRate (GHz) 1.7335 
22 pciBusID 0000:0a:00.0 
23 Total memory: 7.92GiB 
24 Free memory: 7.81GiB 
25 W tensorflow/stream_executor/cuda/cuda_driver.cc:590] creating context when one is currently active; existing: 0x34bccc0 
26 I tensorflow/core/common_runtime/gpu/gpu_device.cc:885] Found device 1 with properties: 
27 name: GeForce GTX 1080 
28 major: 6 minor: 1 memoryClockRate (GHz) 1.7335 
29 pciBusID 0000:09:00.0 
30 Total memory: 7.92GiB 
31 Free memory: 7.81GiB 
32 W tensorflow/stream_executor/cuda/cuda_driver.cc:590] creating context when one is currently active; existing: 0x34c0940 
33 I tensorflow/core/common_runtime/gpu/gpu_device.cc:885] Found device 2 with properties: 
34 name: GeForce GTX 1080 
35 major: 6 minor: 1 memoryClockRate (GHz) 1.7335 
36 pciBusID 0000:06:00.0 
37 Total memory: 7.92GiB 
38 Free memory: 7.81GiB 
39 W tensorflow/stream_executor/cuda/cuda_driver.cc:590] creating context when one is currently active; existing: 0x34c45c0 
40 I tensorflow/core/common_runtime/gpu/gpu_device.cc:885] Found device 3 with properties: 
41 name: GeForce GTX 1080 
42 major: 6 minor: 1 memoryClockRate (GHz) 1.7335 
43 pciBusID 0000:05:00.0 
44 Total memory: 7.92GiB 
45 Free memory: 7.81GiB 
46 I tensorflow/core/common_runtime/gpu/gpu_device.cc:906] DMA: 0 1 2 3 
47 I tensorflow/core/common_runtime/gpu/gpu_device.cc:916] 0: Y Y Y Y 
48 I tensorflow/core/common_runtime/gpu/gpu_device.cc:916] 1: Y Y Y Y 
49 I tensorflow/core/common_runtime/gpu/gpu_device.cc:916] 2: Y Y Y Y 
50 I tensorflow/core/common_runtime/gpu/gpu_device.cc:916] 3: Y Y Y Y 
51 I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 1080, pci bus i d: 0000:0a:00.0) 
52 I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:1) -> (device: 1, name: GeForce GTX 1080, pci bus i d: 0000:09:00.0) 
53 I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:2) -> (device: 2, name: GeForce GTX 1080, pci bus i d: 0000:06:00.0) 
54 I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:3) -> (device: 3, name: GeForce GTX 1080, pci bus i d: 0000:05:00.0) 

peut dans mon code il y a un problème, je l'ai également essayé spécifiant d'utiliser un dispositif particulier à l'aide with tf.device("/gpu:0"): avant de construire le graphique. Faites-moi savoir si d'autres informations sont nécessaires.

Edit 1 sortie de nvidia-smi

[email protected]:~$ nvidia-smi 
Wed Apr 19 20:50:07 2017  
+-----------------------------------------------------------------------------+ 
| NVIDIA-SMI 367.48     Driver Version: 367.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 1080 Off | 0000:05:00.0  Off |     N/A | 
| 38% 54C P8 12W/180W | 7715MiB/8113MiB |  0%  Default | 
+-------------------------------+----------------------+----------------------+ 
| 1 GeForce GTX 1080 Off | 0000:06:00.0  Off |     N/A | 
| 38% 55C P8  8W/180W | 7715MiB/8113MiB |  0%  Default | 
+-------------------------------+----------------------+----------------------+ 
| 2 GeForce GTX 1080 Off | 0000:09:00.0  Off |     N/A | 
| 36% 50C P8  8W/180W | 7715MiB/8113MiB |  0%  Default | 
+-------------------------------+----------------------+----------------------+ 
| 3 GeForce GTX 1080 Off | 0000:0A:00.0  Off |     N/A | 
| 35% 54C P2 41W/180W | 7833MiB/8113MiB |  8%  Default | 
+-------------------------------+----------------------+----------------------+ 

+-----------------------------------------------------------------------------+ 
| Processes:              GPU Memory | 
| GPU  PID Type Process name        Usage  | 
|=============================================================================| 
| 0  24228 C python3          7713MiB | 
| 1  24228 C python3          7713MiB | 
| 2  24228 C python3          7713MiB | 
| 3  24228 C python3          7831MiB | 
+-----------------------------------------------------------------------------+ 

htop montre qu'il utilise environ 100% de l'un des noyaux de CPU. Ma base pour dire qu'il n'utilise pas gpu est à cause de l'utilisation du GPU%. Il a montré 8% sur celui-ci mais il est habituellement à 0%.

+0

On dirait que c'est trouver 4 GPU très bien, je ne vois rien d'anormal dans cette sortie. Vous ne devriez pas avoir besoin de spécifier 'tf.device ("/gpu: 0 ")'. Tous vos processeurs sont-ils utilisés pendant l'entraînement? Pouvez-vous coller la sortie de nvidia-smi? Voyez-vous des processus python dans la sortie de nividia-smi, ou juste que l'utilisation du GPU semble être de 0%? –

+0

@DavidParks J'ai ajouté la sortie de nvidia-smi et les processus python sont là. –

Répondre

0

Donc, vous exécutez sur le GPU, tout est configuré correctement de cette perspective, mais il semble que la vitesse est vraiment mauvaise. Assurez-vous de lancer nvidia-smi un certain nombre de fois pour avoir une idée de la façon dont cela se passe, cela pourrait montrer 100% un moment et 8% un autre. Il est normal d'obtenir environ 80% de taux d'utilisation de la part du GPU car le chargement de chaque lot de la mémoire centrale vers le GPU est retardé avant chaque exécution (de nouvelles fonctionnalités sortent prochainement pour améliorer cela, les files d'attente GPU TF).

Si vous obtenez une performance inférieure à ~ 80% de votre GPU, vous faites quelque chose de mal. 1) Vous faites un tas de pré-traitement entre les étapes, de sorte que le GPU s'exécute rapidement, mais alors vous êtes bloqué sur un thread CPU unique faisant un tas de travail non tensorflow. Déplacer ceci dans son propre thread, charger des données dans le GPU à partir d'un python Queue

2) De gros blocs de données sont déplacés entre la CPU et la mémoire GPU. La bande passante entre le processeur et le GPU peut être un goulot d'étranglement si vous faites cela. Essayez d'ajouter des temporisations entre le début d'un lot d'entraînement/d'inférence et la fin et de voir si vous passez beaucoup de temps en dehors des opérations tensorflow.

+0

Merci votre conseil a travaillé. Son utilisation est toujours autour de 90%. J'ai besoin de conseils sur une chose de plus. Actuellement, il n'utilise qu'un des cœurs du GPU et le reste est à 0%. Comment puis-je résoudre ce problème? –

+0

Il y a une discussion sur l'utilisation de plusieurs GPU ici, il y a aussi un lien en bas pour un exemple d'implémentation: https://www.tensorflow.org/tutorials/using_gpu –

+0

@saharudra, vous pouvez trouver un exemple pour plusieurs implémentation GPU dans le lien suivant: https://github.com/tensorflow/models/blob/master/tutorials/image/cifar10/cifar10_multi_gpu_train.py – Nandeesh