Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QuickSched
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
QuickSched
Commits
6184face
Commit
6184face
authored
8 years ago
by
Aidan Chalk
Browse files
Options
Downloads
Plain Diff
Fixed merge issues
parents
69434db3
f6d1d36c
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
configure.ac
+12
-0
12 additions, 0 deletions
configure.ac
examples/plot_tasks.py
+155
-0
155 additions, 0 deletions
examples/plot_tasks.py
src/qsched.c
+24
-0
24 additions, 0 deletions
src/qsched.c
src/qsched.h
+1
-0
1 addition, 0 deletions
src/qsched.h
src/task.h
+5
-0
5 additions, 0 deletions
src/task.h
with
197 additions
and
0 deletions
configure.ac
+
12
−
0
View file @
6184face
...
@@ -100,11 +100,23 @@ if test "$enable_san" = "yes"; then
...
@@ -100,11 +100,23 @@ if test "$enable_san" = "yes"; then
fi
fi
fi
fi
# Autoconf stuff
# Autoconf stuff
AC_PROG_INSTALL
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_MAKE_SET
AC_HEADER_STDC
AC_HEADER_STDC
AC_ARG_ENABLE([task-timers],
[AS_HELP_STRING([--enable-task-timers],
[Enables task timer output and collection of extra data to enable it])],
[enable_tts="$enableval"],
[enable_tts="no"]
)
if test "$enable_tts" = "yes"; then
AC_DEFINE(WITH_TASK_TIMERS,1,[Define if Task Timer recording is enabled])
fi
# Check for pthreads.
# Check for pthreads.
AX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
AX_PTHREAD([LIBS="$PTHREAD_LIBS $LIBS" CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
CC="$PTHREAD_CC" LDFLAGS="$LDFLAGS $PTHREAD_LIBS $LIBS"]
CC="$PTHREAD_CC" LDFLAGS="$LDFLAGS $PTHREAD_LIBS $LIBS"]
...
...
This diff is collapsed.
Click to expand it.
examples/plot_tasks.py
0 → 100644
+
155
−
0
View file @
6184face
#!/usr/bin/env python
"""
Usage:
plot_tasks.py TASKTIMERS output.png [Ticks per ms]
where TASKTIMERS is a task timers file generated by quicksched.
This file is part of QuickSched.
Copyright (c) 2017 Aidan Chalk (aidan.chalk@stfc.ac.uk)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import
matplotlib
import
matplotlib.pyplot
as
plt
import
matplotlib.colors
as
colors
import
matplotlib.collections
as
collections
import
matplotlib.cm
as
cmx
import
matplotlib.gridspec
as
gridspec
matplotlib
.
use
(
'
Agg
'
)
import
pylab
as
pl
import
numpy
as
np
import
sys
import
math
# Basic plot configuration.
PLOT_PARAMS
=
{
"
axes.labelsize
"
:
10
,
"
axes.titlesize
"
:
10
,
"
font.size
"
:
14
,
"
legend.fontsize
"
:
12
,
"
xtick.labelsize
"
:
11
,
"
ytick.labelsize
"
:
11
,
"
figure.figsize
"
:
(
16.
,
4.
),
"
figure.subplot.left
"
:
0.03
,
"
figure.subplot.right
"
:
0.995
,
"
figure.subplot.bottom
"
:
0.1
,
"
figure.subplot.top
"
:
0.99
,
"
figure.subplot.wspace
"
:
0.
,
"
figure.subplot.hspace
"
:
0.
,
"
lines.markersize
"
:
6
,
"
lines.linewidth
"
:
3.
}
TASKCOLOURS
=
[
"
black
"
,
"
lightblue
"
,
"
greenyellow
"
,
"
navy
"
,
"
greenyellow
"
,
"
navy
"
,
"
indigo
"
,
"
cyan
"
,
"
cyan
"
,
"
green
"
,
"
yellow
"
,
"
magenta
"
,
"
mediumorchid
"
,
#"mediumnightblue",
"
mediumturquoise
"
,
"
mediumvioletred
"
,
"
darkred
"
,
"
darkblue
"
#,"powerblue"
]
pl
.
rcParams
.
update
(
PLOT_PARAMS
)
if
len
(
sys
.
argv
)
==
2
and
(
sys
.
argv
[
1
][
0
:
2
]
==
"
-h
"
or
sys
.
argv
[
1
][
0
:
3
]
==
"
--h
"
):
from
pydoc
import
help
help
(
"
__main__
"
)
sys
.
exit
(
0
)
#Input from command line
if
len
(
sys
.
argv
)
!=
3
and
len
(
sys
.
argv
)
!=
4
:
print
"
Usage:
"
,
sys
.
argv
[
0
],
"
TASKTIMERS output.png [ticks-per-ms]
"
sys
.
exit
(
1
)
infile
=
sys
.
argv
[
1
]
outpng
=
sys
.
argv
[
2
]
tpms
=
0
if
len
(
sys
.
argv
)
==
4
:
tpms
=
int
(
sys
.
argv
[
3
])
#read input.
data
=
pl
.
loadtxt
(
infile
)
nthread
=
int
(
max
(
data
[:,
1
]))
+
1
#Recompute timings in MS if possible.
if
(
tpms
!=
0
):
data
[:,
2
]
=
data
[:,
2
]
/
tpms
data
[:,
3
]
=
data
[:,
3
]
/
tpms
start_t
=
min
(
data
[:,
2
])
data
[:,
2
]
-=
start_t
data
[:,
3
]
-=
start_t
end_t
=
(
max
(
data
[:,
3
]))
start_t
=
min
(
data
[:,
2
])
delta_t
=
end_t
-
start_t
fig
=
pl
.
figure
()
ax
=
fig
.
add_subplot
(
1
,
1
,
1
)
ax
.
set_xlim
(
-
delta_t
*
0.03
,
delta_t
*
1.03
)
ax
.
set_ylim
(
0
,
nthread
)
print
len
(
data
[:,
0
])
for
j
in
range
(
nthread
):
tictocs
=
np
.
zeros
(
len
(
data
[:,
0
])
*
2
)
types
=
np
.
zeros
(
len
(
data
[:,
0
])
*
2
)
for
i
in
range
(
len
(
data
[:,
0
])):
if
data
[
i
,
1
]
==
j
:
tictocs
[
i
*
2
+
0
]
=
data
[
i
,
2
]
tictocs
[
i
*
2
+
1
]
=
data
[
i
,
3
]
types
[
i
*
2
+
0
]
=
int
(
data
[
i
,
0
])
types
[
i
*
2
+
1
]
=
int
(
data
[
i
,
0
])
#print tictocs
#print data[i,1]+0.05
for
i
in
range
(
len
(
TASKCOLOURS
)):
print
i
print
types
==
i
collection
=
collections
.
BrokenBarHCollection
.
span_where
(
tictocs
,
ymin
=
j
+
0.05
,
ymax
=
j
+
0.95
,
where
=
types
==
i
,
facecolor
=
TASKCOLOURS
[
i
],
linewidths
=
1
,
edgecolor
=
"
white
"
)
ax
.
add_collection
(
collection
)
# Start and end of time-step
ax
.
plot
([
start_t
,
start_t
],
[
0
,
nthread
],
'
k--
'
,
linewidth
=
1
)
ax
.
plot
([
end_t
,
end_t
],
[
0
,
nthread
],
'
k--
'
,
linewidth
=
1
)
ax
.
set_xlabel
(
"
time [ms or ticks]
"
)
ax
.
set_ylabel
(
"
Thread ID
"
)
ax
.
set_yticks
(
pl
.
array
(
range
(
nthread
)),
True
)
pl
.
savefig
(
outpng
,
format
=
'
png
'
,
dpi
=
1000
)
pl
.
savefig
(
'
tasks.eps
'
,
format
=
'
eps
'
,
dpi
=
1000
)
pl
.
show
()
print
"
Graphics done, output written to
"
,
outpng
sys
.
exit
(
0
)
This diff is collapsed.
Click to expand it.
src/qsched.c
+
24
−
0
View file @
6184face
...
@@ -627,6 +627,9 @@ void qsched_done ( struct qsched *s , struct task *t ) {
...
@@ -627,6 +627,9 @@ void qsched_done ( struct qsched *s , struct task *t ) {
/* Set the task stats. */
/* Set the task stats. */
t
->
toc
=
getticks
();
t
->
toc
=
getticks
();
#ifdef WITH_TASK_TIMERS
t
->
tid
=
omp_get_thread_num
();
#endif
if
(
!
(
s
->
flags
&
qsched_flag_norecost
))
if
(
!
(
s
->
flags
&
qsched_flag_norecost
))
t
->
cost
=
t
->
toc
-
t
->
tic
;
t
->
cost
=
t
->
toc
-
t
->
tic
;
...
@@ -1687,3 +1690,24 @@ void f_qsched_destroy( struct qsched *s)
...
@@ -1687,3 +1690,24 @@ void f_qsched_destroy( struct qsched *s)
free
(
s
);
free
(
s
);
}
}
void
qsched_dump_task_timers
(
struct
qsched
*
s
,
char
*
filename
){
#ifdef WITH_TASK_TIMERS
FILE
*
task_file
;
task_file
=
fopen
(
filename
,
"w"
);
for
(
int
i
=
0
;
i
<
s
->
count
;
i
++
)
{
struct
task
*
t
=
&
s
->
tasks
[
i
];
fprintf
(
task_file
,
"%i %i %lli %lli
\n
"
,
t
->
type
,
t
->
tid
,
t
->
tic
,
t
->
toc
);
}
fclose
(
task_file
);
#else
error
(
"Quicksched wasn't compiled with task timers enabled
\n
"
);
#endif
}
This diff is collapsed.
Click to expand it.
src/qsched.h
+
1
−
0
View file @
6184face
...
@@ -212,6 +212,7 @@ void qsched_reset ( struct qsched *s );
...
@@ -212,6 +212,7 @@ void qsched_reset ( struct qsched *s );
void
qsched_addtask_dynamic
(
struct
qsched
*
s
,
int
type
,
unsigned
int
flags
,
void
*
data
,
int
data_size
,
int
cost
,
qsched_res_t
*
locks
,
int
nr_locks
,
qsched_res_t
*
uses
,
int
nr_uses
);
void
qsched_addtask_dynamic
(
struct
qsched
*
s
,
int
type
,
unsigned
int
flags
,
void
*
data
,
int
data_size
,
int
cost
,
qsched_res_t
*
locks
,
int
nr_locks
,
qsched_res_t
*
uses
,
int
nr_uses
);
void
qsched_ensure
(
struct
qsched
*
s
,
int
nr_tasks
,
int
nr_res
,
int
nr_deps
,
int
nr_locks
,
int
nr_uses
,
int
size_data
);
void
qsched_ensure
(
struct
qsched
*
s
,
int
nr_tasks
,
int
nr_res
,
int
nr_deps
,
int
nr_locks
,
int
nr_uses
,
int
size_data
);
void
qsched_res_own
(
struct
qsched
*
s
,
qsched_res_t
res
,
int
owner
);
void
qsched_res_own
(
struct
qsched
*
s
,
qsched_res_t
res
,
int
owner
);
void
qsched_dump_task_timers
(
struct
qsched
*
s
,
char
*
filename
);
int
qsched_get_tid
();
int
qsched_get_tid
();
struct
qsched
*
f_qsched_create
();
struct
qsched
*
f_qsched_create
();
...
...
This diff is collapsed.
Click to expand it.
src/task.h
+
5
−
0
View file @
6184face
...
@@ -57,4 +57,9 @@ struct task {
...
@@ -57,4 +57,9 @@ struct task {
/* Task weight for queue selection. */
/* Task weight for queue selection. */
int
cost
,
weight
;
int
cost
,
weight
;
#ifdef WITH_TASK_TIMERS
int
tid
;
#endif
};
};
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