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
6441521f
Commit
6441521f
authored
11 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
prioritize tasks according to the maximum depth of their dependent tasks.
Former-commit-id: 7ce8137a6362d80727fd3d06ca52e9afb25767c1
parent
61e7f193
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/engine.c
+2
-2
2 additions, 2 deletions
src/engine.c
src/queue.c
+3
-3
3 additions, 3 deletions
src/queue.c
src/scheduler.c
+9
-0
9 additions, 0 deletions
src/scheduler.c
src/task.h
+1
-1
1 addition, 1 deletion
src/task.h
with
15 additions
and
6 deletions
src/engine.c
+
2
−
2
View file @
6441521f
...
...
@@ -854,7 +854,7 @@ void engine_step ( struct engine *e ) {
void
engine_init
(
struct
engine
*
e
,
struct
space
*
s
,
float
dt
,
int
nr_threads
,
int
nr_queues
,
int
policy
)
{
#if defined(HAVE_SETAFFINITY)
#if defined(
NO_
HAVE_SETAFFINITY)
cpu_set_t
cpuset
;
#endif
int
k
;
...
...
@@ -900,7 +900,7 @@ void engine_init ( struct engine *e , struct space *s , float dt , int nr_thread
e
->
runners
[
k
].
e
=
e
;
if
(
pthread_create
(
&
e
->
runners
[
k
].
thread
,
NULL
,
&
runner_main
,
&
e
->
runners
[
k
]
)
!=
0
)
error
(
"Failed to create runner thread."
);
#if defined(HAVE_SETAFFINITY)
#if defined(
NO_
HAVE_SETAFFINITY)
/* Set the cpu mask to zero | e->id. */
CPU_ZERO
(
&
cpuset
);
CPU_SET
(
e
->
runners
[
k
].
id
,
&
cpuset
);
...
...
This diff is collapsed.
Click to expand it.
src/queue.c
+
3
−
3
View file @
6441521f
...
...
@@ -104,7 +104,7 @@ void queue_insert ( struct queue *q , struct task *t ) {
/* Shuffle up. */
for
(
int
k
=
q
->
count
-
1
;
k
>
0
;
k
/=
2
)
if
(
q
->
tasks
[
q
->
tid
[
k
]
].
rank
<
q
->
tasks
[
q
->
tid
[
k
/
2
]
].
rank
)
{
if
(
q
->
tasks
[
q
->
tid
[
k
]
].
maxdepth
>
q
->
tasks
[
q
->
tid
[
k
/
2
]
].
maxdepth
)
{
int
temp
=
q
->
tid
[
k
];
q
->
tid
[
k
]
=
q
->
tid
[
k
/
2
];
q
->
tid
[
k
/
2
]
=
temp
;
...
...
@@ -234,9 +234,9 @@ struct task *queue_gettask ( struct queue *q , int qid , int blocking ) {
int
i
=
2
*
k
;
if
(
i
>=
q
->
count
)
break
;
if
(
i
+
1
<
q
->
count
&&
qtasks
[
qtid
[
i
+
1
]
].
rank
<
qtasks
[
qtid
[
i
]
].
rank
)
if
(
i
+
1
<
q
->
count
&&
qtasks
[
qtid
[
i
+
1
]
].
maxdepth
>
qtasks
[
qtid
[
i
]
].
maxdepth
)
i
+=
1
;
if
(
qtasks
[
qtid
[
i
]
].
rank
<
qtasks
[
qtid
[
k
]
].
rank
)
{
if
(
qtasks
[
qtid
[
i
]
].
maxdepth
>
qtasks
[
qtid
[
k
]
].
maxdepth
)
{
int
temp
=
qtid
[
i
];
qtid
[
i
]
=
qtid
[
k
];
qtid
[
k
]
=
temp
;
...
...
This diff is collapsed.
Click to expand it.
src/scheduler.c
+
9
−
0
View file @
6441521f
...
...
@@ -473,6 +473,15 @@ void scheduler_ranktasks ( struct scheduler *s ) {
}
/* Run throught the tasks backwards and set their maxdepth. */
for
(
k
=
nr_tasks
-
1
;
k
>=
0
;
k
--
)
{
t
=
&
tasks
[
tid
[
k
]
];
t
->
maxdepth
=
0
;
for
(
j
=
0
;
j
<
t
->
nr_unlock_tasks
;
j
++
)
if
(
t
->
unlock_tasks
[
j
]
->
maxdepth
>
t
->
maxdepth
)
t
->
maxdepth
=
t
->
unlock_tasks
[
j
]
->
maxdepth
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/task.h
+
1
−
1
View file @
6441521f
...
...
@@ -51,7 +51,7 @@ extern const char *taskID_names[];
struct
task
{
char
type
,
subtype
,
skip
,
tight
;
int
flags
,
wait
,
rank
;
int
flags
,
wait
,
rank
,
maxdepth
;
lock_type
lock
;
...
...
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