Want examples of using multiple Contexts.

I’ve been reading about Context objects in the Driver API, including some posts on Stack Overflow.
Let’s say my app has two Contexts, A and B (one of which could be a Primary Context), and its work is divided up into two independent parts, using Context A and Context B. Each Context holds the kernels, memory allocations, etc. as needed.
But why have separate Contexts? If the app put everything into Context A, would everything still work the same? Having two contexts means expensive context switching and the inability to perform work in both contexts at the same time.
Can you point to some practical examples of an app that requires multiple contexts, or performs better with multiple contexts?

No, I can’t provide you an example of an app that performs better with multiple contexts. And I doubt anyone else can, either - this is not a performance optimization.

I can go some way constructing an example that requires multiple contexts, but that still remains somewhat artificial:
cudaDeviceReset() destroys the current context. If you need to work with code that calls cudaDeviceReset(), (or want to be able to write such code yourself), and at the same time want to keep some resources allocated on the GPU, using two contexts should allow you to do that.

Note that I write “should allow”, because I can’t recall having tried myself. You might run into some pitfalls. My preferred solution would be to have full source code available, and be able to eliminate the cudaDeviceReset() call as well as any potential error conditions that may require its use.