linux_compiler_tensorflow_avec_bazel
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
linux_compiler_tensorflow_avec_bazel [2021/12/12 07:09] – [Intel a déjà fait tout le boulot] serge | linux_compiler_tensorflow_avec_bazel [2021/12/20 11:13] (Version actuelle) – [La version Intel de Tensorflow] serge | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
====== Linux Compiler Tensorflow avec Bazel ====== | ====== Linux Compiler Tensorflow avec Bazel ====== | ||
- | <WRAP center round box 60%> | + | <WRAP center round box 60% centeralign> |
- | **L' | + | **L' |
+ | Voir **[[movenet|]]** | ||
</ | </ | ||
- | =====Intel | + | =====La version |
- | <WRAP center round important 60%> | ||
**[[https:// | **[[https:// | ||
- | </ | ||
- | |||
<code bash> | <code bash> | ||
python3 -m pip install intel-tensorflow | python3 -m pip install intel-tensorflow | ||
</ | </ | ||
- | =====La suite est juste pour mémoire====== | + | Donne toujours le message AVX2 et FMA. Mais c'est normal.\\ |
+ | Bienvenue dans le monde de Tensoflow: c'est un Warning, mais ce n'est pas forcément vrai !\\ | ||
+ | Mon FPS a augmenté de 10 à 20 % :-P | ||
+ | |||
+ | **Il est inutile de compiler** 8-) | ||
=====Ressources===== | =====Ressources===== | ||
* **[[https:// | * **[[https:// | ||
- | * **[[https:// | + | * **[[https:// |
- | * **[[https:// | + | |
+ | Sur les internets, ça en cause: | ||
+ | * https:// | ||
+ | * https:// | ||
+ | * https:// | ||
+ | * https:// | ||
+ | | ||
=====Installation de Bazel===== | =====Installation de Bazel===== | ||
Ligne 33: | Ligne 41: | ||
=====Sans GPU sur Debian===== | =====Sans GPU sur Debian===== | ||
- | Désinstaller les packages python | + | Désinstaller les packages python tensorflow si ils sont installés. |
+ | <code bash> | ||
+ | pip3 list | ||
+ | # Dans la list, chercher ce qu'il faut désinstaller ... | ||
+ | python3 -m pip uninstall tensorflow intel-tensorflow | ||
+ | ... | ||
+ | </ | ||
Installation du nécessaire: | Installation du nécessaire: | ||
- | | + | <code bash> |
- | python3 -m pip install keras_preprocessing --no-deps | + | python3 -m pip install numpy wheel protobuf |
- | + | python3 -m pip install keras_preprocessing --no-deps | |
- | Récupération des sources de tensorflow: | + | </code> |
- | cd / | + | |
- | git clone https:// | + | |
- | ./configure | + | |
- | ====Mes réponses==== | + | Récupération des sources de tensorflow: |
- | < | + | < |
- | Make sure you are running at least bazel 4.2.1 | + | cd /votre/dossier/src |
- | Please specify the location of python. [Default is /usr/bin/python3]: | + | git clone https://github.com/tensorflow/tensorflow |
- | Found possible Python library paths: | + | ./configure |
- | | + | |
- | / | + | |
- | Please input the desired Python library path to use. Default is [/usr/ | + | |
- | Do you wish to build TensorFlow with ROCm support? [y/N]: n | + | |
- | No ROCm support will be enabled for TensorFlow. | + | |
- | Do you wish to build TensorFlow with CUDA support? [y/N]: n | + | |
- | No CUDA support will be enabled for TensorFlow. | + | |
- | Do you wish to download a fresh release of clang? (Experimental) [y/N]: n | + | |
- | Clang will not be downloaded. | + | |
- | Please specify optimization flags to use during compilation when bazel option " | + | |
- | Would you like to interactively | + | |
- | Not configuring the WORKSPACE for Android builds. | + | |
</ | </ | ||
- | ====Avant de recommencer==== | + | Cela génère |
- | bazel clean | + | Répondre entrée ou N partout, nous allons corriger le fichier à la main: |
- | + | ||
- | ====Compilation de tensorflow==== | + | |
- | sudo ln -s / | + | |
- | bazel build -j 4 // | + | |
- | ./ | + | |
- | + | ||
- | INFO: Elapsed time: 5685.443s, Critical Path: 1098.87s\\ | + | |
- | INFO: 3809 processes: 507 internal, 3302 local.\\ | + | |
- | INFO: Build completed successfully, | + | |
- | soit 1.58 heures ! | + | |
- | + | ||
- | ===Consommation mémoire=== | + | |
- | Sur un i5 à 8 threads et 8 Go de Ram: | + | |
- | * -j 4 pour limiter la consommation de mémoire | + | |
- | + | ||
- | ====Conseils Geek==== | + | |
- | Au lieu de répondre aux questions de ./ | + | |
<code bash> | <code bash> | ||
build --action_env PYTHON_BIN_PATH="/ | build --action_env PYTHON_BIN_PATH="/ | ||
Ligne 87: | Ligne 68: | ||
build --python_path="/ | build --python_path="/ | ||
build:opt --copt=-march=native | build:opt --copt=-march=native | ||
- | build:opt --copt=-Wno-sign-compare | ||
- | build:opt --copt=-mavx | ||
- | build:opt --copt=-mavx2 | ||
- | build:opt --copt=-mfma | ||
build:opt --host_copt=-march=native | build:opt --host_copt=-march=native | ||
- | build:opt --define with_default_optimizations=true | ||
test --flaky_test_attempts=3 | test --flaky_test_attempts=3 | ||
test --test_size_filters=small, | test --test_size_filters=small, | ||
Ligne 102: | Ligne 78: | ||
- | ====Installation==== | ||
- | cd / | ||
- | source mon_env/ | ||
- | python3 -m pip uninstall tensorflow | ||
- | python3 -m pip install / | ||
- | | ||
- | =====Avec GPU===== | ||
- | Ubuntu Mate 20.04, python 3.8, venv | ||
- | ===Cuda=== | + | ====Compilation de tensorflow==== |
- | * **[[installation_de_cuda|Installation de CUDA et Compilation de OpenCV avec CUDA]]** | + | |
- | ===CudNN=== | + | |
- | sudo apt install libcudnn8 libcudnn8-dev | + | |
- | ===TensorRT=== | + | |
- | sudo apt install libnvinfer8 libnvinfer8-dev | + | |
- | + | ||
- | ====Tensorflow==== | + | |
<code bash> | <code bash> | ||
- | # Dépendances | + | sudo ln -s /usr/bin/python3 |
- | python3 | + | bazel build -j 4 |
- | python3 -m pip install keras_preprocessing | + | ./bazel-bin/ |
- | + | ||
- | # Récupération des sources de tensorflow | + | |
- | mkdir src | + | |
- | cd src/ | + | |
- | git clone https://github.com/tensorflow/tensorflow.git | + | |
- | cd tensorflow | + | |
- | ./configure | + | |
</ | </ | ||
+ | ===Consommation mémoire=== | ||
+ | Sur un i5 à 8 threads et 8 Go de Ram: -j 2 pour limiter la consommation de mémoire, sinon Swap de 8 Go insuffisante. | ||
+ | ===Stop et reprise=== | ||
+ | Bazel reprend là où il s'est arrêté. | ||
+ | ===Success=== | ||
+ | <code bash> | ||
+ | INFO: Elapsed time: 19106.040s, Critical Path: 196.86s | ||
+ | soit 5.3 heures, perso je trouve 7 heures! | ||
+ | INFO: 11460 processes: 1325 internal, 10135 local. | ||
+ | INFO: Build completed successfully, | ||
+ | </ | ||
+ | |||
+ | ====Nettoyage pour recommencer==== | ||
+ | <code bash> | ||
+ | bazel clean | ||
+ | </ | ||
+ | |||
+ | ====Installation==== | ||
+ | <code bash> | ||
+ | cd / | ||
+ | source mon_env/ | ||
+ | python3 -m pip uninstall tensorflow | ||
+ | python3 -m pip install / | ||
+ | </ | ||
+ | ====Utilisation==== | ||
+ | Le message d'info AVX2 et FMA est toujours là ! | ||
{{tag>ia linux python sb tensorflow}} | {{tag>ia linux python sb tensorflow}} |
linux_compiler_tensorflow_avec_bazel.1639292987.txt.gz · Dernière modification : 2021/12/12 07:09 de serge