From f09989a1b292ac6fdeceb46ca24f8f50a38d391a Mon Sep 17 00:00:00 2001 From: liaogang Date: Thu, 22 Dec 2016 11:12:30 +0800 Subject: [PATCH] Remove utils/CommandLineParser.h --- paddle/cuda/src/hl_cuda_cudnn.cc | 2 +- paddle/cuda/src/hl_dso_loader.cc | 2 +- paddle/gserver/layers/RecurrentLayer.cpp | 2 +- paddle/gserver/tests/TestUtil.cpp | 3 +- paddle/math/SparseRowMatrix.h | 2 +- paddle/parameter/Parameter.cpp | 2 +- paddle/pserver/BaseClient.cpp | 2 +- paddle/utils/CommandLineParser.cpp | 32 -------------------- paddle/utils/CommandLineParser.h | 22 -------------- paddle/utils/CustomStackTrace.cpp | 2 +- paddle/utils/Flags.h | 2 +- paddle/utils/ThreadLocal.cpp | 4 ++- paddle/utils/Util.cpp | 6 ++-- paddle/utils/Util.h | 1 - paddle/utils/tests/test_CustomStackTrace.cpp | 5 +-- paddle/utils/tests/test_SpinLock.cpp | 6 ++-- paddle/utils/tests/test_ThreadBarrier.cpp | 6 ++-- 17 files changed, 26 insertions(+), 75 deletions(-) delete mode 100644 paddle/utils/CommandLineParser.cpp delete mode 100644 paddle/utils/CommandLineParser.h diff --git a/paddle/cuda/src/hl_cuda_cudnn.cc b/paddle/cuda/src/hl_cuda_cudnn.cc index c0c8b0e60..6198f067b 100644 --- a/paddle/cuda/src/hl_cuda_cudnn.cc +++ b/paddle/cuda/src/hl_cuda_cudnn.cc @@ -14,11 +14,11 @@ limitations under the License. */ #include "hl_cuda_cudnn.h" #include +#include #include #include "hl_cuda_cudnn.ph" #include "hl_dso_loader.h" #include "hl_thread.ph" -#include "paddle/utils/CommandLineParser.h" #include "paddle/utils/Logging.h" DEFINE_int32(cudnn_conv_workspace_limit_in_mb, diff --git a/paddle/cuda/src/hl_dso_loader.cc b/paddle/cuda/src/hl_dso_loader.cc index 54c7620fc..c92909de5 100644 --- a/paddle/cuda/src/hl_dso_loader.cc +++ b/paddle/cuda/src/hl_dso_loader.cc @@ -13,7 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "hl_dso_loader.h" -#include "paddle/utils/CommandLineParser.h" +#include #include "paddle/utils/Logging.h" DEFINE_string(cudnn_dir, diff --git a/paddle/gserver/layers/RecurrentLayer.cpp b/paddle/gserver/layers/RecurrentLayer.cpp index 94b16996a..55e0fdfb9 100644 --- a/paddle/gserver/layers/RecurrentLayer.cpp +++ b/paddle/gserver/layers/RecurrentLayer.cpp @@ -12,9 +12,9 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ +#include #include "Layer.h" #include "SequenceToBatch.h" -#include "paddle/utils/CommandLineParser.h" #include "paddle/utils/Stat.h" DEFINE_bool(rnn_use_batch, false, "Using the batch method for calculation."); diff --git a/paddle/gserver/tests/TestUtil.cpp b/paddle/gserver/tests/TestUtil.cpp index e07c60861..c691fe262 100644 --- a/paddle/gserver/tests/TestUtil.cpp +++ b/paddle/gserver/tests/TestUtil.cpp @@ -13,9 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "TestUtil.h" - +#include #include "paddle/math/SparseMatrix.h" -#include "paddle/utils/CommandLineParser.h" DEFINE_int32(fixed_seq_length, 0, "Produce some sequence of fixed length"); diff --git a/paddle/math/SparseRowMatrix.h b/paddle/math/SparseRowMatrix.h index 9364feb4a..778a9bd84 100644 --- a/paddle/math/SparseRowMatrix.h +++ b/paddle/math/SparseRowMatrix.h @@ -14,10 +14,10 @@ limitations under the License. */ #pragma once +#include #include #include #include "Matrix.h" -#include "paddle/utils/CommandLineParser.h" #include "paddle/utils/Util.h" DECLARE_bool(allow_inefficient_sparse_update); diff --git a/paddle/parameter/Parameter.cpp b/paddle/parameter/Parameter.cpp index 1673fc6e5..29d6e20dc 100644 --- a/paddle/parameter/Parameter.cpp +++ b/paddle/parameter/Parameter.cpp @@ -13,6 +13,7 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "Parameter.h" +#include #include #include "AverageOptimizer.h" #include "FirstOrderOptimizer.h" @@ -23,7 +24,6 @@ limitations under the License. */ #include "paddle/math/CpuSparseMatrix.h" #include "paddle/math/MathUtils.h" #include "paddle/math/SparseRowMatrix.h" -#include "paddle/utils/CommandLineParser.h" #include "paddle/utils/Logging.h" DEFINE_int32(enable_grad_share, diff --git a/paddle/pserver/BaseClient.cpp b/paddle/pserver/BaseClient.cpp index b4ac7a250..0e031a7e2 100644 --- a/paddle/pserver/BaseClient.cpp +++ b/paddle/pserver/BaseClient.cpp @@ -13,9 +13,9 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "BaseClient.h" +#include #include #include -#include "paddle/utils/CommandLineParser.h" #include "paddle/utils/Stat.h" DECLARE_string(pservers); diff --git a/paddle/utils/CommandLineParser.cpp b/paddle/utils/CommandLineParser.cpp deleted file mode 100644 index 63f16bc54..000000000 --- a/paddle/utils/CommandLineParser.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. */ - -#include "CommandLineParser.h" - -namespace paddle { -#ifndef GFLAGS_NS -#define GFLAGS_NS google -#endif - -namespace gflags_ns = GFLAGS_NS; - -void ParseCommandLineFlags(int* argc, char** argv, bool withHelp) { - if (withHelp) { - gflags_ns::ParseCommandLineFlags(argc, &argv, true); - } else { - gflags_ns::ParseCommandLineNonHelpFlags(argc, &argv, true); - } -} - -} // namespace paddle diff --git a/paddle/utils/CommandLineParser.h b/paddle/utils/CommandLineParser.h deleted file mode 100644 index 4e89f90bb..000000000 --- a/paddle/utils/CommandLineParser.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. */ - -#pragma once - -#include - -namespace paddle { -void ParseCommandLineFlags(int* argc, char** argv, bool withHelp = true); - -} // namespace paddle diff --git a/paddle/utils/CustomStackTrace.cpp b/paddle/utils/CustomStackTrace.cpp index 66b38218a..9723d7df9 100644 --- a/paddle/utils/CustomStackTrace.cpp +++ b/paddle/utils/CustomStackTrace.cpp @@ -13,8 +13,8 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "CustomStackTrace.h" +#include #include -#include "CommandLineParser.h" DEFINE_bool( layer_stack_error_only_current_thread, diff --git a/paddle/utils/Flags.h b/paddle/utils/Flags.h index 2ebbcb24e..3e72f8356 100644 --- a/paddle/utils/Flags.h +++ b/paddle/utils/Flags.h @@ -14,7 +14,7 @@ limitations under the License. */ #pragma once -#include "CommandLineParser.h" +#include DECLARE_bool(parallel_nn); DECLARE_int32(async_count); diff --git a/paddle/utils/ThreadLocal.cpp b/paddle/utils/ThreadLocal.cpp index 75ccbd28c..d27dae33f 100644 --- a/paddle/utils/ThreadLocal.cpp +++ b/paddle/utils/ThreadLocal.cpp @@ -13,7 +13,9 @@ See the License for the specific language governing permissions and limitations under the License. */ #include "ThreadLocal.h" -#include "CommandLineParser.h" + +#include + #include "Util.h" DEFINE_bool(thread_local_rand_use_global_seed, diff --git a/paddle/utils/Util.cpp b/paddle/utils/Util.cpp index 7c0d66c48..53e26d7b3 100644 --- a/paddle/utils/Util.cpp +++ b/paddle/utils/Util.cpp @@ -24,10 +24,10 @@ limitations under the License. */ #include #include -#include "paddle/utils/Logging.h" +#include -#include "CommandLineParser.h" #include "CustomStackTrace.h" +#include "Logging.h" #include "StringUtil.h" #include "Thread.h" #include "ThreadLocal.h" @@ -152,7 +152,7 @@ void initMain(int argc, char** argv) { line += ' '; } LOG(INFO) << "commandline: " << line; - ParseCommandLineFlags(&argc, argv, true); + gflags::ParseCommandLineFlags(&argc, &argv, true); CHECK_EQ(argc, 1) << "Unknown commandline argument: " << argv[1]; installProfilerSwitch(); diff --git a/paddle/utils/Util.h b/paddle/utils/Util.h index 24ddde28e..e5a89070f 100644 --- a/paddle/utils/Util.h +++ b/paddle/utils/Util.h @@ -26,7 +26,6 @@ limitations under the License. */ #include #include -#include "CommandLineParser.h" #include "DisableCopy.h" #include "Logging.h" #include "TrainerConfig.pb.h" diff --git a/paddle/utils/tests/test_CustomStackTrace.cpp b/paddle/utils/tests/test_CustomStackTrace.cpp index 2ce199837..18dd0aac4 100644 --- a/paddle/utils/tests/test_CustomStackTrace.cpp +++ b/paddle/utils/tests/test_CustomStackTrace.cpp @@ -12,10 +12,11 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include #include -#include "paddle/utils/CommandLineParser.h" +#include +#include + #include "paddle/utils/CustomStackTrace.h" #include "paddle/utils/Locks.h" #include "paddle/utils/Util.h" diff --git a/paddle/utils/tests/test_SpinLock.cpp b/paddle/utils/tests/test_SpinLock.cpp index 8351e7e3a..605bedb6c 100644 --- a/paddle/utils/tests/test_SpinLock.cpp +++ b/paddle/utils/tests/test_SpinLock.cpp @@ -12,9 +12,11 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include #include -#include "paddle/utils/CommandLineParser.h" + +#include +#include + #include "paddle/utils/Locks.h" #include "paddle/utils/Logging.h" #include "paddle/utils/Util.h" diff --git a/paddle/utils/tests/test_ThreadBarrier.cpp b/paddle/utils/tests/test_ThreadBarrier.cpp index 60c2214ff..1237f1b73 100644 --- a/paddle/utils/tests/test_ThreadBarrier.cpp +++ b/paddle/utils/tests/test_ThreadBarrier.cpp @@ -12,10 +12,12 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -#include #include #include -#include "paddle/utils/CommandLineParser.h" + +#include +#include + #include "paddle/utils/Locks.h" #include "paddle/utils/Logging.h" #include "paddle/utils/Util.h" -- GitLab