Flags.cpp 3.8 KB
Newer Older
1
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserve.
Z
zhangjinchao01 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

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"

17
#ifndef PADDLE_WITH_CUDA
18
DEFINE_bool(use_gpu, false, "Only support CPU training");
Z
zhangjinchao01 已提交
19
#else
20
DEFINE_bool(use_gpu, true, "Whether to use GPU for training");
Z
zhangjinchao01 已提交
21 22
#endif

T
tensor-tang 已提交
23 24 25 26 27 28 29
#ifdef PADDLE_USE_MKLDNN
// TODO(TJ): change to true when MKLDNN layers support multi-inputs
DEFINE_bool(use_mkldnn, false, "Default still keep use CPU training");
#else
DEFINE_bool(use_mkldnn, false, "Only support CPU training");
#endif

30 31 32 33 34 35 36 37 38 39 40 41
DEFINE_bool(parallel_nn,
            false,
            "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).");
DEFINE_int32(trainer_count, 1, "Defined how many trainers to train");
DEFINE_int32(gpu_id, 0, "Which gpu core to use");
DEFINE_int32(port, 20134, "Listening port for pserver");
DEFINE_int32(ports_num,
             1,
42 43 44
             "Number of ports for sending dense parameter,"
             " following ports on parameter server will be visited"
             " for sending dense parameter: [port, port+ports_num-1]");
45 46
DEFINE_int32(ports_num_for_sparse,
             0,
47 48 49 50
             "Number of ports for sending sparse parameter,"
             " following ports on parameter server will be visited"
             " for sending sparse parameter:"
             " [port+ports_num, port+ports_num+ports_num_for_sparse-1]");
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
DEFINE_string(nics, "xgbe0,xgbe1", "network device name for pservers");
DEFINE_string(rdma_tcp, "tcp", "use rdma or tcp rdma transport protocol");
DEFINE_int32(trainer_id,
             0,
             "For distributed training, each trainer must be given an unique id"
             " ranging from 0 to num_trainers-1. Trainer 0 is the master"
             " trainer");
DEFINE_int32(num_gradient_servers, 1, "number of gradient servers");
DEFINE_string(comment, "", "A string for commenting this training task");
DEFINE_string(load_missing_parameter_strategy,
              "fail",
              "which operation to take on load model fails. support "
              "fail/rand/zero only.");
DEFINE_int32(log_period, 100, "Log progress every so many batches");
DEFINE_int32(log_period_server,
             500,
             "Log progress every so many batches at pserver end");
DEFINE_double(checkgrad_eps, 1e-5, "parameter change size for checkgrad");
DEFINE_int32(enable_parallel_vector, 0, "threshold for enable parallel vector");
DEFINE_bool(loadsave_parameters_in_pserver,
            false,
            "load and save parameters in pserver. "
            "only work while parameter set sparse_remote_update.");
DEFINE_int32(beam_size,
             1,
             "Beam size used in generating most probable output sequences.");
Z
zhangjinchao01 已提交
77

78 79 80 81 82 83 84
DEFINE_bool(show_layer_stat, false, "show the statistics of each layer");
DEFINE_string(predict_file, "", "File name for saving predict result");
DEFINE_bool(prev_batch_state, false, "batch is continue with next batch");
DEFINE_string(init_model_path,
              "",
              "Path of the initial model parameters."
              "If it was set, start_pass will be ignored.");