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

add memory optimization transpiler demo #7443

Merged
merged 5 commits into from
Jan 22, 2018

Conversation

QiJune
Copy link
Member

@QiJune QiJune commented Jan 11, 2018

Please refer to #7385 to see the benchmark result.

How to make memory optimization benchmark:

FLAGS_do_memory_benchmark=true GLOG_vmodule=executor=2 GLOG_logtostderr=1 python test_meopt_fit_a_line.py
FLAGS_do_memory_benchmark=true GLOG_vmodule=executor=2 GLOG_logtostderr=1 python test_memopt_image_classification_train.py vgg
FLAGS_do_memory_benchmark=true GLOG_vmodule=executor=2 GLOG_logtostderr=1 python test_memopt_image_classification_train.py resnet

The memory usage log will be as follows:

I0111 15:00:04.795303 2497127360 executor.cc:121] Memory used after operator adam running: 666177536
I0111 15:00:04.795395 2497127360 executor.cc:121] Memory used after operator adam running: 666177536
I0111 15:00:04.796185 2497127360 executor.cc:121] Memory used after operator adam running: 666177536
I0111 15:00:04.796331 2497127360 executor.cc:121] Memory used after operator scale running: 666177536
I0111 15:00:04.796389 2497127360 executor.cc:121] Memory used after operator scale running: 666177536
I0111 15:00:04.796910 2497127360 executor.cc:121] Memory used after operator top_k running: 666181632
I0111 15:00:04.797045 2497127360 executor.cc:121] Memory used after operator accuracy running: 666189824
I0111 15:00:04.797137 2497127360 executor.cc:121] Memory used after operator cast running: 666193920
I0111 15:00:04.797209 2497127360 executor.cc:121] Memory used after operator cast running: 666193920
I0111 15:00:04.797315 2497127360 executor.cc:121] Memory used after operator sum running: 666193920
I0111 15:00:04.848588 2497127360 executor.cc:121] Memory used after operator sum running: 666193920
I0111 15:00:04.848660 2497127360 executor.cc:121] Memory used after operator fetch running: 666198016
I0111 15:00:04.848696 2497127360 executor.cc:121] Memory used after operator fetch running: 666202112
I0111 15:00:04.918810 2497127360 executor.cc:138] -------------------------------------------------------
I0111 15:00:04.918910 2497127360 executor.cc:139] Memory used after deleting local scope: 9048064
I0111 15:00:04.918939 2497127360 executor.cc:141] -------------------------------------------------------

VLOG(2) << "Memory used after deleting local scope: "
<< memory::memory_usage(place_);
VLOG(2) << "-------------------------------------------------------";
#endif
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can just add this as a gflags, not a macro.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@dzhwinter dzhwinter left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for such a great enhance!

@QiJune QiJune merged commit a6da470 into PaddlePaddle:develop Jan 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants