Merge branch 'develop' of https://github.com/PaddlePaddle/Paddle into develop
commit
634facecaa
@ -0,0 +1,48 @@
|
||||
# Benchmark
|
||||
|
||||
Machine:
|
||||
|
||||
- Server
|
||||
- Intel(R) Xeon(R) Gold 6148 CPU @ 2.40GHz, 2 Sockets, 20 Cores per socket
|
||||
- Laptop
|
||||
- DELL XPS15-9560-R1745: i7-7700HQ 8G 256GSSD
|
||||
- i5 MacBook Pro (Retina, 13-inch, Early 2015)
|
||||
- Desktop
|
||||
- i7-6700k
|
||||
|
||||
System: CentOS release 6.3 (Final), Docker 1.12.1.
|
||||
|
||||
PaddlePaddle: paddlepaddle/paddle:latest (TODO: will rerun after 0.11.0)
|
||||
|
||||
- MKL-DNN tag v0.10
|
||||
- MKLML 2018.0.20170720
|
||||
- OpenBLAS v0.2.20
|
||||
|
||||
On each machine, we will test and compare the performance of training on single node using MKL-DNN / MKLML / OpenBLAS respectively.
|
||||
|
||||
## Benchmark Model
|
||||
|
||||
### Server
|
||||
Test on batch size 64, 128, 256 on Intel(R) Xeon(R) Gold 6148M CPU @ 2.40GHz
|
||||
|
||||
Input image size - 3 * 224 * 224, Time: images/second
|
||||
|
||||
- VGG-19
|
||||
|
||||
| BatchSize | 64 | 128 | 256 |
|
||||
|--------------|-------| -----| --------|
|
||||
| OpenBLAS | 7.82 | 8.62 | 10.34 |
|
||||
| MKLML | 11.02 | 12.86 | 15.33 |
|
||||
| MKL-DNN | 27.69 | 28.8 | 29.27 |
|
||||
|
||||
|
||||
chart on batch size 128
|
||||
TBD
|
||||
|
||||
- ResNet
|
||||
- GoogLeNet
|
||||
|
||||
### Laptop
|
||||
TBD
|
||||
### Desktop
|
||||
TBD
|
@ -0,0 +1,142 @@
|
||||
# Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved
|
||||
#
|
||||
# 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.
|
||||
|
||||
from paddle.trainer_config_helpers import *
|
||||
|
||||
settings(batch_size=16)
|
||||
channels = get_config_arg("channels", int, 2)
|
||||
|
||||
def two_conv(input, group_name):
|
||||
out1 = img_conv_layer(input=input,
|
||||
name=group_name+'_conv1_',
|
||||
filter_size=1,
|
||||
num_filters=channels,
|
||||
padding=0,
|
||||
shared_biases=True,
|
||||
act=ReluActivation())
|
||||
|
||||
out2 = img_conv_layer(input=input,
|
||||
name=group_name+'_conv2_',
|
||||
filter_size=3,
|
||||
num_filters=channels,
|
||||
padding=1,
|
||||
shared_biases=True,
|
||||
act=ReluActivation())
|
||||
return out1, out2
|
||||
|
||||
def two_conv_bn(input, group_name):
|
||||
out1, out2 = two_conv(input, group_name)
|
||||
out1 = batch_norm_layer(input=out1,
|
||||
name=group_name+'_bn1_',
|
||||
use_global_stats=False,
|
||||
act=ReluActivation())
|
||||
|
||||
out2 = batch_norm_layer(input=out2,
|
||||
name=group_name+'_bn2_',
|
||||
use_global_stats=False,
|
||||
act=ReluActivation())
|
||||
return out1, out2
|
||||
|
||||
def two_conv_pool(input, group_name):
|
||||
out1, out2 = two_conv(input, group_name)
|
||||
out1 = img_pool_layer(input=out1,
|
||||
name=group_name+'_pool1_',
|
||||
pool_size=3,
|
||||
stride=2,
|
||||
padding=0,
|
||||
pool_type=MaxPooling())
|
||||
|
||||
out2 = img_pool_layer(input=out2,
|
||||
name=group_name+'_pool2_',
|
||||
pool_size=5,
|
||||
stride=2,
|
||||
padding=1,
|
||||
pool_type=MaxPooling())
|
||||
return out1, out2
|
||||
|
||||
def two_fc(input, group_name):
|
||||
out1 = fc_layer(input=input,
|
||||
name=group_name+'_fc1_',
|
||||
size=channels,
|
||||
bias_attr=False,
|
||||
act=LinearActivation())
|
||||
|
||||
out2 = fc_layer(input=input,
|
||||
name=group_name+'_fc2_',
|
||||
size=channels,
|
||||
bias_attr=False,
|
||||
act=LinearActivation())
|
||||
return out1, out2
|
||||
|
||||
data = data_layer(name ="input", size=channels*16*16)
|
||||
|
||||
tmp = img_conv_layer(input=data,
|
||||
num_channels=channels,
|
||||
filter_size=3,
|
||||
num_filters=channels,
|
||||
padding=1,
|
||||
shared_biases=True,
|
||||
act=ReluActivation())
|
||||
|
||||
a1, a2 = two_conv(tmp, 'conv_branch')
|
||||
tmp = addto_layer(input=[a1, a2],
|
||||
act=ReluActivation(),
|
||||
bias_attr=False)
|
||||
|
||||
tmp = img_pool_layer(input=tmp,
|
||||
pool_size=3,
|
||||
stride=2,
|
||||
padding=1,
|
||||
pool_type=AvgPooling())
|
||||
|
||||
b1, b2 = two_conv_pool(tmp, 'pool_branch')
|
||||
tmp = concat_layer(input=[b1, b2])
|
||||
|
||||
tmp = img_pool_layer(input=tmp,
|
||||
num_channels=channels*2,
|
||||
pool_size=3,
|
||||
stride=2,
|
||||
padding=1,
|
||||
pool_type=MaxPooling())
|
||||
|
||||
tmp = img_conv_layer(input=tmp,
|
||||
filter_size=3,
|
||||
num_filters=channels,
|
||||
padding=1,
|
||||
stride=2,
|
||||
shared_biases=True,
|
||||
act=LinearActivation(),
|
||||
bias_attr=False)
|
||||
|
||||
tmp = batch_norm_layer(input=tmp,
|
||||
use_global_stats=False,
|
||||
act=ReluActivation())
|
||||
|
||||
c1, c2 = two_conv_bn(tmp, 'bn_branch')
|
||||
tmp = addto_layer(input=[c1, c2],
|
||||
act=ReluActivation(),
|
||||
bias_attr=False)
|
||||
|
||||
tmp = fc_layer(input=tmp, size=channels,
|
||||
bias_attr=True,
|
||||
act=ReluActivation())
|
||||
|
||||
d1, d2 = two_fc(tmp, 'fc_branch')
|
||||
tmp = addto_layer(input=[d1, d2])
|
||||
|
||||
out = fc_layer(input=tmp, size=10,
|
||||
bias_attr=True,
|
||||
act=SoftmaxActivation())
|
||||
|
||||
outputs(out)
|
@ -1,58 +0,0 @@
|
||||
# Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved
|
||||
#
|
||||
# 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.
|
||||
|
||||
from paddle.trainer_config_helpers import *
|
||||
|
||||
settings(batch_size=16)
|
||||
channels = get_config_arg("channels", int, 2)
|
||||
|
||||
def two_fc(input, group_name):
|
||||
out1 = fc_layer(input=input,
|
||||
name=group_name+'_fc1',
|
||||
size=channels,
|
||||
bias_attr=False,
|
||||
act=LinearActivation())
|
||||
|
||||
out2 = fc_layer(input=input,
|
||||
name=group_name+'_fc2',
|
||||
size=channels,
|
||||
bias_attr=False,
|
||||
act=LinearActivation())
|
||||
return out1, out2
|
||||
|
||||
data = data_layer(name ="input", size=channels*16*16)
|
||||
|
||||
conv = img_conv_layer(input=data,
|
||||
num_channels=channels,
|
||||
filter_size=3,
|
||||
num_filters=channels,
|
||||
padding=1,
|
||||
shared_biases=True,
|
||||
act=LinearActivation())
|
||||
|
||||
pool = img_pool_layer(input=conv,
|
||||
pool_size=3,
|
||||
stride=2,
|
||||
padding=1,
|
||||
pool_type=AvgPooling())
|
||||
|
||||
a1, a2 = two_fc(input=pool, group_name='a')
|
||||
|
||||
concat = concat_layer(input=[a1, a2])
|
||||
|
||||
b1, b2 = two_fc(input=pool, group_name='b')
|
||||
|
||||
addto = addto_layer(input=[b1, b2])
|
||||
|
||||
outputs([concat, addto])
|
@ -1,60 +0,0 @@
|
||||
# Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved
|
||||
#
|
||||
# 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.
|
||||
|
||||
from paddle.trainer_config_helpers import *
|
||||
|
||||
settings(batch_size=16)
|
||||
channels = get_config_arg("channels", int, 2)
|
||||
|
||||
def two_pool(input, group_name):
|
||||
out1 = img_pool_layer(input=input,
|
||||
name=group_name+'_pool1',
|
||||
pool_size=3,
|
||||
stride=2,
|
||||
padding=0,
|
||||
pool_type=MaxPooling())
|
||||
|
||||
out2 = img_pool_layer(input=input,
|
||||
name=group_name+'_pool2',
|
||||
pool_size=5,
|
||||
stride=2,
|
||||
padding=1,
|
||||
pool_type=MaxPooling())
|
||||
return out1, out2
|
||||
|
||||
data = data_layer(name ="input", size=channels*16*16)
|
||||
|
||||
conv = img_conv_layer(input=data,
|
||||
num_channels=channels,
|
||||
filter_size=3,
|
||||
num_filters=channels,
|
||||
padding=1,
|
||||
shared_biases=True,
|
||||
act=LinearActivation())
|
||||
|
||||
pool = img_pool_layer(input=conv,
|
||||
pool_size=3,
|
||||
stride=1,
|
||||
padding=1,
|
||||
pool_type=AvgPooling())
|
||||
|
||||
a1, a2 = two_pool(input=pool, group_name='a')
|
||||
|
||||
concat = concat_layer(input=[a1, a2])
|
||||
|
||||
b1, b2 = two_pool(input=pool, group_name='b')
|
||||
|
||||
addto = addto_layer(input=[b1, b2])
|
||||
|
||||
outputs([concat, addto])
|
@ -1,133 +0,0 @@
|
||||
# Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved
|
||||
#
|
||||
# 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.
|
||||
|
||||
from paddle.trainer_config_helpers import *
|
||||
|
||||
################################### Data Configuration ###################################
|
||||
TrainData(ProtoData(files = "trainer/tests/mnist.list"))
|
||||
################################### Algorithm Configuration ###################################
|
||||
settings(batch_size = 128,
|
||||
learning_method = MomentumOptimizer(momentum=0.5, sparse=False))
|
||||
################################### Network Configuration ###################################
|
||||
data = data_layer(name ="input", size=784)
|
||||
|
||||
tmp = img_conv_layer(input=data,
|
||||
num_channels=1,
|
||||
filter_size=3,
|
||||
num_filters=32,
|
||||
padding=1,
|
||||
shared_biases=True,
|
||||
act=ReluActivation())
|
||||
|
||||
a1 = img_conv_layer(input=tmp,
|
||||
filter_size=1,
|
||||
num_filters=32,
|
||||
padding=0,
|
||||
shared_biases=True,
|
||||
act=ReluActivation())
|
||||
|
||||
a2 = img_conv_layer(input=tmp,
|
||||
filter_size=3,
|
||||
num_filters=32,
|
||||
padding=1,
|
||||
shared_biases=True,
|
||||
act=ReluActivation())
|
||||
|
||||
tmp = addto_layer(input=[a1, a2],
|
||||
act=ReluActivation(),
|
||||
bias_attr=False)
|
||||
|
||||
tmp = img_pool_layer(input=tmp,
|
||||
pool_size=3,
|
||||
stride=2,
|
||||
padding=1,
|
||||
pool_type=AvgPooling())
|
||||
|
||||
b1 = img_conv_layer(input=tmp,
|
||||
filter_size=3,
|
||||
num_filters=32,
|
||||
padding=1,
|
||||
shared_biases=True,
|
||||
act=ReluActivation())
|
||||
|
||||
b1 = img_pool_layer(input=b1,
|
||||
pool_size=3,
|
||||
stride=2,
|
||||
padding=0,
|
||||
pool_type=MaxPooling())
|
||||
|
||||
b2 = img_conv_layer(input=tmp,
|
||||
filter_size=3,
|
||||
num_filters=64,
|
||||
padding=1,
|
||||
shared_biases=True,
|
||||
act=ReluActivation())
|
||||
|
||||
b2 = img_pool_layer(input=b2,
|
||||
pool_size=5,
|
||||
stride=2,
|
||||
padding=1,
|
||||
pool_type=MaxPooling())
|
||||
|
||||
tmp = concat_layer(input=[b1, b2])
|
||||
|
||||
tmp = img_pool_layer(input=tmp,
|
||||
num_channels=96,
|
||||
pool_size=3,
|
||||
stride=2,
|
||||
padding=1,
|
||||
pool_type=MaxPooling())
|
||||
|
||||
tmp = img_conv_layer(input=tmp,
|
||||
filter_size=3,
|
||||
num_filters=32,
|
||||
padding=1,
|
||||
shared_biases=True,
|
||||
act=LinearActivation(),
|
||||
bias_attr=False)
|
||||
|
||||
tmp = batch_norm_layer(input=tmp,
|
||||
use_global_stats=False,
|
||||
act=ReluActivation())
|
||||
|
||||
c1 = img_conv_layer(input=tmp,
|
||||
filter_size=1,
|
||||
num_filters=32,
|
||||
padding=0,
|
||||
shared_biases=True,
|
||||
act=ReluActivation())
|
||||
|
||||
c2 = img_conv_layer(input=tmp,
|
||||
filter_size=3,
|
||||
num_filters=32,
|
||||
padding=1,
|
||||
shared_biases=True,
|
||||
act=ReluActivation())
|
||||
|
||||
tmp = addto_layer(input=[c1, c2],
|
||||
act=ReluActivation(),
|
||||
bias_attr=False)
|
||||
|
||||
tmp = fc_layer(input=tmp, size=64,
|
||||
bias_attr=False,
|
||||
act=TanhActivation())
|
||||
|
||||
output = fc_layer(input=tmp, size=10,
|
||||
bias_attr=True,
|
||||
act=SoftmaxActivation())
|
||||
|
||||
lbl = data_layer(name ="label", size=10)
|
||||
|
||||
cost = classification_cost(input=output, label=lbl)
|
||||
outputs(cost)
|
@ -1,68 +0,0 @@
|
||||
# Copyright (c) 2017 PaddlePaddle Authors. All Rights Reserved
|
||||
#
|
||||
# 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.
|
||||
|
||||
from paddle.trainer_config_helpers import *
|
||||
|
||||
################################### Data Configuration ###################################
|
||||
TrainData(ProtoData(files = "trainer/tests/mnist.list"))
|
||||
################################### Algorithm Configuration ###################################
|
||||
settings(batch_size = 128,
|
||||
learning_method = MomentumOptimizer(momentum=0.5, sparse=False))
|
||||
################################### Network Configuration ###################################
|
||||
data = data_layer(name ="input", size=784)
|
||||
|
||||
tmp = img_conv_layer(input=data,
|
||||
num_channels=1,
|
||||
filter_size=3,
|
||||
num_filters=32,
|
||||
padding=1,
|
||||
shared_biases=True,
|
||||
act=ReluActivation())
|
||||
|
||||
tmp = img_pool_layer(input=tmp,
|
||||
pool_size=3,
|
||||
stride=2,
|
||||
padding=1,
|
||||
pool_type=AvgPooling())
|
||||
|
||||
tmp = img_conv_layer(input=tmp,
|
||||
filter_size=3,
|
||||
num_filters=32,
|
||||
padding=1,
|
||||
shared_biases=True,
|
||||
act=LinearActivation(),
|
||||
bias_attr=False)
|
||||
|
||||
tmp = batch_norm_layer(input=tmp,
|
||||
use_global_stats=False,
|
||||
act=ReluActivation())
|
||||
|
||||
tmp = img_pool_layer(input=tmp,
|
||||
pool_size=3,
|
||||
stride=2,
|
||||
padding=1,
|
||||
pool_type=MaxPooling())
|
||||
|
||||
tmp = fc_layer(input=tmp, size=64,
|
||||
bias_attr=True,
|
||||
act=ReluActivation())
|
||||
|
||||
output = fc_layer(input=tmp, size=10,
|
||||
bias_attr=True,
|
||||
act=SoftmaxActivation())
|
||||
|
||||
lbl = data_layer(name ="label", size=10)
|
||||
|
||||
cost = classification_cost(input=output, label=lbl)
|
||||
outputs(cost)
|
Loading…
Reference in new issue