From 4aac90ef7b769314f3b8884ad166051a12e77aa2 Mon Sep 17 00:00:00 2001 From: Zhen Wang Date: Tue, 21 Jun 2022 16:31:56 +0800 Subject: [PATCH] Fix some bugs about the usage of cinn lib. (#43586) * Fix some bugs about the usage of cinn lib. * Fix some unit test errors. --- python/paddle/__init__.py | 2 +- python/setup.py.in | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/python/paddle/__init__.py b/python/paddle/__init__.py index b2a94e62a1e..e39affb84cd 100755 --- a/python/paddle/__init__.py +++ b/python/paddle/__init__.py @@ -370,7 +370,7 @@ if is_compiled_with_cinn(): runtime_include_dir = os.path.join(package_dir, "libs") cuh_file = os.path.join(runtime_include_dir, "cinn_cuda_runtime_source.cuh") if os.path.exists(cuh_file): - os.environ['runtime_include_dir'] = runtime_include_dir + os.environ.setdefault('runtime_include_dir', runtime_include_dir) disable_static() diff --git a/python/setup.py.in b/python/setup.py.in index 8b6a4568651..bbeb1aa4476 100755 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -502,6 +502,10 @@ if '${WITH_CINN}' == 'ON': shutil.copy('${CINN_INCLUDE_DIR}/cinn/runtime/cuda/cinn_cuda_runtime_source.cuh', libs_path) package_data['paddle.libs']+=['libcinnapi.so'] package_data['paddle.libs']+=['cinn_cuda_runtime_source.cuh'] + if '${CMAKE_BUILD_TYPE}' == 'Release' and os.name != 'nt': + command = "patchelf --set-rpath '$ORIGIN/' %s/${CINN_LIB_NAME}" % libs_path + if os.system(command) != 0: + raise Exception("patch %s/${CINN_LIB_NAME} failed, command: %s" % (libs_path, command)) if '${WITH_PSLIB}' == 'ON': shutil.copy('${PSLIB_LIB}', libs_path) -- GitLab