Skip to content

Commit 3d0e73b

Browse files
committed
Remove custom glog-like and gflags-like macros
1 parent be734a6 commit 3d0e73b

File tree

77 files changed

+408
-1396
lines changed

Some content is hidden

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

77 files changed

+408
-1396
lines changed

CMakeLists.txt

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ find_package(ZLIB REQUIRED)
2525
find_package(NumPy REQUIRED)
2626
find_package(Threads REQUIRED)
2727
find_package(AVX QUIET)
28-
find_package(Glog)
29-
find_package(Gflags QUIET)
28+
find_package(Glog REQUIRED)
29+
find_package(Gflags REQUIRED)
3030
find_package(GTest)
3131
find_package(Sphinx)
3232
find_package(Doxygen)
@@ -40,8 +40,6 @@ option(WITH_AVX "Compile PaddlePaddle with avx intrinsics" ${AVX_FOUND})
4040
option(WITH_PYTHON "Compile PaddlePaddle with python interpreter" ON)
4141
option(WITH_STYLE_CHECK "Style Check for PaddlePaddle" ${PYTHONINTERP_FOUND})
4242
option(WITH_RDMA "Compile PaddlePaddle with rdma support" OFF)
43-
option(WITH_GLOG "Compile PaddlePaddle use glog, otherwise use a log implement internally" ${LIBGLOG_FOUND})
44-
option(WITH_GFLAGS "Compile PaddlePaddle use gflags, otherwise use a flag implement internally" ${GFLAGS_FOUND})
4543
option(WITH_TIMER "Compile PaddlePaddle use timer" OFF)
4644
option(WITH_PROFILER "Compile PaddlePaddle use gpu profiler" OFF)
4745
option(WITH_TESTING "Compile and run unittest for PaddlePaddle" ${GTEST_FOUND})
@@ -136,16 +134,12 @@ else(WITH_RDMA)
136134
add_definitions(-DPADDLE_DISABLE_RDMA)
137135
endif(WITH_RDMA)
138136

139-
if(WITH_GLOG)
140-
add_definitions(-DPADDLE_USE_GLOG)
141-
include_directories(${LIBGLOG_INCLUDE_DIR})
142-
endif()
137+
# glog
138+
include_directories(${LIBGLOG_INCLUDE_DIR})
143139

144-
if(WITH_GFLAGS)
145-
add_definitions(-DPADDLE_USE_GFLAGS)
146-
add_definitions(-DGFLAGS_NS=${GFLAGS_NAMESPACE})
147-
include_directories(${GFLAGS_INCLUDE_DIRS})
148-
endif()
140+
#gflags
141+
add_definitions(-DGFLAGS_NS=${GFLAGS_NAMESPACE})
142+
include_directories(${GFLAGS_INCLUDE_DIRS})
149143

150144
if(WITH_TESTING)
151145
enable_testing()

paddle/api/Trainer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ limitations under the License. */
2727

2828
using paddle::real;
2929

30-
P_DECLARE_string(config);
31-
P_DECLARE_string(init_model_path);
32-
P_DECLARE_int32(start_pass);
30+
DECLARE_string(config);
31+
DECLARE_string(init_model_path);
32+
DECLARE_int32(start_pass);
3333

3434
struct TrainerPrivate : public paddle::Trainer {
3535
bool _trainOneBatch(size_t batchSize);

paddle/cuda/src/hl_cuda_cudnn.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ limitations under the License. */
2121
#include "paddle/utils/CommandLineParser.h"
2222
#include "paddle/utils/Logging.h"
2323

24-
P_DEFINE_int32(cudnn_conv_workspace_limit_in_mb,
25-
4096,
26-
"Specify cuDNN max workspace limit, in units MB, "
27-
"4096MB=4GB by default.");
24+
DEFINE_int32(cudnn_conv_workspace_limit_in_mb,
25+
4096,
26+
"Specify cuDNN max workspace limit, in units MB, "
27+
"4096MB=4GB by default.");
2828

2929
namespace dynload {
3030

paddle/cuda/src/hl_dso_loader.cc

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,21 @@ limitations under the License. */
1616
#include "paddle/utils/CommandLineParser.h"
1717
#include "paddle/utils/Logging.h"
1818

19-
P_DEFINE_string(cudnn_dir,
20-
"",
21-
"Specify path for loading libcudnn.so. For instance, "
22-
"/usr/local/cudnn/lib. If empty [default], dlopen "
23-
"will search cudnn from LD_LIBRARY_PATH");
24-
25-
P_DEFINE_string(cuda_dir,
26-
"",
27-
"Specify path for loading cuda library, such as libcublas, "
28-
"libcurand. For instance, /usr/local/cuda/lib64. (Note: "
29-
"libcudart can not be specified by cuda_dir, since some "
30-
"build-in function in cudart already ran before main entry). "
31-
"If default, dlopen will search cuda from LD_LIBRARY_PATH");
32-
33-
P_DEFINE_string(warpctc_dir, "", "Specify path for loading libwarpctc.so.");
19+
DEFINE_string(cudnn_dir,
20+
"",
21+
"Specify path for loading libcudnn.so. For instance, "
22+
"/usr/local/cudnn/lib. If empty [default], dlopen "
23+
"will search cudnn from LD_LIBRARY_PATH");
24+
25+
DEFINE_string(cuda_dir,
26+
"",
27+
"Specify path for loading cuda library, such as libcublas, "
28+
"libcurand. For instance, /usr/local/cuda/lib64. (Note: "
29+
"libcudart can not be specified by cuda_dir, since some "
30+
"build-in function in cudart already ran before main entry). "
31+
"If default, dlopen will search cuda from LD_LIBRARY_PATH");
32+
33+
DEFINE_string(warpctc_dir, "", "Specify path for loading libwarpctc.so.");
3434

3535
static inline std::string join(const std::string& part1,
3636
const std::string& part2) {

paddle/gserver/dataproviders/ProtoDataProvider.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ limitations under the License. */
2222
#include "DataProviderGroup.h"
2323
#include "paddle/utils/Logging.h"
2424

25-
P_DEFINE_double(memory_threshold_on_load_data,
26-
1.0,
27-
"stop loading data when memory is not sufficient");
25+
DEFINE_double(memory_threshold_on_load_data,
26+
1.0,
27+
"stop loading data when memory is not sufficient");
2828

2929
namespace paddle {
3030

paddle/gserver/evaluators/Evaluator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License. */
1717

1818
#include "paddle/gserver/gradientmachines/NeuralNetwork.h"
1919

20-
P_DECLARE_int32(trainer_id);
20+
DECLARE_int32(trainer_id);
2121

2222
namespace paddle {
2323

paddle/gserver/gradientmachines/MultiGradientMachine.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ limitations under the License. */
2121
#include "NeuralNetwork.h"
2222
#include "ParallelNeuralNetwork.h"
2323

24-
P_DEFINE_bool(allow_only_one_model_on_one_gpu,
25-
true,
26-
"If true, do not allow multiple models on one GPU device");
24+
DEFINE_bool(allow_only_one_model_on_one_gpu,
25+
true,
26+
"If true, do not allow multiple models on one GPU device");
2727
#ifdef PADDLE_METRIC_LEARNING
28-
P_DECLARE_bool(external);
28+
DECLARE_bool(external);
2929
#endif
3030

3131
namespace paddle {

paddle/gserver/gradientmachines/RecurrentGradientMachine.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ limitations under the License. */
2424
#include "paddle/utils/Stat.h"
2525
#include "paddle/utils/Util.h"
2626

27-
P_DEFINE_string(diy_beam_search_prob_so, "", "the diy beam search cost so");
27+
DEFINE_string(diy_beam_search_prob_so, "", "the diy beam search cost so");
2828

2929
static const char* DIY_CALC_PROB_SYMBOL_NAME = "calc_prob";
3030
static const char* DIY_START_CALC_PROB_SYMBOL_NAME = "start_calc_prob";

paddle/gserver/layers/Layer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ limitations under the License. */
3333
#include "TransLayer.h"
3434
#include "ValidationLayer.h"
3535

36-
P_DEFINE_bool(log_error_clipping, false, "enable log error clipping or not");
36+
DEFINE_bool(log_error_clipping, false, "enable log error clipping or not");
3737

3838
namespace paddle {
3939

paddle/gserver/layers/LstmLayer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License. */
1717
#include "paddle/math/Matrix.h"
1818
#include "paddle/utils/Stat.h"
1919

20-
P_DECLARE_bool(prev_batch_state);
20+
DECLARE_bool(prev_batch_state);
2121

2222
namespace paddle {
2323

0 commit comments

Comments
 (0)