Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
66c91911
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看板
未验证
提交
66c91911
编写于
6月 30, 2018
作者:
G
gongweibao
提交者:
GitHub
6月 30, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Improve brpccmake (#11842)
上级
28172bbb
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
63 addition
and
16 deletion
+63
-16
CMakeLists.txt
CMakeLists.txt
+13
-0
cmake/configure.cmake
cmake/configure.cmake
+4
-0
cmake/external/brpc.cmake
cmake/external/brpc.cmake
+15
-4
paddle/fluid/framework/executor.cc
paddle/fluid/framework/executor.cc
+2
-5
paddle/fluid/operators/CMakeLists.txt
paddle/fluid/operators/CMakeLists.txt
+15
-1
paddle/fluid/operators/detail/macros.h
paddle/fluid/operators/detail/macros.h
+14
-6
未找到文件。
CMakeLists.txt
浏览文件 @
66c91911
...
...
@@ -64,6 +64,7 @@ option(WITH_CONTRIB "Compile the third-party contributation" OFF)
option
(
REPLACE_ENFORCE_GLOG
"Replace PADDLE_ENFORCE with glog/CHECK for better debug."
OFF
)
option
(
WITH_ANAKIN
"Compile with Anakin library"
OFF
)
option
(
WITH_GRPC
"Use grpc as the default rpc framework"
${
WITH_DISTRIBUTE
}
)
option
(
WITH_BRPC_RDMA
"Use brpc rdma as the rpc protocal"
OFF
)
# CMAKE_BUILD_TYPE
if
(
NOT CMAKE_BUILD_TYPE
)
...
...
@@ -158,12 +159,24 @@ include(external/cares)
if
(
WITH_DISTRIBUTE
)
if
(
WITH_GRPC
)
include
(
external/grpc
)
message
(
STATUS
"Use grpc framework."
)
else
()
message
(
STATUS
"Use brpc framework."
)
include
(
external/leveldb
)
include
(
external/brpc
)
endif
()
endif
()
if
(
WITH_BRPC_RDMA
)
message
(
STATUS
"Use brpc with rdma."
)
if
(
WITH_GRPC
)
message
(
FATAL_ERROR
"Can't use grpc with brpc rdma."
)
endif
()
if
(
NOT WITH_DISTRIBUTE
)
message
(
FATAL_ERROR
"Can't use brpc rdma in no distribute env."
)
endif
()
endif
()
include
(
external/snappy
)
# download snappy
include
(
external/snappystream
)
include
(
external/threadpool
)
...
...
cmake/configure.cmake
浏览文件 @
66c91911
...
...
@@ -174,3 +174,7 @@ endif(WITH_GOLANG)
if
(
WITH_GRPC
)
add_definitions
(
-DPADDLE_WITH_GRPC
)
endif
(
WITH_GRPC
)
if
(
WITH_BRPC_RDMA
)
add_definitions
(
-DPADDLE_WITH_BRPC_RDMA
)
endif
(
WITH_BRPC_RDMA
)
cmake/external/brpc.cmake
浏览文件 @
66c91911
...
...
@@ -14,6 +14,15 @@
INCLUDE
(
ExternalProject
)
find_library
(
SSL_LIBRARY NAMES ssl
)
ADD_LIBRARY
(
ssl SHARED IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET ssl PROPERTY IMPORTED_LOCATION
${
SSL_LIBRARY
}
)
find_library
(
CRYPTO_LIBRARY NAMES crypto
)
ADD_LIBRARY
(
crypto SHARED IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET crypto PROPERTY IMPORTED_LOCATION
${
CRYPTO_LIBRARY
}
)
SET
(
BRPC_SOURCES_DIR
${
THIRD_PARTY_PATH
}
/brpc
)
SET
(
BRPC_INSTALL_DIR
${
THIRD_PARTY_PATH
}
/install/brpc
)
SET
(
BRPC_INCLUDE_DIR
"
${
BRPC_INSTALL_DIR
}
/include"
CACHE PATH
"brpc include directory."
FORCE
)
...
...
@@ -22,14 +31,14 @@ SET(BRPC_LIBRARIES "${BRPC_INSTALL_DIR}/lib/libbrpc.a" CACHE FILEPATH "brpc libr
INCLUDE_DIRECTORIES
(
${
BRPC_INCLUDE_DIR
}
)
# Reference https://stackoverflow.com/questions/45414507/pass-a-list-of-prefix-paths-to-externalproject-add-in-cmake-args
set
(
prefix_path
"
${
THIRD_PARTY_PATH
}
/install/gflags|
${
THIRD_PARTY_PATH
}
/install/leveldb|
${
THIRD_PARTY_PATH
}
/install/snappy|
${
THIRD_PARTY_PATH
}
/install/gtest|
${
THIRD_PARTY_PATH
}
/install/protobuf"
)
set
(
prefix_path
"
${
THIRD_PARTY_PATH
}
/install/gflags|
${
THIRD_PARTY_PATH
}
/install/leveldb|
${
THIRD_PARTY_PATH
}
/install/snappy|
${
THIRD_PARTY_PATH
}
/install/gtest|
${
THIRD_PARTY_PATH
}
/install/protobuf
|
${
THIRD_PARTY_PATH
}
/install/zlib
"
)
# If minimal .a is need, you can set WITH_DEBUG_SYMBOLS=OFF
ExternalProject_Add
(
extern_brpc
${
EXTERNAL_PROJECT_LOG_ARGS
}
GIT_REPOSITORY
"https://github.com/
brpc
/brpc"
GIT_TAG
"
6d153dd7ff00f960ae6895c9c5fff0ce9f07aff2
"
GIT_REPOSITORY
"https://github.com/
gongweibao
/brpc"
GIT_TAG
"
7dc04defad1fd4173aae170c3fcbde131b65155a
"
PREFIX
${
BRPC_SOURCES_DIR
}
UPDATE_COMMAND
""
CMAKE_ARGS -DCMAKE_CXX_COMPILER=
${
CMAKE_CXX_COMPILER
}
...
...
@@ -42,6 +51,8 @@ ExternalProject_Add(
-DCMAKE_BUILD_TYPE=
${
THIRD_PARTY_BUILD_TYPE
}
-DCMAKE_PREFIX_PATH=
${
prefix_path
}
-DBRPC_WITH_GLOG=ON
-DIOBUF_WITH_HUGE_BLOCK=ON
-DBRPC_WITH_RDMA=
${
WITH_BRPC_RDMA
}
${
EXTERNAL_OPTIONAL_ARGS
}
LIST_SEPARATOR |
CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=
${
BRPC_INSTALL_DIR
}
...
...
@@ -49,7 +60,7 @@ ExternalProject_Add(
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON
-DCMAKE_BUILD_TYPE:STRING=
${
THIRD_PARTY_BUILD_TYPE
}
)
ADD_DEPENDENCIES
(
extern_brpc protobuf leveldb gflags glog gtest snappy
)
ADD_DEPENDENCIES
(
extern_brpc protobuf
ssl crypto
leveldb gflags glog gtest snappy
)
ADD_LIBRARY
(
brpc STATIC IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET brpc PROPERTY IMPORTED_LOCATION
${
BRPC_LIBRARIES
}
)
ADD_DEPENDENCIES
(
brpc extern_brpc
)
...
...
paddle/fluid/framework/executor.cc
浏览文件 @
66c91911
...
...
@@ -20,9 +20,7 @@ limitations under the License. */
#include "paddle/fluid/framework/lod_tensor_array.h"
#include "paddle/fluid/framework/op_registry.h"
#include "paddle/fluid/framework/reader.h"
#ifdef PADDLE_WITH_DISTRIBUTE
#include "paddle/fluid/operators/distributed/grpc_client.h"
#endif
#include "paddle/fluid/operators/detail/macros.h"
#include "paddle/fluid/platform/place.h"
#include "paddle/fluid/platform/profiler.h"
...
...
@@ -49,8 +47,7 @@ Executor::Executor(const platform::Place& place) : place_(place) {}
#ifdef PADDLE_WITH_DISTRIBUTE
void
Executor
::
Complete
()
{
::
paddle
::
operators
::
distributed
::
RPCClient
::
GetInstance
<
::
paddle
::
operators
::
distributed
::
GRPCClient
>
()
::
paddle
::
operators
::
distributed
::
RPCClient
::
GetInstance
<
RPCCLIENT_T
>
()
->
SendComplete
();
}
#endif
...
...
paddle/fluid/operators/CMakeLists.txt
浏览文件 @
66c91911
...
...
@@ -184,6 +184,7 @@ else()
set
(
DEPS_OPS
${
DEPS_OPS
}
nccl_op
)
endif
()
set
(
DISTRIBUTE_DEPS
""
)
if
(
WITH_DISTRIBUTE
)
add_subdirectory
(
distributed
)
...
...
@@ -192,6 +193,18 @@ if(WITH_DISTRIBUTE)
set
(
DISTRIBUTE_DEPS sendrecvop_grpc grpc++_unsecure grpc_unsecure gpr cares zlib protobuf
)
else
()
set
(
DISTRIBUTE_DEPS sendrecvop_brpc brpc leveldb snappystream snappy protobuf ssl crypto zlib
)
if
(
WITH_BRPC_RDMA
)
find_library
(
IBVERBS_LIBRARY NAMES ibverbs
)
ADD_LIBRARY
(
ibverbs SHARED IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET ibverbs PROPERTY IMPORTED_LOCATION
${
IBVERBS_LIBRARY
}
)
find_library
(
RDMACM_LIBRARY NAMES rdmacm
)
ADD_LIBRARY
(
rdmacm SHARED IMPORTED GLOBAL
)
SET_PROPERTY
(
TARGET rdmacm PROPERTY IMPORTED_LOCATION
${
RDMACM_LIBRARY
}
)
set
(
DISTRIBUTE_DEPS
${
DISTRIBUTE_DEPS
}
ibverbs rdmacm
)
endif
()
endif
()
set
(
DISTRIBUTE_COMPILE_FLAGS
"-Wno-non-virtual-dtor -Wno-error=non-virtual-dtor -Wno-error=delete-non-virtual-dtor"
)
...
...
@@ -205,7 +218,7 @@ if(WITH_DISTRIBUTE)
# listen_and_serv_op sum_op executor SERIAL)
if
(
WITH_GPU
)
set_source_files_properties
(
test_send_nccl_id.cc PROPERTIES COMPILE_FLAGS
${
DISTRIBUTE_COMPILE_FLAGS
}
)
cc_test
(
test_send_nccl_id SRCS test_send_nccl_id.cc DEPS listen_and_serv_op executor SERIAL
)
cc_test
(
test_send_nccl_id SRCS test_send_nccl_id.cc DEPS listen_and_serv_op
${
DISTRIBUTE_DEPS
}
executor SERIAL
)
if
(
WITH_GRPC
)
op_library
(
gen_nccl_id_op DEPS nccl_common sendrecvop_grpc
)
else
()
...
...
@@ -297,6 +310,7 @@ foreach(src ${DETECTION_LIBRARY})
endforeach
()
set
(
GLOB_OP_LIB
${
OP_LIBRARY
}
CACHE INTERNAL
"Global OP library"
)
set
(
GLOB_DISTRIBUTE_DEPS
${
DISTRIBUTE_DEPS
}
CACHE INTERNAL
"distributed dependency"
)
cc_test
(
gather_test SRCS gather_test.cc DEPS tensor
)
cc_test
(
scatter_test SRCS scatter_test.cc DEPS tensor
)
...
...
paddle/fluid/operators/detail/macros.h
浏览文件 @
66c91911
...
...
@@ -14,14 +14,22 @@
#pragma once
#ifdef PADDLE_WITH_DISTRIBUTE
#ifdef PADDLE_WITH_GRPC
#include "paddle/fluid/operators/distributed/grpc_client.h"
#include "paddle/fluid/operators/distributed/grpc_server.h"
#define RPCSERVER_T distributed::AsyncGRPCServer
#define RPCCLIENT_T distributed::GRPCClient
#else
#define RPCSERVER_T paddle::operators::distributed::AsyncGRPCServer
#define RPCCLIENT_T paddle::operators::distributed::GRPCClient
#else // PADDLE_WITH_GRPC
#include "paddle/fluid/operators/distributed/brpc_client.h"
#include "paddle/fluid/operators/distributed/brpc_server.h"
#define RPCSERVER_T distributed::AsyncBRPCServer
#define RPCCLIENT_T distributed::BRPCClient
#endif
#define RPCSERVER_T paddle::operators::distributed::AsyncBRPCServer
#define RPCCLIENT_T paddle::operators::distributed::BRPCClient
#endif // PADDLE_WITH_GRPC
#endif // PADDLE_WITH_DISTRIBUTE
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录