From 11c231a7b442c15b967ef4c1f4cd627fcf446c74 Mon Sep 17 00:00:00 2001 From: Leo Chen Date: Thu, 16 Jul 2020 15:22:58 +0800 Subject: [PATCH] make preloading ligbomp more robust, test=develop (#25527) (#25546) 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