未验证 提交 4748486e 编写于 作者: T Thunderbrook 提交者: GitHub

compile for afs api (#39113)

* compile for afs api

* with pslib
上级 a7edb3f3
...@@ -333,6 +333,10 @@ else() ...@@ -333,6 +333,10 @@ else()
endif() endif()
endif() endif()
if(WITH_HETERPS AND WITH_PSLIB)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_USE_CXX11_ABI=0")
endif()
if(WITH_DISTRIBUTE) if(WITH_DISTRIBUTE)
if(LINUX) if(LINUX)
set(WITH_GLOO ON CACHE STRING "Enable GLOO when compiling WITH_DISTRIBUTE=ON." FORCE) set(WITH_GLOO ON CACHE STRING "Enable GLOO when compiling WITH_DISTRIBUTE=ON." FORCE)
......
...@@ -55,7 +55,7 @@ else() ...@@ -55,7 +55,7 @@ else()
UPDATE_COMMAND "" UPDATE_COMMAND ""
CONFIGURE_COMMAND "" CONFIGURE_COMMAND ""
BUILD_COMMAND mkdir -p ${GLOO_SOURCE_DIR}/build BUILD_COMMAND mkdir -p ${GLOO_SOURCE_DIR}/build
&& cd ${GLOO_SOURCE_DIR}/build && cmake .. && make && cd ${GLOO_SOURCE_DIR}/build && cmake .. -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} && make
&& mkdir -p ${GLOO_LIBRARY_DIR} ${GLOO_INCLUDE_DIR}/gloo && mkdir -p ${GLOO_LIBRARY_DIR} ${GLOO_INCLUDE_DIR}/gloo
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy ${GLOO_SOURCE_DIR}/build/gloo/libgloo.a ${GLOO_LIBRARY_DIR} INSTALL_COMMAND ${CMAKE_COMMAND} -E copy ${GLOO_SOURCE_DIR}/build/gloo/libgloo.a ${GLOO_LIBRARY_DIR}
COMMAND ${CMAKE_COMMAND} -E copy_directory "${GLOO_SOURCE_DIR}/gloo/" "${GLOO_INCLUDE_DIR}/gloo" COMMAND ${CMAKE_COMMAND} -E copy_directory "${GLOO_SOURCE_DIR}/gloo/" "${GLOO_INCLUDE_DIR}/gloo"
......
...@@ -202,6 +202,16 @@ if (APPLE) ...@@ -202,6 +202,16 @@ if (APPLE)
set (COMMON_FLAGS -Wno-deprecated-register) set (COMMON_FLAGS -Wno-deprecated-register)
endif(APPLE) endif(APPLE)
if(WITH_HETERPS AND WITH_PSLIB)
set(COMMON_FLAGS
-D_GLIBCXX_USE_CXX11_ABI=0
${COMMON_FLAGS})
set(GPU_COMMON_FLAGS
-D_GLIBCXX_USE_CXX11_ABI=0
${GPU_COMMON_FLAGS})
endif()
if(LINUX) if(LINUX)
set(GPU_COMMON_FLAGS set(GPU_COMMON_FLAGS
-Wall -Wall
......
...@@ -299,8 +299,10 @@ if(WITH_PSLIB) ...@@ -299,8 +299,10 @@ if(WITH_PSLIB)
include(external/leveldb) include(external/leveldb)
list(APPEND third_party_deps extern_leveldb) list(APPEND third_party_deps extern_leveldb)
include(external/brpc) if(NOT WITH_HETERPS)
list(APPEND third_party_deps extern_brpc) include(external/brpc)
list(APPEND third_party_deps extern_brpc)
endif()
endif() endif()
endif(WITH_PSLIB) endif(WITH_PSLIB)
......
...@@ -118,7 +118,9 @@ cc_test(var_type_traits_test SRCS var_type_traits_test.cc DEPS var_type_traits) ...@@ -118,7 +118,9 @@ cc_test(var_type_traits_test SRCS var_type_traits_test.cc DEPS var_type_traits)
set(BRPC_DEPS "") set(BRPC_DEPS "")
if(WITH_PSLIB OR WITH_PSCORE) if(WITH_PSLIB OR WITH_PSCORE)
set(BRPC_DEPS brpc ssl crypto) if(NOT WITH_HETERPS)
set(BRPC_DEPS brpc ssl crypto)
endif()
if(WITH_PSLIB_BRPC) if(WITH_PSLIB_BRPC)
set(BRPC_DEPS pslib_brpc) set(BRPC_DEPS pslib_brpc)
endif() endif()
......
...@@ -61,7 +61,7 @@ bool CheckValidOutput(LoDTensor* tensor, size_t batch_size); ...@@ -61,7 +61,7 @@ bool CheckValidOutput(LoDTensor* tensor, size_t batch_size);
class FleetWrapper; class FleetWrapper;
#ifdef PADDLE_WITH_PSLIB #if defined(PADDLE_WITH_PSLIB) && !defined(PADDLE_WITH_HETERPS)
class HeterWrapper; class HeterWrapper;
#endif #endif
...@@ -359,7 +359,7 @@ class DownpourWorkerOpt : public DownpourWorker { ...@@ -359,7 +359,7 @@ class DownpourWorkerOpt : public DownpourWorker {
uint64_t async_tid_ = 0; uint64_t async_tid_ = 0;
}; };
#ifdef PADDLE_WITH_PSLIB #if defined(PADDLE_WITH_PSLIB) && !defined(PADDLE_WITH_HETERPS)
class HeterCpuWorker : public HogwildWorker { class HeterCpuWorker : public HogwildWorker {
public: public:
HeterCpuWorker() {} HeterCpuWorker() {}
......
...@@ -70,7 +70,7 @@ REGISTER_DEVICE_WORKER_CLASS(DownpourWorkerOpt); ...@@ -70,7 +70,7 @@ REGISTER_DEVICE_WORKER_CLASS(DownpourWorkerOpt);
REGISTER_DEVICE_WORKER_CLASS(HeterSectionWorker); REGISTER_DEVICE_WORKER_CLASS(HeterSectionWorker);
#endif #endif
#ifdef PADDLE_WITH_PSLIB #if defined(PADDLE_WITH_PSLIB) && !defined(PADDLE_WITH_HETERPS)
REGISTER_DEVICE_WORKER_CLASS(HeterCpuWorker); REGISTER_DEVICE_WORKER_CLASS(HeterCpuWorker);
#endif #endif
......
...@@ -2,7 +2,9 @@ if(WITH_PSLIB) ...@@ -2,7 +2,9 @@ if(WITH_PSLIB)
if(WITH_PSLIB_BRPC) if(WITH_PSLIB_BRPC)
set(BRPC_DEPS pslib_brpc) set(BRPC_DEPS pslib_brpc)
else() else()
set(BRPC_DEPS brpc) if(NOT WITH_HETERPS)
set(BRPC_DEPS brpc)
endif()
endif(WITH_PSLIB_BRPC) endif(WITH_PSLIB_BRPC)
cc_library(fleet_wrapper SRCS fleet_wrapper.cc DEPS framework_proto proto_desc op_registry variable_helper scope ${BRPC_DEPS} pslib) cc_library(fleet_wrapper SRCS fleet_wrapper.cc DEPS framework_proto proto_desc op_registry variable_helper scope ${BRPC_DEPS} pslib)
else() else()
......
...@@ -27,7 +27,7 @@ See the License for the specific language governing permissions and ...@@ -27,7 +27,7 @@ See the License for the specific language governing permissions and
limitations under the License. */ limitations under the License. */
#include "paddle/fluid/framework/fleet/heter_wrapper.h" #include "paddle/fluid/framework/fleet/heter_wrapper.h"
#ifdef PADDLE_WITH_PSLIB #if defined(PADDLE_WITH_PSLIB) && !defined(PADDLE_WITH_HETERPS)
#include "paddle/fluid/framework/device_worker.h" #include "paddle/fluid/framework/device_worker.h"
namespace paddle { namespace paddle {
......
...@@ -23,7 +23,7 @@ limitations under the License. */ ...@@ -23,7 +23,7 @@ limitations under the License. */
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#ifdef PADDLE_WITH_PSLIB #if defined(PADDLE_WITH_PSLIB) && !defined(PADDLE_WITH_HETERPS)
#include "paddle/fluid/framework/heter_service.h" #include "paddle/fluid/framework/heter_service.h"
#include "paddle/fluid/framework/heter_util.h" #include "paddle/fluid/framework/heter_util.h"
#include "paddle/fluid/framework/scope.h" #include "paddle/fluid/framework/scope.h"
......
...@@ -25,7 +25,7 @@ limitations under the License. */ ...@@ -25,7 +25,7 @@ limitations under the License. */
#include "paddle/fluid/framework/heter_service.pb.h" #include "paddle/fluid/framework/heter_service.pb.h"
#include "paddle/fluid/framework/program_desc.h" #include "paddle/fluid/framework/program_desc.h"
#include "paddle/fluid/framework/scope.h" #include "paddle/fluid/framework/scope.h"
#ifdef PADDLE_WITH_PSLIB #if defined(PADDLE_WITH_PSLIB) && !defined(PADDLE_WITH_HETERPS)
#include "brpc/channel.h" #include "brpc/channel.h"
#include "brpc/controller.h" #include "brpc/controller.h"
#include "brpc/server.h" #include "brpc/server.h"
...@@ -35,7 +35,7 @@ limitations under the License. */ ...@@ -35,7 +35,7 @@ limitations under the License. */
namespace paddle { namespace paddle {
namespace framework { namespace framework {
#ifdef PADDLE_WITH_PSLIB #if defined(PADDLE_WITH_PSLIB) && !defined(PADDLE_WITH_HETERPS)
typedef std::function<int(const HeterRequest*, HeterResponse*)> typedef std::function<int(const HeterRequest*, HeterResponse*)>
HeterServiceHandler; HeterServiceHandler;
class DataFeed; class DataFeed;
......
...@@ -14,7 +14,6 @@ limitations under the License. */ ...@@ -14,7 +14,6 @@ limitations under the License. */
#pragma once #pragma once
#ifdef PADDLE_WITH_PSLIB
#include <fstream> #include <fstream>
#include <memory> #include <memory>
#include <mutex> // NOLINT #include <mutex> // NOLINT
...@@ -23,11 +22,12 @@ limitations under the License. */ ...@@ -23,11 +22,12 @@ limitations under the License. */
#include <unordered_map> // NOLINT #include <unordered_map> // NOLINT
#include <unordered_set> // NOLINT #include <unordered_set> // NOLINT
#include <vector> #include <vector>
#if defined(PADDLE_WITH_PSLIB) && !defined(PADDLE_WITH_HETERPS)
#include "bthread/bthread.h" #include "bthread/bthread.h"
#endif
#include "paddle/fluid/framework/program_desc.h" #include "paddle/fluid/framework/program_desc.h"
#include "paddle/fluid/framework/scope.h" #include "paddle/fluid/framework/scope.h"
#include "paddle/fluid/platform/timer.h" #include "paddle/fluid/platform/timer.h"
namespace paddle { namespace paddle {
namespace framework { namespace framework {
class DataFeed; class DataFeed;
...@@ -106,7 +106,7 @@ class HeterTask { ...@@ -106,7 +106,7 @@ class HeterTask {
double cpu_2_gpu_time{0}; double cpu_2_gpu_time{0};
platform::Timer timeline; platform::Timer timeline;
}; };
#endif
template <class T> template <class T>
class HeterObjectPool { class HeterObjectPool {
public: public:
...@@ -143,7 +143,7 @@ class HeterObjectPool { ...@@ -143,7 +143,7 @@ class HeterObjectPool {
int num_{0}; int num_{0};
}; };
#ifdef PADDLE_WITH_PSLIB #if defined(PADDLE_WITH_PSLIB) && !defined(PADDLE_WITH_HETERPS)
struct BthreadMutextGuard { struct BthreadMutextGuard {
BthreadMutextGuard(bthread_mutex_t* rho) { BthreadMutextGuard(bthread_mutex_t* rho) {
mutex_ = rho; mutex_ = rho;
...@@ -328,6 +328,6 @@ class HeterList { ...@@ -328,6 +328,6 @@ class HeterList {
int cap_; int cap_;
int size; int size;
}; };
#endif
} // namespace framework } // namespace framework
} // namespace paddle } // namespace paddle
#endif
...@@ -19,7 +19,7 @@ limitations under the License. */ ...@@ -19,7 +19,7 @@ limitations under the License. */
#include "paddle/fluid/platform/cpu_helper.h" #include "paddle/fluid/platform/cpu_helper.h"
#include "paddle/fluid/string/string_helper.h" #include "paddle/fluid/string/string_helper.h"
#ifdef PADDLE_WITH_PSLIB #if defined(PADDLE_WITH_PSLIB) && !defined(PADDLE_WITH_HETERPS)
#if defined _WIN32 || defined __APPLE__ #if defined _WIN32 || defined __APPLE__
#else #else
......
...@@ -24,7 +24,7 @@ limitations under the License. */ ...@@ -24,7 +24,7 @@ limitations under the License. */
#include "paddle/fluid/framework/fleet/heter_wrapper.h" #include "paddle/fluid/framework/fleet/heter_wrapper.h"
#include "paddle/fluid/framework/trainer.h" #include "paddle/fluid/framework/trainer.h"
#if (defined PADDLE_WITH_CUDA || defined PADDLE_WITH_XPU) && \ #if (defined PADDLE_WITH_CUDA || defined PADDLE_WITH_XPU) && \
(defined PADDLE_WITH_PSLIB) (defined PADDLE_WITH_PSLIB) && (!defined(PADDLE_WITH_HETERPS))
#ifdef PADDLE_WITH_CUDA #ifdef PADDLE_WITH_CUDA
#include "paddle/fluid/platform/cuda_device_guard.h" #include "paddle/fluid/platform/cuda_device_guard.h"
#endif #endif
......
...@@ -155,7 +155,7 @@ class DistMultiTrainer : public MultiTrainer { ...@@ -155,7 +155,7 @@ class DistMultiTrainer : public MultiTrainer {
#if (defined PADDLE_WITH_CUDA || defined PADDLE_WITH_HIP || \ #if (defined PADDLE_WITH_CUDA || defined PADDLE_WITH_HIP || \
defined PADDLE_WITH_XPU) && \ defined PADDLE_WITH_XPU) && \
(defined PADDLE_WITH_PSLIB) (defined PADDLE_WITH_PSLIB) && (!defined(PADDLE_WITH_HETERPS))
class HeterServiceContext { class HeterServiceContext {
public: public:
HeterServiceContext() {} HeterServiceContext() {}
......
...@@ -73,7 +73,7 @@ REGISTER_TRAINER_CLASS(HeterPipelineTrainer); ...@@ -73,7 +73,7 @@ REGISTER_TRAINER_CLASS(HeterPipelineTrainer);
#if (defined PADDLE_WITH_CUDA || defined PADDLE_WITH_HIP || \ #if (defined PADDLE_WITH_CUDA || defined PADDLE_WITH_HIP || \
defined PADDLE_WITH_XPU) && \ defined PADDLE_WITH_XPU) && \
(defined PADDLE_WITH_PSLIB) (defined PADDLE_WITH_PSLIB) && (!defined(PADDLE_WITH_HETERPS))
REGISTER_TRAINER_CLASS(HeterXpuTrainer); REGISTER_TRAINER_CLASS(HeterXpuTrainer);
#endif #endif
#if (defined PADDLE_WITH_NCCL || defined PADDLE_WITH_RCCL) && \ #if (defined PADDLE_WITH_NCCL || defined PADDLE_WITH_RCCL) && \
......
...@@ -33,7 +33,7 @@ namespace py = pybind11; ...@@ -33,7 +33,7 @@ namespace py = pybind11;
namespace paddle { namespace paddle {
namespace pybind { namespace pybind {
#ifdef PADDLE_WITH_PSLIB #if defined(PADDLE_WITH_PSLIB) && !defined(PADDLE_WITH_HETERPS)
void BindHeterWrapper(py::module* m) { void BindHeterWrapper(py::module* m) {
py::class_<framework::HeterWrapper, std::shared_ptr<framework::HeterWrapper>>( py::class_<framework::HeterWrapper, std::shared_ptr<framework::HeterWrapper>>(
*m, "Heter") *m, "Heter")
......
...@@ -22,7 +22,7 @@ namespace py = pybind11; ...@@ -22,7 +22,7 @@ namespace py = pybind11;
namespace paddle { namespace paddle {
namespace pybind { namespace pybind {
#ifdef PADDLE_WITH_PSLIB #if defined(PADDLE_WITH_PSLIB) && !defined(PADDLE_WITH_HETERPS)
void BindHeterWrapper(py::module* m); void BindHeterWrapper(py::module* m);
#endif #endif
} // namespace pybind } // namespace pybind
......
...@@ -3676,7 +3676,7 @@ All parameter, weight, gradient are variables in Paddle. ...@@ -3676,7 +3676,7 @@ All parameter, weight, gradient are variables in Paddle.
BindFleetWrapper(&m); BindFleetWrapper(&m);
BindIO(&m); BindIO(&m);
#ifdef PADDLE_WITH_PSLIB #if defined(PADDLE_WITH_PSLIB) && !defined(PADDLE_WITH_HETERPS)
BindHeterWrapper(&m); BindHeterWrapper(&m);
#endif #endif
#ifdef PADDLE_WITH_HETERPS #ifdef PADDLE_WITH_HETERPS
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册