Skip to content
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

Remove all global variables in Paddle #852

Closed
1 of 22 tasks
reyoung opened this issue Dec 13, 2016 · 5 comments
Closed
1 of 22 tasks

Remove all global variables in Paddle #852

reyoung opened this issue Dec 13, 2016 · 5 comments
Assignees

Comments

@reyoung
Copy link
Collaborator

reyoung commented Dec 13, 2016

This issue used to record which variables are removed and will be removed. Related issue #849

  • FLAGS_cudnn_dir in hl_dso_loader.cc @gangliao
  • FLAGS_cuda_dir in hl_dso_loader.cc @gangliao
  • FLAGS_warpctc_dir in hl_dso_loader.cc @gangliao
  • FLAGS_memory_threshold_on_load_data
    • ProtoDataProvider.cpp, Should we just removed ProtoDataProvider? because it is not useful. Or just give a deprecated mark.
  • FLAGS_allow_only_one_model_on_one_gpu in MultiGradientMachine.cpp maybe it should be in ModelConfig
  • diy_beam_search_prob_so in RecurrentGradientMachine.cpp
  • log_error_clipping in Layer.cpp
  • rnn_use_batch in RecurrentLayer.cpp
  • allow_inefficient_sparse_update in SparseRowMatrix.cpp remove allow_inefficient_sparse_update since it's only defined but never used. #1238
  • pool_limit_size in Storage.cpp
  • log_clipping in FirstOrderOptimizer.cpp
  • enable_grad_share in Parameter.cpp
  • grad_share_block_num in Parameter.cpp
  • small_message in LightNetwork.cpp
  • sock_send_buf_size in LightNetwork.cpp
  • sock_recv_buf_size in LightNetwork.cpp
  • pservers in ParameterClient2.cpp
  • parallel_thread_num in ParameterClient2.cpp
  • pserver_num_threads in ParameterServer2.cpp
  • async_lagged_ratio_min in ParameterServer2.cpp
  • async_lagged_ratio_default in ParameterServer2.cpp
  • Flags in SparseParameterDistribution
    • It seems that they are not very useful
  • Flags.h
DECLARE_bool(parallel_nn);
DECLARE_int32(async_count);
DECLARE_int32(port);
DECLARE_int32(data_server_port);
DECLARE_bool(use_gpu);
DECLARE_int32(gpu_id);
DECLARE_int32(trainer_count);
DECLARE_int32(ports_num);
DECLARE_int32(ports_num_for_sparse);
DECLARE_string(nics);
DECLARE_string(rdma_tcp);
DECLARE_int32(trainer_id);
DECLARE_int32(num_gradient_servers);
DECLARE_string(comment);
DECLARE_string(load_missing_parameter_strategy);
DECLARE_int32(log_period);
DECLARE_int32(log_period_server);
DECLARE_double(checkgrad_eps);
DECLARE_int32(enable_parallel_vector);
DECLARE_bool(loadsave_parameters_in_pserver);
DECLARE_int32(beam_size);
DECLARE_bool(show_layer_stat);
DECLARE_string(predict_file);
DECLARE_bool(prev_batch_state);
DECLARE_string(init_model_path);

I just go through Paddle code quickly, it seems the Flags.h should be our first thing to removed.

Or maybe we should think a strategy about how to remove them.

  • 我们是不是应该在我们的Protobuf里面增加一些字段,这些字段就是这些flags,然后在main里面把这些flags直接set到protobuf里面。
  • 亦或是,我们先一个一个删掉一些flags?
@jacquesqiao
Copy link
Member

There are two kind of global variable in Paddle:
1. gflags in paddle cpp code to set config value.
2. global var in python code to construct neural network.
Both of them should be removed, so is this issue focus on the global variable in Paddle cpp src code or both?

@wangkuiyi
Copy link
Collaborator

I see @reyoung added an item FLAGS_trainer_count in above list, so I guess @reyoung 's proposal might be that this issue works as a list of subtasks in both C++ and Python codebase? If so, we should create sub-issues and file PRs to fix them?

@reyoung
Copy link
Collaborator Author

reyoung commented Jan 19, 2017

I see @reyoung added an item FLAGS_trainer_count in above list, so I guess @reyoung 's proposal might be that this issue works as a list of subtasks in both C++ and Python codebase? If so, we should create sub-issues and file PRs to fix them?

Yes. This issue is a list of subtasks. I am finding all global variables in Paddle and trying to give a list on this issue.

Python code's global variables are currently harmless, we could focus in Paddle Cpp Part now.

@jacquesqiao
Copy link
Member

i have already removed some flags in parameter server in #1051 , change some of them to proto config, some of them are in the list above. But for Compatibility i keep the old way to set flag. you can see if this way is properly.

@reyoung
Copy link
Collaborator Author

reyoung commented Jul 20, 2017

We are refactoring Paddle, and do not allow global variables expect registries.

@reyoung reyoung closed this as completed Jul 20, 2017
zhhsplendid pushed a commit to zhhsplendid/Paddle that referenced this issue Sep 25, 2019
zhhsplendid pushed a commit to zhhsplendid/Paddle that referenced this issue Sep 25, 2019
wangxicoding pushed a commit to wangxicoding/Paddle that referenced this issue Dec 9, 2021
yaozhixin pushed a commit to graphcore/Paddle-fork that referenced this issue Jul 1, 2022
…-ipu_10c74067247701b2cf4ed6d88a1c893d5a35a6e1

[AUTO PR] Pulling [develop] into [develop-ipu] [2022-06-30 03:05:47+08:00]
lizexu123 pushed a commit to lizexu123/Paddle that referenced this issue Feb 23, 2024
wwbitejotunn pushed a commit to wwbitejotunn/Paddle that referenced this issue Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants