From 0531a48b9a3a5a88c57038ad78d92744efd6ffe1 Mon Sep 17 00:00:00 2001 From: jiangcheng Date: Tue, 27 Dec 2022 19:57:36 +0800 Subject: [PATCH] fix CINN should add float16.h may install bug (#49324) * fix CINN should add float16.h may install bug * reupdate setuppy support float16 * add only if float16.h file exists --- python/setup.py.in | 6 ++++++ setup.py | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/python/setup.py.in b/python/setup.py.in index c453dffb357..f22841e2f86 100755 --- a/python/setup.py.in +++ b/python/setup.py.in @@ -522,6 +522,12 @@ 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'] + + cinn_fp16_file = '${CINN_INCLUDE_DIR}/cinn/runtime/cuda/float16.h' + if os.path.exists(cinn_fp16_file): + shutil.copy(cinn_fp16_file, libs_path) + package_data['paddle.libs']+=['float16.h'] + 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: diff --git a/setup.py b/setup.py index e2e1e9dc2d2..d801365dd13 100644 --- a/setup.py +++ b/setup.py @@ -859,6 +859,14 @@ def get_package_data_and_package_dir(): ) package_data['paddle.libs'] += ['libcinnapi.so'] package_data['paddle.libs'] += ['cinn_cuda_runtime_source.cuh'] + + cinn_fp16_file = ( + env_dict.get("CINN_INCLUDE_DIR") + '/cinn/runtime/cuda/float16.h' + ) + if os.path.exists(cinn_fp16_file): + shutil.copy(cinn_fp16_file, libs_path) + package_data['paddle.libs'] += ['float16.h'] + if env_dict.get("CMAKE_BUILD_TYPE") == 'Release' and os.name != 'nt': command = ( "patchelf --set-rpath '$ORIGIN/' %s/" % libs_path -- GitLab