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 need_save_delta config to solve OOM #23097

Merged
merged 1 commit into from
Mar 20, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions paddle/fluid/framework/fleet/box_wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ void BoxWrapper::BeginPass() const {
"BeginPass failed in BoxPS."));
}

void BoxWrapper::EndPass() const {
int ret = boxps_ptr_->EndPass();
void BoxWrapper::EndPass(bool need_save_delta) const {
int ret = boxps_ptr_->EndPass(need_save_delta);
PADDLE_ENFORCE_EQ(
ret, 0, platform::errors::PreconditionNotMet("EndPass failed in BoxPS."));
}
Expand Down
6 changes: 3 additions & 3 deletions paddle/fluid/framework/fleet/box_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class BoxWrapper {
void BeginFeedPass(int date, boxps::PSAgentBase** agent) const;
void EndFeedPass(boxps::PSAgentBase* agent) const;
void BeginPass() const;
void EndPass() const;
void EndPass(bool need_save_delta) const;
void PullSparse(const paddle::platform::Place& place,
const std::vector<const uint64_t*>& keys,
const std::vector<float*>& values,
Expand Down Expand Up @@ -503,10 +503,10 @@ class BoxHelper {
box_ptr->BeginPass();
#endif
}
void EndPass() {
void EndPass(bool need_save_delta) {
#ifdef PADDLE_WITH_BOX_PS
auto box_ptr = BoxWrapper::GetInstance();
box_ptr->EndPass();
box_ptr->EndPass(need_save_delta);
#endif
}
void LoadIntoMemory() {
Expand Down
6 changes: 3 additions & 3 deletions python/paddle/fluid/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,7 +832,7 @@ def begin_pass(self):
"""
self.boxps.begin_pass()

def end_pass(self):
def end_pass(self, need_save_delta):
"""
End Pass
Notify BoxPS that current pass ended
Expand All @@ -841,9 +841,9 @@ def end_pass(self):

import paddle.fluid as fluid
dataset = fluid.DatasetFactory().create_dataset("BoxPSDataset")
dataset.end_pass()
dataset.end_pass(True)
"""
self.boxps.end_pass()
self.boxps.end_pass(need_save_delta)

def wait_preload_done(self):
"""
Expand Down
4 changes: 2 additions & 2 deletions python/paddle/fluid/tests/unittests/test_boxps.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ def create_dataset():
program=fluid.default_main_program(),
dataset=datasets[0],
print_period=1)
datasets[0].end_pass()
datasets[0].end_pass(True)
datasets[1].wait_preload_done()
datasets[1].begin_pass()
exe.train_from_dataset(
program=fluid.default_main_program(),
dataset=datasets[1],
print_period=1,
debug=True)
datasets[1].end_pass()
datasets[1].end_pass(False)
for f in filelist:
os.remove(f)

Expand Down