Why exactly cant you share CUDA ressources amongst different host threads?

Hi!

I figured out that you cant use CUDA ressources like dev pointers or host memory allocated by cudaHostAlloc() by an other thread than the one which created them (for doing so you need to use portable, mapped memory as I know).
Sadly I couldnt find any explanation why this is inside the documentation. It would be nice if someone could point me to a part of the doc I may have overlooked or if maybe a NVIDIA employee could give me an official explanation (this could make a difference in some projects, you know, so it would be nice to have something official to bolster your explorations).

Thx alot!

because each thread has its own ‘Cuda context’. Resources can not be shared between different cuda contexts - at least to my knowledge.

A possible solution would be to delegate all cuda stuff (from all threads) to exactly one thread which handles it. Someone here in the forum made a class ‘GPUWorker’ for stuff like this. It is freely available, just search the forum to find it.