From 1d393cfb5d6de4af58d56ccf74c1c330202cf4b7 Mon Sep 17 00:00:00 2001 From: Ruibiao Chen Date: Tue, 6 Sep 2022 19:25:57 +0800 Subject: [PATCH] Use logging to print log of FLAGS_FORCE_USE_PROGRAM_CACHE (#45799) --- python/paddle/fluid/executor.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/python/paddle/fluid/executor.py b/python/paddle/fluid/executor.py index 1ef053bab6..447cab7119 100755 --- a/python/paddle/fluid/executor.py +++ b/python/paddle/fluid/executor.py @@ -953,6 +953,13 @@ class Executor(object): def _add_scope_cache(self, scope_cache_key, scope): self.scope_caches[scope_cache_key] = scope + # just for testing, will be removed later + @lru_cache() + def _log_force_set_program_cache(self, use_program_cache): + logging.warning( + f"use_program_cache is force set to {use_program_cache} by FLAGS_FORCE_USE_PROGRAM_CACHE" + ) + def _feed_data(self, program, feed, feed_var_name, scope): # feed var to framework global_block = program.global_block() @@ -1427,9 +1434,7 @@ class Executor(object): use_program_cache = force_use_program_cache in [ 1, '1', True, 'True', 'true' ] - warnings.warn( - f"use_program_cache is force set to {use_program_cache} by FLAGS_FORCE_USE_PROGRAM_CACHE", - UserWarning) + self._log_force_set_program_cache(use_program_cache) try: res = self._run_impl(program=program, -- GitLab