Skip to content

Instantly share code, notes, and snippets.

@mfitton
Created June 3, 2020 21:40
Show Gist options
  • Save mfitton/f42da6bbdf9da1fe6816b5a69574fbee to your computer and use it in GitHub Desktop.
Save mfitton/f42da6bbdf9da1fe6816b5a69574fbee to your computer and use it in GitHub Desktop.
import torch
import ray; ray.init()
@ray.remote(num_gpus=1)
def foo():
a = torch.rand(100000, device='cuda')
b = torch.rand(100000, device='cuda')
c = a * b * a * b * a * b * a * b
return c
results = []
for _ in range(10000):
results.append(foo.remote())
x = ray.get(results)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment