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
54a86f47
Commit
54a86f47
authored
9 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
scheduler_gettask.
parent
453d8ace
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
+11
-12
11 additions, 12 deletions
src/scheduler.c
with
11 additions
and
12 deletions
src/scheduler.c
+
11
−
12
View file @
54a86f47
...
@@ -862,8 +862,9 @@ void scheduler_reweight(struct scheduler *s) {
...
@@ -862,8 +862,9 @@ void scheduler_reweight(struct scheduler *s) {
int
*
tid
=
s
->
tasks_ind
;
int
*
tid
=
s
->
tasks_ind
;
struct
task
*
tasks
=
s
->
tasks
;
struct
task
*
tasks
=
s
->
tasks
;
const
int
nodeID
=
s
->
nodeID
;
const
int
nodeID
=
s
->
nodeID
;
const
float
sid_scale
[
13
]
=
{
0
.
1897
,
0
.
4025
,
0
.
1897
,
0
.
4025
,
0
.
5788
,
0
.
4025
,
0
.
1897
,
const
float
sid_scale
[
13
]
=
{
0
.
1897
,
0
.
4025
,
0
.
1897
,
0
.
4025
,
0
.
5788
,
0
.
4025
,
0
.
1897
,
0
.
4025
,
0
.
5788
,
0
.
4025
,
0
.
5788
};
0
.
4025
,
0
.
1897
,
0
.
4025
,
0
.
1897
,
0
.
4025
,
0
.
5788
,
0
.
4025
,
0
.
5788
};
const
float
wscale
=
0
.
001
;
const
float
wscale
=
0
.
001
;
// ticks tic;
// ticks tic;
...
@@ -1091,8 +1092,7 @@ void scheduler_enqueue(struct scheduler *s, struct task *t) {
...
@@ -1091,8 +1092,7 @@ void scheduler_enqueue(struct scheduler *s, struct task *t) {
case
task_type_recv
:
case
task_type_recv
:
#ifdef WITH_MPI
#ifdef WITH_MPI
err
=
MPI_Irecv
(
t
->
ci
->
parts
,
t
->
ci
->
count
,
s
->
part_mpi_type
,
err
=
MPI_Irecv
(
t
->
ci
->
parts
,
t
->
ci
->
count
,
s
->
part_mpi_type
,
t
->
ci
->
nodeID
,
t
->
flags
,
MPI_COMM_WORLD
,
t
->
ci
->
nodeID
,
t
->
flags
,
MPI_COMM_WORLD
,
&
t
->
req
);
&
t
->
req
);
if
(
err
!=
MPI_SUCCESS
)
{
if
(
err
!=
MPI_SUCCESS
)
{
char
buff
[
MPI_MAX_ERROR_STRING
];
char
buff
[
MPI_MAX_ERROR_STRING
];
int
len
;
int
len
;
...
@@ -1110,8 +1110,7 @@ void scheduler_enqueue(struct scheduler *s, struct task *t) {
...
@@ -1110,8 +1110,7 @@ void scheduler_enqueue(struct scheduler *s, struct task *t) {
case
task_type_send
:
case
task_type_send
:
#ifdef WITH_MPI
#ifdef WITH_MPI
err
=
MPI_Isend
(
t
->
ci
->
parts
,
t
->
ci
->
count
,
s
->
part_mpi_type
,
err
=
MPI_Isend
(
t
->
ci
->
parts
,
t
->
ci
->
count
,
s
->
part_mpi_type
,
t
->
cj
->
nodeID
,
t
->
flags
,
MPI_COMM_WORLD
,
t
->
cj
->
nodeID
,
t
->
flags
,
MPI_COMM_WORLD
,
&
t
->
req
);
&
t
->
req
);
if
(
err
!=
MPI_SUCCESS
)
{
if
(
err
!=
MPI_SUCCESS
)
{
char
buff
[
MPI_MAX_ERROR_STRING
];
char
buff
[
MPI_MAX_ERROR_STRING
];
int
len
;
int
len
;
...
@@ -1163,7 +1162,7 @@ struct task *scheduler_done(struct scheduler *s, struct task *t) {
...
@@ -1163,7 +1162,7 @@ struct task *scheduler_done(struct scheduler *s, struct task *t) {
for
(
int
k
=
0
;
k
<
t
->
nr_unlock_tasks
;
k
++
)
{
for
(
int
k
=
0
;
k
<
t
->
nr_unlock_tasks
;
k
++
)
{
struct
task
*
t2
=
t
->
unlock_tasks
[
k
];
struct
task
*
t2
=
t
->
unlock_tasks
[
k
];
int
res
=
atomic_dec
(
&
t2
->
wait
);
const
int
res
=
atomic_dec
(
&
t2
->
wait
);
if
(
res
<
1
)
{
if
(
res
<
1
)
{
error
(
"Negative wait!"
);
error
(
"Negative wait!"
);
}
else
if
(
res
==
1
)
{
}
else
if
(
res
==
1
)
{
...
@@ -1202,7 +1201,7 @@ struct task *scheduler_unlock(struct scheduler *s, struct task *t) {
...
@@ -1202,7 +1201,7 @@ struct task *scheduler_unlock(struct scheduler *s, struct task *t) {
they are ready. */
they are ready. */
for
(
int
k
=
0
;
k
<
t
->
nr_unlock_tasks
;
k
++
)
{
for
(
int
k
=
0
;
k
<
t
->
nr_unlock_tasks
;
k
++
)
{
struct
task
*
t2
=
t
->
unlock_tasks
[
k
];
struct
task
*
t2
=
t
->
unlock_tasks
[
k
];
int
res
=
atomic_dec
(
&
t2
->
wait
);
const
int
res
=
atomic_dec
(
&
t2
->
wait
);
if
(
res
<
1
)
{
if
(
res
<
1
)
{
error
(
"Negative wait!"
);
error
(
"Negative wait!"
);
}
else
if
(
res
==
1
)
{
}
else
if
(
res
==
1
)
{
...
@@ -1239,7 +1238,7 @@ struct task *scheduler_gettask(struct scheduler *s, int qid,
...
@@ -1239,7 +1238,7 @@ struct task *scheduler_gettask(struct scheduler *s, int qid,
const
struct
task
*
prev
)
{
const
struct
task
*
prev
)
{
struct
task
*
res
=
NULL
;
struct
task
*
res
=
NULL
;
int
k
,
nr_queues
=
s
->
nr_queues
;
const
int
nr_queues
=
s
->
nr_queues
;
unsigned
int
seed
=
qid
;
unsigned
int
seed
=
qid
;
/* Check qid. */
/* Check qid. */
...
@@ -1263,10 +1262,10 @@ struct task *scheduler_gettask(struct scheduler *s, int qid,
...
@@ -1263,10 +1262,10 @@ struct task *scheduler_gettask(struct scheduler *s, int qid,
/* If unsuccessful, try stealing from the other queues. */
/* If unsuccessful, try stealing from the other queues. */
if
(
s
->
flags
&
scheduler_flag_steal
)
{
if
(
s
->
flags
&
scheduler_flag_steal
)
{
int
count
=
0
,
qids
[
nr_queues
];
int
count
=
0
,
qids
[
nr_queues
];
for
(
k
=
0
;
k
<
nr_queues
;
k
++
)
for
(
int
k
=
0
;
k
<
nr_queues
;
k
++
)
if
(
s
->
queues
[
k
].
count
>
0
)
qids
[
count
++
]
=
k
;
if
(
s
->
queues
[
k
].
count
>
0
)
qids
[
count
++
]
=
k
;
for
(
k
=
0
;
k
<
scheduler_maxsteal
&&
count
>
0
;
k
++
)
{
for
(
int
k
=
0
;
k
<
scheduler_maxsteal
&&
count
>
0
;
k
++
)
{
int
ind
=
rand_r
(
&
seed
)
%
count
;
const
int
ind
=
rand_r
(
&
seed
)
%
count
;
TIMER_TIC
TIMER_TIC
res
=
queue_gettask
(
&
s
->
queues
[
qids
[
ind
]],
prev
,
0
);
res
=
queue_gettask
(
&
s
->
queues
[
qids
[
ind
]],
prev
,
0
);
TIMER_TOC
(
timer_qsteal
);
TIMER_TOC
(
timer_qsteal
);
...
...
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