diff --git a/CMakeLists.txt b/CMakeLists.txt index bb5162e..6adc487 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,14 @@ if(TRITON_TENSORFLOW_LIB_PATHS STREQUAL "") endif() message(STATUS "Using Tensorflow docker: ${TRITON_TENSORFLOW_DOCKER_BUILD}") +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) + endif(${DISTRO_ID_LIKE} MATCHES "rhel|centos") +endif(LINUX) + set(TRITON_TENSORFLOW_CC_LIBNAME "libtensorflow_cc.so") set(TRITON_TENSORFLOW_FW_LIBNAME "libtensorflow_framework.so") set(TRITON_TENSORFLOW_LDFLAGS "-ltensorflow_cc -ltensorflow_framework") @@ -68,7 +76,11 @@ if(${TRITON_TENSORFLOW_VERSION} EQUAL "1") elseif(${TRITON_TENSORFLOW_VERSION} EQUAL "2") set(TRITON_TENSORFLOW_BACKEND_LIBNAME triton_tensorflow) set(TRITON_TENSORFLOW_BACKEND_INSTALLDIR ${CMAKE_INSTALL_PREFIX}/backends/tensorflow) - set(TRITON_TENSORFLOW_PYTHON_PATH "/usr/local/lib/python3.10/dist-packages/tensorflow") + if(RHEL_BUILD) + set(TRITON_TENSORFLOW_PYTHON_PATH "/opt/_internal/cpython-3.10.13/lib/python3.10/site-packages/tensorflow") + else() + set(TRITON_TENSORFLOW_PYTHON_PATH "/usr/local/lib/python3.10/dist-packages/tensorflow") + endif(RHEL_BUILD) else() message(FATAL_ERROR "TRITON_TENSORFLOW_VERSION allowed values is '2'") endif() @@ -135,7 +147,7 @@ if (${TRITON_TENSORFLOW_DOCKER_BUILD}) COMMAND docker pull ${TRITON_TENSORFLOW_DOCKER_IMAGE} COMMAND docker rm tensorflow_backend_tflib || echo "error ignored..." || true COMMAND docker create --name tensorflow_backend_tflib ${TRITON_TENSORFLOW_DOCKER_IMAGE} - COMMAND docker cp -L tensorflow_backend_tflib:/usr/local/lib/tensorflow/${TRITON_TENSORFLOW_CC_LIBNAME}.${TRITON_TENSORFLOW_VERSION} ${TRITON_TENSORFLOW_CC_LIBNAME}.${TRITON_TENSORFLOW_VERSION} + COMMAND docker cp -L tensorflow_backend_tflib:${TRITON_TENSORFLOW_PYTHON_PATH}/${TRITON_TENSORFLOW_CC_LIBNAME}.${TRITON_TENSORFLOW_VERSION} ${TRITON_TENSORFLOW_CC_LIBNAME}.${TRITON_TENSORFLOW_VERSION} COMMAND docker cp tensorflow_backend_tflib:${TRITON_TENSORFLOW_PYTHON_PATH}/${TRITON_TENSORFLOW_FW_LIBNAME}.${TRITON_TENSORFLOW_VERSION} ${TRITON_TENSORFLOW_FW_LIBNAME}.${TRITON_TENSORFLOW_VERSION} COMMAND docker cp tensorflow_backend_tflib:/opt/tensorflow/tensorflow-source/LICENSE LICENSE.tensorflow COMMAND docker rm tensorflow_backend_tflib @@ -143,7 +155,7 @@ if (${TRITON_TENSORFLOW_DOCKER_BUILD}) COMMAND docker stop tensorflow_backend_deps || echo "error ignored..." || true COMMAND docker rm tensorflow_backend_deps || echo "error ignored..." || true COMMAND if [ "${TRITON_TENSORFLOW_INSTALL_EXTRA_DEPS}" = "ON" ] \; then mkdir tf_backend_deps && docker run -it -d --name tensorflow_backend_deps ${TRITON_TENSORFLOW_DOCKER_IMAGE} \; fi \; - COMMAND if [ "${TRITON_TENSORFLOW_INSTALL_EXTRA_DEPS}" = "ON" ] \; then docker exec tensorflow_backend_deps sh -c "tar -cf - /usr/lib/${LIBS_ARCH}-linux-gnu/libnccl.so*" | tar --strip-components=3 -xf - -C ./tf_backend_deps \; fi + COMMAND if [ "${TRITON_TENSORFLOW_INSTALL_EXTRA_DEPS}" = "ON" ] \; then docker exec tensorflow_backend_deps sh -c "tar -cf - $,/usr/local/cuda/targets/x86_64-linux/lib/,/usr/lib/${LIBS_ARCH}-linux-gnu/>libnccl.so*" | tar --strip-components=3 -xf - -C ./tf_backend_deps \; fi COMMAND if [ "${TRITON_TENSORFLOW_INSTALL_EXTRA_DEPS}" = "ON" ] \; then docker stop tensorflow_backend_deps && docker rm tensorflow_backend_deps \; fi \; COMMENT "Extracting ${TRITON_TENSORFLOW_CC_LIBNAME}.${TRITON_TENSORFLOW_VERSION} and ${TRITON_TENSORFLOW_FW_LIBNAME}.${TRITON_TENSORFLOW_VERSION} from ${TRITON_TENSORFLOW_DOCKER_IMAGE}"