mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
[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
This commit is contained in:
parent
6cd8b5e9a7
commit
f47231bf0e
|
|
@ -1,10 +1,6 @@
|
|||
#include "quantize_dnnlowp_op.h"
|
||||
#include "dnnlowp_op.h"
|
||||
|
||||
#ifdef _OPENMP
|
||||
#include <omp.h>
|
||||
#endif
|
||||
|
||||
#include "caffe2/core/tensor_int8.h"
|
||||
#include "caffe2/quantization/server/int8_gen_quant_params.h"
|
||||
#include "caffe2_dnnlowp_utils.h"
|
||||
|
|
@ -67,16 +63,7 @@ bool QuantizeDNNLowPOp<T>::RunOnDevice() {
|
|||
const float* in_data = Input(0).template data<float>();
|
||||
T* out_data = output->t.template mutable_data<T>();
|
||||
|
||||
#ifdef _OPENMP
|
||||
#pragma omp parallel
|
||||
#endif
|
||||
{
|
||||
int i_begin, i_end;
|
||||
tie(i_begin, i_end) = Get1DPartition(
|
||||
Input(0).numel(), dnnlowp_get_num_threads(), dnnlowp_get_thread_num());
|
||||
fbgemm::Quantize<T>(
|
||||
in_data + i_begin, out_data + i_begin, i_end - i_begin, in_qparams);
|
||||
}
|
||||
fbgemm::Quantize<T>(in_data, out_data, Input(0).numel(), in_qparams);
|
||||
|
||||
PropagateOutputTensorQuantizationParams(this, 0, in_qparams);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user