|
|
|
@ -26,6 +26,11 @@ DEFINE_bool(benchmark, false,
|
|
|
|
|
"Default cuda is asynchronous device, set to True will"
|
|
|
|
|
"force op run in synchronous mode.");
|
|
|
|
|
|
|
|
|
|
DEFINE_bool(
|
|
|
|
|
eager_delete_scope, true,
|
|
|
|
|
"Delete local scope eagerly. It will reduce GPU memory usage but "
|
|
|
|
|
"slow down the destruction of variables.(around 1% performance harm)");
|
|
|
|
|
|
|
|
|
|
namespace paddle {
|
|
|
|
|
namespace framework {
|
|
|
|
|
|
|
|
|
@ -97,7 +102,7 @@ void Scope::DeleteScope(Scope* scope) const {
|
|
|
|
|
PADDLE_ENFORCE(it != this->kids_.end(), "Cannot find %p as kid scope", scope);
|
|
|
|
|
this->kids_.erase(it);
|
|
|
|
|
// When making memory benchmark on Fluid, we have to delete scope sync.
|
|
|
|
|
if (FLAGS_benchmark) {
|
|
|
|
|
if (FLAGS_benchmark || FLAGS_eager_delete_scope) {
|
|
|
|
|
delete scope;
|
|
|
|
|
} else {
|
|
|
|
|
Async([scope] { delete scope; });
|
|
|
|
|