From fbcd1f57a1c7c22d5fb81ccfea7afd640b7add19 Mon Sep 17 00:00:00 2001 From: fpetrini15 Date: Tue, 22 Oct 2024 18:09:35 -0700 Subject: [PATCH 1/2] PYBE RHEL --- CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index ee209b5b..7ef2c388 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -92,6 +92,16 @@ FetchContent_Declare( GIT_TAG "aa304c9c7d725ffb9d10af08a3b34cb372307020" GIT_SHALLOW ON ) + +# RHEL base container has multiple version of Python installed. By default +# it seems like pybind will pickup v3.6, so we specifically assign it to +# search for 3.12 here. +if(LINUX) + file(STRINGS "/etc/os-release" DISTRO_ID_LIKE REGEX "ID_LIKE") + if(${DISTRO_ID_LIKE} MATCHES "rhel|centos") + set(PYBIND11_PYTHON_VERSION 3.12) + endif(${DISTRO_ID_LIKE} MATCHES "rhel|centos") +endif(LINUX) FetchContent_MakeAvailable(pybind11) # From 5048e9e84082a77a683f7087f47b5e92e89e2059 Mon Sep 17 00:00:00 2001 From: fpetrini15 Date: Fri, 25 Oct 2024 11:16:19 -0700 Subject: [PATCH 2/2] Add RPATH --- CMakeLists.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ef2c388..d27f10a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,9 +96,11 @@ FetchContent_Declare( # RHEL base container has multiple version of Python installed. By default # it seems like pybind will pickup v3.6, so we specifically assign it to # search for 3.12 here. +set(RHEL_BUILD OFF) if(LINUX) file(STRINGS "/etc/os-release" DISTRO_ID_LIKE REGEX "ID_LIKE") if(${DISTRO_ID_LIKE} MATCHES "rhel|centos") + set(RHEL_BUILD ON) set(PYBIND11_PYTHON_VERSION 3.12) endif(${DISTRO_ID_LIKE} MATCHES "rhel|centos") endif(LINUX) @@ -278,6 +280,23 @@ target_compile_options( ) target_compile_definitions(triton-python-backend-stub PRIVATE TRITON_PB_STUB) +# RHEL assets are not released in a container environment nor do the current +# Python lib versions in the manylinux base container match those currently +# available for RHEL8 package managers. Therefore, we package the correct +# python libs in the backend folder and adjust the stub executable to look +# in its own folder at runtime. +if(RHEL_BUILD) + set_target_properties( + triton-python-backend-stub + PROPERTIES + SKIP_BUILD_RPATH TRUE + BUILD_WITH_INSTALL_RPATH TRUE + INSTALL_RPATH_USE_LINK_PATH FALSE + INSTALL_RPATH "$\{ORIGIN\}" + ) +endif(RHEL_BUILD) + + # For WIN32 do not link Threads and DL_LIBS if(WIN32) target_link_libraries(