Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
SWIFT
SWIFTsim
Commits
d255638f
Commit
d255638f
authored
7 years ago
by
Pedro Gonnet
Committed by
Matthieu Schaller
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
convert engine_count_and_link_tasks to a threadpool mapper function.
parent
b2982133
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!384
Threadpoolize all the things
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/engine.c
+7
-5
7 additions, 5 deletions
src/engine.c
with
7 additions
and
5 deletions
src/engine.c
+
7
−
5
View file @
d255638f
...
...
@@ -1913,14 +1913,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
;
...
...
@@ -2505,7 +2506,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. */
...
...
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