Created
February 3, 2021 05:52
-
-
Save toshihikoyanase/27350c587b40335fccf012e108eb6b93 to your computer and use it in GitHub Desktop.
Cannot broadcast bool tensor.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torch.distributed as dist | |
import torch.multiprocessing as mp | |
def example(rank, world_size): | |
dist.init_process_group("gloo", rank=rank, world_size=world_size) | |
if rank == 0: | |
z = torch.tensor([True], dtype=torch.bool) | |
else: | |
z = torch.empty(1, dtype=torch.bool) | |
dist.broadcast(z, 0) | |
def main(): | |
world_size = 2 | |
mp.spawn(example, | |
args=(world_size,), | |
nprocs=world_size, | |
join=True) | |
print("Done") | |
if __name__=="__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment