SimonW:

x = torch.randn(3).cuda() ys = torch.cuda.comm.broadcast(x, [0, 1]) # assuming you have >= 2 GPUs print(x.storage().data_ptr()) print(ys[0].storage().data_ptr())


Python 3.6.5 (default, May 16 2018, 13:09:02)
Type ‘copyright’, ‘credits’ or ‘license’ for more information
IPython 6.4.0 – An enhanced Interactive Python. Type ‘?’ for help.
In [1]: import torch
In [2]: x = torch.randn(3).cuda()
…: ys = torch.cuda.comm.broadcast(x, [0, 1])  # assuming you have >= 2 GPUs
…: print(x.storage().data_ptr())
…: print(ys[0].storage().data_ptr())
…:
…:
139669103522816
139669103522816
In [3]: