Ceci est une ancienne révision du document !
L'environnement Tensorflow a été installé cet été au Centre Blaise Pascal.
Deux environnements étaient disponibles mais seul l'environnement permettant d'exploiter les cartes GPU à base de circuit Nvidia a été installée. La version courante déployée est la 1.10.
L'environnement Tensorflow disponible exige une version spécifique de CUDA, la 9.0 minimum.
Pour la charge dans le SIDUS standard du CBP:
module load cuda/9.0
L'exemple suivant, fourni par le site officiel, permet de rapidement juger du fonctionnement de l'environnement. Il nécessite le lancement de l'interpréteur python :
# Python import tensorflow as tf hello = tf.constant('Hello, TensorFlow!') sess = tf.Session() print(sess.run(hello))
A l'exécution de la première ligne, vous pouvez avoir un message d'erreur sans importance :
/usr/lib/python2.7/dist-packages/h5py/__init__.py:34: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`. from ._conv import register_converters as _register_converters
A l'exécution de la seconde ligne, l'environnement détecte la carte graphique susceptible d'être exploitée :
2018-08-21 11:24:28.475954: 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-08-21 11:24:28.476656: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1405] Found device 0 with properties: name: GeForce GTX TITAN major: 3 minor: 5 memoryClockRate(GHz): 0.8755 pciBusID: 0000:06:00.0 totalMemory: 5.94GiB freeMemory: 5.83GiB 2018-08-21 11:24:28.476704: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1484] Adding visible gpu devices: 0 2018-08-21 11:24:34.039086: I tensorflow/core/common_runtime/gpu/gpu_device.cc:965] Device interconnect StreamExecutor with strength 1 edge matrix: 2018-08-21 11:24:34.039883: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] 0 2018-08-21 11:24:34.039922: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] 0: N 2018-08-21 11:24:34.040245: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1097] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 5626 MB memory) -> physical GPU (device: 0, name: GeForce GTX TITAN, pci bus id: 0000:06:00.0, compute capability: 3.5)
Dans l'exemple ci-dessus, il s'agit d'une carte GeForce GTX TITAN avec 5.94GiB de RAM.
La dernière ligne permet s'assurer que la session fonctionne de manière nominal en affichant :
Hello, TensorFlow!
Une grande variété de tutoriels en ligne permettent de vérifier le bon fonctionnement.