Skip to content

Conversation

@qingqing01
Copy link
Contributor

Fix #6008

For the convenience of profiling, we need to add benchmark mode and running scripts.

  • Add typical network ResNet for the benchmark.
  • Use dataset Flowers-102 instead of CIAR. Since data shape of former is (3, 224, 224), and the latter is (3, 28, 28). The former data shape is more typical.
  • After run python benchmark_convnet_model.py, some time info will be printed out.

The usage is:

optional arguments: -h, --help show this help message and exit --model MODEL The model architecture: (resnet). --batch_size BATCH_SIZE The minibatch size. --iterations ITERATIONS The number of minibatches. --pass_num PASS_NUM The number of minibatches. --order ORDER The data order: (NCHW, NHWC). --device DEVICE The data order: (GPU, CPU). --infer_only If set, run forward only. --use_cprof If set, use cProfile. --use_nvprof If set, use nvprof for CUDA.
default='NCHW',
help='The data order: (NCHW, NHWC).')
parser.add_argument(
'--device', type=str, default='GPU', help='The data order: (GPU, CPU).')
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use "choices" in parser.add_argument.

'--order',
type=str,
default='NCHW',
help='The data order: (NCHW, NHWC).')
Copy link
Contributor

Choose a reason for hiding this comment

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

Writing this into 'help'? "Only support NCHW order now."

if args.device == 'CPU':
place = fluid.CPUPlace()
else:
place = fluid.GPUPlace(0)
Copy link
Contributor

Choose a reason for hiding this comment

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

place = fluid.CPUPlace() if fluid.CPUPlace() else fluid.GPUPlace(0)

@qingqing01 qingqing01 closed this Jul 10, 2018
@qingqing01 qingqing01 deleted the fluid_prof branch November 14, 2019 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants