Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
aidge_core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
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
Model registry
Operate
Environments
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
Houssem ROUIS
aidge_core
Commits
b5472812
Commit
b5472812
authored
4 months ago
by
Cyril Moineau
Browse files
Options
Downloads
Patches
Plain Diff
Check if gnuplot is installed before saving stat_folder.
parent
ee9de485
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aidge_core/mem_info.py
+18
-14
18 additions, 14 deletions
aidge_core/mem_info.py
with
18 additions
and
14 deletions
aidge_core/mem_info.py
+
18
−
14
View file @
b5472812
...
...
@@ -41,7 +41,7 @@ def compute_default_mem_info(scheduler: aidge_core.Scheduler) -> Tuple[int, List
return
mem_size
,
mem_info
def
generate_optimized_memory_info
(
scheduler
:
aidge_core
.
Scheduler
,
stats_folder
:
Path
,
wrapping
:
bool
=
False
)
->
Tuple
[
int
,
List
[
dict
]]:
def
generate_optimized_memory_info
(
scheduler
:
aidge_core
.
Scheduler
,
stats_folder
:
Path
=
None
,
wrapping
:
bool
=
False
)
->
Tuple
[
int
,
List
[
dict
]]:
"""
Generates optimized memory information for a computation graph managed by a scheduler.
This function analyzes the memory usage of a computation graph, determining the memory peak
...
...
@@ -52,8 +52,8 @@ def generate_optimized_memory_info(scheduler: aidge_core.Scheduler, stats_folder
nodes and facilitates memory planning by invoking its `generate_memory` method.
:type scheduler: aidge_core.Scheduler
:param stats_folder: Directory path to store memory statistics and plots generated by `mem_manager`.
If provided as a string, it is converted to a `Path` object.
:type stats_folder: Path
If provided as a string, it is converted to a `Path` object
, default=None
.
:type stats_folder: Path
, optional
:param wrapping: Boolean flag to enable or disable wrap-around buffer optimization.
Defaults to `False`.
:type wrapping: bool, optional
...
...
@@ -73,17 +73,21 @@ def generate_optimized_memory_info(scheduler: aidge_core.Scheduler, stats_folder
# List of nodes which are connected at the input of the graph (None if input is not connected)
nodes_at_input
=
[
n
[
0
]
for
n
in
scheduler
.
graph_view
().
inputs
()]
# Use gnuplot to generate the log
if
isinstance
(
stats_folder
,
str
):
stats_folder
=
Path
(
stats_folder
)
os
.
makedirs
(
str
(
Path
(
stats_folder
)
/
"
graph
"
),
exist_ok
=
True
)
mem_manager
.
log
(
"
memory_info
"
)
os
.
chmod
(
"
memory_info_plot.gnu
"
,
0o777
)
os
.
system
(
"
./memory_info_plot.gnu
"
)
shutil
.
move
(
"
memory_info
"
,
str
(
Path
(
stats_folder
)
/
"
graph
"
/
"
memory_info
"
))
shutil
.
move
(
"
memory_info_plot.png
"
,
str
(
Path
(
stats_folder
)
/
"
graph
"
/
"
memory_info_plot.png
"
))
os
.
remove
(
"
memory_info_plot.gnu
"
)
# Return 0 ==> gnuplot installed
if
os
.
system
(
"
gnuplot --version > /dev/null 2>&1
"
)
==
0
:
# Use gnuplot to generate the log
if
isinstance
(
stats_folder
,
str
):
stats_folder
=
Path
(
stats_folder
)
os
.
makedirs
(
str
(
Path
(
stats_folder
)
/
"
graph
"
),
exist_ok
=
True
)
mem_manager
.
log
(
"
memory_info
"
)
os
.
chmod
(
"
memory_info_plot.gnu
"
,
0o777
)
os
.
system
(
"
./memory_info_plot.gnu
"
)
shutil
.
move
(
"
memory_info
"
,
str
(
Path
(
stats_folder
)
/
"
graph
"
/
"
memory_info
"
))
shutil
.
move
(
"
memory_info_plot.png
"
,
str
(
Path
(
stats_folder
)
/
"
graph
"
/
"
memory_info_plot.png
"
))
os
.
remove
(
"
memory_info_plot.gnu
"
)
elif
stats_folder
is
not
None
:
aidge_core
.
Log
.
warn
(
"
Warning: gnuplot is not installed, could not generate stat folder.
"
)
# In the export, we currently use an unified memory buffer whose size
# is determined by the memory peak usage
mem_size
=
mem_manager
.
get_peak_usage
()
...
...
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