Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Martin Reinecke
pypocketfft
Commits
bc6f45f9
Commit
bc6f45f9
authored
Nov 06, 2019
by
Martin Reinecke
Browse files
print some more information during the run
parent
804b4c6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
bench.py
View file @
bc6f45f9
...
...
@@ -42,9 +42,9 @@ def get_next_prime_factor(n):
def
measure_fftw
(
a
,
nrepeat
):
import
pyfftw
f1
=
pyfftw
.
empty_aligned
(
a
.
shape
,
dtype
=
a
.
dtype
)
f1
[()]
=
a
f2
=
pyfftw
.
empty_aligned
(
a
.
shape
,
dtype
=
a
.
dtype
)
fftw
=
pyfftw
.
FFTW
(
f1
,
f2
,
flags
=
(
'FFTW_MEASURE'
,),
axes
=
range
(
a
.
ndim
),
threads
=
nthr
)
f1
[()]
=
a
tmin
=
1e38
for
i
in
range
(
nrepeat
):
t0
=
time
()
...
...
@@ -89,13 +89,15 @@ def measure_scipy_fftpack(a, nrepeat):
def
bench_nd
(
ndim
,
nmax
,
ntry
,
tp
,
funcs
,
nrepeat
,
ttl
=
""
,
filename
=
""
):
print
(
"{}D, type {}, max extent is {}:"
.
format
(
ndim
,
tp
,
nmax
))
results
=
[[]
for
i
in
range
(
len
(
funcs
))]
for
n
in
range
(
ntry
):
print
(
n
,
ntry
)
shp
=
np
.
random
.
randint
(
nmax
//
3
,
nmax
+
1
,
ndim
)
print
(
" {0:4d}/{1}: shape={2} ..."
.
format
(
n
,
ntry
,
shp
),
end
=
" "
,
flush
=
True
)
a
=
(
np
.
random
.
rand
(
*
shp
)
+
1j
*
np
.
random
.
rand
(
*
shp
)).
astype
(
tp
)
for
func
,
res
in
zip
(
funcs
,
results
):
res
.
append
(
func
(
a
,
nrepeat
))
print
(
"{0:5.2e}/{1:5.2e} = {2:5.2f}"
.
format
(
results
[
0
][
n
],
results
[
1
][
n
],
results
[
0
][
n
]
/
results
[
1
][
n
]))
results
=
np
.
array
(
results
)
plt
.
title
(
"{}: {}D, {}, max_extent={}"
.
format
(
ttl
,
ndim
,
str
(
tp
),
nmax
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment