Skip to content

Commit 65f1e61

Browse files
committed
Revert "Update changes to opencv path"
This reverts commit f511258.
1 parent f511258 commit 65f1e61

File tree

1 file changed

+41
-9
lines changed

1 file changed

+41
-9
lines changed

CMakeLists.txt

Lines changed: 41 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,15 @@ else()
7979

8080
# Look for installed Torchvision package in lib paths
8181
if(TRITON_PYTORCH_ENABLE_TORCHVISION)
82+
if(${RHEL_BUILD})
8283
if(NOT EXISTS "${TRITON_PYTORCH_LIB_PATHS}/libtorchvision.so")
8384
message(WARNING "TRITON_PYTORCH_ENABLE_TORCHVISION is on, but TRITON_PYTORCH_LIB_PATHS does not contain Torchvision package")
8485
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()
8591
endif()
8692
endif()
8793

@@ -164,10 +170,17 @@ set(PT_LIBS
164170
)
165171

166172
if (${TRITON_PYTORCH_ENABLE_TORCHVISION})
173+
if(${RHEL_BUILD})
167174
set(PT_LIBS
168175
${PT_LIBS}
169176
"libtorchvision.so"
170177
)
178+
else()
179+
set(PT_LIBS
180+
${PT_LIBS}
181+
"libtorchvision.so.1"
182+
)
183+
endif()
171184
endif() # TRITON_PYTORCH_ENABLE_TORCHVISION
172185

173186
if (${TRITON_PYTORCH_ENABLE_TORCHTRT})
@@ -217,10 +230,21 @@ set(OPENCV_LIBS
217230
"libopencv_calib3d.so"
218231
"libopencv_flann.so"
219232
"libopencv_features2d.so"
220-
"libpng16.so"
221-
"libjpeg.so.62"
222-
"libjpeg.so"
223233
)
234+
if(${RHEL_BUILD})
235+
set(OPENCV_LIBS
236+
${OPENCV_LIBS}
237+
"libjpeg.so.62" # RHEL uses only .so.62 version
238+
"libpng16.so.16" # RHEL uses .so.16 version
239+
)
240+
else()
241+
set(OPENCV_LIBS
242+
${OPENCV_LIBS}
243+
"libjpeg.so" # Non-RHEL uses both .so and .so.62
244+
"libjpeg.so.62"
245+
"libpng16.so"
246+
)
247+
endif()
224248

225249
# The patchelf commands ensure the MKL libraries are loaded correctly during runtime
226250
# Without these, the framework/backend complains of missing libraries / symbols and
@@ -252,7 +276,8 @@ if (${TRITON_PYTORCH_DOCKER_BUILD})
252276
COMMAND docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH}/torch/lib/libcaffe2_nvrtc.so libcaffe2_nvrtc.so
253277
# TODO: Revisit when not needed by making it part of cuda base container.
254278
COMMAND docker cp -L pytorch_backend_ptlib:/usr/local/cuda/lib64/libcusparseLt.so libcusparseLt.so;
255-
COMMAND /bin/sh -c "docker cp pytorch_backend_ptlib:$<IF:$<BOOL:${TRITON_PYTORCH_ENABLE_TORCHVISION}>,$<IF:$<BOOL:${RHEL_BUILD}>,/usr/local/lib64/libtorchvision.so,/usr/local/${LIB_DIR}/libtorchvision.so.1>,/dev/null> libtorchvision.so"
279+
#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"
280+
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"
256281
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"
257282
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"
258283
COMMAND docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH}/torch_tensorrt/bin/torchtrtc torchtrtc || echo "error ignored..." || true
@@ -268,8 +293,8 @@ if (${TRITON_PYTORCH_DOCKER_BUILD})
268293
COMMAND docker cp -L pytorch_backend_ptlib:/usr/local/${LIB_DIR}/libopencv_calib3d.so libopencv_calib3d.so
269294
COMMAND docker cp -L pytorch_backend_ptlib:/usr/local/${LIB_DIR}/libopencv_features2d.so libopencv_features2d.so
270295
COMMAND docker cp -L pytorch_backend_ptlib:/usr/local/${LIB_DIR}/libopencv_flann.so libopencv_flann.so
271-
COMMAND /bin/sh -c "docker cp pytorch_backend_ptlib:$<IF:$<BOOL:${RHEL_BUILD}>,/usr/lib64/libjpeg.so.62,/usr/local/lib/libjpeg.so.62> libjpeg.so.62 && docker cp pytorch_backend_ptlib:$<IF:$<BOOL:${RHEL_BUILD}>,/dev/null,/usr/lib/${LIBS_ARCH}-linux-gnu/libjpeg.so.8.2.2> libjpeg.so"
272-
COMMAND /bin/sh -c "docker cp pytorch_backend_ptlib:$<IF:$<BOOL:${RHEL_BUILD}>,/usr/lib64/libpng16.so.16,/usr/lib/${LIBS_ARCH}-linux-gnu/libpng16.so> libpng16.so"
296+
COMMAND /bin/sh -c "if [ ${RHEL_BUILD} = 'ON' ]; then docker cp -L pytorch_backend_ptlib:/usr/lib64/libjpeg.so.62 libjpeg.so.62; else docker cp -L pytorch_backend_ptlib:/usr/local/lib/libjpeg.so.62 libjpeg.so.62 && docker cp pytorch_backend_ptlib:/usr/lib/${LIBS_ARCH}-linux-gnu/libjpeg.so.8.2.2 libjpeg.so; fi;"
297+
COMMAND /bin/sh -c "if [ ${RHEL_BUILD} = 'ON' ]; then docker cp -L pytorch_backend_ptlib:/usr/lib64/libpng16.so.16 libpng16.so.16; else docker cp -L pytorch_backend_ptlib:/usr/lib/${LIBS_ARCH}-linux-gnu/libpng16.so libpng16.so; fi;"
273298
COMMAND /bin/sh -c "if [ -f libmkl_def.so.1 ]; then patchelf --add-needed libmkl_gnu_thread.so.1 libmkl_def.so.1; fi"
274299
COMMAND /bin/sh -c "if [ -f libmkl_def.so.1 ]; then patchelf --add-needed libmkl_core.so.1 libmkl_def.so.1; fi"
275300
COMMAND /bin/sh -c "if [ -f libmkl_avx2.so.1 ]; then patchelf --add-needed libmkl_gnu_thread.so.1 libmkl_avx2.so.1; fi"
@@ -280,6 +305,7 @@ if (${TRITON_PYTORCH_DOCKER_BUILD})
280305
COMMAND /bin/sh -c "if [ -f libmkl_vml_def.so.1 ]; then patchelf --add-needed libmkl_intel_thread.so.1 libmkl_vml_def.so.1; fi"
281306
COMMAND /bin/sh -c "if [ -f libmkl_vml_def.so.1 ]; then patchelf --add-needed libmkl_core.so.1 libmkl_vml_def.so.1; fi"
282307
COMMAND /bin/sh -c "if [ -f libmkl_intel_thread.so.1 ]; then patchelf --add-needed libmkl_intel_lp64.so.1 libmkl_intel_thread.so.1; fi"
308+
COMMAND /bin/sh -c "if [ ${TRITON_PYTORCH_ENABLE_TORCHVISION} = 'ON' ]; then if [ ${RHEL_BUILD} = 'OFF' ]; then ln -s libtorchvision.so.1 libtorchvision.so; fi; fi;"
283309
COMMAND docker rm pytorch_backend_ptlib
284310
COMMENT "Extracting pytorch and torchvision libraries and includes from ${TRITON_PYTORCH_DOCKER_IMAGE}"
285311
VERBATIM
@@ -382,9 +408,15 @@ if (${TRITON_PYTORCH_DOCKER_BUILD})
382408
set(TRITON_PYTORCH_LIBS "${CMAKE_CURRENT_BINARY_DIR}/libtorch.so")
383409

384410
if (${TRITON_PYTORCH_ENABLE_TORCHVISION})
385-
set(TRITON_PYTORCH_LIBS
386-
${TRITON_PYTORCH_LIBS}
387-
"${CMAKE_CURRENT_BINARY_DIR}/libtorchvision.so")
411+
if(${RHEL_BUILD})
412+
set(TRITON_PYTORCH_LIBS
413+
${TRITON_PYTORCH_LIBS}
414+
"${CMAKE_CURRENT_BINARY_DIR}/libtorchvision.so")
415+
else()
416+
set(TRITON_PYTORCH_LIBS
417+
${TRITON_PYTORCH_LIBS}
418+
"${CMAKE_CURRENT_BINARY_DIR}/libtorchvision.so.1")
419+
endif()
388420
endif() # TRITON_PYTORCH_ENABLE_TORCHVISION
389421

390422
if (${TRITON_PYTORCH_ENABLE_TORCHTRT})

0 commit comments

Comments
 (0)