Created
August 9, 2019 20:22
-
-
Save pentschev/42c0434300692dbde8b6b2b16c80f44a to your computer and use it in GitHub Desktop.
Blog Post - Parallelizing Custom CuPy Kernels with Dask - Kernel Dispatcher
This file contains hidden or 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
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