提交 9e13b68f 编写于 作者: Q qiaolongfei

refine code

上级 b101aaca
...@@ -47,7 +47,7 @@ option(WITH_COVERAGE "Compile PaddlePaddle with code coverage" OFF) ...@@ -47,7 +47,7 @@ option(WITH_COVERAGE "Compile PaddlePaddle with code coverage" OFF)
option(COVERALLS_UPLOAD "Package code coverage data to coveralls" OFF) option(COVERALLS_UPLOAD "Package code coverage data to coveralls" OFF)
option(ON_TRAVIS "Exclude special unit test on Travis CI" OFF) option(ON_TRAVIS "Exclude special unit test on Travis CI" OFF)
option(WITH_C_API "Compile PaddlePaddle with C-API(Prediction)" OFF) option(WITH_C_API "Compile PaddlePaddle with C-API(Prediction)" OFF)
option(WITH_Go "Compile PaddlePaddle with Go)" OFF) option(WITH_GOLANG "Compile PaddlePaddle with GOLANG" OFF)
# CMAKE_BUILD_TYPE # CMAKE_BUILD_TYPE
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
...@@ -108,7 +108,7 @@ include(configure) # add paddle env configuration ...@@ -108,7 +108,7 @@ include(configure) # add paddle env configuration
include_directories("${PROJ_ROOT}") include_directories("${PROJ_ROOT}")
include_directories("${PROJ_ROOT}/paddle/cuda/include") include_directories("${PROJ_ROOT}/paddle/cuda/include")
include_directories("${CMAKE_CURRENT_BINARY_DIR}/proto") include_directories("${CMAKE_CURRENT_BINARY_DIR}/proto")
include_directories("${CMAKE_BINARY_DIR}/go/pserver/cclient") include_directories("${CMAKE_CURRENT_BINARY_DIR}/go/pserver/cclient")
set(EXTERNAL_LIBS set(EXTERNAL_LIBS
${GFLAGS_LIBRARIES} ${GFLAGS_LIBRARIES}
...@@ -130,10 +130,10 @@ add_subdirectory(proto) ...@@ -130,10 +130,10 @@ add_subdirectory(proto)
add_subdirectory(paddle) add_subdirectory(paddle)
add_subdirectory(python) add_subdirectory(python)
if(WITH_Go) if(WITH_GOLANG)
#add_subdirectory(go/pserver/cclient) #TODO (add go/master/c back when fixed)
add_subdirectory(go/master/c) add_subdirectory(go/pserver/cclient)
endif(WITH_Go) endif(WITH_GOLANG)
if(WITH_DOC) if(WITH_DOC)
add_subdirectory(doc) add_subdirectory(doc)
......
...@@ -40,9 +40,9 @@ if(NOT CMAKE_CROSSCOMPILING) ...@@ -40,9 +40,9 @@ if(NOT CMAKE_CROSSCOMPILING)
endif() endif()
endif() endif()
if(NOT WITH_Go) if(NOT WITH_GOLANG)
add_definitions(-DPADDLE_WITHOUT_GO) add_definitions(-DPADDLE_WITHOUT_GOLANG)
endif() endif(NOT WITH_GOLANG)
if(NOT WITH_GPU) if(NOT WITH_GPU)
add_definitions(-DPADDLE_ONLY_CPU) add_definitions(-DPADDLE_ONLY_CPU)
......
...@@ -10,8 +10,7 @@ function(GO_LIBRARY NAME BUILD_TYPE) ...@@ -10,8 +10,7 @@ function(GO_LIBRARY NAME BUILD_TYPE)
else() else()
set(BUILD_MODE -buildmode=c-shared) set(BUILD_MODE -buildmode=c-shared)
if(APPLE) if(APPLE)
# set(LIB_NAME "lib${NAME}.dylib") set(LIB_NAME "lib${NAME}.dylib")
set(LIB_NAME "lib${NAME}.so")
else() else()
set(LIB_NAME "lib${NAME}.so") set(LIB_NAME "lib${NAME}.so")
endif() endif()
......
...@@ -842,7 +842,8 @@ public: ...@@ -842,7 +842,8 @@ public:
int passCount, int passCount,
bool useSparseUpdater); bool useSparseUpdater);
static ParameterUpdater* createNewRemoteUpdater( static ParameterUpdater* createNewRemoteUpdater(
OptimizationConfig* config, const std::string pserverSpec) throw(UnsupportError); OptimizationConfig* config,
const std::string pserverSpec) throw(UnsupportError);
~ParameterUpdater(); ~ParameterUpdater();
/** /**
......
...@@ -15,7 +15,7 @@ limitations under the License. */ ...@@ -15,7 +15,7 @@ limitations under the License. */
#include "PaddleAPI.h" #include "PaddleAPI.h"
#include "PaddleAPIPrivate.h" #include "PaddleAPIPrivate.h"
#ifndef PADDLE_WITHOUT_GO #ifndef PADDLE_WITHOUT_GOLANG
#include "paddle/trainer/NewRemoteParameterUpdater.h" #include "paddle/trainer/NewRemoteParameterUpdater.h"
#endif #endif
#include "paddle/trainer/RemoteParameterUpdater.h" #include "paddle/trainer/RemoteParameterUpdater.h"
...@@ -31,10 +31,10 @@ ParameterUpdater *ParameterUpdater::createLocalUpdater( ...@@ -31,10 +31,10 @@ ParameterUpdater *ParameterUpdater::createLocalUpdater(
return updater; return updater;
} }
ParameterUpdater *ParameterUpdater::createNewRemoteUpdater ( ParameterUpdater *ParameterUpdater::createNewRemoteUpdater(
OptimizationConfig *config, const std::string pserverSpec) OptimizationConfig *config,
throw(UnsupportError) { const std::string pserverSpec) throw(UnsupportError) {
#ifndef PADDLE_WITHOUT_GO #ifndef PADDLE_WITHOUT_GOLANG
auto updater = new ParameterUpdater(); auto updater = new ParameterUpdater();
updater->m->updater.reset(new paddle::NewRemoteParameterUpdater( updater->m->updater.reset(new paddle::NewRemoteParameterUpdater(
config->m->getConfig(), pserverSpec)); config->m->getConfig(), pserverSpec));
......
...@@ -26,7 +26,7 @@ set(TRAINER_HEADERS ...@@ -26,7 +26,7 @@ set(TRAINER_HEADERS
ThreadParameterUpdater.h ThreadParameterUpdater.h
TrainerConfigHelper.h) TrainerConfigHelper.h)
if(NOT WITH_Go) if(NOT WITH_GOLANG)
list(REMOVE_ITEM TRAINER_SOURCES list(REMOVE_ITEM TRAINER_SOURCES
NewRemoteParameterUpdater.cpp) NewRemoteParameterUpdater.cpp)
list(REMOVE_ITEM TRAINER_HEADERS list(REMOVE_ITEM TRAINER_HEADERS
...@@ -70,8 +70,8 @@ if(APPLE) ...@@ -70,8 +70,8 @@ if(APPLE)
set(CMAKE_EXE_LINKER_FLAGS "-framework CoreFoundation -framework Security") set(CMAKE_EXE_LINKER_FLAGS "-framework CoreFoundation -framework Security")
endif() endif()
if(WITH_Go) if(WITH_GOLANG)
add_dependencies(paddle_trainer_lib paddle_pserver_cclient) add_dependencies(paddle_trainer_lib paddle_pserver_cclient)
target_link_libraries(paddle_trainer ${CMAKE_BINARY_DIR}/go/pserver/cclient/libpaddle_pserver_cclient.a) target_link_libraries(paddle_trainer ${CMAKE_BINARY_DIR}/go/pserver/cclient/libpaddle_pserver_cclient.a)
target_link_libraries(paddle_trainer_lib ${CMAKE_BINARY_DIR}/go/pserver/cclient/libpaddle_pserver_cclient.a) target_link_libraries(paddle_trainer_lib ${CMAKE_BINARY_DIR}/go/pserver/cclient/libpaddle_pserver_cclient.a)
endif(WITH_Go) endif(WITH_GOLANG)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册