From 8d605d3bcff2e8f454e1816bcc222412d758e91b Mon Sep 17 00:00:00 2001 From: zhoufeng Date: Mon, 21 Nov 2022 15:30:25 +0800 Subject: [PATCH] only linux need to pre-load libgomp.so Signed-off-by: zhoufeng --- .../mindspore/run_check/_check_version.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/mindspore/python/mindspore/run_check/_check_version.py b/mindspore/python/mindspore/run_check/_check_version.py index 65aa82a00bc..8567473125e 100644 --- a/mindspore/python/mindspore/run_check/_check_version.py +++ b/mindspore/python/mindspore/run_check/_check_version.py @@ -491,14 +491,15 @@ def set_env(device, library_path): def check_version_and_env_config(): """check version and env config""" - # Note: pre-load libgomp.so to solve error like "cannot allocate memory in statis TLS block" - try: - import ctypes - ctypes.cdll.LoadLibrary("libgomp.so.1") - except OSError: - logger.warning( - "Pre-Load Lirary libgomp.so.1 failed, this might cause cannot allocate TLS memory problem, " - "if so find solution in FAQ in https://www.mindspore.cn/docs/en/master/faq/installation.html.") + if platform.system().lower() == 'linux': + # Note: pre-load libgomp.so to solve error like "cannot allocate memory in statis TLS block" + try: + import ctypes + ctypes.cdll.LoadLibrary("libgomp.so.1") + except OSError: + logger.warning( + "Pre-Load Lirary libgomp.so.1 failed, this might cause cannot allocate TLS memory problem, " + "if so find solution in FAQ in https://www.mindspore.cn/docs/en/master/faq/installation.html.") if not os.getenv("MS_DEV_CLOSE_VERSION_CHECK") is None: return MSContext.get_instance().register_check_env_callback(check_env)