Skip to content

Commit f47231b

Browse files
dskhudiafacebook-github-bot
authored andcommitted
[caffe2][dnnlowp] Remove openmp usage in quantize dnnlowp op
Summary: It creates cpu overload issues when openmp gets enabled and OMP_NUM_THREADS=1 is not set. Test Plan: buck test //caffe2/caffe2/quantization/server:quantize_dnnlowp_op_test Reviewed By: jspark1105 Differential Revision: D24437305 fbshipit-source-id: 426209fc33ce0d4680c478f584716837ee62cb5e
1 parent 6cd8b5e commit f47231b

File tree

1 file changed

+1
-14
lines changed

1 file changed

+1
-14
lines changed

caffe2/quantization/server/quantize_dnnlowp_op.cc

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
#include "quantize_dnnlowp_op.h"
22
#include "dnnlowp_op.h"
33

4-
#ifdef _OPENMP
5-
#include <omp.h>
6-
#endif
7-
84
#include "caffe2/core/tensor_int8.h"
95
#include "caffe2/quantization/server/int8_gen_quant_params.h"
106
#include "caffe2_dnnlowp_utils.h"
@@ -67,16 +63,7 @@ bool QuantizeDNNLowPOp<T>::RunOnDevice() {
6763
const float* in_data = Input(0).template data<float>();
6864
T* out_data = output->t.template mutable_data<T>();
6965

70-
#ifdef _OPENMP
71-
#pragma omp parallel
72-
#endif
73-
{
74-
int i_begin, i_end;
75-
tie(i_begin, i_end) = Get1DPartition(
76-
Input(0).numel(), dnnlowp_get_num_threads(), dnnlowp_get_thread_num());
77-
fbgemm::Quantize<T>(
78-
in_data + i_begin, out_data + i_begin, i_end - i_begin, in_qparams);
79-
}
66+
fbgemm::Quantize<T>(in_data, out_data, Input(0).numel(), in_qparams);
8067

8168
PropagateOutputTensorQuantizationParams(this, 0, in_qparams);
8269

0 commit comments

Comments
 (0)