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
7e9b6217
Commit
7e9b6217
authored
7 years ago
by
lhausamm
Browse files
Options
Downloads
Patches
Plain Diff
Formating
parent
c9b94e9a
No related branches found
No related tags found
1 merge request
!459
Task graph
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/main.c
+4
-6
4 additions, 6 deletions
examples/main.c
src/scheduler.c
+32
-41
32 additions, 41 deletions
src/scheduler.c
with
36 additions
and
47 deletions
examples/main.c
+
4
−
6
View file @
7e9b6217
...
@@ -191,8 +191,7 @@ int main(int argc, char *argv[]) {
...
@@ -191,8 +191,7 @@ int main(int argc, char *argv[]) {
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
strcat
(
parameters
,
"x"
);
strcat
(
parameters
,
"x"
);
#endif
#endif
while
((
c
=
getopt
(
argc
,
argv
,
parameters
))
!=
-
1
)
while
((
c
=
getopt
(
argc
,
argv
,
parameters
))
!=
-
1
)
switch
(
c
)
{
switch
(
c
)
{
case
'a'
:
case
'a'
:
#if defined(HAVE_SETAFFINITY) && defined(HAVE_LIBNUMA)
#if defined(HAVE_SETAFFINITY) && defined(HAVE_LIBNUMA)
with_aff
=
1
;
with_aff
=
1
;
...
@@ -205,8 +204,8 @@ int main(int argc, char *argv[]) {
...
@@ -205,8 +204,8 @@ int main(int argc, char *argv[]) {
break
;
break
;
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
case
'x'
:
case
'x'
:
write_dependencies
=
1
;
write_dependencies
=
1
;
break
;
break
;
#endif
#endif
case
'C'
:
case
'C'
:
with_cooling
=
1
;
with_cooling
=
1
;
...
@@ -704,8 +703,7 @@ int main(int argc, char *argv[]) {
...
@@ -704,8 +703,7 @@ int main(int argc, char *argv[]) {
engine_print_stats
(
&
e
);
engine_print_stats
(
&
e
);
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
if
(
write_dependencies
)
if
(
write_dependencies
)
scheduler_write_dependency
(
&
e
.
sched
);
scheduler_write_dependency
(
&
e
.
sched
);
#endif
#endif
/* Legend */
/* Legend */
...
...
This diff is collapsed.
Click to expand it.
src/scheduler.c
+
32
−
41
View file @
7e9b6217
...
@@ -129,7 +129,7 @@ void scheduler_write_dependency(struct scheduler *s) {
...
@@ -129,7 +129,7 @@ void scheduler_write_dependency(struct scheduler *s) {
int
nber_relation
=
2
*
task_type_count
*
task_subtype_count
*
max_nber_dep
;
int
nber_relation
=
2
*
task_type_count
*
task_subtype_count
*
max_nber_dep
;
/* For each type/subtype, a table of 2*max_nber_dep int is available =>
/* For each type/subtype, a table of 2*max_nber_dep int is available =>
max_nber_dep task with subtype available
max_nber_dep task with subtype available
-1 means that it is not set yet
-1 means that it is not set yet
to get the table of max_nber_dep for a task:
to get the table of max_nber_dep for a task:
...
@@ -138,8 +138,7 @@ void scheduler_write_dependency(struct scheduler *s) {
...
@@ -138,8 +138,7 @@ void scheduler_write_dependency(struct scheduler *s) {
task_subtype
task_subtype
*/
*/
int
*
table
=
malloc
(
nber_relation
*
sizeof
(
int
));
int
*
table
=
malloc
(
nber_relation
*
sizeof
(
int
));
for
(
i
=
0
;
i
<
nber_relation
;
i
++
)
for
(
i
=
0
;
i
<
nber_relation
;
i
++
)
table
[
i
]
=
-
1
;
table
[
i
]
=
-
1
;
message
(
"Writing dependencies"
);
message
(
"Writing dependencies"
);
...
@@ -156,7 +155,7 @@ void scheduler_write_dependency(struct scheduler *s) {
...
@@ -156,7 +155,7 @@ void scheduler_write_dependency(struct scheduler *s) {
/* loop over all tasks */
/* loop over all tasks */
for
(
i
=
0
;
i
<
s
->
nr_tasks
;
i
++
)
{
for
(
i
=
0
;
i
<
s
->
nr_tasks
;
i
++
)
{
struct
task
*
ta
;
struct
task
*
ta
;
ta
=
&
s
->
tasks
[
i
];
ta
=
&
s
->
tasks
[
i
];
/* and theirs dependencies */
/* and theirs dependencies */
...
@@ -164,62 +163,54 @@ void scheduler_write_dependency(struct scheduler *s) {
...
@@ -164,62 +163,54 @@ void scheduler_write_dependency(struct scheduler *s) {
struct
task
*
tb
;
struct
task
*
tb
;
tb
=
ta
->
unlock_tasks
[
j
];
tb
=
ta
->
unlock_tasks
[
j
];
char
tmp
[
200
];
/* text to write */
char
tmp
[
200
];
/* text to write */
char
ta_name
[
200
];
char
ta_name
[
200
];
char
tb_name
[
200
];
char
tb_name
[
200
];
/* construct line */
/* construct line */
if
(
ta
->
subtype
==
task_subtype_none
)
if
(
ta
->
subtype
==
task_subtype_none
)
sprintf
(
ta_name
,
"%s"
,
taskID_names
[
ta
->
type
]);
sprintf
(
ta_name
,
"%s"
,
taskID_names
[
ta
->
type
]);
else
else
sprintf
(
ta_name
,
"
\"
%s %s
\"
"
,
sprintf
(
ta_name
,
"
\"
%s %s
\"
"
,
taskID_names
[
ta
->
type
],
taskID_names
[
ta
->
type
],
subtaskID_names
[
ta
->
subtype
]);
subtaskID_names
[
ta
->
subtype
]);
if
(
tb
->
subtype
==
task_subtype_none
)
if
(
tb
->
subtype
==
task_subtype_none
)
sprintf
(
tb_name
,
"%s"
,
taskID_names
[
tb
->
type
]);
sprintf
(
tb_name
,
"%s"
,
taskID_names
[
tb
->
type
]);
else
else
sprintf
(
tb_name
,
"
\"
%s %s
\"
"
,
sprintf
(
tb_name
,
"
\"
%s %s
\"
"
,
taskID_names
[
tb
->
type
],
taskID_names
[
tb
->
type
],
subtaskID_names
[
tb
->
subtype
]);
subtaskID_names
[
tb
->
subtype
]);
sprintf
(
tmp
,
"
\t
%s->%s;
\n
"
,
ta_name
,
tb_name
);
sprintf
(
tmp
,
"
\t
%s->%s;
\n
"
,
ta_name
,
tb_name
);
/* check if dependency already written */
/* check if dependency already written */
int
written
=
0
;
int
written
=
0
;
int
ind
=
ta
->
type
*
task_subtype_count
+
ta
->
subtype
;
int
ind
=
ta
->
type
*
task_subtype_count
+
ta
->
subtype
;
ind
*=
2
*
max_nber_dep
;
ind
*=
2
*
max_nber_dep
;
int
k
=
0
;
int
k
=
0
;
int
*
cur
=
&
table
[
ind
];
int
*
cur
=
&
table
[
ind
];
while
(
k
<
max_nber_dep
)
while
(
k
<
max_nber_dep
)
{
{
/* not written yet */
/* not written yet */
if
(
cur
[
0
]
==
-
1
)
{
if
(
cur
[
0
]
==
-
1
)
cur
[
0
]
=
tb
->
type
;
{
cur
[
1
]
=
tb
->
subtype
;
cur
[
0
]
=
tb
->
type
;
break
;
cur
[
1
]
=
tb
->
subtype
;
}
break
;
}
/* already written */
if
(
cur
[
0
]
==
tb
->
type
&&
cur
[
1
]
==
tb
->
subtype
)
{
/* already written */
written
=
1
;
if
(
cur
[
0
]
==
tb
->
type
&&
cur
[
1
]
==
tb
->
subtype
)
break
;
{
}
written
=
1
;
break
;
k
+=
1
;
}
cur
=
&
cur
[
3
];
}
k
+=
1
;
cur
=
&
cur
[
3
];
}
/* max_nber_dep is too small */
/* max_nber_dep is too small */
if
(
k
==
max_nber_dep
)
if
(
k
==
max_nber_dep
)
error
(
"Not enough memory, please increase max_nber_dep"
);
error
(
"Not enough memory, please increase max_nber_dep"
);
/* Not written yet => write it */
/* Not written yet => write it */
if
(
!
written
)
{
if
(
!
written
)
{
fprintf
(
f
,
tmp
);
fprintf
(
f
,
tmp
);
...
...
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