Skip to content

Remove utils/CommandLineParser.h #989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion paddle/cuda/src/hl_cuda_cudnn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ limitations under the License. */

#include "hl_cuda_cudnn.h"
#include <cudnn.h>
#include <gflags/gflags.h>
#include <mutex>
#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,
Expand Down
2 changes: 1 addition & 1 deletion paddle/cuda/src/hl_dso_loader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <gflags/gflags.h>
#include "paddle/utils/Logging.h"

DEFINE_string(cudnn_dir,
Expand Down
2 changes: 1 addition & 1 deletion paddle/gserver/layers/RecurrentLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <gflags/gflags.h>
#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.");
Expand Down
3 changes: 1 addition & 2 deletions paddle/gserver/tests/TestUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ See the License for the specific language governing permissions and
limitations under the License. */

#include "TestUtil.h"

#include <gflags/gflags.h>
#include "paddle/math/SparseMatrix.h"
#include "paddle/utils/CommandLineParser.h"

DEFINE_int32(fixed_seq_length, 0, "Produce some sequence of fixed length");

Expand Down
2 changes: 1 addition & 1 deletion paddle/math/SparseRowMatrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ limitations under the License. */

#pragma once

#include <gflags/gflags.h>
#include <string.h>
#include <algorithm>
#include "Matrix.h"
#include "paddle/utils/CommandLineParser.h"
#include "paddle/utils/Util.h"

DECLARE_bool(allow_inefficient_sparse_update);
Expand Down
2 changes: 1 addition & 1 deletion paddle/parameter/Parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ See the License for the specific language governing permissions and
limitations under the License. */

#include "Parameter.h"
#include <gflags/gflags.h>
#include <fstream>
#include "AverageOptimizer.h"
#include "FirstOrderOptimizer.h"
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion paddle/pserver/BaseClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ See the License for the specific language governing permissions and
limitations under the License. */

#include "BaseClient.h"
#include <gflags/gflags.h>
#include <string.h>
#include <vector>
#include "paddle/utils/CommandLineParser.h"
#include "paddle/utils/Stat.h"

DECLARE_string(pservers);
Expand Down
32 changes: 0 additions & 32 deletions paddle/utils/CommandLineParser.cpp

This file was deleted.

22 changes: 0 additions & 22 deletions paddle/utils/CommandLineParser.h

This file was deleted.

2 changes: 1 addition & 1 deletion paddle/utils/CustomStackTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ See the License for the specific language governing permissions and
limitations under the License. */

#include "CustomStackTrace.h"
#include <gflags/gflags.h>
#include <iostream>
#include "CommandLineParser.h"

DEFINE_bool(
layer_stack_error_only_current_thread,
Expand Down
2 changes: 1 addition & 1 deletion paddle/utils/Flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ limitations under the License. */

#pragma once

#include "CommandLineParser.h"
#include <gflags/gflags.h>

DECLARE_bool(parallel_nn);
DECLARE_int32(async_count);
Expand Down
4 changes: 3 additions & 1 deletion paddle/utils/ThreadLocal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <gflags/gflags.h>

#include "Util.h"

DEFINE_bool(thread_local_rand_use_global_seed,
Expand Down
11 changes: 8 additions & 3 deletions paddle/utils/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ limitations under the License. */
#include <fstream>
#include <mutex>

#include "paddle/utils/Logging.h"
#include <gflags/gflags.h>

#include "CommandLineParser.h"
#include "CustomStackTrace.h"
#include "Logging.h"
#include "StringUtil.h"
#include "Thread.h"
#include "ThreadLocal.h"
Expand Down Expand Up @@ -152,7 +152,12 @@ void initMain(int argc, char** argv) {
line += ' ';
}
LOG(INFO) << "commandline: " << line;
ParseCommandLineFlags(&argc, argv, true);

#ifndef GFLAGS_GFLAGS_H_
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

后期可以移到common.h

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent.

namespace gflags = google;
#endif

gflags::ParseCommandLineFlags(&argc, &argv, true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有个bug,gflags的namespace不一定是gflags。
gflags的不同版本里面有区别。这个namespace有的时候是google,有的时候是gflags

paddle/utils/CommandLineParser.cpp 这里有对namespace的特殊性进行处理。。

不过,如果我们依赖确定某个版本的gflags就没这个问题了。。。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我之前也check了一下,应该是老版有这个问题

# First try the (older) google namespace. Note that the output variable

CHECK_EQ(argc, 1) << "Unknown commandline argument: " << argv[1];

installProfilerSwitch();
Expand Down
1 change: 0 additions & 1 deletion paddle/utils/Util.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ limitations under the License. */
#include <unordered_map>
#include <vector>

#include "CommandLineParser.h"
#include "DisableCopy.h"
#include "Logging.h"
#include "TrainerConfig.pb.h"
Expand Down
5 changes: 3 additions & 2 deletions paddle/utils/tests/test_CustomStackTrace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <gtest/gtest.h>
#include <chrono>

#include "paddle/utils/CommandLineParser.h"
#include <gflags/gflags.h>
#include <gtest/gtest.h>

#include "paddle/utils/CustomStackTrace.h"
#include "paddle/utils/Locks.h"
#include "paddle/utils/Util.h"
Expand Down
6 changes: 4 additions & 2 deletions paddle/utils/tests/test_SpinLock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <gtest/gtest.h>
#include <vector>
#include "paddle/utils/CommandLineParser.h"

#include <gflags/gflags.h>
#include <gtest/gtest.h>

#include "paddle/utils/Locks.h"
#include "paddle/utils/Logging.h"
#include "paddle/utils/Util.h"
Expand Down
6 changes: 4 additions & 2 deletions paddle/utils/tests/test_ThreadBarrier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <gtest/gtest.h>
#include <set>
#include <vector>
#include "paddle/utils/CommandLineParser.h"

#include <gflags/gflags.h>
#include <gtest/gtest.h>

#include "paddle/utils/Locks.h"
#include "paddle/utils/Logging.h"
#include "paddle/utils/Util.h"
Expand Down