【TensorRT】tensorRT 7.0的安装配置

前几天老黄发布了tensorRT 7.0, 对于模型服务器部署来说,tensorRT是真的香啊。先放官网链接,https://docs.nvidia.com/deeplearning/sdk/tensorrt-developer-guide/index.html

先介绍一下TensorRT

TensorRT的核心就是一个深度学习的高性能C++的推理库, 基本适配主流的训练框架,如Tensorflow, Caffe, Pytorch, MXNet。

Some training frameworks such as TensorFlow have integrated TensorRT so that it can be used to accelerate inference within the framework. Alternatively, TensorRT can be used as a library within a user application. It includes parsers for importing existing models from Caffe, ONNX, or TensorFlow, and C++ and Python APIs for building models programmatically.

TensorRT 7.0的安装

这里介绍在ubuntu下的两个安装方式:deb和tar安装。

一、deb安装:

注意deb安装需要sudo权限,没有sudo权限的下面可以不用看,直接看第二种安装方式。

  1. 先从 https://developer.nvidia.com/tensorrt 官网下载一个 tensorRT 的 deb版本, 这里跟下载cudnn一样, 需要进行验证才能下载

在这里插入图片描述
注意本博客介绍的第一种安装方式需要下载deb的包,tar是第二种安装方式,建议先把两个都下载下来。

2)按照TensorRT的版本:这里nvidia的官网写的很繁琐,可以直接dpkg -i 安装下载的deb安装包,然后记得把key加进来

os=”ubuntu1x04”
tag=”cudax.x-trt7.x.x.x-ga-yyyymmdd”
sudo dpkg -i nv-tensorrt-repo-${os}-${tag}_1-1_amd64.deb
sudo apt-key add /var/nv-tensorrt-repo-${tag}/7fa2af80.pub

sudo apt-get update
sudo apt-get install tensorrt

If using Python 2.7:

sudo apt-get install python-libnvinfer-dev

The following additional packages will be installed:

python-libnvinfer

If using Python 3.x:

sudo apt-get install python3-libnvinfer-dev

The following additional packages will be installed:

python3-libnvinfer

If you plan to use TensorRT with TensorFlow:

sudo apt-get install uff-converter-tf

The graphsurgeon-tf package will also be installed with the above command.

3。 验证一下是否安装完毕:

dpkg -l | grep TensorRT

You should see something similar to the following:

ii  graphsurgeon-tf	7.0.0-1+cuda10.2	amd64	GraphSurgeon for TensorRT package
ii  libnvinfer-bin		7.0.0-1+cuda10.2	amd64	TensorRT binaries
ii  libnvinfer-dev		7.0.0-1+cuda10.2	amd64	TensorRT development libraries and headers
ii  libnvinfer-doc		7.0.0-1+cuda10.2	all	TensorRT documentation
ii  libnvinfer-plugin-dev	7.0.0-1+cuda10.2	amd64	TensorRT plugin libraries
ii  libnvinfer-plugin7	7.0.0-1+cuda10.2	amd64	TensorRT plugin libraries
ii  libnvinfer-samples	7.0.0-1+cuda10.2	all	TensorRT samples
ii  libnvinfer7		7.0.0-1+cuda10.2	amd64	TensorRT runtime libraries
ii  libnvonnxparsers-dev		7.0.0-1+cuda10.2	amd64	TensorRT ONNX libraries
ii  libnvonnxparsers7	7.0.0-1+cuda10.2	amd64	TensorRT ONNX libraries
ii  libnvparsers-dev	7.0.0-1+cuda10.2	amd64	TensorRT parsers libraries
ii  libnvparsers7	7.0.0-1+cuda10.2	amd64	TensorRT parsers libraries
ii  python-libnvinfer	7.0.0-1+cuda10.2	amd64	Python bindings for TensorRT
ii  python-libnvinfer-dev	7.0.0-1+cuda10.2	amd64	Python development package for TensorRT
ii  python3-libnvinfer	7.0.0-1+cuda10.2	amd64	Python 3 bindings for TensorRT
ii  python3-libnvinfer-dev	7.0.0-1+cuda10.2	amd64	Python 3 development package for TensorRT
ii  tensorrt		7.0.0.x-1+cuda10.2 	amd64	Meta package of TensorRT
ii  uff-converter-tf	7.0.0-1+cuda10.2	amd64	UFF converter for TensorRT package

这样就安装完毕。

注意: 我在安装过程中,则出现了问题:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 tensorrt : Depends: libnvinfer7 (= 7.0.0-1+cuda10.0) but it is not going to be installed
            Depends: libnvinfer-plugin7 (= 7.0.0-1+cuda10.0) but it is not going to be installed
            Depends: libnvparsers7 (= 7.0.0-1+cuda10.0) but it is not going to be installed
            Depends: libnvonnxparsers7 (= 7.0.0-1+cuda10.0) but it is not going to be installed
            Depends: libnvinfer-bin (= 7.0.0-1+cuda10.0) but it is not going to be installed
            Depends: libnvinfer-dev (= 7.0.0-1+cuda10.0) but it is not going to be installed
            Depends: libnvinfer-plugin-dev (= 7.0.0-1+cuda10.0) but it is not going to be installed
            Depends: libnvparsers-dev (= 7.0.0-1+cuda10.0) but it is not going to be installed
            Depends: libnvonnxparsers-dev (= 7.0.0-1+cuda10.0) but it is not going to be installed
            Depends: libnvinfer-samples (= 7.0.0-1+cuda10.0) but it is not going to be installed
            Depends: libnvinfer-doc (= 7.0.0-1+cuda10.0) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

这好像安装cuda的时候出现了问题,有时间的同学请重新安装cuda,跟我一样比较懒的同学移步看下一个安装方式。

二、tar安装:

这个按照方式比较简单,不需要管理员权限。
对下载好的tar文件进行解压:

version=”7.x.x.x”
os=<os>”
arch=$(uname -m)
cuda=”cuda-x.x”
cudnn=”cudnn7.x”
tar xzvf TensorRT-${version}.${os}.${arch}-gnu.${cuda}.${cudnn}.tar.gz

然后把lib路径加到系统动态库路径上。

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:<TensorRT-${version}/lib>

解压后:目录如下

ls TensorRT-${version}
bin  data  doc  graphsurgeon  include  lib  python  samples  targets  TensorRT-Release-Notes.pdf  uff

Install the Python TensorRT wheel file.

cd TensorRT-${version}/python

If using Python 2.7:

sudo pip2 install tensorrt-*-cp27-none-linux_x86_64.whl

If using Python 3.x:

sudo pip3 install tensorrt-*-cp3x-none-linux_x86_64.whl

Install the Python UFF wheel file. This is only required if you plan to use TensorRT with TensorFlow.

cd TensorRT-${version}/uff

If using Python 2.7:

sudo pip2 install uff-0.6.5-py2.py3-none-any.whl

If using Python 3.x:

sudo pip3 install uff-0.6.5-py2.py3-none-any.whl

In either case, check the installation with:

which convert-to-uff

Install the Python graphsurgeon wheel file.

cd TensorRT-${version}/graphsurgeon

If using Python 2.7:

sudo pip2 install graphsurgeon-0.4.1-py2.py3-none-any.whl

If using Python 3.x:

sudo pip3 install graphsurgeon-0.4.1-py2.py3-none-any.whl
  • 6
    点赞
  • 38
    收藏
    觉得还不错? 一键收藏
  • 11
    评论
Tomcat 是一个免费的、开源的 Web 服务器,它是用 Java 语言编写的,用于支持 Java Servlet 和 JSP(JSP 是动态生成 HTML、XML 或其他类型文档的服务器端脚本),Tomcat 7.0 是 Tomcat 的一个版本。以下是 Tomcat 7.0 的安装配置教程: 1. 下载 Tomcat 7.0 访问 Apache Tomcat 的官方网站,下载 Tomcat 7.0 的压缩包。 2. 安装 Tomcat 7.0 将下载的压缩包解压到本地磁盘中的目录,然后进入 Tomcat 的 bin 目录,双击 startup.bat 启动 Tomcat。 3. 配置 Tomcat 7.0 3.1 修改端口号 默认情况下,Tomcat 监听的是 8080 端口,如果端口被占用了,则需要修改端口号。打开 Tomcat 的 conf 目录下的 server.xml 文件,将默认的 8080 改成未被占用的端口号即可。 3.2 配置虚拟主机 如果需要配置虚拟主机,则需要修改 Tomcat 的 conf 目录下的 server.xml 文件,在 <Service> 标签中添加以下代码: <Engine name="Catalina" defaultHost="localhost"> <Host name="example.com" appBase="example.com\webapps" unpackWARs="true" autoDeploy="true"> <Context path="" docBase="example.com\webapps\ROOT" debug="0" reloadable="true" /> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="example.com\logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b" /> </Host> </Engine> 3.3 配置 Tomcat 环境变量 配置 Tomcat 环境变量,方便在命令行中调用 Tomcat。打开系统属性,添加 TOMCAT_HOME 变量,并将其值设置为 Tomcat 安装目录的路径。 以上就是 Tomcat 7.0 的安装配置教程,按照上述步骤进行操作,就可以很轻松地搭建自己的 Tomcat 服务器。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 11
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值