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
SWIFT
SWIFTsim
Commits
0912571f
Commit
0912571f
authored
Jul 28, 2017
by
Pedro Gonnet
Browse files
convert engine_count_and_link_tasks to a threadpool mapper function.
parent
9dd9a045
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/engine.c
View file @
0912571f
...
...
@@ -1908,14 +1908,15 @@ void engine_make_hydroloop_tasks_mapper(void *map_data, int num_elements,
*
* @param e The #engine.
*/
void
engine_count_and_link_tasks
(
struct
engine
*
e
)
{
void
engine_count_and_link_tasks_mapper
(
void
*
map_data
,
int
num_elements
,
void
*
extra_data
)
{
struct
engine
*
e
=
(
struct
engine
*
)
extra_data
;
struct
scheduler
*
const
sched
=
&
e
->
sched
;
const
int
nr_tasks
=
sched
->
nr_tasks
;
for
(
int
ind
=
0
;
ind
<
nr_tasks
;
ind
++
)
{
for
(
int
ind
=
0
;
ind
<
num_elements
;
ind
++
)
{
struct
task
*
const
t
=
&
((
struct
task
*
)
map_data
)[
ind
];
struct
task
*
const
t
=
&
sched
->
tasks
[
ind
];
struct
cell
*
const
ci
=
t
->
ci
;
struct
cell
*
const
cj
=
t
->
cj
;
...
...
@@ -2500,7 +2501,8 @@ void engine_maketasks(struct engine *e) {
/* Count the number of tasks associated with each cell and
store the density tasks in each cell, and make each sort
depend on the sorts of its progeny. */
engine_count_and_link_tasks
(
e
);
threadpool_map
(
&
e
->
threadpool
,
engine_count_and_link_tasks_mapper
,
sched
->
tasks
,
sched
->
nr_tasks
,
sizeof
(
struct
task
),
0
,
e
);
/* Now that the self/pair tasks are at the right level, set the super
* pointers. */
...
...
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