Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pypocketfft
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
4
Issues
4
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Martin Reinecke
pypocketfft
Commits
891b5454
Commit
891b5454
authored
Aug 06, 2019
by
Peter Bell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better parallelisability heuristic
parent
0b65b8fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
pocketfft_hdronly.h
pocketfft_hdronly.h
+11
-6
No files found.
pocketfft_hdronly.h
View file @
891b5454
...
@@ -566,11 +566,16 @@ struct util // hack to avoid duplicate symbols
...
@@ -566,11 +566,16 @@ struct util // hack to avoid duplicate symbols
}
}
static
size_t
thread_count
(
size_t
nthreads
,
const
shape_t
&
shape
,
static
size_t
thread_count
(
size_t
nthreads
,
const
shape_t
&
shape
,
size_t
axis
)
size_t
axis
,
size_t
vlen
)
{
{
if
(
nthreads
==
1
)
return
1
;
if
(
nthreads
==
1
)
return
1
;
if
(
prod
(
shape
)
<
20
*
shape
[
axis
])
return
1
;
size_t
size
=
prod
(
shape
);
return
(
nthreads
==
0
)
?
thread
::
hardware_concurrency
()
:
nthreads
;
size_t
parallel
=
size
/
(
shape
[
axis
]
*
vlen
);
if
(
shape
[
axis
]
<
1000
)
parallel
/=
4
;
size_t
max_threads
=
nthreads
==
0
?
thread
::
hardware_concurrency
()
:
nthreads
;
return
max
(
size_t
(
1
),
min
(
parallel
,
max_threads
));
}
}
};
};
...
@@ -3086,7 +3091,7 @@ POCKETFFT_NOINLINE void general_nd(const cndarr<T> &in, ndarr<T> &out,
...
@@ -3086,7 +3091,7 @@ POCKETFFT_NOINLINE void general_nd(const cndarr<T> &in, ndarr<T> &out,
if
((
!
plan
)
||
(
len
!=
plan
->
length
()))
if
((
!
plan
)
||
(
len
!=
plan
->
length
()))
plan
=
get_plan
<
Tplan
>
(
len
);
plan
=
get_plan
<
Tplan
>
(
len
);
threading
::
thread_map
(
util
::
thread_count
(
nthreads
,
in
.
shape
(),
axes
[
iax
]),
threading
::
thread_map
(
util
::
thread_count
(
nthreads
,
in
.
shape
(),
axes
[
iax
]
,
vlen
),
[
&
]
{
[
&
]
{
auto
storage
=
alloc_tmp
<
T0
>
(
in
.
shape
(),
len
,
sizeof
(
T
));
auto
storage
=
alloc_tmp
<
T0
>
(
in
.
shape
(),
len
,
sizeof
(
T
));
const
auto
&
tin
(
iax
==
0
?
in
:
out
);
const
auto
&
tin
(
iax
==
0
?
in
:
out
);
...
@@ -3192,7 +3197,7 @@ template<typename T> POCKETFFT_NOINLINE void general_r2c(
...
@@ -3192,7 +3197,7 @@ template<typename T> POCKETFFT_NOINLINE void general_r2c(
auto
plan
=
get_plan
<
pocketfft_r
<
T
>>
(
in
.
shape
(
axis
));
auto
plan
=
get_plan
<
pocketfft_r
<
T
>>
(
in
.
shape
(
axis
));
constexpr
auto
vlen
=
VLEN
<
T
>::
val
;
constexpr
auto
vlen
=
VLEN
<
T
>::
val
;
size_t
len
=
in
.
shape
(
axis
);
size_t
len
=
in
.
shape
(
axis
);
threading
::
thread_map
(
util
::
thread_count
(
nthreads
,
in
.
shape
(),
axis
),
threading
::
thread_map
(
util
::
thread_count
(
nthreads
,
in
.
shape
(),
axis
,
vlen
),
[
&
]
{
[
&
]
{
auto
storage
=
alloc_tmp
<
T
>
(
in
.
shape
(),
len
,
sizeof
(
T
));
auto
storage
=
alloc_tmp
<
T
>
(
in
.
shape
(),
len
,
sizeof
(
T
));
multi_iter
<
vlen
>
it
(
in
,
out
,
axis
);
multi_iter
<
vlen
>
it
(
in
,
out
,
axis
);
...
@@ -3246,7 +3251,7 @@ template<typename T> POCKETFFT_NOINLINE void general_c2r(
...
@@ -3246,7 +3251,7 @@ template<typename T> POCKETFFT_NOINLINE void general_c2r(
auto
plan
=
get_plan
<
pocketfft_r
<
T
>>
(
out
.
shape
(
axis
));
auto
plan
=
get_plan
<
pocketfft_r
<
T
>>
(
out
.
shape
(
axis
));
constexpr
auto
vlen
=
VLEN
<
T
>::
val
;
constexpr
auto
vlen
=
VLEN
<
T
>::
val
;
size_t
len
=
out
.
shape
(
axis
);
size_t
len
=
out
.
shape
(
axis
);
threading
::
thread_map
(
util
::
thread_count
(
nthreads
,
in
.
shape
(),
axis
),
threading
::
thread_map
(
util
::
thread_count
(
nthreads
,
in
.
shape
(),
axis
,
vlen
),
[
&
]
{
[
&
]
{
auto
storage
=
alloc_tmp
<
T
>
(
out
.
shape
(),
len
,
sizeof
(
T
));
auto
storage
=
alloc_tmp
<
T
>
(
out
.
shape
(),
len
,
sizeof
(
T
));
multi_iter
<
vlen
>
it
(
in
,
out
,
axis
);
multi_iter
<
vlen
>
it
(
in
,
out
,
axis
);
...
...
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