6daac0f60c
* Initial python support
* Add python testing
* Increase timeout for bin tests
* cmake-format
* Valid build types + testing + formatting + more
- Enforce valid build types
- Fix to numpy install
- Increase testing timeout
- Fix to cmake format glob
- Fix to backtrace verbose
* Disable stripping libraries by default
* omnitrace exe updates
- new '--print-instructions' option
- changed format of instructions in JSON
- remove no-save-fpr tests
* Default to strip libraries when release build
[ROCm/rocprofiler-systems commit: afa3edebab]
36 строки
644 B
Python
Исполняемый файл
36 строки
644 B
Python
Исполняемый файл
#!@PYTHON_EXECUTABLE@
|
|
|
|
import sys
|
|
import numpy as np
|
|
|
|
|
|
def fib(n):
|
|
return n if n < 2 else (fib(n - 1) + fib(n - 2))
|
|
|
|
|
|
def inefficient(n):
|
|
print(f"inefficient: {n}")
|
|
a = 0
|
|
for i in range(n):
|
|
a += i
|
|
for j in range(n):
|
|
a += j
|
|
arr = np.random.rand(a * n * n * n)
|
|
sum = arr.sum()
|
|
print(f"sum: {sum}")
|
|
return sum
|
|
|
|
|
|
def run(nfib):
|
|
ret = 0
|
|
ret += fib(nfib)
|
|
ret += inefficient(nfib)
|
|
return ret
|
|
|
|
|
|
if __name__ == "__main__":
|
|
nfib = int(sys.argv[1]) if len(sys.argv) > 1 else 20
|
|
for i in range(5):
|
|
ans = run(nfib)
|
|
print(f"[{i}] fibonacci({nfib}) = {ans}")
|