From 799280db07d6acc3365b5748109def9e9727e388 Mon Sep 17 00:00:00 2001 From: Freddy Paul Date: Thu, 26 Aug 2021 09:04:56 -0700 Subject: [PATCH] SWDEV-300274 - Path to OCL library not handled consistently OpenCl applications are expected to work with publicly available libopencl.so that is capable of finding vendor specific library libamdocl64.so using the ICD loader entry. x86_64-rocm-opencl.conf should provide ldconfig entry for libamdocl64.so and libamdocl64.so shall use RUNPATH for finding dependencies like hsa runtime. Change-Id: Icf1267c7a04c1545eae0a7236bf8b7581ffa11ef [ROCm/clr commit: 4790350f63c8e89ebab62b7133bcde6efc72d028] --- projects/clr/opencl/packaging/rocm-opencl.postinst | 12 +++++------- projects/clr/opencl/packaging/rocm-opencl.rpm_post | 7 +++---- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/projects/clr/opencl/packaging/rocm-opencl.postinst b/projects/clr/opencl/packaging/rocm-opencl.postinst index c11d1ad2d5..b76ed1a888 100644 --- a/projects/clr/opencl/packaging/rocm-opencl.postinst +++ b/projects/clr/opencl/packaging/rocm-opencl.postinst @@ -2,16 +2,14 @@ set -e -do_ldconfig() { - if [ -e "/opt/rocm/opencl" ] ; then - echo /opt/rocm/opencl/lib > /etc/ld.so.conf.d/x86_64-rocm-opencl.conf && ldconfig - fi - mkdir -p /etc/OpenCL/vendors && (echo libamdocl64.so > /etc/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@) -} - INSTALL_PATH=@CPACK_PACKAGING_INSTALL_PREFIX@ ROCM_LIBPATH=@ROCM_PATH@/lib +do_ldconfig() { + echo ${ROCM_LIBPATH} > /etc/ld.so.conf.d/x86_64-rocm-opencl.conf && ldconfig + mkdir -p /etc/OpenCL/vendors && (echo libamdocl64.so > /etc/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@) +} + case "$1" in abort-deconfigure|abort-remove|abort-upgrade) echo "$1" diff --git a/projects/clr/opencl/packaging/rocm-opencl.rpm_post b/projects/clr/opencl/packaging/rocm-opencl.rpm_post index 936d9e16d1..b9a98fb932 100644 --- a/projects/clr/opencl/packaging/rocm-opencl.rpm_post +++ b/projects/clr/opencl/packaging/rocm-opencl.rpm_post @@ -1,10 +1,9 @@ -if [ -e "/opt/rocm/opencl" ] ; then - echo /opt/rocm/opencl/lib > /etc/ld.so.conf.d/x86_64-rocm-opencl.conf && ldconfig -fi -mkdir -p /etc/OpenCL/vendors && (echo libamdocl64.so > /etc/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@) INSTALL_PATH=@CPACK_PACKAGING_INSTALL_PREFIX@ ROCM_LIBPATH=@ROCM_PATH@/lib +echo ${ROCM_LIBPATH} > /etc/ld.so.conf.d/x86_64-rocm-opencl.conf && ldconfig +mkdir -p /etc/OpenCL/vendors && (echo libamdocl64.so > /etc/OpenCL/vendors/@OPENCL_AMD_ICD_FILE@) + mkdir -p ${ROCM_LIBPATH} ln -s -f -r ${INSTALL_PATH}/lib/libOpenCL.so ${ROCM_LIBPATH}/libOpenCL.so ln -s -f -r ${INSTALL_PATH}/lib/libOpenCL.so.@OPENCL_LIB_VERSION_MAJOR@ ${ROCM_LIBPATH}/libOpenCL.so.@OPENCL_LIB_VERSION_MAJOR@