Hey @amirhf,
It’s OK to fork a process as long as the parent process has not yet created a CUDA runtime/context. The CUDA context will be created lazily when the process creates CUDA tensors or run CUDA operations.

In my specific use case, I kinda have to use ‘fork’ so I can pass object like data with shared memory.

I would expect PyTorch Tensors shared_memory also works in spawn mode. Did you hit any error when doing that?