This depends on your cluster/cloud.
For AWS, I have an example here: https://github.com/cybertronai/pytorch-aws/ 14
Basically you set your AWS credentials and then do
python mnist_distributed.py --mode=remote --nnodes=2