Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
ngraph
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ngraph
Commits
fb094fb1
Commit
fb094fb1
authored
Mar 07, 2019
by
Jayaram Bobba
Committed by
Robert Kimball
Mar 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow user override for eigen thread count (#2558)
parent
073e68fd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
2 deletions
+24
-2
cpu_executor.cpp
src/ngraph/runtime/cpu/cpu_executor.cpp
+24
-2
No files found.
src/ngraph/runtime/cpu/cpu_executor.cpp
View file @
fb094fb1
...
...
@@ -18,6 +18,8 @@
#include "cpu_executor.hpp"
#include "ngraph/except.hpp"
static
int
GetNumCores
()
{
const
auto
omp_num_threads
=
std
::
getenv
(
"OMP_NUM_THREADS"
);
...
...
@@ -67,14 +69,34 @@ namespace ngraph
{
int
num_threads_per_pool
;
#if defined(EIGEN_OPENMP)
// Eigen threadpool will still be used for reductions
// and other tensor operations that dont use a parallelFor
num_threads_per_pool
=
1
;
#else
num_threads_per_pool
=
GetNumCores
();
#endif
// User override
char
*
eigen_tp_count
=
std
::
getenv
(
"NGRAPH_CPU_EIGEN_THREAD_COUNT"
);
if
(
eigen_tp_count
!=
nullptr
)
{
const
int
tp_count
=
std
::
atoi
(
eigen_tp_count
);
if
(
tp_count
<
1
||
tp_count
>
GetNumCores
())
{
throw
ngraph_error
(
"Unexpected value specified for NGRAPH_CPU_EIGEN_THREAD_COUNT "
"("
+
std
::
string
(
eigen_tp_count
)
+
"). Please specify a value in range [1-"
+
std
::
to_string
(
GetNumCores
())
+
"]"
);
}
num_threads_per_pool
=
tp_count
;
}
m_thread_pools
.
push_back
(
std
::
unique_ptr
<
Eigen
::
ThreadPool
>
(
new
Eigen
::
ThreadPool
(
num_threads_per_pool
)));
m_thread_pool_devices
.
push_back
(
std
::
unique_ptr
<
Eigen
::
ThreadPoolDevice
>
(
new
Eigen
::
ThreadPoolDevice
(
m_thread_pools
[
i
].
get
(),
GetNumCores
())));
m_thread_pool_devices
.
push_back
(
std
::
unique_ptr
<
Eigen
::
ThreadPoolDevice
>
(
new
Eigen
::
ThreadPoolDevice
(
m_thread_pools
[
i
].
get
(),
num_threads_per_pool
)));
m_tbb_arenas
.
emplace_back
(
1
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment