/usr/share/doc/python-arrayfire-doc/examples/benchmarks/bench_fft.py is in python-arrayfire-doc 3.3.20160624-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | #!/usr/bin/python
#######################################################
# Copyright (c) 2015, ArrayFire
# All rights reserved.
#
# This file is distributed under 3-clause BSD license.
# The complete license agreement can be obtained at:
# http://arrayfire.com/licenses/BSD-3-Clause
########################################################
import sys
from time import time
from arrayfire import (array, randu, matmul)
import arrayfire as af
def bench(A, iters = 100):
start = time()
for t in range(iters):
B = af.fft2(A)
af.sync()
return (time() - start) / iters
if __name__ == "__main__":
if (len(sys.argv) > 1):
af.set_device(int(sys.argv[1]))
af.info()
print("Benchmark N x N 2D fft")
for M in range(7, 13):
N = 1 << M
A = af.randu(N, N)
af.sync()
t = bench(A)
gflops = (10.0 * N * N * M) / (t * 1E9)
print("Time taken for %4d x %4d: %0.4f Gflops" % (N, N, gflops))
|