Skip to content

Commit f511258

Browse files
committed
Update changes to opencv path
1 parent 8ea88f2 commit f511258

File tree

1 file changed

+9
-41
lines changed

1 file changed

+9
-41
lines changed

CMakeLists.txt

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

8080
# Look for installed Torchvision package in lib paths
8181
if(TRITON_PYTORCH_ENABLE_TORCHVISION)
82-
if(${RHEL_BUILD})
8382
if(NOT EXISTS "${TRITON_PYTORCH_LIB_PATHS}/libtorchvision.so")
8483
message(WARNING "TRITON_PYTORCH_ENABLE_TORCHVISION is on, but TRITON_PYTORCH_LIB_PATHS does not contain Torchvision package")
8584
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()
9185
endif()
9286
endif()
9387

@@ -170,17 +164,10 @@ set(PT_LIBS
170164
)
171165

172166
if (${TRITON_PYTORCH_ENABLE_TORCHVISION})
173-
if(${RHEL_BUILD})
174167
set(PT_LIBS
175168
${PT_LIBS}
176169
"libtorchvision.so"
177170
)
178-
else()
179-
set(PT_LIBS
180-
${PT_LIBS}
181-
"libtorchvision.so.1"
182-
)
183-
endif()
184171
endif() # TRITON_PYTORCH_ENABLE_TORCHVISION
185172

186173
if (${TRITON_PYTORCH_ENABLE_TORCHTRT})
@@ -230,21 +217,10 @@ set(OPENCV_LIBS
230217
"libopencv_calib3d.so"
231218
"libopencv_flann.so"
232219
"libopencv_features2d.so"
220+
"libpng16.so"
221+
"libjpeg.so.62"
222+
"libjpeg.so"
233223
)
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()
248224

249225
# The patchelf commands ensure the MKL libraries are loaded correctly during runtime
250226
# Without these, the framework/backend complains of missing libraries / symbols and
@@ -276,8 +252,7 @@ if (${TRITON_PYTORCH_DOCKER_BUILD})
276252
COMMAND docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH}/torch/lib/libcaffe2_nvrtc.so libcaffe2_nvrtc.so
277253
# TODO: Revisit when not needed by making it part of cuda base container.
278254
COMMAND docker cp -L pytorch_backend_ptlib:/usr/local/cuda/lib64/libcusparseLt.so libcusparseLt.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"
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"
281256
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"
282257
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"
283258
COMMAND docker cp pytorch_backend_ptlib:${PY_INSTALL_PATH}/torch_tensorrt/bin/torchtrtc torchtrtc || echo "error ignored..." || true
@@ -293,8 +268,8 @@ if (${TRITON_PYTORCH_DOCKER_BUILD})
293268
COMMAND docker cp -L pytorch_backend_ptlib:/usr/local/${LIB_DIR}/libopencv_calib3d.so libopencv_calib3d.so
294269
COMMAND docker cp -L pytorch_backend_ptlib:/usr/local/${LIB_DIR}/libopencv_features2d.so libopencv_features2d.so
295270
COMMAND docker cp -L pytorch_backend_ptlib:/usr/local/${LIB_DIR}/libopencv_flann.so libopencv_flann.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;"
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"
298273
COMMAND /bin/sh -c "if [ -f libmkl_def.so.1 ]; then patchelf --add-needed libmkl_gnu_thread.so.1 libmkl_def.so.1; fi"
299274
COMMAND /bin/sh -c "if [ -f libmkl_def.so.1 ]; then patchelf --add-needed libmkl_core.so.1 libmkl_def.so.1; fi"
300275
COMMAND /bin/sh -c "if [ -f libmkl_avx2.so.1 ]; then patchelf --add-needed libmkl_gnu_thread.so.1 libmkl_avx2.so.1; fi"
@@ -305,7 +280,6 @@ if (${TRITON_PYTORCH_DOCKER_BUILD})
305280
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"
306281
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"
307282
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;"
309283
COMMAND docker rm pytorch_backend_ptlib
310284
COMMENT "Extracting pytorch and torchvision libraries and includes from ${TRITON_PYTORCH_DOCKER_IMAGE}"
311285
VERBATIM
@@ -408,15 +382,9 @@ if (${TRITON_PYTORCH_DOCKER_BUILD})
408382
set(TRITON_PYTORCH_LIBS "${CMAKE_CURRENT_BINARY_DIR}/libtorch.so")
409383

410384
if (${TRITON_PYTORCH_ENABLE_TORCHVISION})
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()
385+
set(TRITON_PYTORCH_LIBS
386+
${TRITON_PYTORCH_LIBS}
387+
"${CMAKE_CURRENT_BINARY_DIR}/libtorchvision.so")
420388
endif() # TRITON_PYTORCH_ENABLE_TORCHVISION
421389

422390
if (${TRITON_PYTORCH_ENABLE_TORCHTRT})

0 commit comments

Comments
 (0)