diff options
author | Jongsoo Park <jongsoo@fb.com> | 2019-01-02 04:00:53 +0300 |
---|---|---|
committer | Facebook Github Bot <facebook-github-bot@users.noreply.github.com> | 2019-01-02 04:03:20 +0300 |
commit | b86d64219a0cb8fc2f8e9595c91986faff17863c (patch) | |
tree | 376d104407c9f5d881b77c89a29de1103377bd04 /bench/FP16Benchmark.cc | |
parent | bd35fce789f33bbb026617b1dff722d173586951 (diff) |
use 1 omp thread unless OMP_NUM_THREADS is explicitly set (#53)
Summary:
Pull Request resolved: https://github.com/pytorch/FBGEMM/pull/53
As title
Reviewed By: jianyuh
Differential Revision: D13561724
fbshipit-source-id: 815ab310f2f4862c65ad0e3d61bf221cb8cf679b
Diffstat (limited to 'bench/FP16Benchmark.cc')
-rw-r--r-- | bench/FP16Benchmark.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bench/FP16Benchmark.cc b/bench/FP16Benchmark.cc index fd9de5b..c42ee29 100644 --- a/bench/FP16Benchmark.cc +++ b/bench/FP16Benchmark.cc @@ -212,8 +212,11 @@ void performance_test() { int main(int /*argc*/, char** /*argv*/) { #ifdef _OPENMP - omp_set_num_threads(1); + // Use 1 thread unless OMP_NUM_THREADS is explicit set. + const char* val = getenv("OMP_NUM_THREADS"); + if (val == nullptr || !*val) { + omp_set_num_threads(1); + } #endif - performance_test(); } |