Can only get one NVENC session running on Quadro P600, but two should work

I have created a prototype based on the AppEncGL sample program.

With that I can only get one NVENC session running on a P600.
But 2 sessions should work on a P600.
Either
nvEncInitializeEncoder returns error code 10
or nvEncRegisterResource returns error code 23

If I replace the P600 with a P2000 I can run this test program multiple times in parallel.

Some info about my system:

  • Video Codex SDK 8.1.24
  • NVidia driver version 410.48
  • Operating system: Xubuntu 16.04.4
  • Graphic card: Using either Quadro P600 or P2000
  • Displays: Two 4k monitors with 60Hz.
  • Encoder settings: HEVC, -s 3840x2160 -gop 10000 -lookahead 32 -preset lossless_hp -fps 30
    (modifying the encoder settings does not change that problem)

Are there any tools do debug this?
E.g. a tool that lists all programs that have an NVENC session opened?
Maybe, some application of the OS always allocates on NVENC session?

I have found the cause: The -lookahead 32 used up all GPU memory for one stream.
So there was not enough memory available for a second stream.
It works with -lookahead 4