Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Crocoddyl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Pep Martí Saumell
Crocoddyl
Commits
ba7dae2d
Commit
ba7dae2d
authored
5 years ago
by
Carlos Mastalli
Browse files
Options
Downloads
Patches
Plain Diff
[benchmark] Added times in milliseconds
parent
d0694fd9
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
benchmark/lqr.cpp
+40
-5
40 additions, 5 deletions
benchmark/lqr.cpp
benchmark/unicycle.cpp
+23
-6
23 additions, 6 deletions
benchmark/unicycle.cpp
src/core/optctrl/shooting.cpp
+1
-1
1 addition, 1 deletion
src/core/optctrl/shooting.cpp
with
64 additions
and
12 deletions
benchmark/lqr.cpp
+
40
−
5
View file @
ba7dae2d
...
...
@@ -40,17 +40,52 @@ int main() {
}
// Solving the optimal control problem
std
::
clock_t
c_start
,
c_end
;
struct
timespec
start
,
finish
;
double
elapsed
;
Eigen
::
ArrayXd
duration
(
T
);
for
(
unsigned
int
i
=
0
;
i
<
T
;
++
i
)
{
c
_start
=
std
::
clock
(
);
c
lock_gettime
(
CLOCK_MONOTONIC
,
&
start
);
ddp
.
solve
(
xs
,
us
,
MAXITER
);
c_end
=
std
::
clock
();
duration
[
i
]
=
1e3
*
(
double
)(
c_end
-
c_start
)
/
CLOCKS_PER_SEC
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
finish
);
elapsed
=
(
finish
.
tv_sec
-
start
.
tv_sec
)
*
1000000.0
;
elapsed
+=
(
finish
.
tv_nsec
-
start
.
tv_nsec
)
/
1000.0
;
duration
[
i
]
=
elapsed
/
1000.
;
}
double
avrg_duration
=
duration
.
sum
()
/
T
;
double
min_duration
=
duration
.
minCoeff
();
double
max_duration
=
duration
.
maxCoeff
();
std
::
cout
<<
"CPU time [ms]: "
<<
avrg_duration
<<
" ("
<<
min_duration
<<
"-"
<<
max_duration
<<
")"
<<
std
::
endl
;
std
::
cout
<<
"Wall time [mu]: "
<<
avrg_duration
<<
" ("
<<
min_duration
<<
"-"
<<
max_duration
<<
")"
<<
std
::
endl
;
// Running calc
for
(
unsigned
int
i
=
0
;
i
<
T
;
++
i
)
{
clock_gettime
(
CLOCK_MONOTONIC
,
&
start
);
problem
.
calc
(
xs
,
us
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
finish
);
elapsed
=
(
finish
.
tv_sec
-
start
.
tv_sec
)
*
1000000.0
;
elapsed
+=
(
finish
.
tv_nsec
-
start
.
tv_nsec
)
/
1000.0
;
duration
[
i
]
=
elapsed
/
1000.
;
}
avrg_duration
=
duration
.
sum
()
/
T
;
min_duration
=
duration
.
minCoeff
();
max_duration
=
duration
.
maxCoeff
();
std
::
cout
<<
"Wall time calc [ms]: "
<<
avrg_duration
<<
" ("
<<
min_duration
<<
"-"
<<
max_duration
<<
")"
<<
std
::
endl
;
// Running calcDiff
for
(
unsigned
int
i
=
0
;
i
<
T
;
++
i
)
{
clock_gettime
(
CLOCK_MONOTONIC
,
&
start
);
problem
.
calcDiff
(
xs
,
us
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
finish
);
elapsed
=
(
finish
.
tv_sec
-
start
.
tv_sec
)
*
1000000.0
;
elapsed
+=
(
finish
.
tv_nsec
-
start
.
tv_nsec
)
/
1000.0
;
duration
[
i
]
=
elapsed
/
1000.
;
}
avrg_duration
=
duration
.
sum
()
/
T
;
min_duration
=
duration
.
minCoeff
();
max_duration
=
duration
.
maxCoeff
();
std
::
cout
<<
"Wall time calcDiff [ms]: "
<<
avrg_duration
<<
" ("
<<
min_duration
<<
"-"
<<
max_duration
<<
")"
<<
std
::
endl
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
benchmark/unicycle.cpp
+
23
−
6
View file @
ba7dae2d
...
...
@@ -39,9 +39,10 @@ int main() {
cbs
.
push_back
(
new
CallbackVerbose
());
ddp
.
setCallbacks
(
cbs
);
}
// Solving the optimal control problem
struct
timespec
start
,
finish
;
double
elapsed
;
// Solving the optimal control problem
Eigen
::
ArrayXd
duration
(
T
);
for
(
unsigned
int
i
=
0
;
i
<
T
;
++
i
)
{
clock_gettime
(
CLOCK_MONOTONIC
,
&
start
);
...
...
@@ -49,28 +50,44 @@ int main() {
clock_gettime
(
CLOCK_MONOTONIC
,
&
finish
);
elapsed
=
(
finish
.
tv_sec
-
start
.
tv_sec
)
*
1000000.0
;
elapsed
+=
(
finish
.
tv_nsec
-
start
.
tv_nsec
)
/
1000.0
;
duration
[
i
]
=
elapsed
;
// in us
duration
[
i
]
=
elapsed
/
1000.
;
}
double
avrg_duration
=
duration
.
sum
()
/
T
;
double
min_duration
=
duration
.
minCoeff
();
double
max_duration
=
duration
.
maxCoeff
();
std
::
cout
<<
"Wall time solve [us]: "
<<
avrg_duration
<<
" ("
<<
min_duration
<<
"-"
<<
max_duration
<<
")"
std
::
cout
<<
"Wall time solve [ms]: "
<<
avrg_duration
<<
" ("
<<
min_duration
<<
"-"
<<
max_duration
<<
")"
<<
std
::
endl
;
// Running calc
for
(
unsigned
int
i
=
0
;
i
<
T
;
++
i
)
{
clock_gettime
(
CLOCK_MONOTONIC
,
&
start
);
problem
.
calc
(
xs
,
us
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
finish
);
elapsed
=
(
finish
.
tv_sec
-
start
.
tv_sec
)
*
1000000.0
;
elapsed
+=
(
finish
.
tv_nsec
-
start
.
tv_nsec
)
/
1000.0
;
duration
[
i
]
=
elapsed
/
1000.
;
}
avrg_duration
=
duration
.
sum
()
/
T
;
min_duration
=
duration
.
minCoeff
();
max_duration
=
duration
.
maxCoeff
();
std
::
cout
<<
"Wall time calc [ms]: "
<<
avrg_duration
<<
" ("
<<
min_duration
<<
"-"
<<
max_duration
<<
")"
<<
std
::
endl
;
// Running calcDiff
for
(
unsigned
int
i
=
0
;
i
<
T
;
++
i
)
{
clock_gettime
(
CLOCK_MONOTONIC
,
&
start
);
problem
.
calcDiff
(
xs
,
us
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
finish
);
elapsed
=
(
finish
.
tv_sec
-
start
.
tv_sec
)
*
1000000.0
;
elapsed
+=
(
finish
.
tv_nsec
-
start
.
tv_nsec
)
/
1000.0
;
duration
[
i
]
=
elapsed
;
// in us
duration
[
i
]
=
elapsed
/
1000.
;
}
avrg_duration
=
duration
.
sum
()
/
T
;
min_duration
=
duration
.
minCoeff
();
max_duration
=
duration
.
maxCoeff
();
std
::
cout
<<
"Wall time calcDiff [
u
s]: "
<<
avrg_duration
<<
" ("
<<
min_duration
<<
"-"
<<
max_duration
<<
")"
std
::
cout
<<
"Wall time calcDiff [
m
s]: "
<<
avrg_duration
<<
" ("
<<
min_duration
<<
"-"
<<
max_duration
<<
")"
<<
std
::
endl
;
}
This diff is collapsed.
Click to expand it.
src/core/optctrl/shooting.cpp
+
1
−
1
View file @
ba7dae2d
...
...
@@ -10,7 +10,7 @@
#include
<iostream>
#ifdef WITH_MULTITHREADING
#include
<omp.h>
#define NUM_THREADS NTHREADS
#define NUM_THREADS
WITH_
NTHREADS
#endif // WITH_MULTITHREADING
namespace
crocoddyl
{
...
...
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