Multiple NVENC sessions per process

I’m having issues with application that encodes multiple video resolutions simultaneously.

case 0:

  • one or many encoder processes
  • one nvenc per process
    result:
  • everything works as expected

case 1:

  • one encoder process
  • multiple nvenc sessions
    result:
  • everything is working fine for prolonged period of time

case 2:

  • multiple encoder processes
  • multiple nvenc per process
  • all nvenc use same context
    result:
  • at some point (quite soon after start) at least one of the processes hangs inside one of the cuda api functions (seems like it’s waiting for some kind of operation completion - I can see slightly different call stack depending on which type of scheduling is configured for context)

case 3:

  • multiple encoder processes
  • multiple nvenc per process
  • each nvenc uses it’s own context
    result:
  • no hanging/freezing happens over prolonged period of time

Can anybody comment on this?
Am I the only one having this issue with freezing?
Am I supposed to use separate contexts for each nvenc session or it is allowed to use one for all of them?

I get the same behaviour even if all nvenc calls are made from one thread, without any concurrency at all.

I use the following environment:
OS: Fedora 32 with kernel 5.8.10-200
nvidia driver: 440.95.01
GPU: Quadro RTX 4000
But it also happens on other OS versions (CentOS 7 with corresponding driver version).

1 Like

Hi.

case 2:

  • multiple encoder processes
  • multiple nvenc per process
  • all nvenc use same context

In this scenario you mean, there are multiple processes each with one CUDA context. Each such process has multiple nvenc sessions that share the CUDA context in that process.
Is this understanding correct?

This scenario should work. Is it possible for you to share reproducer with detailed steps that we can use to reproduce this issue internally?

Thanks.