Skip to content

Instantly share code, notes, and snippets.

@4OH4
Last active November 13, 2021 20:50
Show Gist options
  • Save 4OH4/73238d0f1e89cfb8d6a0a860c034d5da to your computer and use it in GitHub Desktop.
Save 4OH4/73238d0f1e89cfb8d6a0a860c034d5da to your computer and use it in GitHub Desktop.
Executing a CUDA function with PyCUDA (pt. 3)
# run multiply function on GPU
multiply_func(
result_gpu, a_gpu, b_gpu,
block=(100, 1, 1),
grid=(1, 1, 1)
)
# Get data back from GPU
cuda.memcpy_dtoh(result, result_gpu)
assert np.allclose(result, np.multiply(a,b))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment