Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: RHEL8 Python Backend #385

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,18 @@ 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.
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)
FetchContent_MakeAvailable(pybind11)

#
Expand Down Expand Up @@ -268,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(
Expand Down
Loading