ARGUS CudaBayerDemosaic Example with nppi library

I want to combine your example of ARGUS CudaBayerDemosaic with some nppi processing. But everytime I call nppi function my stream crashes. (while the nppi function run until end and produce nice results)
I am calling the nppi functions from another cpu thread and I not settings streams until now, so everything should be synchronized in the default stream.

I guess it has to be something about the cuda context.

In your example there is an explicit creation of a cuda context. So in my newly spawned thread I use cuCtxSetCurrent to bind that context to my thread. This way normal CUDA kernels work.

But when using NPPI it crashes. But I did not find a way to set cuda context for nppi. So I thought maybe it just uses the primary context and the primary context fails with my newly created one.

So I tried to use primary context with the egl stream, but that way I get (CUresult invalid device context).

So what would be the correct way to bring this example together with nppi?

Thanks for your help!

Please share a sample so that we can reproduce the issue. This is not a case we have tested/verified in our test cases. It is possibly not working properly. We would need to reproduce it and check further.