From 5cc6a2584c49bf16e702a9e82cfb383f2eda88bd Mon Sep 17 00:00:00 2001 From: liuruilong Date: Tue, 3 Jul 2018 19:42:39 +0800 Subject: [PATCH] remove clang-format ios_io --- src/operators/math/pooling.cpp | 2 +- test/common/test_openmp.cpp | 2 +- tools/pre-commit.hooks/clang-format.hook | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/operators/math/pooling.cpp b/src/operators/math/pooling.cpp index 46bbd1a384..0252eae845 100644 --- a/src/operators/math/pooling.cpp +++ b/src/operators/math/pooling.cpp @@ -57,7 +57,7 @@ class PoolFunctor { T *output_data = output->mutable_data(); for (int i = 0; i < batch_size; i++) { - // #pragma omp parallel for + // #pragma omp parallel for for (int c = 0; c < output_channels; ++c) { for (int ph = 0; ph < output_height; ++ph) { int hstart = ph * stride_height - padding_height; diff --git a/test/common/test_openmp.cpp b/test/common/test_openmp.cpp index 3f22320862..790c434101 100644 --- a/test/common/test_openmp.cpp +++ b/test/common/test_openmp.cpp @@ -17,7 +17,7 @@ limitations under the License. */ int main(void) { #ifdef PADDLE_MOBILE_USE_OPENMP - //#pragma omp parallel num_threads(2) + #pragma omp parallel num_threads(2) { // int thread_id = omp_get_thread_num(); // int nthreads = omp_get_num_threads(); diff --git a/tools/pre-commit.hooks/clang-format.hook b/tools/pre-commit.hooks/clang-format.hook index 4fa4253bad..878c688ec1 100644 --- a/tools/pre-commit.hooks/clang-format.hook +++ b/tools/pre-commit.hooks/clang-format.hook @@ -14,6 +14,7 @@ fi # https://medicineyeh.wordpress.com/2017/07/13/clang-format-with-pragma/ shift -perl -i -pe 's|#pragma\s+omp|// #pragma omp|' "$@" -clang-format -i $@ +perl -i -pe 's|^\s+#pragma\s+omp|// #pragma omp|' "$@" +flist=$(echo "$@" | perl -pe 's|src/ios_io/[^ ]*||') +clang-format -i $flist perl -i -pe 's|// ||' "$@" -- GitLab