tensorrt7.0在windows环境下安装方式(来自nvidia官方文档精简后)

 

安装前提

 

CUDA 10.2或11.0 RC,cudnn8.0,以上都安装完成的情况下开始安装tensorrt。

 

怎么安装cuda和cudnn参考之前安装pytorch的教程。

 

安装步骤

 

先去nvidia官网下载Windows版本匹配的TensorRT zip文件。https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html#downloading

 

解压zip文件

 

1.7.x.x.x(含TensorRT版本)

 

2.cuda-x.x和cuda版本,以及

 

3.cudnnx.x和cuDNN版本供您下载。

 

将TensorRT库文件添加到系统路径中。

 

将DLL文件从/lib复制到CUDA安装目录,例如C:\Program files\NVIDIA GPU Computing Toolkit\CUDA\vX.Y\bin,其中vX.Y是CUDA版本。(CUDA路径要添加到环境变量下)

 

验证安装前的准备

 

若要验证安装是否正常,应打开VisualStudio解决方案文件的示例,比如“Hello World” For TensorRT (sampleMNIST),并确认您能够生成和运行该示例。

 

打开visual studio的项目>属性,确认以下已被添加

 

1.<tensorrt安装目录>/lib 已被加到 PATH variable 并且在visual studio的VC++目录 > 可执行目录下.

 

 

2.<tensorrt安装目录>/include 在C/C++ > 常规 > 附加包含目录.

 

 

3.nvinfer.lib 和其他所有需要的 LIB文件 都在 链接器 > 输入 > 附加依赖项

 

注意:为了构建包含的示例,要先安装VisualStudio2017(https://visualstudio.microsoft.com/downloads/)。

 

直接选社区版就足够用于运行项目了。

 

如果使用的是TensorFlow,先安装uff和graphsurgeon 的whl文件。(在tensorrt文件夹下找到这俩whl文件,然后直接pip install 安装就行)

 

 

 

验证安装

 

打开tensorrt解压后文件夹下的sample

 

 

随便找一个运行一下

 

 

点击.sln的文件,自动打开visualstudio运行,这时会出现如下报错,其实说白了就是没找到mnist数据集

 

 

去tensorrt目录下的data文件夹找到对应数据集的download_pgms.py,然后运行就可以了,运行的时候没输出,等一会看到文件夹下有了x.pgm文件就说明下载好了

 

这时候再运行,已然是成了

 

 

以下是官方文档原文

 

4.4. Zip File Installation

 

This section contains instructions for installing TensorRT from a zip file.

 

Before you begin

 

Ensure that you have the following dependencies installed.

 

 

About this task

 

This section contains instructions for installing TensorRT from a zip package on Windows 10.

 

Procedure

 

  1. Download the TensorRT zip file that matches the Windows version you are using.
  2. Choose where you want to install TensorRT. The zip file will install everything into a subdirectory called TensorRT-7.x.x.x. This new subdirectory will be referred to as <installpath> in the steps below.
  3. Unzip the TensorRT-7.x.x.x.Windows10.x86_64.cuda-x.x.cudnnx.x.zip file to the location that you chose. Replace:
    1. 7.x.x.x with the TensorRT version
    2. cuda-x.x with the CUDA version, and
    3. cudnnx.x with the cuDNN version for your particular download.
  4. Add the TensorRT library files to your system PATH. There are two ways to accomplish this task:
    1. Leave the DLL files where they were unzipped and add <installpath>/lib to your system PATH. You can add a new path to your system PATH using the steps below.
      1. Press the Windows key and search for "environment variables" which should present you with the option Edit the system environment variables and click it.
      2. Click Environment Variables… at the bottom of the window.
      3. Under System variables, select Path and click Edit….
      4. Click either New or Browse to add a new item that contains <installpath>/lib.
      5. Continue to click OK until all the newly opened windows are closed.
      6. If your cuDNN libraries were not copied to the CUDA installation directory and instead left where they were unzipped, then repeat the above steps for the cuDNNbin directory.
    2. Copy the DLL files from <installpath>/lib to your CUDA installation directory, for example, C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\vX.Y\bin, where vX.Y is your CUDA version. The CUDA installer should have already added the CUDA path to your system PATH.
  5. To verify that your installation is working you should open a Visual Studio Solution file from one of the samples, such as “Hello World” For TensorRT (sampleMNIST), and confirm that you are able to build and run the sample. If you want to use TensorRT in your own project, ensure that the following is present in your Visual Studio Solution project properties:
    1. <installpath>/lib has been added to your PATH variable and is present under VC++ Directories > Executable Directories.
    2. <installpath>/include is present under C/C++ > General > AdditionalDirectories.
    3. nvinfer.lib and any other LIB files that your project requires are present under Linker > Input > Additional Dependencies.Note: In order to build the included samples, you should have Visual Studio 2017 (https://visualstudio.microsoft.com/downloads/) installed. The community edition is sufficient to build the TensorRT samples.
  6. If you are using TensorFlow install the uff and graphsurgeon wheel packages. You must prepare the Python environment before installing uff and graphsurgeon.If using Python 2.7:python -m pip install <installpath>\graphsurgeon\graphsurgeon-0.4.5-py2.py3-none-any.whl python -m pip install <installpath>\uff\uff-0.6.9-py2.py3-none-any.whl If using Python 3.x:python3 -m pip install <installpath>\graphsurgeon\graphsurgeon-0.4.5-py2.py3-none-any.whl python3 -m pip install <installpath>\uff\uff-0.6.9-py2.py3-none-any.whl

 

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值