Skip to content

add ParallelDo example for benchmark/fluid#11199

Merged
luotao1 merged 1 commit intoPaddlePaddle:developfrom
luotao1:benchmark
Jun 6, 2018
Merged

add ParallelDo example for benchmark/fluid#11199
luotao1 merged 1 commit intoPaddlePaddle:developfrom
luotao1:benchmark

Conversation

@luotao1
Copy link
Contributor

@luotao1 luotao1 commented Jun 5, 2018

  • add ParallelDo example for multi-thread CPU training in benchmark/fluid. For four models in benchmark/fluid, only add ParallelDo example for mnist and resnet now.
  • add --cpus arguments to specify the number of cpus. The usage likes:
python fluid_benchmark.py --model resnet --batch_size=64 --pass_num 5 --device CPU --data_set cifar10 --no_test --cpus=20
  • remove unused batch_size_tensor = fluid.layers.create_tensor(dtype='int64'), since fluid.layers.accuracy(input=predict, label=label) will auto create it.
    def accuracy(input, label, k=1, correct=None, total=None):
    """
    This function computes the accuracy using the input and label.
    The output is the top k inputs and their indices.
    """
    helper = LayerHelper("accuracy", **locals())
    topk_out, topk_indices = nn.topk(input, k=k)
    acc_out = helper.create_tmp_variable(dtype="float32")
    if correct is None:
    correct = helper.create_tmp_variable(dtype="int64")
    if total is None:
    total = helper.create_tmp_variable(dtype="int64")
@luotao1 luotao1 requested a review from tonyyang-svail June 5, 2018 10:27
Copy link

@tonyyang-svail tonyyang-svail left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@luotao1 luotao1 merged commit 7938b30 into PaddlePaddle:develop Jun 6, 2018
@luotao1 luotao1 deleted the benchmark branch June 11, 2018 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants