From 255890ffb33c6a391df504a122a156d40e392cb7 Mon Sep 17 00:00:00 2001 From: Ruibiao Chen Date: Fri, 30 Sep 2022 20:03:12 +0800 Subject: [PATCH] Release memory cache after build_op_func_list in interpretercore (#46670) --- paddle/fluid/framework/new_executor/interpretercore_util.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/paddle/fluid/framework/new_executor/interpretercore_util.cc b/paddle/fluid/framework/new_executor/interpretercore_util.cc index e5bd3c97b1..a2b21b5fa5 100644 --- a/paddle/fluid/framework/new_executor/interpretercore_util.cc +++ b/paddle/fluid/framework/new_executor/interpretercore_util.cc @@ -744,6 +744,12 @@ void build_op_func_list(const platform::Place& place, interpreter::LogDeviceMemoryStats(place); } + + // NOTE(Ruibiao): Release memory cache to avoid memory fragments in Allocator. + // It reduce about 10% memory usage for V100 8-GPU training of + // transformer_base_bs4096_amp_fp16 and transformer_base_bs4096_pure_fp16 + // model. + memory::Release(place); } void add_fetch(const std::vector& fetch_names, -- GitLab