我使用PyTorch 1.9.0,但在尝试运行模型的分布式版本时会出现以下错误:
File "/home/ferdiko/fastmoe/examples/transformer-xl/train.py", line 315, in <module>
para_model = DistributedGroupedDataParallel(model).to(device)
File "/home/ferdiko/anaconda3/envs/fastmoe/lib/python3.9/site-packages/fastmoe-0.2.1-py3.9-linux-x86_64.egg/fmoe/distributed.py", line 45, in __init__
self.comms["dp"] = get_torch_default_comm()
File "/home/ferdiko/anaconda3/envs/fastmoe/lib/python3.9/site-packages/fastmoe-0.2.1-py3.9-linux-x86_64.egg/fmoe/utils.py", line 30, in get_torch_default_comm
raise RuntimeError("Unsupported PyTorch version")如果我运行torch.cuda.nccl.version(),就会得到2708。开发人员建议运行:
x = torch.rand(10).cuda()
print(torch.cuda.nccl.is_available(x))这给了我False。这是否意味着PyTorch和NCCL存在问题?
发布于 2021-10-13 19:55:29
torch.cuda.nccl.is_available采用一系列张量,如果它们位于不同的设备上,则有希望得到一个True
In [1]: import torch
In [2]: x = torch.rand(1024, 1024, device='cuda:0')
In [3]: y = torch.rand(1024, 1024, device='cuda:1')
In [4]: torch.cuda.nccl.is_available([x, y])
Out[4]: True如果你只给它一个张量,torch.cuda.nccl.is_available会迭代它,但是相同张量的不同部分总是在同一个设备上,所以你总是会得到一个False。
In [5]: torch.cuda.nccl.is_available(x)
Out[5]: False In [6]: torch.cuda.nccl.is_available([x])
Out[6]: Truehttps://stackoverflow.com/questions/69558803
复制相似问题