Skip to content

Commit b0cbcca

Browse files
Merge pull request #9 from PaddlePaddle/develop
update
2 parents 9ddf5e8 + e8d6ff5 commit b0cbcca

File tree

304 files changed

+8065
-3790
lines changed

Some content is hidden

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

304 files changed

+8065
-3790
lines changed

cmake/external/boost.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ ExternalProject_Add(
4646
${BOOST_PROJECT}
4747
${EXTERNAL_PROJECT_LOG_ARGS}
4848
"${BOOST_DOWNLOAD_CMD}"
49+
URL_MD5 f891e8c2c9424f0565f0129ad9ab4aff
4950
PREFIX ${BOOST_PREFIX_DIR}
5051
DOWNLOAD_DIR ${BOOST_SOURCE_DIR}
5152
SOURCE_DIR ${BOOST_SOURCE_DIR}

cmake/external/mkldnn.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ if(WIN32)
110110
add_custom_command(TARGET ${MKLDNN_PROJECT} POST_BUILD VERBATIM
111111
COMMAND echo EXPORTS >> ${MKLDNN_INSTALL_DIR}/bin/mkldnn.def)
112112
add_custom_command(TARGET ${MKLDNN_PROJECT} POST_BUILD VERBATIM
113-
COMMAND for /f "skip=19 tokens=4" %A in (${MKLDNN_INSTALL_DIR}/bin/exports.txt) do echo %A >> ${MKLDNN_INSTALL_DIR}/bin/mkldnn.def)
113+
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)
114114
add_custom_command(TARGET ${MKLDNN_PROJECT} POST_BUILD VERBATIM
115115
COMMAND lib /def:${MKLDNN_INSTALL_DIR}/bin/mkldnn.def /out:${MKLDNN_INSTALL_DIR}/bin/mkldnn.lib /machine:x64)
116116
else(WIN32)

cmake/external/mklml.cmake

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH}" "${MKLML_ROOT}/lib")
2424
IF(WIN32)
2525
SET(MKLML_VER "mklml_win_2019.0.5.20190502" CACHE STRING "" FORCE)
2626
SET(MKLML_URL "https://paddlepaddledeps.bj.bcebos.com/${MKLML_VER}.zip" CACHE STRING "" FORCE)
27+
SET(MKLML_URL_MD5 ff8c5237570f03eea37377ccfc95a08a)
2728
SET(MKLML_LIB ${MKLML_LIB_DIR}/mklml.lib)
2829
SET(MKLML_IOMP_LIB ${MKLML_LIB_DIR}/libiomp5md.lib)
2930
SET(MKLML_SHARED_LIB ${MKLML_LIB_DIR}/mklml.dll)
@@ -33,6 +34,7 @@ ELSE()
3334
# Now enable csrmm function in mklml library temporarily, it will be updated as offical version later.
3435
SET(MKLML_VER "csrmm_mklml_lnx_2019.0.5" CACHE STRING "" FORCE)
3536
SET(MKLML_URL "http://paddlepaddledeps.bj.bcebos.com/${MKLML_VER}.tgz" CACHE STRING "" FORCE)
37+
SET(MKLML_URL_MD5 bc6a7faea6a2a9ad31752386f3ae87da)
3638
SET(MKLML_LIB ${MKLML_LIB_DIR}/libmklml_intel.so)
3739
SET(MKLML_IOMP_LIB ${MKLML_LIB_DIR}/libiomp5.so)
3840
SET(MKLML_SHARED_LIB ${MKLML_LIB_DIR}/libmklml_intel.so)
@@ -52,6 +54,7 @@ ExternalProject_Add(
5254
${MKLML_PROJECT}
5355
${EXTERNAL_PROJECT_LOG_ARGS}
5456
"${MKLML_DOWNLOAD_CMD}"
57+
URL_MD5 ${MKLML_URL_MD5}
5558
PREFIX ${MKLML_PREFIX_DIR}
5659
DOWNLOAD_DIR ${MKLML_SOURCE_DIR}
5760
SOURCE_DIR ${MKLML_SOURCE_DIR}

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: 7 additions & 10 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
@@ -193,10 +193,7 @@ copy(inference_lib_dist
193193
SRCS ${PADDLE_SOURCE_DIR}/paddle/fluid/extension/include/*
194194
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/)
195195
copy(inference_lib_dist
196-
SRCS ${PADDLE_SOURCE_DIR}/paddle/fluid/platform/complex64.h
197-
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/)
198-
copy(inference_lib_dist
199-
SRCS ${PADDLE_SOURCE_DIR}/paddle/fluid/platform/complex128.h
196+
SRCS ${PADDLE_SOURCE_DIR}/paddle/fluid/platform/complex.h
200197
DSTS ${PADDLE_INFERENCE_INSTALL_DIR}/paddle/include/experimental/)
201198
copy(inference_lib_dist
202199
SRCS ${PADDLE_SOURCE_DIR}/paddle/fluid/platform/float16.h
@@ -259,7 +256,7 @@ copy(fluid_lib_dist
259256
set(module "platform")
260257
set(platform_lib_deps profiler_proto error_codes_proto)
261258
if(WITH_GPU)
262-
set(platform_lib_deps ${platform_lib_deps} cuda_error_proto)
259+
set(platform_lib_deps ${platform_lib_deps} external_error_proto)
263260
endif(WITH_GPU)
264261

265262
add_dependencies(fluid_lib_dist ${platform_lib_deps})

cmake/third_party.cmake

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,19 @@ ENDMACRO()
108108
# 2. NAME: The name of file, that determin the dirname
109109
#
110110
FUNCTION(file_download_and_uncompress URL NAME)
111-
MESSAGE(STATUS "Download dependence[${NAME}] from ${URL}")
111+
set(options "")
112+
set(oneValueArgs MD5)
113+
set(multiValueArgs "")
114+
cmake_parse_arguments(URL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
115+
MESSAGE(STATUS "Download dependence[${NAME}] from ${URL}, MD5: ${URL_MD5}")
112116
SET(${NAME}_INCLUDE_DIR ${THIRD_PARTY_PATH}/${NAME}/data PARENT_SCOPE)
113117
ExternalProject_Add(
114-
extern_download_${NAME}
118+
download_${NAME}
115119
${EXTERNAL_PROJECT_LOG_ARGS}
116120
PREFIX ${THIRD_PARTY_PATH}/${NAME}
117121
URL ${URL}
122+
URL_MD5 ${URL_MD5}
123+
TIMEOUT 120
118124
DOWNLOAD_DIR ${THIRD_PARTY_PATH}/${NAME}/data/
119125
SOURCE_DIR ${THIRD_PARTY_PATH}/${NAME}/data/
120126
DOWNLOAD_NO_PROGRESS 1
@@ -123,7 +129,7 @@ FUNCTION(file_download_and_uncompress URL NAME)
123129
UPDATE_COMMAND ""
124130
INSTALL_COMMAND ""
125131
)
126-
set(third_party_deps ${third_party_deps} extern_download_${NAME} PARENT_SCOPE)
132+
set(third_party_deps ${third_party_deps} download_${NAME} PARENT_SCOPE)
127133
ENDFUNCTION()
128134

129135

@@ -242,8 +248,20 @@ if(WITH_GPU)
242248
include(external/cub) # download cub
243249
list(APPEND third_party_deps extern_cub)
244250
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
251+
set(URL "https://paddlepaddledeps.bj.bcebos.com/externalErrorMsg.tar.gz" CACHE STRING "" FORCE)
252+
file_download_and_uncompress(${URL} "externalError" MD5 c0749523ebb536eb7382487d645d9cd4) # download file externalErrorMsg.tar.gz
253+
if(WITH_TESTING)
254+
# copy externalErrorMsg.pb for unittest 'enforce_test'
255+
set(SRC_DIR ${THIRD_PARTY_PATH}/externalError/data)
256+
if(WIN32 AND (NOT "${CMAKE_GENERATOR}" STREQUAL "Ninja"))
257+
set(DST_DIR ${CMAKE_BINARY_DIR}/paddle/fluid/third_party/externalError/data)
258+
else()
259+
set(DST_DIR ${CMAKE_BINARY_DIR}/paddle/third_party/externalError/data)
260+
endif()
261+
add_custom_command(TARGET download_externalError POST_BUILD
262+
COMMAND ${CMAKE_COMMAND} -E copy_directory ${SRC_DIR} ${DST_DIR}
263+
COMMENT "copy_directory from ${SRC_DIR} to ${DST_DIR}")
264+
endif()
247265
endif(WITH_GPU)
248266

249267
if(WITH_XPU)
@@ -304,6 +322,11 @@ if (WITH_PSCORE)
304322

305323
include(external/libmct) # download, build, install libmct
306324
list(APPEND third_party_deps extern_libmct)
325+
326+
if (WITH_HETERPS)
327+
include(external/rocksdb) # download, build, install libmct
328+
list(APPEND third_party_deps extern_rocksdb)
329+
endif()
307330
endif()
308331

309332
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);

0 commit comments

Comments
 (0)