Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pypocketfft
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Peter Bell
pypocketfft
Commits
7342ee68
Commit
7342ee68
authored
6 years ago
by
Martin Reinecke
Browse files
Options
Downloads
Patches
Plain Diff
support nthread selection
parent
36b04d9c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bench_nd.py
+2
-1
2 additions, 1 deletion
bench_nd.py
stress.py
+7
-7
7 additions, 7 deletions
stress.py
with
9 additions
and
8 deletions
bench_nd.py
+
2
−
1
View file @
7342ee68
...
@@ -5,6 +5,7 @@ import pypocketfft
...
@@ -5,6 +5,7 @@ import pypocketfft
from
time
import
time
from
time
import
time
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
nthreads
=
0
def
_l2error
(
a
,
b
):
def
_l2error
(
a
,
b
):
return
np
.
sqrt
(
np
.
sum
(
np
.
abs
(
a
-
b
)
**
2
)
/
np
.
sum
(
np
.
abs
(
a
)
**
2
))
return
np
.
sqrt
(
np
.
sum
(
np
.
abs
(
a
-
b
)
**
2
)
/
np
.
sum
(
np
.
abs
(
a
)
**
2
))
...
@@ -22,7 +23,7 @@ def bench_nd_fftn(ndim, nmax, ntry, tp, nrepeat, filename=""):
...
@@ -22,7 +23,7 @@ def bench_nd_fftn(ndim, nmax, ntry, tp, nrepeat, filename=""):
tmin_pp
=
1e38
tmin_pp
=
1e38
for
i
in
range
(
nrepeat
):
for
i
in
range
(
nrepeat
):
t0
=
time
()
t0
=
time
()
b
=
pypocketfft
.
fftn
(
a
)
b
=
pypocketfft
.
fftn
(
a
,
nthreads
=
nthreads
)
t1
=
time
()
t1
=
time
()
tmin_pp
=
min
(
tmin_pp
,
t1
-
t0
)
tmin_pp
=
min
(
tmin_pp
,
t1
-
t0
)
a2
=
pypocketfft
.
ifftn
(
b
,
fct
=
1.
/
a
.
size
)
a2
=
pypocketfft
.
ifftn
(
b
,
fct
=
1.
/
a
.
size
)
...
...
This diff is collapsed.
Click to expand it.
stress.py
+
7
−
7
View file @
7342ee68
...
@@ -4,7 +4,7 @@ import pypocketfft
...
@@ -4,7 +4,7 @@ import pypocketfft
def
_l2error
(
a
,
b
):
def
_l2error
(
a
,
b
):
return
np
.
sqrt
(
np
.
sum
(
np
.
abs
(
a
-
b
)
**
2
)
/
np
.
sum
(
np
.
abs
(
a
)
**
2
))
return
np
.
sqrt
(
np
.
sum
(
np
.
abs
(
a
-
b
)
**
2
)
/
np
.
sum
(
np
.
abs
(
a
)
**
2
))
nthreads
=
0
cmaxerr
=
0.
cmaxerr
=
0.
fmaxerr
=
0.
fmaxerr
=
0.
cmaxerrf
=
0.
cmaxerrf
=
0.
...
@@ -23,32 +23,32 @@ def test():
...
@@ -23,32 +23,32 @@ def test():
lastsize
=
shape
[
axes
[
-
1
]]
lastsize
=
shape
[
axes
[
-
1
]]
fct
=
1.
/
np
.
prod
(
np
.
take
(
shape
,
axes
))
fct
=
1.
/
np
.
prod
(
np
.
take
(
shape
,
axes
))
a
=
np
.
random
.
rand
(
*
shape
)
-
0.5
+
1j
*
np
.
random
.
rand
(
*
shape
)
-
0.5j
a
=
np
.
random
.
rand
(
*
shape
)
-
0.5
+
1j
*
np
.
random
.
rand
(
*
shape
)
-
0.5j
b
=
pypocketfft
.
ifftn
(
pypocketfft
.
fftn
(
a
,
axes
=
axes
),
axes
=
axes
,
fct
=
fct
)
b
=
pypocketfft
.
ifftn
(
pypocketfft
.
fftn
(
a
,
axes
=
axes
,
nthreads
=
nthreads
),
axes
=
axes
,
fct
=
fct
,
nthreads
=
nthreads
)
err
=
_l2error
(
a
,
b
)
err
=
_l2error
(
a
,
b
)
if
err
>
cmaxerr
:
if
err
>
cmaxerr
:
cmaxerr
=
err
cmaxerr
=
err
print
(
"
cmaxerr:
"
,
cmaxerr
,
shape
,
axes
)
print
(
"
cmaxerr:
"
,
cmaxerr
,
shape
,
axes
)
b
=
pypocketfft
.
irfftn
(
pypocketfft
.
rfftn
(
a
.
real
,
axes
=
axes
),
axes
=
axes
,
fct
=
fct
,
lastsize
=
lastsize
)
b
=
pypocketfft
.
irfftn
(
pypocketfft
.
rfftn
(
a
.
real
,
axes
=
axes
,
nthreads
=
nthreads
),
axes
=
axes
,
fct
=
fct
,
lastsize
=
lastsize
,
nthreads
=
nthreads
)
err
=
_l2error
(
a
.
real
,
b
)
err
=
_l2error
(
a
.
real
,
b
)
if
err
>
fmaxerr
:
if
err
>
fmaxerr
:
fmaxerr
=
err
fmaxerr
=
err
print
(
"
fmaxerr:
"
,
fmaxerr
,
shape
,
axes
)
print
(
"
fmaxerr:
"
,
fmaxerr
,
shape
,
axes
)
b
=
pypocketfft
.
ifftn
(
pypocketfft
.
fftn
(
a
.
astype
(
np
.
complex64
),
axes
=
axes
),
axes
=
axes
,
fct
=
fct
)
b
=
pypocketfft
.
ifftn
(
pypocketfft
.
fftn
(
a
.
astype
(
np
.
complex64
),
axes
=
axes
,
nthreads
=
nthreads
),
axes
=
axes
,
fct
=
fct
,
nthreads
=
nthreads
)
err
=
_l2error
(
a
.
astype
(
np
.
complex64
),
b
)
err
=
_l2error
(
a
.
astype
(
np
.
complex64
),
b
)
if
err
>
cmaxerrf
:
if
err
>
cmaxerrf
:
cmaxerrf
=
err
cmaxerrf
=
err
print
(
"
cmaxerrf:
"
,
cmaxerrf
,
shape
,
axes
)
print
(
"
cmaxerrf:
"
,
cmaxerrf
,
shape
,
axes
)
b
=
pypocketfft
.
irfftn
(
pypocketfft
.
rfftn
(
a
.
real
.
astype
(
np
.
float32
),
axes
=
axes
),
axes
=
axes
,
fct
=
fct
,
lastsize
=
lastsize
)
b
=
pypocketfft
.
irfftn
(
pypocketfft
.
rfftn
(
a
.
real
.
astype
(
np
.
float32
),
axes
=
axes
,
nthreads
=
nthreads
),
axes
=
axes
,
fct
=
fct
,
lastsize
=
lastsize
,
nthreads
=
nthreads
)
err
=
_l2error
(
a
.
real
.
astype
(
np
.
float32
),
b
)
err
=
_l2error
(
a
.
real
.
astype
(
np
.
float32
),
b
)
if
err
>
fmaxerrf
:
if
err
>
fmaxerrf
:
fmaxerrf
=
err
fmaxerrf
=
err
print
(
"
fmaxerrf:
"
,
fmaxerrf
,
shape
,
axes
)
print
(
"
fmaxerrf:
"
,
fmaxerrf
,
shape
,
axes
)
b
=
pypocketfft
.
hartley
(
pypocketfft
.
hartley
(
a
.
real
,
axes
=
axes
),
axes
=
axes
,
fct
=
fct
)
b
=
pypocketfft
.
hartley
(
pypocketfft
.
hartley
(
a
.
real
,
axes
=
axes
,
nthreads
=
nthreads
),
axes
=
axes
,
fct
=
fct
,
nthreads
=
nthreads
)
err
=
_l2error
(
a
.
real
,
b
)
err
=
_l2error
(
a
.
real
,
b
)
if
err
>
hmaxerr
:
if
err
>
hmaxerr
:
hmaxerr
=
err
hmaxerr
=
err
print
(
"
hmaxerr:
"
,
hmaxerr
,
shape
,
axes
)
print
(
"
hmaxerr:
"
,
hmaxerr
,
shape
,
axes
)
b
=
pypocketfft
.
hartley
(
pypocketfft
.
hartley
(
a
.
real
.
astype
(
np
.
float32
),
axes
=
axes
),
axes
=
axes
,
fct
=
fct
)
b
=
pypocketfft
.
hartley
(
pypocketfft
.
hartley
(
a
.
real
.
astype
(
np
.
float32
),
axes
=
axes
,
nthreads
=
nthreads
),
axes
=
axes
,
fct
=
fct
,
nthreads
=
nthreads
)
err
=
_l2error
(
a
.
real
.
astype
(
np
.
float32
),
b
)
err
=
_l2error
(
a
.
real
.
astype
(
np
.
float32
),
b
)
if
err
>
hmaxerrf
:
if
err
>
hmaxerrf
:
hmaxerrf
=
err
hmaxerrf
=
err
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment