Skip to content

Commit 94a7942

Browse files
committed
chore: Add note about Cuda Driver Error
1 parent 995c21c commit 94a7942

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

examples/dynamo/dynamo_compile_advanced_usage.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,13 @@ def forward(self, x: torch.Tensor, y: torch.Tensor):
8989
# Finally, we use Torch utilities to clean up the workspace
9090
torch._dynamo.reset()
9191

92-
with torch.no_grad():
93-
torch.cuda.empty_cache()
92+
# %%
93+
# Cuda Driver Error Note
94+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
95+
#
96+
# Occasionally, upon exiting the Python runtime after Dynamo compilation with `torch_tensorrt`,
97+
# one may encounter a Cuda Driver Error. This issue is related to https://github.com/NVIDIA/TensorRT/issues/2052
98+
# and can be resolved by wrapping the compilation/inference in a function and using a scoped call, as in::
99+
#
100+
# if __name__ == '__main__':
101+
# compile_engine_and_infer()

examples/dynamo/dynamo_compile_resnet_example.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,13 @@
7878
# Finally, we use Torch utilities to clean up the workspace
7979
torch._dynamo.reset()
8080

81-
with torch.no_grad():
82-
torch.cuda.empty_cache()
81+
# %%
82+
# Cuda Driver Error Note
83+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
84+
#
85+
# Occasionally, upon exiting the Python runtime after Dynamo compilation with `torch_tensorrt`,
86+
# one may encounter a Cuda Driver Error. This issue is related to https://github.com/NVIDIA/TensorRT/issues/2052
87+
# and can be resolved by wrapping the compilation/inference in a function and using a scoped call, as in::
88+
#
89+
# if __name__ == '__main__':
90+
# compile_engine_and_infer()

examples/dynamo/dynamo_compile_transformers_example.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,13 @@
8888
# Finally, we use Torch utilities to clean up the workspace
8989
torch._dynamo.reset()
9090

91-
with torch.no_grad():
92-
torch.cuda.empty_cache()
91+
# %%
92+
# Cuda Driver Error Note
93+
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
94+
#
95+
# Occasionally, upon exiting the Python runtime after Dynamo compilation with `torch_tensorrt`,
96+
# one may encounter a Cuda Driver Error. This issue is related to https://github.com/NVIDIA/TensorRT/issues/2052
97+
# and can be resolved by wrapping the compilation/inference in a function and using a scoped call, as in::
98+
#
99+
# if __name__ == '__main__':
100+
# compile_engine_and_infer()

0 commit comments

Comments
 (0)