Skip to content

Commit 3e069f3

Browse files
committed
Update the RHEL library path
1 parent cd2dc94 commit 3e069f3

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

CMakeLists.txt

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,16 @@ else()
7878
endif()
7979

8080
# Look for installed Torchvision package in lib paths
81-
if(TRITON_PYTORCH_ENABLE_TORCHVISION AND NOT EXISTS "${TRITON_PYTORCH_LIB_PATHS}/libtorchvision.so.1")
82-
message(WARNING "TRITON_PYTORCH_ENABLE_TORCHVISION is on, but TRITON_PYTORCH_LIB_PATHS does not contain Torchvision package")
81+
if(TRITON_PYTORCH_ENABLE_TORCHVISION)
82+
if(${RHEL_BUILD})
83+
if(NOT EXISTS "${TRITON_PYTORCH_LIB_PATHS}/libtorchvision.so")
84+
message(WARNING "TRITON_PYTORCH_ENABLE_TORCHVISION is on, but TRITON_PYTORCH_LIB_PATHS does not contain Torchvision package")
85+
endif()
86+
else()
87+
if(NOT EXISTS "${TRITON_PYTORCH_LIB_PATHS}/libtorchvision.so.1")
88+
message(WARNING "TRITON_PYTORCH_ENABLE_TORCHVISION is on, but TRITON_PYTORCH_LIB_PATHS does not contain Torchvision package")
89+
endif()
90+
endif()
8391
endif()
8492
endif()
8593

@@ -164,7 +172,7 @@ set(PT_LIBS
164172
if (${TRITON_PYTORCH_ENABLE_TORCHVISION})
165173
set(PT_LIBS
166174
${PT_LIBS}
167-
"libtorchvision.so.1"
175+
${RHEL_BUILD} ? "libtorchvision.so" : "libtorchvision.so.1"
168176
)
169177
endif() # TRITON_PYTORCH_ENABLE_TORCHVISION
170178

@@ -249,7 +257,8 @@ if (${TRITON_PYTORCH_DOCKER_BUILD})
249257
COMMAND docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH}/torch/lib/libcaffe2_nvrtc.so libcaffe2_nvrtc.so
250258
# TODO: Revisit when not needed by making it part of cuda base container.
251259
COMMAND docker cp -L pytorch_backend_ptlib:/usr/local/cuda/lib64/libcusparseLt.so libcusparseLt.so;
252-
COMMAND /bin/sh -c "if [ ${TRITON_PYTORCH_ENABLE_TORCHVISION} = 'ON' ]; then docker cp -a -L pytorch_backend_ptlib:/usr/local/${LIB_DIR}/libtorchvision.so.1 libtorchvision.so.1; fi"
260+
#COMMAND /bin/sh -c "if [ ${TRITON_PYTORCH_ENABLE_TORCHVISION} = 'ON' ]; then docker cp -a -L pytorch_backend_ptlib:/usr/local/${LIB_DIR}/libtorchvision.so.1 libtorchvision.so.1; fi"
261+
COMMAND /bin/sh -c "if [ ${TRITON_PYTORCH_ENABLE_TORCHVISION} = 'ON' ]; then if [ ${RHEL_BUILD} = 'ON' ]; then docker cp -a -L pytorch_backend_ptlib:/usr/local/lib64/libtorchvision.so libtorchvision.so; else docker cp -a -L pytorch_backend_ptlib:/usr/local/${LIB_DIR}/libtorchvision.so.1 libtorchvision.so.1; fi; fi"
253262
COMMAND /bin/sh -c "if [ ${TRITON_PYTORCH_ENABLE_TORCHVISION} = 'ON' ]; then docker cp pytorch_backend_ptlib:/opt/pytorch/vision/torchvision/csrc include/torchvision/torchvision; fi"
254263
COMMAND /bin/sh -c "if [ ${TRITON_PYTORCH_ENABLE_TORCHTRT} = 'ON' ]; then docker cp pytorch_backend_ptlib:/usr/local/lib/python3.12/dist-packages/torch_tensorrt/lib/libtorchtrt_runtime.so libtorchtrt_runtime.so; fi"
255264
COMMAND docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH}/torch_tensorrt/bin/torchtrtc torchtrtc || echo "error ignored..." || true
@@ -382,9 +391,15 @@ if (${TRITON_PYTORCH_DOCKER_BUILD})
382391
set(TRITON_PYTORCH_LIBS "${CMAKE_CURRENT_BINARY_DIR}/libtorch.so")
383392

384393
if (${TRITON_PYTORCH_ENABLE_TORCHVISION})
385-
set(TRITON_PYTORCH_LIBS
386-
${TRITON_PYTORCH_LIBS}
387-
"${CMAKE_CURRENT_BINARY_DIR}/libtorchvision.so.1")
394+
if(${RHEL_BUILD})
395+
set(TRITON_PYTORCH_LIBS
396+
${TRITON_PYTORCH_LIBS}
397+
"${CMAKE_CURRENT_BINARY_DIR}/libtorchvision.so")
398+
else()
399+
set(TRITON_PYTORCH_LIBS
400+
${TRITON_PYTORCH_LIBS}
401+
"${CMAKE_CURRENT_BINARY_DIR}/libtorchvision.so.1")
402+
endif()
388403
endif() # TRITON_PYTORCH_ENABLE_TORCHVISION
389404

390405
if (${TRITON_PYTORCH_ENABLE_TORCHTRT})

0 commit comments

Comments
 (0)