Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
fa1547ae
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
337
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
fa1547ae
编写于
6月 06, 2018
作者:
H
Haipeng Wang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix #pragma omp problem in clang-format
上级
8a0733ec
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
39 addition
and
21 deletion
+39
-21
src/common/openmp-fix.cpp
src/common/openmp-fix.cpp
+6
-6
src/operators/math/pooling.cpp
src/operators/math/pooling.cpp
+1
-1
test/common/test_openmp.cc
test/common/test_openmp.cc
+0
-12
test/common/test_openmp.cpp
test/common/test_openmp.cpp
+26
-0
tools/pre-commit.hooks/clang-format.hook
tools/pre-commit.hooks/clang-format.hook
+5
-1
tools/scripts/push2android.sh
tools/scripts/push2android.sh
+1
-1
未找到文件。
src/common/openmp-fix.c
c
→
src/common/openmp-fix.c
pp
浏览文件 @
fa1547ae
...
...
@@ -15,12 +15,12 @@ limitations under the License. */
#ifdef PADDLE_MOBILE_USE_OPENMP
/**
* android-ndk-r17 has a problem when linking with openmp.
* if paddle-mobile enables -fopenmp, but didn't use those omp_* functions,
after
*
linking another binary with libpaddle-mobile.so, the omp_get_thread_num will not work.
*
see test/common/test_openmp.cc
*
the detailed reason is still unclear, but this trick will work.
*
a better solution is hacking the linker, try some flags to make it link omp_* functions,
*
but I didn't find out how to
make it work.
* if paddle-mobile enables -fopenmp, but didn't use those omp_* functions,
*
after linking another binary with libpaddle-mobile.so, the omp_get_thread_num
*
will not work. see test/common/test_openmp.cc the detailed reason is still
*
unclear, but this trick will work. a better solution is hacking the linker,
*
try some flags to make it link omp_* functions, but I didn't find out how to
* make it work.
*/
#include <omp.h>
static
int
_
=
omp_get_num_procs
();
...
...
src/operators/math/pooling.cpp
浏览文件 @
fa1547ae
...
...
@@ -59,7 +59,7 @@ class PoolFunctor<CPU, PoolProcess, T> {
T
*
output_data
=
output
->
mutable_data
<
T
>
();
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
;
...
...
test/common/test_openmp.cc
已删除
100644 → 0
浏览文件 @
8a0733ec
#include <iostream>
#include <omp.h>
int
main
(
void
)
{
#pragma omp parallel num_threads(2)
{
int
thread_id
=
omp_get_thread_num
();
int
nthreads
=
omp_get_num_threads
();
std
::
cout
<<
"Hello, OMP "
<<
thread_id
<<
"/"
<<
nthreads
<<
"
\n
"
;
}
return
0
;
}
test/common/test_openmp.cpp
0 → 100644
浏览文件 @
fa1547ae
/* Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */
#include <omp.h>
#include <iostream>
int
main
(
void
)
{
#pragma omp parallel num_threads(2)
{
int
thread_id
=
omp_get_thread_num
();
int
nthreads
=
omp_get_num_threads
();
std
::
cout
<<
"Hello, OMP "
<<
thread_id
<<
"/"
<<
nthreads
<<
"
\n
"
;
}
return
0
;
}
tools/pre-commit.hooks/clang-format.hook
浏览文件 @
fa1547ae
...
...
@@ -12,4 +12,8 @@ if ! [[ $version == *"$VERSION"* ]]; then
exit
-1
fi
clang-format
$@
# https://medicineyeh.wordpress.com/2017/07/13/clang-format-with-pragma/
shift
perl
-i
-pe
's|#pragma\s+omp|// <TRICKY-CLANG-FORMAT-PRAGMA-FIX> #pragma omp|'
"
$@
"
clang-format
-i
$@
perl
-i
-pe
's|// <TRICKY-CLANG-FORMAT-PRAGMA-FIX> ||'
"
$@
"
tools/scripts/push2android.sh
浏览文件 @
fa1547ae
...
...
@@ -7,7 +7,7 @@ EXE_FILE="../../test/build/*"
EXE_DIR
=
"data/local/tmp/bin"
MODELS_DIR
=
"data/local/tmp/models"
IMAGES_DIR
=
"data/local/tmp/images"
LIB_PATH
=
"../build/release/arm-v7a/build/*"
LIB_PATH
=
"../
../
build/release/arm-v7a/build/*"
adb push
${
EXE_FILE
}
${
EXE_DIR
}
adb push
${
LIB_PATH
}
${
EXE_DIR
}
adb push
${
IMAGE_PATH
}
${
IMAGES_DIR
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录