From 7b608396feb0106733295b6ff00cef8d87e505d1 Mon Sep 17 00:00:00 2001 From: sneaxiy Date: Wed, 6 Mar 2019 07:11:34 +0000 Subject: [PATCH] fix travis-ci format check test=develop --- paddle/fluid/framework/details/computation_op_handle.h | 1 + paddle/fluid/framework/details/eager_deletion_op_handle.cc | 5 ++++- paddle/fluid/framework/details/eager_deletion_pass.cc | 5 ++++- paddle/fluid/framework/details/reference_count_pass.cc | 4 ++++ .../fluid/framework/details/reference_count_pass_helper.h | 1 + paddle/fluid/framework/executor.cc | 6 +++++- paddle/fluid/operators/controlflow/while_op_helper.cc | 2 ++ .../tests/unittests/test_eager_deletion_transformer.py | 3 +-- .../unittests/test_partial_eager_deletion_transformer.py | 2 +- 9 files changed, 23 insertions(+), 6 deletions(-) diff --git a/paddle/fluid/framework/details/computation_op_handle.h b/paddle/fluid/framework/details/computation_op_handle.h index 67f7cb738f..e98b16e6b3 100644 --- a/paddle/fluid/framework/details/computation_op_handle.h +++ b/paddle/fluid/framework/details/computation_op_handle.h @@ -14,6 +14,7 @@ #pragma once +#include #include #include diff --git a/paddle/fluid/framework/details/eager_deletion_op_handle.cc b/paddle/fluid/framework/details/eager_deletion_op_handle.cc index e58e501e6d..dbc90737f2 100644 --- a/paddle/fluid/framework/details/eager_deletion_op_handle.cc +++ b/paddle/fluid/framework/details/eager_deletion_op_handle.cc @@ -12,11 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include +#include +#include + #include "paddle/fluid/framework/details/eager_deletion_op_handle.h" #include "paddle/fluid/framework/lod_tensor_array.h" #include "paddle/fluid/framework/scope.h" #include "paddle/fluid/framework/selected_rows.h" -#include "paddle/fluid/platform/profiler.h" #ifdef PADDLE_WITH_CUDA #include "paddle/fluid/platform/cuda_device_guard.h" #endif diff --git a/paddle/fluid/framework/details/eager_deletion_pass.cc b/paddle/fluid/framework/details/eager_deletion_pass.cc index 566bc15c17..377bb915e0 100644 --- a/paddle/fluid/framework/details/eager_deletion_pass.cc +++ b/paddle/fluid/framework/details/eager_deletion_pass.cc @@ -25,7 +25,10 @@ #include "paddle/fluid/framework/ir/graph_helper.h" DEFINE_double(memory_fraction_of_eager_deletion, 1.0, - "Fraction of eager deletion"); + "Fraction of eager deletion. If less than 1.0, all variables in " + "the program would be sorted according to its memory size, and " + "only the FLAGS_memory_fraction_of_eager_deletion of the largest " + "variables would be deleted."); namespace paddle { namespace framework { diff --git a/paddle/fluid/framework/details/reference_count_pass.cc b/paddle/fluid/framework/details/reference_count_pass.cc index 892f638f1f..6092143449 100644 --- a/paddle/fluid/framework/details/reference_count_pass.cc +++ b/paddle/fluid/framework/details/reference_count_pass.cc @@ -12,9 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +#include #include #include #include +#include +#include +#include #include #include "paddle/fluid/framework/details/computation_op_handle.h" diff --git a/paddle/fluid/framework/details/reference_count_pass_helper.h b/paddle/fluid/framework/details/reference_count_pass_helper.h index d9e8776d7e..ce700119c5 100644 --- a/paddle/fluid/framework/details/reference_count_pass_helper.h +++ b/paddle/fluid/framework/details/reference_count_pass_helper.h @@ -16,6 +16,7 @@ #include #include +#include #include #include #include diff --git a/paddle/fluid/framework/executor.cc b/paddle/fluid/framework/executor.cc index 5555679412..7eef9ec504 100644 --- a/paddle/fluid/framework/executor.cc +++ b/paddle/fluid/framework/executor.cc @@ -14,6 +14,10 @@ limitations under the License. */ #include "paddle/fluid/framework/executor.h" #include +#include +#include +#include +#include #include "paddle/fluid/framework/feed_fetch_method.h" #include "paddle/fluid/framework/lod_rank_table.h" @@ -428,7 +432,7 @@ void Executor::RunPreparedContext(ExecutorPrepareContext* ctx, Scope* scope, #ifdef PADDLE_WITH_CUDA } #endif - if (gc) { + if (gc && keep_kids) { operators::PrepareSafeEagerDeletionOnWhileOpAndWhileGradOp(ctx->block_id_, ctx->ops_); } diff --git a/paddle/fluid/operators/controlflow/while_op_helper.cc b/paddle/fluid/operators/controlflow/while_op_helper.cc index 848ff5e8f1..2cbd94a061 100644 --- a/paddle/fluid/operators/controlflow/while_op_helper.cc +++ b/paddle/fluid/operators/controlflow/while_op_helper.cc @@ -14,6 +14,8 @@ #include "paddle/fluid/operators/controlflow/while_op_helper.h" #include +#include +#include #include "paddle/fluid/framework/program_desc.h" namespace paddle { diff --git a/python/paddle/fluid/tests/unittests/test_eager_deletion_transformer.py b/python/paddle/fluid/tests/unittests/test_eager_deletion_transformer.py index 603c8e7488..05cc41b96f 100644 --- a/python/paddle/fluid/tests/unittests/test_eager_deletion_transformer.py +++ b/python/paddle/fluid/tests/unittests/test_eager_deletion_transformer.py @@ -16,8 +16,7 @@ import os import unittest os.environ['FLAGS_eager_delete_tensor_gb'] = "0.0" -os.environ[ - 'RECORDIO_FILENAME'] = '/tmp/eager_deletion_transformer.wmt16.recordio' +os.environ['RECORDIO_FILENAME'] = './eager_deletion_transformer.wmt16.recordio' from test_parallel_executor_transformer import TestTransformer diff --git a/python/paddle/fluid/tests/unittests/test_partial_eager_deletion_transformer.py b/python/paddle/fluid/tests/unittests/test_partial_eager_deletion_transformer.py index ba3b275c7e..fc1d762ec9 100644 --- a/python/paddle/fluid/tests/unittests/test_partial_eager_deletion_transformer.py +++ b/python/paddle/fluid/tests/unittests/test_partial_eager_deletion_transformer.py @@ -18,7 +18,7 @@ os.environ['FLAGS_eager_delete_tensor_gb'] = "0.0" os.environ['FLAGS_memory_fraction_of_eager_deletion'] = "0.55" os.environ[ - 'RECORDIO_FILENAME'] = '/tmp/partial_eager_deletion_transformer.wmt16.recordio' + 'RECORDIO_FILENAME'] = './partial_eager_deletion_transformer.wmt16.recordio' from test_parallel_executor_transformer import TestTransformer -- GitLab