Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B-ASIC - Better ASIC Toolbox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Computer Engineering
B-ASIC - Better ASIC Toolbox
Commits
43db6273
Commit
43db6273
authored
2 years ago
by
Oscar Gustafsson
Browse files
Options
Downloads
Patches
Plain Diff
Draw schedule plot as in GUI
parent
f749bd9d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!141
Draw schedule plot as in GUI
Pipeline
#88610
passed
2 years ago
Stage: test
Stage: deploy
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
b_asic/schedule.py
+20
-5
20 additions, 5 deletions
b_asic/schedule.py
pyproject.toml
+1
-1
1 addition, 1 deletion
pyproject.toml
test/baseline/test__get_figure_no_execution_times.png
+0
-0
0 additions, 0 deletions
test/baseline/test__get_figure_no_execution_times.png
with
21 additions
and
6 deletions
b_asic/schedule.py
+
20
−
5
View file @
43db6273
...
...
@@ -43,6 +43,7 @@ class Schedule:
_laps
:
Dict
[
GraphID
,
int
]
_schedule_time
:
int
_cyclic
:
bool
_y_locations
:
Dict
[
GraphID
,
Optional
[
int
]]
def
__init__
(
self
,
...
...
@@ -56,6 +57,7 @@ class Schedule:
self
.
_start_times
=
{}
self
.
_laps
=
defaultdict
(
lambda
:
0
)
self
.
_cyclic
=
cyclic
self
.
_y_locations
=
defaultdict
(
lambda
:
None
)
if
scheduling_alg
==
"
ASAP
"
:
self
.
_schedule_asap
()
else
:
...
...
@@ -449,6 +451,11 @@ class Schedule:
def
_plot_schedule
(
self
,
ax
):
line_cache
=
[]
y_location
=
0
for
op_id
,
op_start_time
in
self
.
_start_times
.
items
():
self
.
_y_locations
[
op_id
]
=
y_location
y_location
+=
1
def
_draw_arrow
(
start
,
end
,
name
=
""
,
laps
=
0
):
if
end
[
0
]
<
start
[
0
]
or
laps
>
0
:
# Wrap around
if
start
not
in
line_cache
:
...
...
@@ -539,13 +546,16 @@ class Schedule:
laps
=
laps
,
)
ypos
=
0.5
ytickpositions
=
[]
yticklabels
=
[]
ax
.
set_axisbelow
(
True
)
ax
.
grid
()
ypositions
=
{}
for
op_id
,
op_start_time
in
self
.
_start_times
.
items
():
y_location
=
self
.
_y_locations
[
op_id
]
if
y_location
is
None
:
raise
RuntimeError
(
f
"
No y-location for operation
{
op_id
}
"
)
ypos
=
-
0.5
-
y_location
*
1.5
op
=
self
.
_sfg
.
find_by_id
(
op_id
)
# Rewrite to make better use of NumPy
latency_coords
,
execution_time_coords
=
op
.
get_plot_coordinates
()
...
...
@@ -568,7 +578,6 @@ class Schedule:
ytickpositions
.
append
(
ypos
+
0.5
)
yticklabels
.
append
(
self
.
_sfg
.
find_by_id
(
op_id
).
name
)
ypositions
[
op_id
]
=
ypos
ypos
+=
1.5
for
op_id
,
op_start_time
in
self
.
_start_times
.
items
():
op
=
self
.
_sfg
.
find_by_id
(
op_id
)
...
...
@@ -596,18 +605,24 @@ class Schedule:
ax
.
set_yticks
(
ytickpositions
)
ax
.
set_yticklabels
(
yticklabels
)
ax
.
axis
([
-
1
,
self
.
_schedule_time
+
1
,
0
,
ypos
])
yposmin
=
min
(
ypositions
.
values
())
-
0.5
ax
.
axis
([
-
1
,
self
.
_schedule_time
+
1
,
yposmin
,
1
])
ax
.
xaxis
.
set_major_locator
(
MaxNLocator
(
integer
=
True
))
ax
.
add_line
(
Line2D
([
0
,
0
],
[
0
,
ypos
],
linestyle
=
"
--
"
,
color
=
"
black
"
))
ax
.
add_line
(
Line2D
([
0
,
0
],
[
yposmin
,
1
],
linestyle
=
"
--
"
,
color
=
"
black
"
)
)
ax
.
add_line
(
Line2D
(
[
self
.
_schedule_time
,
self
.
_schedule_time
],
[
0
,
ypos
],
[
ypos
min
,
1
],
linestyle
=
"
--
"
,
color
=
"
black
"
,
)
)
def
_reset_y_locations
(
self
):
self
.
_y_locations
=
self
.
_y_locations
=
defaultdict
(
lambda
:
None
)
def
plot_schedule
(
self
)
->
None
:
self
.
_get_figure
().
show
()
...
...
This diff is collapsed.
Click to expand it.
pyproject.toml
+
1
−
1
View file @
43db6273
...
...
@@ -48,7 +48,7 @@ fallback_version = "0.0+UNKNOWN"
[project.urls]
homepage
=
"https://gitlab.liu.se/da/B-ASIC"
documenation
=
"https://da.gitlab-pages.liu.se/B-ASIC/"
documen
t
ation
=
"https://da.gitlab-pages.liu.se/B-ASIC/"
[tool.black]
skip-string-normalization
=
true
...
...
This diff is collapsed.
Click to expand it.
test/baseline/test__get_figure_no_execution_times.png
+
0
−
0
View replaced file @
f749bd9d
View file @
43db6273
25.4 KiB
|
W:
|
H:
25.6 KiB
|
W:
|
H:
2-up
Swipe
Onion skin
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