Skip to content

Conversation

@tensor-tang
Copy link
Contributor

@tensor-tang tensor-tang commented Sep 21, 2017

Related #4309

@tensor-tang tensor-tang requested a review from luotao1 September 22, 2017 13:57
Copy link
Contributor

@luotao1 luotao1 left a comment

Choose a reason for hiding this comment

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

这个PR可以拆成两个:一个是VGG相关的,一个是单测中比较网络使用mkldnn前后,有无区别。

#========== mklml ===========#
train vgg 64 16
train vgg 128 16
train vgg 256 16
Copy link
Contributor

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进去吧。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里比较的是,在WITH_MKLDNNWITH_MKLML都打开的前提下,使用MKLDNN与不使用MKLDNN的区别。

最后一个参数不是layer的层数,是trainer_count的个数。mkldnn默认用一个,所以没写。

@@ -0,0 +1,50 @@
set -e
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的

else
use_mkldnn=0
log="logs/${topology}-${thread}mklml-${bs}.log"
fi
Copy link
Contributor

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行的时候传进去会比较清楚。

Copy link
Contributor Author

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
Copy link
Contributor

Choose a reason for hiding this comment

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

49行的use_gpu可以去掉吧。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个是因为目前使用对比的时候是不希望使用gpu的。


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");
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK.

Copy link
Contributor Author

@tensor-tang tensor-tang left a comment

Choose a reason for hiding this comment

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

好的,谢谢。稍后会把更改提交上。

@@ -0,0 +1,50 @@
set -e
Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的

else
use_mkldnn=0
log="logs/${topology}-${thread}mklml-${bs}.log"
fi
Copy link
Contributor Author

Choose a reason for hiding this comment

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

因为当使用MKLDNN的时候只需要一个trainer,MKLDNN会自己使用多线程进行计算,所以才是现在看到的这样。不过我会改一个把接口都留好的,也方便以后大家测试。

#========== mklml ===========#
train vgg 64 16
train vgg 128 16
train vgg 256 16
Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里比较的是,在WITH_MKLDNNWITH_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
Copy link
Contributor Author

Choose a reason for hiding this comment

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

这个是因为目前使用对比的时候是不希望使用gpu的。


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");
Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK.

Copy link
Contributor

@luotao1 luotao1 left a 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."
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

43行也是多余的。

@luotao1 luotao1 merged commit 330e992 into PaddlePaddle:develop Sep 25, 2017
@tensor-tang tensor-tang deleted the vgg branch September 25, 2017 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants