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
8deb53cb
Commit
8deb53cb
authored
5 years ago
by
Carlos Mastalli
Browse files
Options
Downloads
Patches
Plain Diff
[cmake] Added option in cmake for setting the number of threads
parent
bf33b1e9
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
CMakeLists.txt
+14
-5
14 additions, 5 deletions
CMakeLists.txt
benchmark/unicycle.cpp
+1
-1
1 addition, 1 deletion
benchmark/unicycle.cpp
src/core/optctrl/shooting.cpp
+1
-1
1 addition, 1 deletion
src/core/optctrl/shooting.cpp
with
16 additions
and
7 deletions
CMakeLists.txt
+
14
−
5
View file @
8deb53cb
...
@@ -37,7 +37,7 @@ ENDIF()
...
@@ -37,7 +37,7 @@ ENDIF()
SET
(
CXX_DISABLE_WERROR True
)
SET
(
CXX_DISABLE_WERROR True
)
# Create different building options
# Create different building options
OPTION
(
ENABLE_VECTORIZATION
"Enable vectorization and futhers processor-related optimizations"
O
N
)
OPTION
(
ENABLE_VECTORIZATION
"Enable vectorization and futhers processor-related optimizations"
O
FF
)
OPTION
(
BUILD_PYTHON_INTERFACE
"Build the python binding"
ON
)
OPTION
(
BUILD_PYTHON_INTERFACE
"Build the python binding"
ON
)
OPTION
(
BUILD_UNIT_TESTS
"Build the unitary tests"
ON
)
OPTION
(
BUILD_UNIT_TESTS
"Build the unitary tests"
ON
)
OPTION
(
BUILD_BENCHMARK
"Build the benchmark"
ON
)
OPTION
(
BUILD_BENCHMARK
"Build the benchmark"
ON
)
...
@@ -58,16 +58,25 @@ ADD_OPTIONAL_DEPENDENCY("quadprog")
...
@@ -58,16 +58,25 @@ ADD_OPTIONAL_DEPENDENCY("quadprog")
ADD_OPTIONAL_DEPENDENCY
(
"scipy"
)
ADD_OPTIONAL_DEPENDENCY
(
"scipy"
)
OPTION
(
BUILD_WITH_MULTITHREADING
"Build the library with the OpenMP support (required OpenMP)"
ON
)
OPTION
(
BUILD_WITH_MULTITHREADS
"Build the library with the OpenMP support (required OpenMP)"
OFF
)
IF
(
BUILD_WITH_MULTITHREADS
)
SET
(
BUILD_WITH_NTHREADS
"4"
CACHE STRING
"Number of threads"
)
string
(
REGEX MATCH
"^[0-9]+$"
BUILD_WITH_NTHREADS
${
BUILD_WITH_NTHREADS
}
)
IF
(
NOT BUILD_WITH_NTHREADS MATCHES
"^[0-9]+$"
)
SET
(
BUILD_WITH_NTHREADS 4
)
MESSAGE
(
"Warning: the number of threads have to be an interger value, set to
${
BUILD_WITH_NTHREADS
}
"
)
ENDIF
()
ENDIF
()
#OpenMP
#
Add
OpenMP
if
(
BUILD_WITH_MULTITHREAD
ING
)
if
(
BUILD_WITH_MULTITHREAD
S
)
find_package
(
OpenMP
)
find_package
(
OpenMP
)
ENDIF
()
ENDIF
()
if
(
OPENMP_FOUND
)
if
(
OPENMP_FOUND
)
SET
(
CMAKE_CXX_FLAGS
"-fopenmp"
)
SET
(
CMAKE_CXX_FLAGS
"-fopenmp"
)
ADD_DEFINITIONS
(
-DWITH_MULTITHREADING
)
ADD_DEFINITIONS
(
-DWITH_MULTITHREADING
)
LIST
(
APPEND CFLAGS_DEPENDENCIES
"-DWITH_MULTITHREADING"
)
ADD_DEFINITIONS
(
-DNTHREADS=
${
BUILD_WITH_NTHREADS
}
)
LIST
(
APPEND CFLAGS_DEPENDENCIES
"-DWITH_MULTITHREADING"
,
"DNTHREADS"
)
ENDIF
()
ENDIF
()
...
...
This diff is collapsed.
Click to expand it.
benchmark/unicycle.cpp
+
1
−
1
View file @
8deb53cb
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
int
main
()
{
int
main
()
{
bool
CALLBACKS
=
false
;
bool
CALLBACKS
=
false
;
unsigned
int
N
=
200
;
// number of nodes
unsigned
int
N
=
200
;
// number of nodes
unsigned
int
T
=
10
;
// number of trials
unsigned
int
T
=
5e3
;
// number of trials
unsigned
int
MAXITER
=
1
;
unsigned
int
MAXITER
=
1
;
using
namespace
crocoddyl
;
using
namespace
crocoddyl
;
...
...
This diff is collapsed.
Click to expand it.
src/core/optctrl/shooting.cpp
+
1
−
1
View file @
8deb53cb
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
#include
<iostream>
#include
<iostream>
#ifdef WITH_MULTITHREADING
#ifdef WITH_MULTITHREADING
#include
<omp.h>
#include
<omp.h>
#define NUM_THREADS
4
#define NUM_THREADS
NTHREADS
#endif // WITH_MULTITHREADING
#endif // WITH_MULTITHREADING
namespace
crocoddyl
{
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