From 5618f14047250f1325e7d544b4c147bf0a98c5a8 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Mon, 1 Mar 2021 16:47:16 +0800 Subject: [PATCH] fix reading flags from env (#31329) --- python/paddle/fluid/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/python/paddle/fluid/__init__.py b/python/paddle/fluid/__init__.py index aa1f49cce63..189ee12e529 100644 --- a/python/paddle/fluid/__init__.py +++ b/python/paddle/fluid/__init__.py @@ -218,7 +218,7 @@ def __bootstrap__(): read_env_flags.append('tracer_mkldnn_ops_on') read_env_flags.append('tracer_mkldnn_ops_off') - if core.is_compiled_with_cuda() or core.is_compiled_with_npu(): + if core.is_compiled_with_cuda(): read_env_flags += [ 'fraction_of_gpu_memory_to_use', 'initial_gpu_memory_in_mb', @@ -236,7 +236,13 @@ def __bootstrap__(): ] if core.is_compiled_with_npu(): - read_env_flags += ['selected_npus', ] + read_env_flags += [ + 'selected_npus', + 'fraction_of_gpu_memory_to_use', + 'initial_gpu_memory_in_mb', + 'reallocate_gpu_memory_in_mb', + 'gpu_memory_limit_mb', + ] core.init_gflags(["--tryfromenv=" + ",".join(read_env_flags)]) core.init_glog(sys.argv[0]) -- GitLab