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
e548bb03
Commit
e548bb03
authored
Mar 23, 2018
by
Jaikrishnan Menon
Committed by
Scott Cyphers
Mar 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CPU/Eigen: Propagate correct core counts to thread pools (#734)
parent
07c3212f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
2 deletions
+20
-2
eigen_thread_pool.cpp
src/ngraph/runtime/cpu/kernel/eigen_thread_pool.cpp
+20
-2
No files found.
src/ngraph/runtime/cpu/kernel/eigen_thread_pool.cpp
View file @
e548bb03
...
...
@@ -14,6 +14,8 @@
* limitations under the License.
*******************************************************************************/
#include <thread>
#include "eigen_thread_pool.hpp"
namespace
ngraph
...
...
@@ -24,9 +26,25 @@ namespace ngraph
{
namespace
eigen
{
Eigen
::
ThreadPool
global_thread_pool
(
Eigen
::
nbThreads
());
static
int
GetNumCores
()
{
const
auto
omp_num_threads
=
std
::
getenv
(
"OMP_NUM_THREADS"
);
int
count
;
if
(
omp_num_threads
&&
(
count
=
std
::
atoi
(
omp_num_threads
)))
{
return
count
;
}
else
{
count
=
std
::
thread
::
hardware_concurrency
()
>>
1
;
}
return
count
?
count
:
1
;
}
Eigen
::
ThreadPool
global_thread_pool
(
GetNumCores
());
Eigen
::
ThreadPoolDevice
global_thread_pool_device
(
&
global_thread_pool
,
Eigen
::
nb
Threads
());
global_thread_pool
.
Num
Threads
());
}
}
}
...
...
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