Skip to content

Commit 470add1

Browse files
committed
Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into develop
2 parents 78edfac + e587853 commit 470add1

File tree

241 files changed

+5985
-2196
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

241 files changed

+5985
-2196
lines changed

cmake/external/mkldnn.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ if(WIN32)
108108
add_custom_command(TARGET ${MKLDNN_PROJECT} POST_BUILD VERBATIM
109109
COMMAND echo EXPORTS >> ${MKLDNN_INSTALL_DIR}/bin/mkldnn.def)
110110
add_custom_command(TARGET ${MKLDNN_PROJECT} POST_BUILD VERBATIM
111-
COMMAND for /f "skip=19 tokens=4" %A in (${MKLDNN_INSTALL_DIR}/bin/exports.txt) do echo %A >> ${MKLDNN_INSTALL_DIR}/bin/mkldnn.def)
111+
COMMAND echo off &&(for /f "skip=19 tokens=4" %A in (${MKLDNN_INSTALL_DIR}/bin/exports.txt) do echo %A >> ${MKLDNN_INSTALL_DIR}/bin/mkldnn.def)&& echo on)
112112
add_custom_command(TARGET ${MKLDNN_PROJECT} POST_BUILD VERBATIM
113113
COMMAND lib /def:${MKLDNN_INSTALL_DIR}/bin/mkldnn.def /out:${MKLDNN_INSTALL_DIR}/bin/mkldnn.lib /machine:x64)
114114
else(WIN32)

cmake/external/mklml.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ cache_third_party(${MKLML_PROJECT}
5151
# Ninja Generator can not establish the correct dependency relationship between the imported library with target,
5252
# the product file in the ExternalProject need to be specified manually, please refer to
5353
# https://stackoverflow.com/questions/54866067/cmake-and-ninja-missing-and-no-known-rule-to-make-it
54-
# It is the same to other ExternalProject.
54+
# It is the same to all other ExternalProject.
5555
ExternalProject_Add(
5656
${MKLML_PROJECT}
5757
${EXTERNAL_PROJECT_LOG_ARGS}

cmake/external/rocksdb.cmake

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
INCLUDE(ExternalProject)
16+
17+
SET(ROCKSDB_SOURCES_DIR ${THIRD_PARTY_PATH}/rocksdb)
18+
SET(ROCKSDB_INSTALL_DIR ${THIRD_PARTY_PATH}/install/rocksdb)
19+
SET(ROCKSDB_INCLUDE_DIR "${ROCKSDB_INSTALL_DIR}/include" CACHE PATH "rocksdb include directory." FORCE)
20+
SET(ROCKSDB_LIBRARIES "${ROCKSDB_INSTALL_DIR}/lib/librocksdb.a" CACHE FILEPATH "rocksdb library." FORCE)
21+
SET(ROCKSDB_CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
22+
INCLUDE_DIRECTORIES(${ROCKSDB_INCLUDE_DIR})
23+
24+
ExternalProject_Add(
25+
extern_rocksdb
26+
${EXTERNAL_PROJECT_LOG_ARGS}
27+
PREFIX ${ROCKSDB_SOURCES_DIR}
28+
GIT_REPOSITORY "https://github.com/facebook/rocksdb"
29+
GIT_TAG v6.10.1
30+
UPDATE_COMMAND ""
31+
CMAKE_ARGS -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
32+
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
33+
-DWITH_BZ2=OFF
34+
-DWITH_GFLAGS=OFF
35+
-DCMAKE_CXX_FLAGS=${ROCKSDB_CMAKE_CXX_FLAGS}
36+
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
37+
# BUILD_BYPRODUCTS ${ROCKSDB_SOURCES_DIR}/src/extern_rocksdb/librocksdb.a
38+
INSTALL_COMMAND mkdir -p ${ROCKSDB_INSTALL_DIR}/lib/
39+
&& cp ${ROCKSDB_SOURCES_DIR}/src/extern_rocksdb/librocksdb.a ${ROCKSDB_LIBRARIES}
40+
&& cp -r ${ROCKSDB_SOURCES_DIR}/src/extern_rocksdb/include ${ROCKSDB_INSTALL_DIR}/
41+
BUILD_IN_SOURCE 1
42+
)
43+
44+
ADD_DEPENDENCIES(extern_rocksdb snappy)
45+
46+
ADD_LIBRARY(rocksdb STATIC IMPORTED GLOBAL)
47+
SET_PROPERTY(TARGET rocksdb PROPERTY IMPORTED_LOCATION ${ROCKSDB_LIBRARIES})
48+
ADD_DEPENDENCIES(rocksdb extern_rocksdb)
49+
50+
LIST(APPEND external_project_dependencies rocksdb)
51+

cmake/external/warpctc.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ SET(WARPCTC_INSTALL_DIR ${THIRD_PARTY_PATH}/install/warpctc)
2424
# in case of low internet speed
2525
#set(WARPCTC_REPOSITORY https://gitee.com/tianjianhe/warp-ctc.git)
2626
set(WARPCTC_REPOSITORY ${GIT_URL}/baidu-research/warp-ctc.git)
27-
set(WARPCTC_TAG c690fc5755abbdbdc98ef78d51ec10a6748a8cd1)
27+
set(WARPCTC_TAG 37ece0e1bbe8a0019a63ac7e6462c36591c66a5b)
2828

2929
SET(WARPCTC_INCLUDE_DIR "${WARPCTC_INSTALL_DIR}/include"
3030
CACHE PATH "Warp-ctc Directory" FORCE)

cmake/inference_lib.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,12 @@ copy(inference_lib_dist
146146
SRCS ${THREADPOOL_INCLUDE_DIR}/ThreadPool.h
147147
DSTS ${dst_dir})
148148

149-
# Only GPU need cudaErrorMessage.pb
149+
# GPU must copy externalErrorMsg.pb
150150
IF(WITH_GPU)
151-
set(dst_dir "${PADDLE_INFERENCE_INSTALL_DIR}/third_party/cudaerror/data")
152-
copy(inference_lib_dist
153-
SRCS ${cudaerror_INCLUDE_DIR}
154-
DSTS ${dst_dir})
151+
set(dst_dir "${PADDLE_INFERENCE_INSTALL_DIR}/third_party/externalError/data")
152+
copy(inference_lib_dist
153+
SRCS ${externalError_INCLUDE_DIR}
154+
DSTS ${dst_dir})
155155
ENDIF()
156156

157157
# CMakeCache Info
@@ -259,7 +259,7 @@ copy(fluid_lib_dist
259259
set(module "platform")
260260
set(platform_lib_deps profiler_proto error_codes_proto)
261261
if(WITH_GPU)
262-
set(platform_lib_deps ${platform_lib_deps} cuda_error_proto)
262+
set(platform_lib_deps ${platform_lib_deps} external_error_proto)
263263
endif(WITH_GPU)
264264

265265
add_dependencies(fluid_lib_dist ${platform_lib_deps})

cmake/third_party.cmake

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,11 @@ FUNCTION(file_download_and_uncompress URL NAME)
111111
MESSAGE(STATUS "Download dependence[${NAME}] from ${URL}")
112112
SET(${NAME}_INCLUDE_DIR ${THIRD_PARTY_PATH}/${NAME}/data PARENT_SCOPE)
113113
ExternalProject_Add(
114-
extern_download_${NAME}
114+
download_${NAME}
115115
${EXTERNAL_PROJECT_LOG_ARGS}
116116
PREFIX ${THIRD_PARTY_PATH}/${NAME}
117117
URL ${URL}
118+
TIMEOUT 120
118119
DOWNLOAD_DIR ${THIRD_PARTY_PATH}/${NAME}/data/
119120
SOURCE_DIR ${THIRD_PARTY_PATH}/${NAME}/data/
120121
DOWNLOAD_NO_PROGRESS 1
@@ -123,7 +124,7 @@ FUNCTION(file_download_and_uncompress URL NAME)
123124
UPDATE_COMMAND ""
124125
INSTALL_COMMAND ""
125126
)
126-
set(third_party_deps ${third_party_deps} extern_download_${NAME} PARENT_SCOPE)
127+
set(third_party_deps ${third_party_deps} download_${NAME} PARENT_SCOPE)
127128
ENDFUNCTION()
128129

129130

@@ -242,8 +243,20 @@ if(WITH_GPU)
242243
include(external/cub) # download cub
243244
list(APPEND third_party_deps extern_cub)
244245
endif()
245-
set(CUDAERROR_URL "http://paddlepaddledeps.bj.bcebos.com/cudaErrorMessage.tar.gz" CACHE STRING "" FORCE)
246-
file_download_and_uncompress(${CUDAERROR_URL} "cudaerror") # download file cudaErrorMessage
246+
set(URL "https://paddlepaddledeps.bj.bcebos.com/externalErrorMsg.tar.gz" CACHE STRING "" FORCE)
247+
file_download_and_uncompress(${URL} "externalError") # download file externalErrorMsg.tar.gz
248+
if(WITH_TESTING)
249+
# copy externalErrorMsg.pb for unittest 'enforce_test'
250+
set(SRC_DIR ${THIRD_PARTY_PATH}/externalError/data)
251+
if(WIN32 AND (NOT "${CMAKE_GENERATOR}" STREQUAL "Ninja"))
252+
set(DST_DIR ${CMAKE_BINARY_DIR}/paddle/fluid/third_party/externalError/data)
253+
else()
254+
set(DST_DIR ${CMAKE_BINARY_DIR}/paddle/third_party/externalError/data)
255+
endif()
256+
add_custom_command(TARGET download_externalError POST_BUILD
257+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${SRC_DIR} ${DST_DIR}
258+
COMMENT "copy_directory from ${SRC_DIR} to ${DST_DIR}")
259+
endif()
247260
endif(WITH_GPU)
248261

249262
if(WITH_XPU)
@@ -304,6 +317,11 @@ if (WITH_PSCORE)
304317

305318
include(external/libmct) # download, build, install libmct
306319
list(APPEND third_party_deps extern_libmct)
320+
321+
if (WITH_HETERPS)
322+
include(external/rocksdb) # download, build, install libmct
323+
list(APPEND third_party_deps extern_rocksdb)
324+
endif()
307325
endif()
308326

309327
if(WITH_XBYAK)

paddle/fluid/distributed/fleet.cc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,10 @@ void FleetWrapper::PushSparseFromTensorWithLabelAsync(
417417
return;
418418
}
419419

420-
void FleetWrapper::LoadModel(const std::string& path, const int mode) {
421-
auto ret = pserver_ptr_->_worker_ptr->load(path, std::to_string(mode));
420+
void FleetWrapper::LoadModel(const std::string& path, const std::string& mode) {
421+
auto* communicator = Communicator::GetInstance();
422+
auto ret = communicator->_worker_ptr->load(path, mode);
423+
// auto ret = pserver_ptr_->_worker_ptr->load(path, std::to_string(mode));
422424
ret.wait();
423425
if (ret.get() != 0) {
424426
LOG(ERROR) << "load model from path:" << path << " failed";
@@ -429,8 +431,11 @@ void FleetWrapper::LoadModel(const std::string& path, const int mode) {
429431

430432
void FleetWrapper::LoadModelOneTable(const uint64_t table_id,
431433
const std::string& path, const int mode) {
434+
auto* communicator = Communicator::GetInstance();
432435
auto ret =
433-
pserver_ptr_->_worker_ptr->load(table_id, path, std::to_string(mode));
436+
communicator->_worker_ptr->load(table_id, path, std::to_string(mode));
437+
// auto ret =
438+
// pserver_ptr_->_worker_ptr->load(table_id, path, std::to_string(mode));
434439
ret.wait();
435440
if (ret.get() != 0) {
436441
LOG(ERROR) << "load model of table id: " << table_id

paddle/fluid/distributed/fleet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ class FleetWrapper {
200200
void PrintTableStat(const uint64_t table_id);
201201
// mode = 0, load all feature
202202
// mode = 1, load delta feature, which means load diff
203-
void LoadModel(const std::string& path, const int mode);
203+
void LoadModel(const std::string& path, const std::string& mode);
204204
// mode = 0, load all feature
205205
// mode = 1, load delta feature, which means load diff
206206
void LoadModelOneTable(const uint64_t table_id, const std::string& path,

paddle/fluid/distributed/service/ps_local_client.cc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ ::std::future<int32_t> PsLocalClient::shrink(uint32_t table_id,
4242
::std::future<int32_t> PsLocalClient::load(const std::string& epoch,
4343
const std::string& mode) {
4444
// TODO
45-
// for (auto& it : _table_map) {
46-
// load(it.first, epoch, mode);
47-
//}
45+
for (auto& it : _table_map) {
46+
load(it.first, epoch, mode);
47+
}
4848
return done();
4949
}
5050
::std::future<int32_t> PsLocalClient::load(uint32_t table_id,
5151
const std::string& epoch,
5252
const std::string& mode) {
5353
// TODO
54-
// auto* table_ptr = table(table_id);
55-
// table_ptr->load(epoch, mode);
54+
auto* table_ptr = table(table_id);
55+
table_ptr->load(epoch, mode);
5656
return done();
5757
}
5858

@@ -245,7 +245,6 @@ ::std::future<int32_t> PsLocalClient::pull_sparse_ptr(char** select_values,
245245
::std::future<int32_t> PsLocalClient::push_sparse_raw_gradient(
246246
size_t table_id, const uint64_t* keys, const float** update_values,
247247
size_t num, void* callback) {
248-
VLOG(1) << "wxx push_sparse_raw_gradient";
249248
PSClientClosure* closure = reinterpret_cast<PSClientClosure*>(callback);
250249
auto* accessor = table_accessor(table_id);
251250
auto* table_ptr = table(table_id);

paddle/fluid/distributed/service/ps_local_server.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,14 @@ class PsLocalServer : public PSServer {
2626
PsLocalServer() {}
2727
virtual ~PsLocalServer() {}
2828
virtual uint64_t start() { return 0; }
29-
virtual uint64_t start(const std::string& ip, uint32_t port) { return 0; }
29+
virtual uint64_t start(const std::string &ip, uint32_t port) { return 0; }
3030
virtual int32_t stop() { return 0; }
3131
virtual int32_t port() { return 0; }
32+
virtual int32_t configure(
33+
const PSParameter &config, PSEnvironment &env, size_t server_rank,
34+
const std::vector<framework::ProgramDesc> &server_sub_program = {}) {
35+
return 0;
36+
}
3237

3338
private:
3439
virtual int32_t initialize() { return 0; }

0 commit comments

Comments
 (0)