Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
dc339b78
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
dc339b78
编写于
11月 12, 2018
作者:
P
peizhilin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix code style
上级
ef8a7db8
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
65 addition
and
69 deletion
+65
-69
CMakeLists.txt
CMakeLists.txt
+0
-1
cmake/external/openblas.cmake
cmake/external/openblas.cmake
+54
-53
paddle/fluid/framework/ir/attention_lstm_fuse_pass.cc
paddle/fluid/framework/ir/attention_lstm_fuse_pass.cc
+6
-6
paddle/fluid/framework/ir/pass.h
paddle/fluid/framework/ir/pass.h
+2
-2
paddle/fluid/platform/port.h
paddle/fluid/platform/port.h
+0
-4
paddle/fluid/platform/stream_callback_manager.h
paddle/fluid/platform/stream_callback_manager.h
+1
-1
paddle/fluid/platform/variant.h
paddle/fluid/platform/variant.h
+2
-2
未找到文件。
CMakeLists.txt
浏览文件 @
dc339b78
...
...
@@ -77,7 +77,6 @@ option(WITH_INFERENCE_API_TEST "Test fluid inference high-level api interface"
option
(
WITH_SYSTEM_BLAS
"Use system blas library"
OFF
)
option
(
PY_VERSION
"Compile PaddlePaddle with python3 support"
${
PY_VERSION
}
)
option
(
WITH_FAST_MATH
"Make use of fast math library, might affect the precision to some extent"
ON
)
option
(
WITH_PREBUILD_OPENBLAS
"Make use of the pre-built openblas library"
${
WIN32
}
)
# PY_VERSION
if
(
NOT PY_VERSION
)
...
...
cmake/external/openblas.cmake
浏览文件 @
dc339b78
...
...
@@ -31,65 +31,66 @@ IF(NOT ${CBLAS_FOUND})
ADD_DEFINITIONS
(
-DPADDLE_USE_OPENBLAS
)
IF
(
WI
TH_PREBUILD_OPENBLAS
)
IF
(
WI
N32
)
SET
(
CBLAS_FOUND true
)
MESSAGE
(
STATUS,
"Use prebuild openblas, please put it at "
${
CBLAS_INSTALL_DIR
}
)
ELSE
(
WITH_PREBUILD_OPENBLAS
)
SET
(
OPENBLAS_CC
"
${
CMAKE_C_COMPILER
}
-Wno-unused-but-set-variable -Wno-unused-variable"
)
SET
(
OPENBLAS_COMMIT
"v0.2.20"
)
MESSAGE
(
WARNING,
"In windows, openblas only support msvc build, please build it manually and put it at "
${
CBLAS_INSTALL_DIR
}
)
ENDIF
(
WIN32
)
IF
(
CMAKE_CROSSCOMPILING
)
SET
(
OPTIONAL_ARGS HOSTCC=
${
HOST_C_COMPILER
}
)
GET_FILENAME_COMPONENT
(
CROSS_SUFFIX
${
CMAKE_C_COMPILER
}
DIRECTORY
)
SET
(
CROSS_SUFFIX
${
CROSS_SUFFIX
}
/
)
IF
(
ANDROID
)
IF
(
ANDROID_ABI MATCHES
"^armeabi(-v7a)?$"
)
# use softfp
SET
(
OPTIONAL_ARGS
${
OPTIONAL_ARGS
}
TARGET=ARMV7 ARM_SOFTFP_ABI=1 USE_THREAD=0
)
ELSEIF
(
ANDROID_ABI STREQUAL
"arm64-v8a"
)
SET
(
OPTIONAL_ARGS
${
OPTIONAL_ARGS
}
TARGET=ARMV8 BINARY=64 USE_THREAD=0
)
ENDIF
()
ELSEIF
(
IOS
)
IF
(
CMAKE_OSX_ARCHITECTURES MATCHES
"arm64"
)
SET
(
OPENBLAS_CC
"
${
OPENBLAS_CC
}
${
CMAKE_C_FLAGS
}
-isysroot
${
CMAKE_OSX_SYSROOT
}
"
)
SET
(
OPENBLAS_CC
"
${
OPENBLAS_CC
}
-arch arm64"
)
SET
(
OPTIONAL_ARGS
${
OPTIONAL_ARGS
}
TARGET=ARMV8 BINARY=64 USE_THREAD=0 CROSS_SUFFIX=
${
CROSS_SUFFIX
}
)
ELSE
()
MESSAGE
(
FATAL_ERROR
"OpenBLAS only support arm64 architectures on iOS. "
"You can set IOS_USE_VECLIB_FOR_BLAS=ON or USE_EIGEN_FOR_BLAS=ON to use other blas library instead."
)
ENDIF
()
ELSEIF
(
RPI
)
# use hardfp
SET
(
OPTIONAL_ARGS
${
OPTIONAL_ARGS
}
TARGET=ARMV7 USE_THREAD=0
)
ENDIF
()
ELSE
()
IF
(
APPLE
)
SET
(
OPENBLAS_CC
"
${
CMAKE_C_COMPILER
}
-isysroot
${
CMAKE_OSX_SYSROOT
}
"
)
IF
(
NOT WIN32
)
SET
(
OPENBLAS_CC
"
${
CMAKE_C_COMPILER
}
-Wno-unused-but-set-variable -Wno-unused-variable"
)
SET
(
OPENBLAS_COMMIT
"v0.2.20"
)
IF
(
CMAKE_CROSSCOMPILING
)
SET
(
OPTIONAL_ARGS HOSTCC=
${
HOST_C_COMPILER
}
)
GET_FILENAME_COMPONENT
(
CROSS_SUFFIX
${
CMAKE_C_COMPILER
}
DIRECTORY
)
SET
(
CROSS_SUFFIX
${
CROSS_SUFFIX
}
/
)
IF
(
ANDROID
)
IF
(
ANDROID_ABI MATCHES
"^armeabi(-v7a)?$"
)
# use softfp
SET
(
OPTIONAL_ARGS
${
OPTIONAL_ARGS
}
TARGET=ARMV7 ARM_SOFTFP_ABI=1 USE_THREAD=0
)
ELSEIF
(
ANDROID_ABI STREQUAL
"arm64-v8a"
)
SET
(
OPTIONAL_ARGS
${
OPTIONAL_ARGS
}
TARGET=ARMV8 BINARY=64 USE_THREAD=0
)
ENDIF
()
SET
(
OPTIONAL_ARGS
""
)
IF
(
CMAKE_SYSTEM_PROCESSOR MATCHES
"^x86(_64)?$"
)
SET
(
OPTIONAL_ARGS DYNAMIC_ARCH=1 NUM_THREADS=64
)
ELSEIF
(
IOS
)
IF
(
CMAKE_OSX_ARCHITECTURES MATCHES
"arm64"
)
SET
(
OPENBLAS_CC
"
${
OPENBLAS_CC
}
${
CMAKE_C_FLAGS
}
-isysroot
${
CMAKE_OSX_SYSROOT
}
"
)
SET
(
OPENBLAS_CC
"
${
OPENBLAS_CC
}
-arch arm64"
)
SET
(
OPTIONAL_ARGS
${
OPTIONAL_ARGS
}
TARGET=ARMV8 BINARY=64 USE_THREAD=0 CROSS_SUFFIX=
${
CROSS_SUFFIX
}
)
ELSE
()
MESSAGE
(
FATAL_ERROR
"OpenBLAS only support arm64 architectures on iOS. "
"You can set IOS_USE_VECLIB_FOR_BLAS=ON or USE_EIGEN_FOR_BLAS=ON to use other blas library instead."
)
ENDIF
()
ELSEIF
(
RPI
)
# use hardfp
SET
(
OPTIONAL_ARGS
${
OPTIONAL_ARGS
}
TARGET=ARMV7 USE_THREAD=0
)
ENDIF
()
ELSE
()
IF
(
APPLE
)
SET
(
OPENBLAS_CC
"
${
CMAKE_C_COMPILER
}
-isysroot
${
CMAKE_OSX_SYSROOT
}
"
)
ENDIF
()
SET
(
OPTIONAL_ARGS
""
)
IF
(
CMAKE_SYSTEM_PROCESSOR MATCHES
"^x86(_64)?$"
)
SET
(
OPTIONAL_ARGS DYNAMIC_ARCH=1 NUM_THREADS=64
)
ENDIF
()
ENDIF
()
SET
(
COMMON_ARGS CC=
${
OPENBLAS_CC
}
NO_SHARED=1 NO_LAPACK=1 libs
)
ExternalProject_Add
(
extern_openblas
${
EXTERNAL_PROJECT_LOG_ARGS
}
# GIT_REPOSITORY https://github.com/xianyi/OpenBLAS.git
GIT_REPOSITORY http://admin@172.20.90.14:8080/r/openblas.git
# GIT_TAG ${OPENBLAS_COMMIT}
PREFIX
${
CBLAS_SOURCES_DIR
}
INSTALL_DIR
${
CBLAS_INSTALL_DIR
}
BUILD_IN_SOURCE 1
BUILD_COMMAND
${
CMAKE_MAKE_PROGRAM
}
${
COMMON_ARGS
}
${
OPTIONAL_ARGS
}
INSTALL_COMMAND
${
CMAKE_MAKE_PROGRAM
}
install NO_SHARED=1 NO_LAPACK=1 PREFIX=<INSTALL_DIR>
&& rm -r
${
CBLAS_INSTALL_DIR
}
/lib/cmake
${
CBLAS_INSTALL_DIR
}
/lib/pkgconfig
UPDATE_COMMAND
""
CONFIGURE_COMMAND
""
)
ENDIF
(
WITH_PREBUILD_OPENBLAS
)
SET
(
COMMON_ARGS CC=
${
OPENBLAS_CC
}
NO_SHARED=1 NO_LAPACK=1 libs
)
ExternalProject_Add
(
extern_openblas
${
EXTERNAL_PROJECT_LOG_ARGS
}
GIT_REPOSITORY https://github.com/xianyi/OpenBLAS.git
GIT_TAG
${
OPENBLAS_COMMIT
}
PREFIX
${
CBLAS_SOURCES_DIR
}
INSTALL_DIR
${
CBLAS_INSTALL_DIR
}
BUILD_IN_SOURCE 1
BUILD_COMMAND
${
CMAKE_MAKE_PROGRAM
}
${
COMMON_ARGS
}
${
OPTIONAL_ARGS
}
INSTALL_COMMAND
${
CMAKE_MAKE_PROGRAM
}
install NO_SHARED=1 NO_LAPACK=1 PREFIX=<INSTALL_DIR>
&& rm -r
${
CBLAS_INSTALL_DIR
}
/lib/cmake
${
CBLAS_INSTALL_DIR
}
/lib/pkgconfig
UPDATE_COMMAND
""
CONFIGURE_COMMAND
""
)
ELSE
()
ENDIF
(
NOT WIN32
)
SET
(
CBLAS_PROVIDER openblas
)
IF
(
WITH_C_API
)
INSTALL
(
DIRECTORY
${
CBLAS_INC_DIR
}
DESTINATION third_party/openblas
)
...
...
paddle/fluid/framework/ir/attention_lstm_fuse_pass.cc
浏览文件 @
dc339b78
...
...
@@ -211,12 +211,12 @@ void PrepareLSTMWeight(const LoDTensor& W_forget_w0,
VLOG
(
30
)
<<
"LSTMWeight resized to "
<<
out
->
dims
();
float
*
out_data
=
out
->
mutable_data
<
float
>
(
platform
::
CPUPlace
());
std
::
array
<
const
float
*
,
4
>
tensors
=
std
::
array
<
const
float
*
,
4
>
tensors
{
{
W_forget_w0
.
data
<
float
>
(),
W_input_w0
.
data
<
float
>
(),
W_output_w0
.
data
<
float
>
(),
W_cell_w0
.
data
<
float
>
()};
std
::
array
<
const
float
*
,
4
>
tensors1
=
W_output_w0
.
data
<
float
>
(),
W_cell_w0
.
data
<
float
>
()}
}
;
std
::
array
<
const
float
*
,
4
>
tensors1
{
{
W_forget_w1
.
data
<
float
>
(),
W_input_w1
.
data
<
float
>
(),
W_output_w1
.
data
<
float
>
(),
W_cell_w1
.
data
<
float
>
()};
W_output_w1
.
data
<
float
>
(),
W_cell_w1
.
data
<
float
>
()}
}
;
for
(
int
row
=
0
;
row
<
D
;
row
++
)
{
for
(
int
col
=
0
;
col
<
4
;
col
++
)
{
...
...
@@ -238,9 +238,9 @@ void PrepareLSTMWeight(const LoDTensor& W_forget_w0,
void
PrepareLSTMBias
(
const
LoDTensor
&
B_forget
,
const
LoDTensor
&
B_input
,
const
LoDTensor
&
B_output
,
const
LoDTensor
&
B_cell
,
LoDTensor
*
out
)
{
std
::
array
<
const
float
*
,
4
>
tensors
=
std
::
array
<
const
float
*
,
4
>
tensors
{
{
B_forget
.
data
<
float
>
(),
B_input
.
data
<
float
>
(),
B_output
.
data
<
float
>
(),
B_cell
.
data
<
float
>
()};
B_cell
.
data
<
float
>
()}
}
;
PADDLE_ENFORCE_EQ
(
B_forget
.
dims
().
size
(),
1
);
int
D
=
B_forget
.
dims
()[
0
];
...
...
paddle/fluid/framework/ir/pass.h
浏览文件 @
dc339b78
...
...
@@ -207,7 +207,7 @@ struct PassRegistrar : public Registrar {
return 0; \
} \
static ::paddle::framework::ir::PassRegistrar<pass_class> \
&__pass_tmp_registrar_##pass_type##__
__UNUSED__()
= \
&__pass_tmp_registrar_##pass_type##__
UNUSED
= \
__pass_registrar_##pass_type##__
#define USE_PASS(pass_type) \
...
...
@@ -215,7 +215,7 @@ struct PassRegistrar : public Registrar {
__use_pass_itself_##pass_type, \
"USE_PASS must be called in global namespace"); \
extern int TouchPassRegistrar_##pass_type(); \
static int use_pass_itself_##pass_type##_
__UNUSED__()
= \
static int use_pass_itself_##pass_type##_
UNUSED
= \
TouchPassRegistrar_##pass_type()
}
// namespace ir
...
...
paddle/fluid/platform/port.h
浏览文件 @
dc339b78
...
...
@@ -24,7 +24,6 @@
#include "glog/logging.h"
#if !defined(_WIN32)
#define UNUSED __attribute__((unused))
#include <dlfcn.h> // dladdr
#include <execinfo.h> // backtrace
#include <sys/stat.h>
...
...
@@ -34,9 +33,6 @@
#include <io.h> // _popen, _pclose
#include <windows.h>
#include <numeric> // std::accumulate in msvc
// windows version of __attribute__((unused))
#define UNUSED __pragma(warning(suppress : 4100))
#ifndef S_ISDIR // windows port for sys/stat.h
#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
#endif // S_ISDIR
...
...
paddle/fluid/platform/stream_callback_manager.h
浏览文件 @
dc339b78
...
...
@@ -18,8 +18,8 @@
#include <cuda_runtime.h>
#include <functional>
#include <memory>
#include "ThreadPool.h"
#include "paddle/fluid/platform/enforce.h"
#include "third_party/threadpool/src/extern_threadpool/ThreadPool.h"
namespace
paddle
{
namespace
platform
{
...
...
paddle/fluid/platform/variant.h
浏览文件 @
dc339b78
...
...
@@ -45,8 +45,8 @@ limitations under the License. */
// some platform-independent defintion
#if defined(_WIN32)
#define
__UNUSED__()
#define
UNUSED
#define __builtin_expect(EXP, C) (EXP)
#else
#define
__UNUSED__()
__attribute__((unused))
#define
UNUSED
__attribute__((unused))
#endif
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录