-
-
Save CJ-Wright/713e35b417087a8a7c71 to your computer and use it in GitHub Desktop.
This file contains 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
from numba import cuda | |
import numpy as np | |
@cuda.jit | |
def foo(arr): | |
for i in range(arr.size): | |
arr[i] += i | |
A = np.arange(10000) | |
B = np.arange(10000) | |
dA=cuda.to_device(A) | |
dB=cuda.to_device(A) | |
cuda.synchronize() | |
streamA = cuda.stream() | |
streamB = cuda.stream() | |
for _ in range(100): | |
foo[1, 1, streamA](dA) | |
foo[1, 1, streamB](dB) | |
cuda.synchronize() | |
dA.copy_to_host(A) | |
dB.copy_to_host(B) | |
print(A) | |
print(B) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment