Moving once_flag as requested by reviewer

Signed-off-by: Vishakha Agrawal <vishakha.agrawal@intel.com>
This commit is contained in:
Vishakha Agrawal 2020-08-11 16:27:54 -07:00
parent 508fddb3af
commit f63da8dfc0

View File

@ -42,7 +42,6 @@ limitations under the License.
#endif
namespace tensorflow {
absl::once_flag omp_setting_flag;
ThreadPoolDevice::ThreadPoolDevice(const SessionOptions& options,
const string& name, Bytes memory_limit,
@ -57,6 +56,7 @@ ThreadPoolDevice::ThreadPoolDevice(const SessionOptions& options,
if (DisableMKL()) return;
#ifdef _OPENMP
const char* user_omp_threads = getenv("OMP_NUM_THREADS");
static absl::once_flag omp_setting_flag;
if (user_omp_threads == nullptr) {
// OMP_NUM_THREADS controls MKL's intra-op parallelization
// Default to available physical cores