Skip to content

Commit f951757

Browse files
Hemant Jainmc-nv
authored andcommitted
Fix intel mkl issue that causes segfault (#66)
* Fix intel mkl issue that causes segfault - during destruction - causes freeze during inference * Add comment
1 parent b8baa93 commit f951757

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,9 @@ set(OPENCV_LIBS
185185
"libjpeg.so"
186186
)
187187

188+
# The patchelf commands ensure the MKL libraries are loaded correctly during runtime
189+
# Without these, the framework/backend complains of missing libraries / symbols and
190+
# in some cases leads to segmentation faults.
188191
if (${TRITON_PYTORCH_DOCKER_BUILD})
189192
string(REPLACE ";" " " CONDA_LIBS_STR "${CONDA_LIBS}")
190193

@@ -228,6 +231,10 @@ if (${TRITON_PYTORCH_DOCKER_BUILD})
228231
COMMAND /bin/sh -c "if [ -f libmkl_avx2.so ]; then patchelf --add-needed libmkl_core.so libmkl_avx2.so; fi"
229232
COMMAND /bin/sh -c "if [ -f libmkl_avx512.so ]; then patchelf --add-needed libmkl_gnu_thread.so libmkl_avx512.so; fi"
230233
COMMAND /bin/sh -c "if [ -f libmkl_avx512.so ]; then patchelf --add-needed libmkl_core.so libmkl_avx512.so; fi"
234+
COMMAND /bin/sh -c "if [ -f libmkl_vml_def.so ]; then patchelf --add-needed libmkl_gnu_thread.so libmkl_vml_def.so; fi"
235+
COMMAND /bin/sh -c "if [ -f libmkl_vml_def.so ]; then patchelf --add-needed libmkl_intel_thread.so libmkl_vml_def.so; fi"
236+
COMMAND /bin/sh -c "if [ -f libmkl_vml_def.so ]; then patchelf --add-needed libmkl_core.so libmkl_vml_def.so; fi"
237+
COMMAND /bin/sh -c "patchelf --add-needed libmkl_intel_lp64.so libmkl_intel_thread.so"
231238
COMMAND docker rm pytorch_backend_ptlib
232239
COMMENT "Extracting pytorch and torchvision libraries and includes from ${TRITON_PYTORCH_DOCKER_IMAGE}"
233240
VERBATIM

0 commit comments

Comments
 (0)