# Profiling fails with \[E\] Error\[1\]: \[executionContext.cpp::syncShapeBindingsToDevice::1990\] Error Code 1: Cuda Runtime (context is destroyed)

**URL:** <https://forums.developer.nvidia.com/t/profiling-fails-with-e-error-1-executioncontext-cpp-1990-error-code-1-cuda-runtime-context-is-destroyed/264590>\
**Category:** TensorRT\
**Created:** [August 28, 2023, 8:20am UTC](https://forums.developer.nvidia.com/t/profiling-fails-with-e-error-1-executioncontext-cpp-1990-error-code-1-cuda-runtime-context-is-destroyed/264590 "2023-08-28T08:20:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![minkyu.kim2](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@minkyu.kim2](https://forums.developer.nvidia.com/u/minkyu.kim2)\
**Post date:** [August 28, 2023, 8:20am UTC](https://forums.developer.nvidia.com/t/profiling-fails-with-e-error-1-executioncontext-cpp-1990-error-code-1-cuda-runtime-context-is-destroyed/264590/1 "2023-08-28T08:20:23Z")

</div>

## Description

While running trtexec with a command  
`trtexec --loadEngine=whisper-tiny-decoder-sim.engine --exportProfile=whisper-tiny-decoder-sim.engine.profile.json --verbose --noDataTransfers --useCudaGraph --separateProfileRun`,  
I’ve got the following error.

```auto
[08/28/2023-06:09:53] [E] Error[1]: [executionContext.cpp::syncShapeBindingsToDevice::1990] Error Code 1: Cuda Runtime (context is destroyed)
trtexec: samples/common/sampleInference.cpp:844: void sample::{anonymous}::Iteration<ContextType>::createEnqueueFunction(const sample::InferenceOptions&, nvinfer1::IExecutionContext&, sample::Bindings&) [with ContextType = nvinfer1::IExecutionContext]: Assertion `ret' failed.

```

I found out without the `--separateProfileRun` option on the command, it runs successfully without the error.  
However I believe it’s more accurate to get the latency with this option on.  
I wonder if it could be a bug or if there’s any solution recommended.

## Environment

**TensorRT Version** : 8.5.2-1+cuda11.8  
**GPU Type** : RTX A6000  
**Nvidia Driver Version** : 510.108.03  
**CUDA Version** : 12.0  
**CUDNN Version** : 8  
**Operating System + Version** : Ubuntu 20.04  
**Python Version (if applicable)**: 3.8.10  
**TensorFlow Version (if applicable)**:  
**PyTorch Version (if applicable)**:  
**Baremetal or Container (if container which image + tag)**: [nvcr.io/nvidia/tensorrt](http://nvcr.io/nvidia/tensorrt) 23.01-py3

## Relevant Files

Attaching the input onnx file [[link](https://drive.google.com/file/d/1WVLMbKySorWVuxi1vwgm8GkqyJp7MY1L/view?usp=sharing)]

## Steps To Reproduce

1. Build trtexec on the above docker image
2. `trtexec --loadEngine=whisper-tiny-decoder-sim.engine --exportProfile=whisper-tiny-decoder-sim.engine.profile.json --verbose --noDataTransfers --useCudaGraph --separateProfileRun`

---

<div class="post-metadata">

**Author:** ![AakankshaS](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aakankshas/32/14047_2.png) [@AakankshaS](https://forums.developer.nvidia.com/u/AakankshaS)\
**Post date:** [August 28, 2023, 9:37am UTC](https://forums.developer.nvidia.com/t/profiling-fails-with-e-error-1-executioncontext-cpp-1990-error-code-1-cuda-runtime-context-is-destroyed/264590/2 "2023-08-28T09:37:33Z")

</div>

Hi,  
Request you to share the ONNX model and the script if not shared already so that we can assist you better.  
Alongside you can try few things:

> **[Quick Start Guide — NVIDIA TensorRT](https://docs.nvidia.com/deeplearning/tensorrt/latest/getting-started/quick-start-guide.html)**

1. validating your model with the below snippet

# check\_model.py

import sys  
import onnx  
filename = yourONNXmodel  
model = onnx.load(filename)  
onnx.checker.check\_model(model).  
2) Try running your model with trtexec command.

> **[TensorRT/samples/trtexec at master · NVIDIA/TensorRT](https://github.com/NVIDIA/TensorRT/tree/master/samples/trtexec)**
>
> NVIDIA® TensorRT™ is an SDK for high-performance deep learning inference on NVIDIA GPUs. This repository contains the open source components of TensorRT. - NVIDIA/TensorRT

In case you are still facing issue, request you to share the trtexec “”–verbose"" log for further debugging  
Thanks!

---

<div class="post-metadata">

**Author:** ![minkyu.kim2](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@minkyu.kim2](https://forums.developer.nvidia.com/u/minkyu.kim2)\
**Post date:** [August 28, 2023, 10:54am UTC](https://forums.developer.nvidia.com/t/profiling-fails-with-e-error-1-executioncontext-cpp-1990-error-code-1-cuda-runtime-context-is-destroyed/264590/4 "2023-08-28T10:54:09Z")

</div>

Hi Thank you for the quick response.

I attached the ONNX model link in the “Relevant Files” above.  
Also, the error log I attached is from `--verbose` as I attached the command too.  
By the way, with the ONNX checker you’ve shared, there’s no exception.

Thank you!
