tensorrt中workspace_size的理解

首先单位是字节,比如 builder.max_workspace_size = 1<< 30 就是 2^30 bytes 即 1 GB。

它的作用是给出模型中任一层能使用的内存上限。运行时,每一层需要多少内存系统分配多少,并不是每次都分 1 GB,但不会超过 1 GB。

One particularly important property is the maximum workspace size.

  • Layer algorithms often require temporary workspace. This parameter limits the maximum size that any layer in the network can use. If an insufficient scratch is provided, it is possible that TensorRT may not be able to find an implementation for a given layer.

一个特别重要的特性是最大工作空间大小。
层算法通常需要临时工作空间。 此参数限制网络中任何层可以使用的最大大小。 如果提供的暂存不足,TensorRT 可能无法找到给定层的实现。

 workspace 作为每层网络执行时的临时存储空间,该空间是共享的以减少显存占用

参考:

https://forums.developer.nvidia.com/t/the-significance-of-builder-max-workspace-size/72364/2

https://docs.nvidia.com/deeplearning/tensorrt/developer-guide/index.html#build_engine_c

posted @ 2022-10-11 11:11  海_纳百川  阅读(754)  评论(0编辑  收藏  举报
本站总访问量