Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
aidge_core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
Eclipse Projects
aidge
aidge_core
Commits
764c6ad8
Commit
764c6ad8
authored
1 year ago
by
Maxence Naud
Browse files
Options
Downloads
Patches
Plain Diff
[Add] 'backward()' function to SequentialScheduler
parent
95a2f4da
No related branches found
Branches containing commit
No related tags found
Tags containing commit
3 merge requests
!105
version 0.2.0
,
!88
Basic supervised learning
,
!79
Scheduler backward
Pipeline
#38467
canceled
1 year ago
Stage: static_analysis
Stage: build
Stage: test
Stage: coverage
Changes
2
Pipelines
3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/aidge/scheduler/Scheduler.hpp
+5
-0
5 additions, 0 deletions
include/aidge/scheduler/Scheduler.hpp
src/scheduler/Scheduler.cpp
+36
-1
36 additions, 1 deletion
src/scheduler/Scheduler.cpp
with
41 additions
and
1 deletion
include/aidge/scheduler/Scheduler.hpp
+
5
−
0
View file @
764c6ad8
...
@@ -55,6 +55,11 @@ public:
...
@@ -55,6 +55,11 @@ public:
*/
*/
void
forward
(
bool
forwardDims
=
true
,
bool
verbose
=
false
);
void
forward
(
bool
forwardDims
=
true
,
bool
verbose
=
false
);
/**
* @brief Run the provided Computational Graph with a batch of data
*/
void
backward
(
bool
forwardDims
=
true
,
bool
verbose
=
false
);
/**
/**
* @brief Save in a Markdown file the order of layers execution.
* @brief Save in a Markdown file the order of layers execution.
* @param fileName Name of the generated file.
* @param fileName Name of the generated file.
...
...
This diff is collapsed.
Click to expand it.
src/scheduler/Scheduler.cpp
+
36
−
1
View file @
764c6ad8
...
@@ -18,8 +18,9 @@
...
@@ -18,8 +18,9 @@
#include
"aidge/graph/GraphView.hpp"
#include
"aidge/graph/GraphView.hpp"
#include
"aidge/graph/Node.hpp"
#include
"aidge/graph/Node.hpp"
#include
"aidge/utils/Types.h"
#include
"aidge/operator/OperatorTensor.hpp"
#include
"aidge/operator/OperatorTensor.hpp"
#include
"aidge/utils/Types.h"
#include
"aidge/recipies/GraphViewHelper.hpp"
void
drawProgressBar
(
double
progress
,
int
barWidth
,
const
std
::
string
&
additionalInfo
=
""
)
{
void
drawProgressBar
(
double
progress
,
int
barWidth
,
const
std
::
string
&
additionalInfo
=
""
)
{
putchar
(
'['
);
putchar
(
'['
);
...
@@ -208,6 +209,40 @@ void Aidge::SequentialScheduler::forward(bool forwardDims, bool verbose) {
...
@@ -208,6 +209,40 @@ void Aidge::SequentialScheduler::forward(bool forwardDims, bool verbose) {
printf
(
"
\n
"
);
printf
(
"
\n
"
);
}
}
void
Aidge
::
SequentialScheduler
::
backward
(
bool
instanciateGrad
,
bool
verbose
)
{
// Forward dims (if allowed)
if
(
instanciateGrad
)
{
instanciateGradient
(
mGraphView
);
}
// Generate scheduling *only if empty*
// If scheduling was already generated (in one or several steps, i.e. one or
// several successive call to generateScheduling()), do not generate it twice
if
(
mStaticSchedule
.
empty
())
{
this
->
generateScheduling
();
}
// Clear previous scheduling results
mScheduling
.
clear
();
int
cpt
=
0
;
for
(
auto
runnable
=
mStaticSchedule
.
crbegin
();
runnable
!=
mStaticSchedule
.
crend
();
++
runnable
)
{
if
(
verbose
)
printf
(
"run: %s
\n
"
,
((
*
runnable
)
->
type
()
+
"_"
+
std
::
to_string
(
reinterpret_cast
<
uintptr_t
>
(
runnable
->
get
()))).
c_str
());
else
drawProgressBar
(
static_cast
<
float
>
(
cpt
)
/
static_cast
<
float
>
(
mStaticSchedule
.
size
()),
50
,
(
std
::
string
(
"running "
)
+
(
*
runnable
)
->
type
()
+
"_"
+
std
::
to_string
(
reinterpret_cast
<
uintptr_t
>
(
runnable
->
get
()))));
const
auto
tStart
=
std
::
chrono
::
high_resolution_clock
::
now
();
(
*
runnable
)
->
backward
();
const
auto
tEnd
=
std
::
chrono
::
high_resolution_clock
::
now
();
mScheduling
.
push_back
(
SchedulingElement
(
*
runnable
,
tStart
,
tEnd
));
cpt
++
;
}
if
(
!
verbose
)
drawProgressBar
(
1.0
,
50
,
" "
);
printf
(
"
\n
"
);
}
void
Aidge
::
SequentialScheduler
::
saveSchedulingDiagram
(
const
std
::
string
&
fileName
)
const
{
void
Aidge
::
SequentialScheduler
::
saveSchedulingDiagram
(
const
std
::
string
&
fileName
)
const
{
FILE
*
fp
=
std
::
fopen
((
fileName
+
".mmd"
).
c_str
(),
"w"
);
FILE
*
fp
=
std
::
fopen
((
fileName
+
".mmd"
).
c_str
(),
"w"
);
std
::
fprintf
(
fp
,
"gantt
\n
dateFormat x
\n
axisFormat %%Q ms
\n\n
"
);
std
::
fprintf
(
fp
,
"gantt
\n
dateFormat x
\n
axisFormat %%Q ms
\n\n
"
);
...
...
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