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
5732bba9
Commit
5732bba9
authored
9 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
scheduler_ranktasks.
parent
8e7eea26
No related branches found
No related tags found
2 merge requests
!136
Master
,
!123
Local variable cleanup
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/scheduler.c
+14
-16
14 additions, 16 deletions
src/scheduler.c
with
14 additions
and
16 deletions
src/scheduler.c
+
14
−
16
View file @
5732bba9
...
...
@@ -661,17 +661,14 @@ struct task *scheduler_addtask(struct scheduler *s, int type, int subtype,
int
flags
,
int
wait
,
struct
cell
*
ci
,
struct
cell
*
cj
,
int
tight
)
{
int
ind
;
struct
task
*
t
;
/* Get the next free task. */
ind
=
atomic_inc
(
&
s
->
tasks_next
);
const
int
ind
=
atomic_inc
(
&
s
->
tasks_next
);
/* Overflow? */
if
(
ind
>=
s
->
size
)
error
(
"Task list overflow."
);
/* Get a pointer to the new task. */
t
=
&
s
->
tasks
[
ind
];
struct
task
*
t
=
&
s
->
tasks
[
ind
];
/* Copy the data. */
t
->
type
=
type
;
...
...
@@ -766,24 +763,24 @@ void scheduler_set_unlocks(struct scheduler *s) {
void
scheduler_ranktasks
(
struct
scheduler
*
s
)
{
int
i
,
j
=
0
,
k
,
temp
,
left
=
0
,
rank
;
struct
task
*
t
,
*
tasks
=
s
->
tasks
;
int
*
tid
=
s
->
tasks_ind
,
nr_tasks
=
s
->
nr_tasks
;
struct
task
*
tasks
=
s
->
tasks
;
int
*
tid
=
s
->
tasks
_ind
;
const
int
nr_tasks
=
s
->
nr_tasks
;
/* Run through the tasks and get all the waits right. */
for
(
i
=
0
,
k
=
0
;
k
<
nr_tasks
;
k
++
)
{
for
(
i
nt
k
=
0
;
k
<
nr_tasks
;
k
++
)
{
tid
[
k
]
=
k
;
for
(
j
=
0
;
j
<
tasks
[
k
].
nr_unlock_tasks
;
j
++
)
for
(
int
j
=
0
;
j
<
tasks
[
k
].
nr_unlock_tasks
;
j
++
)
tasks
[
k
].
unlock_tasks
[
j
]
->
wait
+=
1
;
}
/* Main loop. */
for
(
j
=
0
,
rank
=
0
;
left
<
nr_tasks
;
rank
++
)
{
for
(
int
j
=
0
,
rank
=
0
,
left
=
0
;
left
<
nr_tasks
;
rank
++
)
{
/* Load the tids of tasks with no waits. */
for
(
k
=
left
;
k
<
nr_tasks
;
k
++
)
for
(
int
k
=
left
;
k
<
nr_tasks
;
k
++
)
if
(
tasks
[
tid
[
k
]].
wait
==
0
)
{
temp
=
tid
[
j
];
int
temp
=
tid
[
j
];
tid
[
j
]
=
tid
[
k
];
tid
[
k
]
=
temp
;
j
+=
1
;
...
...
@@ -793,15 +790,16 @@ void scheduler_ranktasks(struct scheduler *s) {
if
(
j
==
left
)
error
(
"Unsatisfiable task dependencies detected."
);
/* Unlock the next layer of tasks. */
for
(
i
=
left
;
i
<
j
;
i
++
)
{
t
=
&
tasks
[
tid
[
i
]];
for
(
int
i
=
left
;
i
<
j
;
i
++
)
{
struct
task
*
t
=
&
tasks
[
tid
[
i
]];
t
->
rank
=
rank
;
tid
[
i
]
=
t
-
tasks
;
if
(
tid
[
i
]
>=
nr_tasks
)
error
(
"Task index overshoot."
);
/* message( "task %i of type %s has rank %i." , i ,
(t->type == task_type_self) ? "self" : (t->type == task_type_pair) ?
"pair" : "sort" , rank ); */
for
(
k
=
0
;
k
<
t
->
nr_unlock_tasks
;
k
++
)
t
->
unlock_tasks
[
k
]
->
wait
-=
1
;
for
(
int
k
=
0
;
k
<
t
->
nr_unlock_tasks
;
k
++
)
t
->
unlock_tasks
[
k
]
->
wait
-=
1
;
}
/* The new left (no, not tony). */
...
...
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