cufft.py 469 Bytes
Newer Older
root's avatar
root committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# nvprof --print-gpu-trace python examples/stream/cufft.py
import cupy

x = cupy.array([1, 0, 3, 0, 5, 0, 7, 0, 9], dtype=float)
expected_f = cupy.fft.fft(x)
cupy.cuda.Device().synchronize()

stream = cupy.cuda.stream.Stream()
with stream:
    f = cupy.fft.fft(x)
stream.synchronize()
cupy.testing.assert_array_equal(f, expected_f)

stream = cupy.cuda.stream.Stream()
stream.use()
f = cupy.fft.fft(x)
stream.synchronize()
cupy.testing.assert_array_equal(f, expected_f)