Static linking cublas

When I upgraded from cuda, cuda libraries, and nvcc V11.6.55 to V11.6.124, I ran into errors with static linking. Specifically, I get many undefined references from within libcublasLt_static.a. Here is the first one:

linking test_gpu_matrix
nvcc -m64 -ccbin icpc -o …/test_gpu_matrix obfil/test_gpu_matrix.o …/gpu_hub.a …/…/hub/hub.a /home/intel/mkl/2021.4.0/lib/intel64/libmkl_intel_ilp64.a /home/intel/mkl/2021.4.0/lib/intel64/libmkl_core.a /home/intel/mkl/2021.4.0/lib/intel64/libmkl_intel_thread.a /home/intel/compiler/2021.4.0/linux/compiler/lib/intel64_lin/libiomp5.a -lpthread -lm -lcublas_static -lcublasLt_static -lculibos -lcusolver_static -lcusparse_static -lmetis_static -llapack_static -lcudart_static -lcublas_static -lcublasLt_static -lculibos -lcusolver_static -lcusparse_static -lmetis_static -llapack_static -lcudart_static /home/intel/compiler/2021.4.0/linux/compiler/lib/intel64_lin/libifcore.a
/usr/local/cuda/bin/…/targets/x86_64-linux/lib/libcublasLt_static.a(cublas_zzz_matmul_factory.cu.o): In function gemm_matmulAlgo_sass<double2, double2, double2, double2, 1049601ul, &cuBLASLt::sass::cfp64_cfp64_gemm_cfp64, &cuBLASLt::sass::cfp64_cfp64_gemm_cfp64>::~gemm_matmulAlgo_sass()': tmpxft_000069d0_00000000-6_cublas_zzz_matmul_factory.compute_86.cudafe1.cpp:(.text._ZN20gemm_matmulAlgo_sassI7double2S0_S0_S0_Lm1049601EXadL_ZN8cuBLASLt4sass22cfp64_cfp64_gemm_cfp64EEEXadL_ZNS2_22cfp64_cfp64_gemm_cfp64EEEED0Ev[_ZN20gemm_matmulAlgo_sassI7double2S0_S0_S0_Lm1049601EXadL_ZN8cuBLASLt4sass22cfp64_cfp64_gemm_cfp64EEEXadL_ZNS2_22cfp64_cfp64_gemm_cfp64EEEED5Ev]+0x6): undefined reference to operator delete(void*, unsigned long)’

Has there been some change in how to accomplish static linking? I see no mention of it in the documentation, but will admit that getting static linking working has always been challenging.

Do you mind sharing precisely what cublas libraries are being used in each test case?

This kind of error
operator delete(void*, unsigned long)’
is due to a wrong C++ ABI handling. You need to use a C++11 compiler with the new ABI (see https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html) as pointed out in our release notes.

As far as we can tell, nothing has changed.

Also, can you try adding -lstdc++?

Thanks for pointing me in the correct direction. On the machine in question (a centos 7.9 machine), the installed version of gcc and associated libraries is 4.8.5, which is probably too old to work with this version of nvcc. I don’t normally pay too close attention to gcc, as we use the intel compilers for our own C, C++, and Fortran compilations.

I installed devtoolset-8, giving me access to gcc 8.3.1, and by doing so solved the link issue. Thank you for your help. I assume this means I won’t have any problem when I update cuda/nvcc on our redhat 8 machines, as their versions of gcc and libraries are considerably more recent.

Thanks for letting me know.

Yeah, in 11.3U1 cuBLAS added a requirement for GCC 5.2

But that requirement is technically trumped by CTK’s system requirements which require 6.x

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.