Skip to content

Instantly share code, notes, and snippets.

@pentschev
Created August 9, 2019 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pentschev/42c0434300692dbde8b6b2b16c80f44a to your computer and use it in GitHub Desktop.
Save pentschev/42c0434300692dbde8b6b2b16c80f44a to your computer and use it in GitHub Desktop.
Blog Post - Parallelizing Custom CuPy Kernels with Dask - Kernel Dispatcher
def dispatch_add_broadcast(x, y):
block_size = (32, 32)
grid_size = (x.shape[1] // block_size[1], x.shape[0] // block_size[0])
z = cupy.empty(x.shape, x.dtype)
xdim0 = x.strides[0] // x.strides[1]
zdim0 = z.strides[0] // z.strides[1]
add_broadcast_kernel(grid_size, block_size, (x, y, z, xdim0, zdim0))
return z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment