-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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 VGG with MKLDNN layers #4310
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个PR可以拆成两个:一个是VGG相关的,一个是单测中比较网络使用mkldnn前后,有无区别。
benchmark/paddle/image/run.mkldnn.sh
Outdated
#========== mklml ===========# | ||
train vgg 64 16 | ||
train vgg 128 16 | ||
train vgg 256 16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
41行和47行的注释不明白:一个是用mkldnn,一个是没用?
另外,最后一个layer_num的参数,既然传了16进去,前面的也传19进去吧。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里比较的是,在WITH_MKLDNN
和WITH_MKLML
都打开的前提下,使用MKLDNN与不使用MKLDNN的区别。
最后一个参数不是layer的层数,是trainer_count的个数。mkldnn默认用一个,所以没写。
benchmark/paddle/image/run.mkldnn.sh
Outdated
@@ -0,0 +1,50 @@ | |||
set -e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个文件名从run.mkldnn.sh改成run_mkldnn.sh
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的
benchmark/paddle/image/run.mkldnn.sh
Outdated
else | ||
use_mkldnn=0 | ||
log="logs/${topology}-${thread}mklml-${bs}.log" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
14-20行:thread=1的时候,用mkldnn?否则不用?
那看41-50行,都是用了mkldnn。
trainer_count和use_mkldnn都做为一个参数,在41-50行的时候传进去会比较清楚。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
因为当使用MKLDNN的时候只需要一个trainer,MKLDNN会自己使用多线程进行计算,所以才是现在看到的这样。不过我会改一个把接口都留好的,也方便以后大家测试。
${CMAKE_CURRENT_BINARY_DIR}/test_CompareMKLDNNandCPU | ||
--config_file_a=trainer/tests/sample_trainer_config_simple_net.conf --use_mkldnn_a=True | ||
--config_file_b=trainer/tests/sample_trainer_config_simple_net.conf --use_mkldnn_b=False | ||
--use_gpu=False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
49行的use_gpu
可以去掉吧。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是因为目前使用对比的时候是不希望使用gpu的。
|
||
DECLARE_string(config); | ||
DECLARE_string(nics); | ||
|
||
DEFINE_string(config_file_a, "", "config of one network to compare"); | ||
DEFINE_string(config_file_b, "", "config of another network to compare"); | ||
DEFINE_bool(use_mkldnn_a, false, "whether to use mkldnn to run network"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whether to use mkldnn to run config_file_a
whether to use mkldnn to run config_file_b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的,谢谢。稍后会把更改提交上。
benchmark/paddle/image/run.mkldnn.sh
Outdated
@@ -0,0 +1,50 @@ | |||
set -e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的
benchmark/paddle/image/run.mkldnn.sh
Outdated
else | ||
use_mkldnn=0 | ||
log="logs/${topology}-${thread}mklml-${bs}.log" | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
因为当使用MKLDNN的时候只需要一个trainer,MKLDNN会自己使用多线程进行计算,所以才是现在看到的这样。不过我会改一个把接口都留好的,也方便以后大家测试。
benchmark/paddle/image/run.mkldnn.sh
Outdated
#========== mklml ===========# | ||
train vgg 64 16 | ||
train vgg 128 16 | ||
train vgg 256 16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里比较的是,在WITH_MKLDNN
和WITH_MKLML
都打开的前提下,使用MKLDNN与不使用MKLDNN的区别。
最后一个参数不是layer的层数,是trainer_count的个数。mkldnn默认用一个,所以没写。
${CMAKE_CURRENT_BINARY_DIR}/test_CompareMKLDNNandCPU | ||
--config_file_a=trainer/tests/sample_trainer_config_simple_net.conf --use_mkldnn_a=True | ||
--config_file_b=trainer/tests/sample_trainer_config_simple_net.conf --use_mkldnn_b=False | ||
--use_gpu=False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是因为目前使用对比的时候是不希望使用gpu的。
|
||
DECLARE_string(config); | ||
DECLARE_string(nics); | ||
|
||
DEFINE_string(config_file_a, "", "config of one network to compare"); | ||
DEFINE_string(config_file_b, "", "config of another network to compare"); | ||
DEFINE_bool(use_mkldnn_a, false, "whether to use mkldnn to run network"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
thread=`nproc` | ||
log="logs/${topology}-${thread}mklml-${bs}.log" | ||
else | ||
echo "Wrong input $3, use True or False." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
12行和16行是多余的。
fi | ||
|
||
#========= mkldnn =========# | ||
# vgg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
43行也是多余的。
Related #4309