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

enable alexnet benchmark #6852

Merged
merged 4 commits into from
Dec 22, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions benchmark/paddle/image/alexnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,18 @@
width = 227
num_class = 1000
batch_size = get_config_arg('batch_size', int, 128)
use_mkldnn = get_config_arg('use_mkldnn', bool, False)
is_infer = get_config_arg("is_infer", bool, False)
num_samples = get_config_arg('num_samples', int, 2560)

args = {'height': height, 'width': width, 'color': True, 'num_class': num_class}
args = {
'height': height,
'width': width,
'color': True,
'num_class': num_class,
'is_infer': is_infer,
'num_samples': num_samples
}
define_py_data_sources2(
"train.list", None, module="provider", obj="process", args=args)

Copy link
Contributor

Choose a reason for hiding this comment

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

groups=2 if use_mkldnn else 1
net = img_conv_layer(		  
    input=net, filter_size=5, num_filters=256, stride=1, padding=2, groups=groups)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个我刚好改了逻辑,就是你说的现在这样了。thx。

Expand All @@ -31,7 +41,12 @@

# conv2
net = img_conv_layer(
input=net, filter_size=5, num_filters=256, stride=1, padding=2, groups=1)
input=net,
filter_size=5,
num_filters=256,
stride=1,
padding=2,
groups=2 if use_mkldnn else 1)
net = img_cmrnorm_layer(input=net, size=5, scale=0.0001, power=0.75)
net = img_pool_layer(input=net, pool_size=3, stride=2)

Expand All @@ -40,11 +55,21 @@
input=net, filter_size=3, num_filters=384, stride=1, padding=1)
# conv4
net = img_conv_layer(
input=net, filter_size=3, num_filters=384, stride=1, padding=1, groups=1)
input=net,
filter_size=3,
num_filters=384,
stride=1,
padding=1,
groups=2 if use_mkldnn else 1)

# conv5
net = img_conv_layer(
input=net, filter_size=3, num_filters=256, stride=1, padding=1, groups=1)
input=net,
filter_size=3,
num_filters=256,
stride=1,
padding=1,
groups=2 if use_mkldnn else 1)
net = img_pool_layer(input=net, pool_size=3, stride=2)

net = fc_layer(
Expand Down
1 change: 1 addition & 0 deletions benchmark/paddle/image/run_mkl_infer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ fi
# inference benchmark
for use_mkldnn in True False; do
for batchsize in 1 2 4 8 16; do
infer alexnet group2 $batchsize $use_mkldnn
infer googlenet v1 $batchsize $use_mkldnn
infer resnet 50 $batchsize $use_mkldnn
infer vgg 19 $batchsize $use_mkldnn
Copy link
Contributor

Choose a reason for hiding this comment

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

这里的测试顺序和train的刚好反过来,麻烦都换成一样的测试顺序吧。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

没问题

Expand Down
1 change: 1 addition & 0 deletions benchmark/paddle/image/run_mkl_train.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,6 @@ for use_mkldnn in True False; do
train vgg 19 $batchsize $use_mkldnn
train resnet 50 $batchsize $use_mkldnn
train googlenet v1 $batchsize $use_mkldnn
train alexnet group2 $batchsize $use_mkldnn
done
done
1 change: 1 addition & 0 deletions benchmark/paddle/image/run_openblas_infer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ fi

# inference benchmark
for batchsize in 1 2 4 8 16; do
infer alexnet group2 $batchsize $use_mkldnn
infer googlenet v1 $batchsize
infer resnet 50 $batchsize
infer vgg 19 $batchsize
Expand Down
1 change: 1 addition & 0 deletions benchmark/paddle/image/run_openblas_train.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ for batchsize in 64 128 256; do
train vgg 19 $batchsize
train resnet 50 $batchsize
train googlenet v1 $batchsize
train alexnet group2 $batchsize $use_mkldnn
done