TF-TRT5: How to run tensorflow-tensorrt inferences with multiple GPUs

hi all, I am using integration TF-TRT5 via container image

I want to run the python sample with multiple GPUs. I have done the below modification but it is not working

Modified code

estimator = tf.estimator.Estimator(

Could you please provide some sample that implements tensorflow-tensorrt inference with multiple GPUs?




Would the TRT Inference Server be appropriate?

Hi, thanks for your prompt reply.

I have explored TRT Inference Server container, but it doesn’t show the code where the Inference Server distributes the inferencing across all system GPUs.

Some other suggestion?. Thanks


Can you describe your use case?

TRTIS (TensorRT Inference Server) supports multiple GPUs but it does not support running a single inference distributed across multiple GPUs. TRTIS can run multiple models (and/or multiple instances of the same model) on multiple GPUs to increase throughput.


I am using integration TF-TRT5 via container image to run the sample which shows the inference performance using tf-trt (throughput and latency). I realized the script only uses 1 GPUs to do the calculation. I need some example of running a single inference distributed across multiple GPUs to maximize the performance and system capabilities (with 3 GPUs)

Here is the environment I am using:
container image:
top-level directory: /workspace/nvidia-examples/tftrt/scripts
GPU model and memory: 3x Tesla P4 - 7GB
Command to reproduce: python3 --model resnet_v1_50 --batch_size 1 --use_trt --precision fp32



can you elaborate on “to maximize the performance and system capabilities”? Is it because your model takes more than 7GB that they can’t fit it in one P4?

FYI. If your goal is to have trt engine doing gpu-to-gpu communications, it is not possible, at least for now.

If you want to run same graph in multiple gpus to increase the throughput, then you’ll need native tf.

Right, I want to test the server showing its max capability in terms of GPU utilization. For instance, when I ran the test with 128 batch size, it hit 100% of GPU utilization, so with batch sizes over 128 the script should use the rest of the GPUs available in the system and increases throughput

I got it. Is there a sample code that shows how TRTIS runs multiple models (and/or multiple instances of the same model) on multiple GPUs to increase throughput?. I would like to add this functionality to my code. Thanks


The open-source repo of client code and examples has everything you need I believe. The instructions there tell you how to build perf_client and also there is a sample model that configurations 4 model instances. The instructions tell how to use the example model store. The actual config file is: You can modify that to use different numbers of model instances.

The current user guide doesn’t have the section they would be interested in, but the 18.10 user guide will. You could instead look at this blog: in the Performance section is discussion about model instances.


Currently I am using TensorRT for model inference on one GPU and would like to have multi-gpu utilization. Is it not possible to run one model instance on multi-gpus? For example, instead of consuming 15 ms for one frame using one GPU, is it possible to use two GPUs to get less than 15 ms time consumption?

In my case, the batch_size here is 1. If not, what is the best way of utilizing multi-gpu for one real-time video stream to get less inference time per frame?