while the path for libcublasLt.so is not.
Explicitly setting the $LD_LIBRARY_PATH takes care of this
at runtime, but I would prefer to have the path already set so the
user doesn’t have to figure this out.
These are the rules that I’m using in my CMakeLists.txt file
find_package(CUDA QUIET REQUIRED) # Keep this form for backward-compatibility with older CMake. link_directories(${CUDA_TOOLKIT_ROOT_DIR}/lib64) link_directories(${CUDA_TOOLKIT_ROOT_DIR}/lib64/stubs) # Dummy library for builds on non-GPU nodes. list(APPEND CUDA_DEV_LIBRARIES ${CUDA_LIBRARIES} ${CUDA_CUBLAS_LIBRARIES} ${CUDA_cublas_LIBRARY} ${CUDA_driver_LIBRARY} **${CUDA_TOOLKIT_ROOT_DIR}/lib64/libcublasLt.so**) list(APPEND CUDA_CUBLAS_LIBRARIES ${CUDA_TOOLKIT_ROOT_DIR}/lib64/libcublasLt.so) set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} --std=c++11") CUDA_ADD_LIBRARY(CUDA-SGEMM SHARED CUDADriver.c) target_link_libraries(CUDA-SGEMM cuda cublas **cublasLt**)
which I put together by trial-and-error. I’m using cmake
3.16.2.
I would hope there’s just some simple setting I need to use – maybe
I’m over-specifying in the above rules – but I haven’t found any
info on this by googling-around on the web.
I get the impression that cmake has some mechanisms
already in place for handling CUDA & cuBLAS but hadn’t been
built to handle cublasLt.
I had originally posted this as a “Usage” issue but it looks like “code” is more correct.
I’m sorry about spamming everyone with duplicate messages, I’m new to this forum.
What puzzles me is why I have to do this for libcublasLt.so.10 but not libcublas.so.10, which is already linked correctly without setting $LD_LIBRARY_PATH
Okay I am pretty sure I understand why this is failing.
RUNPATH on an executable is only used for finding direct dependencies and not indirect. In this case cublasLt is being treated as an indirect dependency ( cublas depends on it, but libcublas.so.10 has no relevant RUNPATH values ).
So why is cublasLt an indirect dependency, while you are explicitly requesting it on the link line? Well the linker by default is now dropping unneeded libraries final since you are not directly calling any symbols that are inside of it ( or they are all weak symbols ).
The quickest solution is to add the following to your CMakeLists.txt to disable this linking behavior:
The longer term solution is to work with cublas team to have them setup the proper RUNPATH values for loading of cublasLt to work no matter where it is installed.