From b796d8facb2db31f28872dd2c00f60413bd44738 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Wed, 15 Jul 2020 17:10:43 +0800 Subject: [PATCH] make preloading ligbomp more robust, test=develop (#25527) add try..catch... --- python/paddle/fluid/core.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/python/paddle/fluid/core.py b/python/paddle/fluid/core.py index d7d0c68a314..d87363abf14 100644 --- a/python/paddle/fluid/core.py +++ b/python/paddle/fluid/core.py @@ -169,13 +169,13 @@ def run_shell_command(cmd): if err: return None else: - return out.decode('utf-8') + return out.decode('utf-8').strip() def get_dso_path(core_so, dso_name): if core_so and dso_name: return run_shell_command("ldd %s|grep %s|awk '{print $3}'" % - (core_so, dso_name)).strip() + (core_so, dso_name)) else: return None @@ -225,7 +225,11 @@ def less_than_ver(a, b): # The final solution is to upgrade glibc to > 2.22 on the target system. if platform.system().lower() == 'linux' and less_than_ver(get_glibc_ver(), '2.23'): - pre_load('libgomp') + try: + pre_load('libgomp') + except Exception as e: + # NOTE(zhiqiu): do not abort if failed, since it may success when import core_avx.so + sys.stderr.write('Error: Can not preload libgomp.so') load_noavx = False -- GitLab