Commit 8ad38f2e authored by Amy Zhuang's avatar Amy Zhuang Committed by Scott Cyphers

Add NGRAPH_INTRA_OP_PARALLELISM to control size of thread pools. (#1248)

* Add NGRAPH_INTRA_OP_PARALLELISM to control size of thread pools.

* Initialize variable.
parent 81c48453
...@@ -29,12 +29,19 @@ namespace ngraph ...@@ -29,12 +29,19 @@ namespace ngraph
static int GetNumCores() static int GetNumCores()
{ {
const auto omp_num_threads = std::getenv("OMP_NUM_THREADS"); const auto omp_num_threads = std::getenv("OMP_NUM_THREADS");
int count; const auto ngraph_intra_op_parallelism =
std::getenv("NGRAPH_INTRA_OP_PARALLELISM");
int count = 0;
if (omp_num_threads && (count = std::atoi(omp_num_threads))) if (omp_num_threads && (count = std::atoi(omp_num_threads)))
{ {
return count; return count;
} }
else if (ngraph_intra_op_parallelism &&
(count == std::atoi(ngraph_intra_op_parallelism)))
{
return count;
}
else else
{ {
count = std::thread::hardware_concurrency() >> 1; count = std::thread::hardware_concurrency() >> 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment