For the second problem, maybe it is because of the reason said in Getting Started with Distributed Data Parallel — PyTorch Tutorials 1.7.1 documentation 4.

DDP processes can be placed on the same machine or across machines, but GPU devices cannot be shared across processes.

and Distributed communication package - torch.distributed — PyTorch 1.7.1 documentation 2,

If using multiple processes per machine with nccl backend, each process must have exclusive access to every GPU it uses, as sharing GPUs between processes can result in deadlocks.