Skip to content

Instantly share code, notes, and snippets.

@mfitton
Last active June 26, 2020 22:42
Show Gist options
  • Save mfitton/face08073f636ded7196d96710ca9eb2 to your computer and use it in GitHub Desktop.
Save mfitton/face08073f636ded7196d96710ca9eb2 to your computer and use it in GitHub Desktop.
blog snippit 3
for i, x in enumerate(np.linspace(S[0], S[2], w)):
for j, y in enumerate(np.linspace(S[1], S[3], h)):
coords.append((i, j))
next_task_xys.append((x, y))
if len(next_task_xys) == CHUNK_SIZE:
results.append(
trace_rays_with_bounces.remote(next_task_xys)
)
next_task_xys = []
if next_task_xys:
results.append(trace_rays_with_bounces.remote(next_task_xys))
flat_results = chain.from_iterable(ray.get(results))
for coord, result in zip(coords, flat_results):
i, j = coord
img[h - j - 1, i, :] = result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment