Flags.cpp 3.4 KB
Newer Older
Z
zhangjinchao01 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/* Copyright (c) 2016 Baidu, Inc. 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 "Flags.h"

#ifdef PADDLE_ONLY_CPU
P_DEFINE_bool(use_gpu, false, "Only support CPU training");
#else
P_DEFINE_bool(use_gpu, true, "Whether to use GPU for training");
#endif

P_DEFINE_bool(
24 25
    parallel_nn,
    false,
Z
zhangjinchao01 已提交
26 27 28 29 30 31 32 33 34
    "Whether to use multi-threads to calculate one neural network."
    "If it was set false, use gpu_id specify which gpu core to use"
    "(the device property in the trainer config file will be ingored)."
    "If it was set true, the gpu core is specified by the trainer"
    "  config file(gpu_id will be ignored).");
P_DEFINE_int32(trainer_count, 1, "Defined how many trainers to train");
P_DEFINE_int32(gpu_id, 0, "Which gpu core to use");
P_DEFINE_int32(port, 20134, "Listening port for pserver");
P_DEFINE_int32(data_server_port, 21134, "Listening port for dserver");
35 36
P_DEFINE_int32(ports_num,
               1,
Z
zhangjinchao01 已提交
37 38
               "The ports number for parameter send,"
               " increment based on default port number");
39 40
P_DEFINE_int32(ports_num_for_sparse,
               0,
Z
zhangjinchao01 已提交
41 42 43 44 45
               "The ports number for parameter send,"
               " increment based on default (port + ports_num)");
P_DEFINE_string(nics, "xgbe0,xgbe1", "network device name for pservers");
P_DEFINE_string(rdma_tcp, "tcp", "use rdma or tcp rdma transport protocol");
P_DEFINE_int32(
46 47
    trainer_id,
    0,
Z
zhangjinchao01 已提交
48 49 50 51 52
    "For distributed training, each trainer must be given an unique id"
    " ranging from 0 to num_trainers-1. Trainer 0 is the master"
    " trainer");
P_DEFINE_int32(num_gradient_servers, 1, "number of gradient servers");
P_DEFINE_string(comment, "", "A string for commenting this training task");
53 54
P_DEFINE_string(load_missing_parameter_strategy,
                "fail",
Z
zhangjinchao01 已提交
55 56 57
                "which operation to take on load model fails. support "
                "fail/rand/zero only.");
P_DEFINE_int32(log_period, 100, "Log progress every so many batches");
58 59
P_DEFINE_int32(log_period_server,
               500,
Z
zhangjinchao01 已提交
60 61
               "Log progress every so many batches at pserver end");
P_DEFINE_double(checkgrad_eps, 1e-5, "parameter change size for checkgrad");
62 63
P_DEFINE_int32(enable_parallel_vector,
               0,
Z
zhangjinchao01 已提交
64
               "threshold for enable parallel vector");
65 66
P_DEFINE_bool(loadsave_parameters_in_pserver,
              false,
Z
zhangjinchao01 已提交
67 68
              "load and save parameters in pserver. "
              "only work while parameter set sparse_remote_update.");
69 70
P_DEFINE_int32(beam_size,
               1,
Z
zhangjinchao01 已提交
71 72 73 74 75
               "Beam size used in generating most probable output sequences.");

P_DEFINE_bool(show_layer_stat, false, "show the statistics of each layer");
P_DEFINE_string(predict_file, "", "File name for saving predict result");
P_DEFINE_bool(prev_batch_state, false, "batch is continue with next batch");
76 77
P_DEFINE_string(init_model_path,
                "",
Z
zhangjinchao01 已提交
78 79
                "Path of the initial model parameters."
                "If it was set, start_pass will be ignored.");