Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For older versions of FFMPEG we should try to reuse the device context #190

Open
ahmadsharif1 opened this issue Aug 20, 2024 · 0 comments
Open

Comments

@ahmadsharif1
Copy link
Contributor

I recently did some profiling of GPU profiling, and I found that creating Cuda contexts is quite expensive because it because it requires device synchronization:

err = av_hwdevice_ctx_create(

image

trace_rank_0.json

I am actually not even sure if this is correct code because underlying this quote it may create a CUDA context and it is illegal to access memory across CUDA contexts. Somehow the code still works, though.

For new versions of FFMPEG, you can pass in the flag to this creation so it reuses the CUDA context, and therefore memory can be passed to pytorch code (which initializes its own CUDA context).

But for older versions of FFMPEG like 4.1 we should reuse the CUDA context if possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant