triton客户端使用

model_analyzer

简介:

Triton Model Analyzer is a CLI tool which can help you find a more optimal configuration, on a given piece of hardware, for single, multiple, ensemble, or BLS models running on a Triton Inference Server. Model Analyzer will also generate reports to help you better understand the trade-offs of the different configurations along with their compute and memory requirements.

代码地址:https://github.com/triton-inference-server/model_analyzer

测试方法:

启docker

docker run --name fan-triton -it --gpus device=0 \

      -v /var/run/docker.sock:/var/run/docker.sock \

      -v $(pwd)/examples/quick-start:$(pwd)/examples/quick-start \

      -v /home/fanz/thirdparty/triton:/home/fanz/thirdparty/triton \

      --net=host nvcr.io/nvidia/tritonserver:23.04-py3-sdk

测试

    /usr/local/bin/model-analyzer profile \

    --model-repository /home/xx/thirdparty/triton/models \

    --profile-models Primary_Detector --triton-launch-mode=docker \

    --output-model-repository-path /home/xx/thirdparty/triton/prm-out2 \

--export-path .

models下包含Primary_Detector等模型文件。Primary_Detector下包含模型配置文件config.pbtxt和模型版本目录1,1下就是模型的engine文件。

跑的时间会很长,因为在运行所有的配置。最后生成如下几个文件,具体意义详见文档:https://github.com/triton-inference-server/model_analyzer/blob/main/docs/report.md

 

perf_analyzer

perf_analyzer是个功能强大的测试工具,支持http, grpc, capi三种模式的测试。http, grpc方式需要启动tritonserver, 客户端发送命令包给服务端,服务端调triton的底层接口进行推理。capi方式不需要启动tritonserver,程序直接调接口进行推理。

perf_analyzer的源码:client/src/c++/perf_analyzer at main · triton-inference-server/client · GitHub

capi方式的使用:

./perf_analyzer --service-kind=triton_c_api --triton-server-directory=/opt/tritonserver  --model-repository=/opt/nvidia/deepstream/deepstream/samples/models  -m Primary_Detector

model-repository的意义详见上一章节。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Triton Inference Server 支持使用共享内存来提高推理性能。当多个 Triton 实例在同一台服务器上运行时,共享内存可以让它们共享模型数据和推理结果,避免重复加载和传输数据。 使用共享内存需要以下步骤: 1. 首先,在 Triton Server 的配置文件中启用共享内存。你可以在配置文件中添加以下行: ``` model-control-mode = "explicit" model-repository = "/path/to/models" shared-memory-type = "system" shared-memory-name = "triton_shm" ``` 其中,`shared-memory-type` 指定共享内存的类型(在本例中为“system”),`shared-memory-name` 指定共享内存的名称(在本例中为“triton_shm”)。 2. 接下来,启动 Triton 实例,并在启动命令中指定共享内存的大小。例如,以下命令启动了一个 Triton 实例,并指定了共享内存的大小为1GB: ``` tritonserver --model-repository /path/to/models --shared-memory-size 1073741824 ``` 3. 如果你要启动多个 Triton 实例,需要确保它们使用相同的共享内存名称和大小。 4. 在你的客户端代码中,你可以指定使用共享内存来进行推理。例如,在 Python 中,你可以使用以下代码来创建一个使用共享内存的 InferenceServerClient: ``` import tritonclient.grpc as triton # Connect to the local Triton server using shared memory client = triton.InferenceServerClient(url="localhost:8001", transport="shm") ``` 这些步骤可以帮助你在 Triton Inference Server 中使用共享内存来提高推理性能。注意,共享内存的使用可能会占用大量的系统内存,需要根据实际情况进行调整。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

山西茄子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值