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/PackedFloatInOutBenchmark.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/PackedFloatInOutBenchmark.cc')
-rw-r--r-- | bench/PackedFloatInOutBenchmark.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/bench/PackedFloatInOutBenchmark.cc b/bench/PackedFloatInOutBenchmark.cc index f2589f7..1397125 100644 --- a/bench/PackedFloatInOutBenchmark.cc +++ b/bench/PackedFloatInOutBenchmark.cc @@ -256,7 +256,11 @@ void performance_test() { int main(int /* unused */, char** /* unused */) { #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(); return 0; |