Win 10 配置TensorRT环境

 

下载TensorRT

官网https://developer.nvidia.com/tensorrt下载对应版本的TensorRT(示例为 cuda 10.0 cudnn 7.6),需注册账号、填写问卷调查方可下载。

设置环境变量

TensorRT-7.0.0.11.Windows10.x86_64.cuda-10.0.cudnn7.6.zip解压至本地,将

xxx\TensorRT-7.0.0.11\lib 添加至环境变量

安装uff和graphsurgeon

xxx\TensorRT-7.0.0.11\下有uff和graphsurgeon,分别安装两个文件夹下的安装包 (激活对应的虚拟环境,比如我是python36):

 >>pip install .\uff-0.6.5-py2.py3-none-any.whl

 >>pip install .\graphsurgeon-0.4.1-py2.py3-none-any.whl

 

测试

用vs 2015打开TensorRT-7.0.0.11\samples\sampleMNIST下的sample_mnist.sln,生成项目,在

在TensorRT-7.0.0.11\bin下会新生成sample_mnist.exe

命令行切换进目录TensorRT-7.0.0.11\data\mnist,运行:

>python download_pgms.py

下载所需数据,

然后切换到TensorRT-7.0.0.11\bin目录,运行生成的sample_mnist.exe即可(注意指定一下--datadir,在 根目录下data/mnist,不然可能找不到数据)


(python36) PS D:\xx\TensorRT\TensorRT-7.0.0.11\bin> .\sample_mnist.exe --datadir D:\xx\TensorRT\TensorRT-7.0.0.11\data\mnist

&&&& RUNNING TensorRT.sample_mnist # D:\Software\xx\TensorRT\TensorRT-7.0.0.11\bin\sample_mnist.exe --datadir D:\xx\TensorRT\TensorRT-7.0.0.11\data\mnist
[03/10/2020-16:37:34] [I] Building and running a GPU inference engine for MNIST
[03/10/2020-16:37:36] [W] [TRT] TensorRT was linked against cuDNN 7.6.3 but loaded cuDNN 7.4.2
[03/10/2020-16:37:36] [I] [TRT] Detected 1 inputs and 1 output network tensors.
[03/10/2020-16:37:36] [W] [TRT] TensorRT was linked against cuDNN 7.6.3 but loaded cuDNN 7.4.2
[03/10/2020-16:37:36] [W] [TRT] TensorRT was linked against cuDNN 7.6.3 but loaded cuDNN 7.4.2
[03/10/2020-16:37:36] [W] [TRT] Current optimization profile is: 0. Please ensure there are no enqueued operations pending in this context prior to switching profiles
[03/10/2020-16:37:36] [I] Input:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@%%+      -@@@@@@@
@@@@@@@@@%=..        -@@@@@@
@@@@@@@@@:            #@@@@@
@@@@@@@@@+   ====:    #@@@@@
@@@@@@@@@@%%%@@@@@.  -@@@@@@
@@@@@@@@@@@@@@@@@*   =@@@@@@
@@@@@@@@@@@@@@@@*:   @@@@@@@
@@@@@@@@@@@@@@*.    .@@@@@@@
@@@@@@@@@%+:::     +%@@@@@@@
@@@@@@@@%.        -@@@@@@@@@
@@@@@@@@%.         *@@@@@@@@
@@@@@@@@@%+#%%%%=  *@@@@@@@@
@@@@@@@@@@@@@@@@@  *@@@@@@@@
@@@@@@@@@@@@@@@@*  *@@@@@@@@
@@@@@@@*@@@@@@@*   *@@@@@@@@
@@@@@#: %@@@@@*    #@@@@@@@@
@@@@@.  =====:   :*@@@@@@@@@
@@@@@.          -@@@@@@@@@@@
@@@@@#-     ..=%@@@@@@@@@@@@
@@@@@@@+  -+%@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@

[03/10/2020-16:37:36] [I] Output:
0:
1:
2:
3: **********
4:
5:
6:
7:
8:
9:

可能的bug:

报错信息 :The build tools for v141 (Platform Toolset = 'v141') cannot be found. To build using the v141 build tools, please install v141 build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution".   

原因:Visual Studio 2015 编辑错误,是缺少了v141组件
方法:
项目-->属性--->常规-->平台工具集--->选择 Visual Studio 2015 (v140),或者Visual Studio 2015 - Windows XP (v140_xp)确定,重新生成。
 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值