Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
06748210
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
06748210
编写于
7月 12, 2017
作者:
H
hedaoyuan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix some link errors about NNPACK.
上级
8681c580
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
29 addition
and
12 deletion
+29
-12
CMakeLists.txt
CMakeLists.txt
+2
-1
cmake/external/nnpack.cmake
cmake/external/nnpack.cmake
+14
-0
paddle/function/CMakeLists.txt
paddle/function/CMakeLists.txt
+0
-1
paddle/function/nnpack/NNPACKConvOp.cpp
paddle/function/nnpack/NNPACKConvOp.cpp
+13
-10
未找到文件。
CMakeLists.txt
浏览文件 @
06748210
...
...
@@ -135,7 +135,8 @@ if(WITH_GPU)
endif
(
WITH_GPU
)
if
(
USE_NNPACK
)
list
(
APPEND EXTERNAL_LIBS
${
NNPACK_LIB
}
${
PTHREADPOOL_LIB
}
"rt"
)
include
(
external/nnpack
)
list
(
APPEND EXTERNAL_LIBS
${
NNPACK_LIBS
}
)
endif
(
USE_NNPACK
)
add_subdirectory
(
proto
)
...
...
paddle/function/nnpack
/nnpack.cmake
→
cmake/external
/nnpack.cmake
浏览文件 @
06748210
...
...
@@ -7,10 +7,24 @@ set(NNPACK_ROOT $ENV{NNPACK_ROOT} CACHE PATH "Folder contains NNPACK")
find_path
(
NNPACK_INC_DIR nnpack.h PATHS
${
NNPACK_ROOT
}
/include
)
find_library
(
NNPACK_LIB NAMES nnpack PATHS
${
NNPACK_ROOT
}
/lib
)
find_library
(
PTHREADPOOL_LIB NAMES pthreadpool PATHS
${
NNPACK_ROOT
}
/lib
)
find_library
(
NNPACK_UKERNELS_LIB NAMES nnpack_ukernels PATHS
${
NNPACK_ROOT
}
/lib
)
find_library
(
NNPACK_CPUFEATURES_LIB NAMES cpufeatures PATHS
${
NNPACK_ROOT
}
/lib
)
if
(
NNPACK_INC_DIR AND NNPACK_LIB AND PTHREADPOOL_LIB
)
set
(
NNPACK_FOUND ON
)
INCLUDE_DIRECTORIES
(
${
NNPACK_INC_DIR
}
)
set
(
NNPACK_LIBS
)
list
(
APPEND NNPACK_LIBS
${
NNPACK_LIB
}
${
PTHREADPOOL_LIB
}
)
if
(
NNPACK_UKERNELS_LIB
)
list
(
APPEND NNPACK_LIBS
${
NNPACK_UKERNELS_LIB
}
)
endif
()
if
(
NNPACK_CPUFEATURES_LIB
)
list
(
APPEND NNPACK_LIBS
${
NNPACK_CPUFEATURES_LIB
}
)
endif
()
if
(
NOT ANDROID
)
list
(
APPEND NNPACK_LIBS
"rt"
)
endif
()
else
()
message
(
FATAL_ERROR
"Cannot find NNPACK in (
${
NNPACK_ROOT
}
)"
)
endif
()
paddle/function/CMakeLists.txt
浏览文件 @
06748210
...
...
@@ -11,7 +11,6 @@ if(WITH_GPU)
endif
()
if
(
USE_NNPACK
)
include
(
nnpack/nnpack.cmake
)
list
(
APPEND cpp_files nnpack/NNPACKConvOp.cpp
)
if
(
WITH_TESTING
)
add_unittest
(
NNPACKConvOpTest nnpack/NNPACKConvOpTest.cpp
)
...
...
paddle/function/nnpack/NNPACKConvOp.cpp
浏览文件 @
06748210
...
...
@@ -58,18 +58,10 @@ public:
workspaceBuffer_
=
nullptr
;
workspaceSize_
=
0
;
threadpool_
=
nullptr
;
if
(
FLAGS_nnpack_num_threads
)
{
threadpool_
=
pthreadpool_create
(
FLAGS_nnpack_num_threads
);
VLOG
(
3
)
<<
"Number of threads "
<<
pthreadpool_get_threads_count
(
threadpool_
);
}
create_nnpack_threadpool
();
}
~
NNPACKConvFunction
()
{
if
(
threadpool_
)
{
pthreadpool_destroy
(
threadpool_
);
}
if
(
workspaceBuffer_
)
{
free
(
workspaceBuffer_
);
}
...
...
@@ -225,14 +217,25 @@ public:
}
}
static
void
create_nnpack_threadpool
()
{
if
(
FLAGS_nnpack_num_threads
&&
threadpool_
==
nullptr
)
{
threadpool_
=
pthreadpool_create
(
FLAGS_nnpack_num_threads
);
VLOG
(
3
)
<<
"Number of threads "
<<
pthreadpool_get_threads_count
(
threadpool_
);
}
}
private:
nnp_convolution_algorithm
algorithm_
;
nnp_convolution_transform_strategy
transform_strategy_
;
void
*
workspaceBuffer_
;
size_t
workspaceSize_
;
pthreadpool_t
threadpool_
;
static
pthreadpool_t
threadpool_
;
};
template
<
DeviceType
Device
>
pthreadpool_t
NNPACKConvFunction
<
Device
>::
threadpool_
=
nullptr
;
REGISTER_TYPED_FUNC
(
NNPACKConv
,
CPU
,
NNPACKConvFunction
);
}
// namespace paddle
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录