lix19937 / tensorrt-insight

Deep insight tensorrt, including but not limited to qat, ptq, plugin, triton_inference, cuda
12 stars 0 forks source link

trt cuda ctx vs engine 生命周期问题 #40

Open lix19937 opened 2 months ago

lix19937 commented 2 months ago

We need make sure trt engine < cuda ctx in life range.

https://github.com/NVIDIA/TensorRT/issues/2052#issuecomment-1155361468

https://stackoverflow.com/questions/4775579/main-and-scoping-in-python

Variables in the current modules global scope are visible everywhere in the module -- this rule also holds for the main module.

if __name__ == "__main__":
    foo = "bar"

defines a global variable named foo in that script. so any function of that module will have access to it.

The piece of code listed above is global to the module and not inside any function.