$ cd ~ $ mv software Software $ cd ~/Software $ bash ./Anaconda3-5.2.0-Linux-x86_64.sh
In order to continue the installation process, please review the license agreement. Please, press ENTER to continue >>>
Do you accept the license terms? [yes|no] [no] >>> Please answer 'yes' or 'no':' >>> yes Anaconda3 will now be installed into this location: /home/eustomaqua/anaconda3 - Press ENTER to confirm the location - Press CTRL-C to abort the installation - Or specify a different location below [/home/eustomaqua/anaconda3] >>> /home/eustomaqua/VirtualEnv/anaconda3 PREFIX=/home/eustomaqua/VirtualEnv/anaconda3 installing: python-3.6.5-hc3d631a_2 ... Python 3.6.5 :: Anaconda, Inc. installing: blas-1.0-mkl ... installation finished. WARNING: You currently have a PYTHONPATH environment variable set. This may cause unexpected behavior when running the Python interpreter in Anaconda3. For best results, please verify that your PYTHONPATH only points to directories of packages that are compatible with the Python interpreter in Anaconda3: /home/eustomaqua/VirtualEnv/anaconda3 Do you wish the installer to prepend the Anaconda3 install location to PATH in your /home/eustomaqua/.bashrc ? [yes|no] [no] >>> yes Appending source /home/eustomaqua/VirtualEnv/anaconda3/bin/activate to /home/eustomaqua/.bashrc A backup will be made to: /home/eustomaqua/.bashrc-anaconda3.bak For this change to become active, you have to open a new terminal. Thank you for installing Anaconda3! =========================================================================== Anaconda is partnered with Microsoft! Microsoft VSCode is a streamlined code editor with support for development operations like debugging, task running and version control. To install Visual Studio Code, you will need: - Administrator Privileges - Internet connectivity Visual Studio Code License: https://code.visualstudio.com/license Do you wish to proceed with the installation of Microsoft VSCode? [yes|no] >>> no $
检查
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
~/software$ python Python 2.7.12 (default, Nov 12 2018, 14:36:49) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license"for more information. >>> [1]+ Stopped(SIGTSTP) python ~/software$
~/software$ source ~/.bashrc ~/software$ python Python 3.6.5 |Anaconda, Inc.| (default, Apr 29 2018, 16:14:56) [GCC 7.2.0] on linux Type "help", "copyright", "credits" or "license"for more information. >>> [2]+ Stopped(SIGTSTP) python ~/software$ ~/software$ pip list
~$ cd Software ~/Software$ ls Anaconda3-5.2.0-Linux-x86_64.sh cudnn-10.0-linux-x64-v7.6.4.38.solitairetheme8 cuda_10.0.130_410.48_linux.run Python-3.6.1.tgz
~/Software$ chmod +x cuda_10.0.130_410.48_linux.run ~/Software$ ls Anaconda3-5.2.0-Linux-x86_64.sh cudnn-10.0-linux-x64-v7.6.4.38.solitairetheme8 cuda_10.0.130_410.48_linux.run Python-3.6.1.tgz
~/Software$ ./cuda_10.0.130_410.48_linux.run Logging to /tmp/cuda_install_25104.log Using more to view the EULA. End User License Agreement --------------------------
20. Licensee's use of linmath.h header for CPU functions for GL vector/matrix operations from lunarG is subject to the Apache License Version 2.0. ----------------- Do you accept the previously read EULA? accept/decline/quit: Do you accept the previously read EULA? accept/decline/quit: accept Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 410.48? (y)es/(n)o/(q)uit: no Install the CUDA 10.0 Toolkit? (y)es/(n)o/(q)uit: yes Enter Toolkit Location [ default is /usr/local/cuda-10.0 ]: /home/eustomaqua/Software/cuda-10.0 Do you want to install a symbolic link at /usr/local/cuda? (y)es/(n)o/(q)uit: no Install the CUDA 10.0 Samples? (y)es/(n)o/(q)uit: yes Enter CUDA Samples Location [ default is /home/eustomaqua ]: /home/eustomaqua/Software/cuda-samples $
~/Software$ ls Anaconda3-5.2.0-Linux-x86_64.sh cuda-samples cuda cudnn-10.0-linux-x64-v7.6.4.38.solitairetheme8 cuda-10.0 cudnn-10.0-linux-x64-v7.6.4.38.tgz cuda_10.0.130_410.48_linux.run Python-3.6.1.tgz ~/Software$ rm cudnn-10.0-linux-x64-v7.6.4.38.solitairetheme8 ~/Software$ cd cuda :~/Software/cuda$ ls include lib64 NVIDIA_SLA_cuDNN_Support.txt ~/Software/cuda$ cd ..
在 Nvidia 官网注册,填写调查问卷之后可下载 TensorRT NVIDIA TensorRT Click Download Now 下载前先检查下自己的开发环境 —— 系统和 CUDA 版本
~$ cat /etc/issue
Ubuntu 18.04.3 LTS \n \l
~$ cat /usr/local/cuda/version.txt
cat: /usr/local/cuda/version.txt: No such file or directory
~$ cat ~/Software/cuda-10.0/version.txt
CUDA Version 10.0.130
~$
1 2 3 4 5 6 7 8 9
- ```bash ~/Software$ cat /etc/issue Ubuntu 16.04.6 LTS \n \l ~/Software$ cat /usr/local/cuda/version.txt CUDA Version 10.2.89 ~/Software$ cat ~/Software/cuda-10.0/version.txt CUDA Version 10.0.130 ~/Software$
~/Software$ # 3. 进入解压后的 TensorRT 目录下的 python 文件夹 ~/Software$ cd TensorRT-7.0.0.11 ~/Software/TensorRT-7.0.0.11$ ls bin doc include python targets uff data graphsurgeon lib samples TensorRT-Release-Notes.pdf ~/Software/TensorRT-7.0.0.11$ cd Python -sh: cd: Python: No such file or directory ~/Software/TensorRT-7.0.0.11$ cd python ~/Software/TensorRT-7.0.0.11/python$ ls tensorrt-7.0.0.11-cp27-none-linux_x86_64.whl tensorrt-7.0.0.11-cp36-none-linux_x86_64.whl tensorrt-7.0.0.11-cp34-none-linux_x86_64.whl tensorrt-7.0.0.11-cp37-none-linux_x86_64.whl tensorrt-7.0.0.11-cp35-none-linux_x86_64.whl ~/Software/TensorRT-7.0.0.11/python$
Python 3.6.10 |Anaconda, Inc.| (default, Mar 252020, 23:51:54) [GCC 7.3.0] on linux Type"help", "copyright", "credits"or"license"for more information. >>> import tensorflow as tf 2020-04-03 07:02:35.550509: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libnvinfer.so.6 2020-04-03 07:02:35.552571: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libnvinfer_plugin.so.6 >>> import adanet WARNING:tensorflow:From /home/eustomaqua/VirtualEnv/anaconda3/envs/adanet/lib/python3.6/site-packages/adanet/core/tpu_estimator.py:39: The name tf.estimator.tpu.TPUEstimator is deprecated. Please use tf.compat.v1.estimator.tpu.TPUEstimator instead.
>>> >>> import tensorrt >>> import uff Traceback (most recent call last): File "/home/eustomaqua/VirtualEnv/anaconda3/envs/adanet/lib/python3.6/site-packages/uff/converters/tensorflow/conversion_helpers.py", line 18, in <module> from tensorflow import GraphDef ImportError: cannot import name 'GraphDef'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/eustomaqua/VirtualEnv/anaconda3/envs/adanet/lib/python3.6/site-packages/uff/__init__.py", line 2, in <module> from uff.converters.tensorflow.conversion_helpers import from_tensorflow # noqa File "/home/eustomaqua/VirtualEnv/anaconda3/envs/adanet/lib/python3.6/site-packages/uff/converters/tensorflow/conversion_helpers.py", line 23, in <module> https://www.tensorflow.org/install/""".format(err)) ImportError: ERROR: Failed to import module (cannot import name 'GraphDef') Please make sure you have TensorFlow installed. For installation instructions, see: https://www.tensorflow.org/install/ >>>
It seems to be due to Tensorflow version. UFF converter not supporting TF version 2.0. Please check the tensorflow version and install tensorflow version 1.15 or 1.14.
Python 3.6.10 |Anaconda, Inc.| (default, Mar 25 2020, 23:51:54) [GCC 7.3.0] on linux Type "help", "copyright", "credits" or "license"for more information. >>> import tensorrt Traceback (most recent call last): File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'tensorrt' >>> import tensorflow as tf >>> import adanet WARNING:tensorflow:From /home/eustomaqua/VirtualEnv/anaconda3/envs/adanet/lib/python3.6/site-packages/adanet/tf_compat/__init__.py:87: The name tf.losses.Reduction is deprecated. Please use tf.compat.v1.losses.Reduction instead. WARNING:tensorflow:From /home/eustomaqua/VirtualEnv/anaconda3/envs/adanet/lib/python3.6/site-packages/adanet/core/tpu_estimator.py:39: The name tf.estimator.tpu.TPUEstimator is deprecated. Please use tf.compat.v1.estimator.tpu.TPUEstimator instead. >>>
$ cd ~/Software/TensorRT-6.0.1.5 $ cd python $ pip install tensorrt-6.0.1.5-cp36-none-linux_x86_64.whl $ cd ../uff $ pip install uff-0.6.5-py2.py3-none-any.whl
Python 3.6.10 |Anaconda, Inc.| (default, Mar 25 2020, 23:51:54) [GCC 7.3.0] on linux Type "help", "copyright", "credits" or "license"for more information. >>> import tensorrt >>> import uff >>> import tensorflow as tf >>> import adanet WARNING:tensorflow:From /home/eustomaqua/VirtualEnv/anaconda3/envs/adanet/lib/python3.6/site-packages/adanet/tf_compat/__init__.py:87: The name tf.losses.Reduction is deprecated. Please use tf.compat.v1.losses.Reduction instead.
WARNING:tensorflow:From /home/eustomaqua/VirtualEnv/anaconda3/envs/adanet/lib/python3.6/site-packages/adanet/core/tpu_estimator.py:39: The name tf.estimator.tpu.TPUEstimator is deprecated. Please use tf.compat.v1.estimator.tpu.TPUEstimator instead.
Python 3.6.10 |Anaconda, Inc.| (default, Mar 25 2020, 23:51:54) [GCC 7.3.0] on linux Type "help", "copyright", "credits" or "license"for more information. >>> import tensorflow as tf >>> import adanet WARNING:tensorflow:From /home/eustomaqua/anaconda3/envs/adanet/lib/python3.6/site-packages/adanet/tf_compat/__init__.py:87: The name tf.losses.Reduction is deprecated. Please use tf.compat.v1.losses.Reduction instead. WARNING:tensorflow:From /home/eustomaqua/anaconda3/envs/adanet/lib/python3.6/site-packages/adanet/core/tpu_estimator.py:39: The name tf.estimator.tpu.TPUEstimator is deprecated. Please use tf.compat.v1.estimator.tpu.TPUEstimator instead. >>> [1]+ Stopped python
安装 TensorRT
1 2 3 4 5 6 7 8 9 10 11
$ cd ~/Software $ ls cuda-10.0 cuda-samples nv-tensorrt-repo-ubuntu1804-cuda10.0-trt6.0.1.5-ga-20190913_1-1_amd64.deb nv-tensorrt-repo-ubuntu1804-cuda10.0-trt7.0.0.11-ga-20191216_1-1_amd64.deb TensorRT-6.0.1.5.Ubuntu-18.04.x86_64-gnu.cuda-10.0.cudnn7.6.tar.gz TensorRT-7.0.0.11.Ubuntu-18.04.x86_64-gnu.cuda-10.0.cudnn7.6.tar.gz
$ cd ~/Software $ tar -xvaf TensorRT-6.0.1.5.Ubuntu-18.04.x86_64-gnu.cuda-10.0.cudnn7.6.tar.gz $ cd TensorRT-6.0.1.5 $ cd python $ pip install tensorrt-6.0.1.5-cp36-none-linux_x86_64.whl $ cd ../uff $ pip install uff-0.6.5-py2.py3-none-any.whl
$ source activate adanet $ cd ~/Software/TensorRT-6.0.1.5
Python 3.6.10 |Anaconda, Inc.| (default, Mar 25 2020, 23:51:54) [GCC 7.3.0] on linux Type "help", "copyright", "credits" or "license"for more information. >>> import tensorrt >>> import uff >>> import tensorflow as tf >>> import adanet WARNING:tensorflow:From /home/eustomaqua/anaconda3/envs/adanet/lib/python3.6/site-packages/adanet/tf_compat/__init__.py:87: The name tf.losses.Reduction is deprecated. Please use tf.compat.v1.losses.Reduction instead.
WARNING:tensorflow:From /home/eustomaqua/anaconda3/envs/adanet/lib/python3.6/site-packages/adanet/core/tpu_estimator.py:39: The name tf.estimator.tpu.TPUEstimator is deprecated. Please use tf.compat.v1.estimator.tpu.TPUEstimator instead.
$ cd ~/Software/TensorRT-6.0.1.5 $ which convert-to-uff /home/eustomaqua/anaconda3/envs/adanet/bin/convert-to-uff $ $ mkdir python/data $ mkdir python/data/mnist $ cp ./data/mnist/lenet5.uff ./python/data/mnist/lenet5.uff $ cd ./samples/sampleMNIST $ make clean $ make $ cd ../../bin $ ./sample_mnist &&&& RUNNING TensorRT.sample_mnist # ./sample_mnist [03/03/2020-07:47:01] [I] Building and running a GPU inference engine for MNIST [03/03/2020-07:47:07] [I] [TRT] Detected 1 inputs and 1 output network tensors. Could not find 8.pgm in data directories: data/mnist/ data/samples/mnist/ &&&& FAILED
# 1. Install CUDA 10.0.130, cuDNN 7.6.4 # install tensorflow-gpu=2.1.0 or 1.15.2 (recommend 1.15.2 for uff) $ pip install tensorflow-gpu==1.*
# 2. download TensorRT tar from NVIDIA $ wget TensorRT-6.0.1.5.Ubuntu-{16/18}.04.x86_64-gnu.cuda-10.0.cudnn7.6.tar.gz $ tar -xzvf TensorRT-6.0.1.5.Ubuntu-16.04.x86_64-gpu.cuda-10.0.cudnn7.6.tar.gz
# 3. .bashrc $ vim ~/.bashrc
1 2 3 4 5 6 7 8 9
# add by Anaconda3 install export PATH="/home/eustomaqua/VirtualEnv/anaconda3/bin:$PATH" # self added for Nvidia export PATH=$HOME/Software/cuda-10.0/bin:$PATH export LD_LIBRARY_PATH=$HOME/Software/cuda-10.0/lib64:$LD_LIBRARY_PATH # self modified for TensorRT export LD_LIBRARY_PATH=$HOME/Software/TensorRT-6.0.1.5/lib:$LD_LIBRARY_PATH export CUDA_INSTALL_DIR=$HOME/Software/cuda-10.0 export CUDNN_INSTALL_DIR=$HOME/Software/cuda-10.0
1 2 3 4 5 6 7 8 9 10 11
$ # source ~/.bashrc $ echo$HOME
# 4. install tensorrt $ cd TensorRT-6.0.1.5 $ cd python $ pip install tensorrt-6.0.1.5-cp36-none-linux_x86_64.whl