Closed LoicFerrot closed 2 years ago
This is unfortunately expected since you can't mix CUDA applications with their own context without setting it as current before each use (when it's implicit like this).
Since we can't fix it, the workaround is to have 2 independent threads for CUDA applications such as PyTorch and the ZED. You should check out the zed TensorFlow project which implements this, there's a thread for the ZED capture functions and another one for the CNN, there's a CPU buffer shared between the two. The added benefit is that it's also parallelized and therefore faster to process. https://github.com/stereolabs/zed-tensorflow/blob/master/object_detection_zed.py
To my knowledge, this is the easiest solution to this problem
Thanks for your answer! Indeed, simply creating a python thread in which the pytorch + cuda related code was running did solve the problem
Preliminary Checks
Description
I want to load different .svo files and process them on the fly with a torch network, but after the first file is loaded I get an error
RuntimeError: CUDA error: invalid argument
. From what I understand it seems to be related to #154 but the error is different. I provide a minimal crash example, that consistently produces the error. I didn't try it with cuda 10.2 as my GPU doesn't support it. Could you please fix the bug or at least explain the different cuda context workaround from #35 a bit more clearly please? Thanks in advance!Steps to Reproduce
Expected Result
No raised exception
Actual Result
RuntimeError: CUDA error: invalid argument
and a substantial hair loss when trying to debug :)ZED Camera model
ZED2
Environment
Anything else?
No response