Problem with using Cmake with CUDA

I am having some weird problems with CMake and CUDA. It seems like it can find CUDA alright, but it cannot locate CUBLAS.

-- The CXX compiler identification is GNU 7.5.0
-- Check for working CXX compiler: /home/qth20/Documents/compadre_toolkit/build/../kokkos/bin/nvcc_wrapper
-- Check for working CXX compiler: /home/qth20/Documents/compadre_toolkit/build/../kokkos/bin/nvcc_wrapper -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- CMAKE_VERSION: 3.10.2
-- Compadre_VERSION: 1.0.3
-- USE_XSDK_DEFAULTS: OFF
-- BUILD_TESTING: OFF
-- BUILD_SHARED_LIBS: ON
-- CMAKE_INSTALL_PREFIX: /home/qth20/Documents/compadre_toolkit/build/install
-- Compadre_DEBUG: ON
-- Compadre_EXTREME_DEBUG: OFF
-- PYTHON_CALLING_BUILD: OFF
-- Compadre_USE_PYTHON: ON
-- Trilinos_PREFIX: 
-- KokkosCore_PREFIX: 
-- KokkosKernels_PREFIX: 
-- LAPACK_DECLARED_THREADSAFE: ON
-- Kokkos_ENABLE_CUDA: ON
-- Kokkos_ENABLE_OPENMP: ON
-- Kokkos_ENABLE_PTHREAD: OFF
-- Setting default Kokkos CXX standard to 11
-- The project name is: Kokkos
-- Using -std=c++11 for C++11 standard as feature
-- Execution Spaces:
--   Device Parallel: CUDA
--     Host Parallel: OPENMP
--       Host Serial: NONE
-- 
-- Architectures:
-- Found TPLLIBDL: /usr/lib/x86_64-linux-gnu/libdl.so  
-- Compadre_USE_LAPACK: OFF
-- Compadre_USE_CUDA: ON
-- The project name is: KokkosKernels
-- The project name is: KokkosKernels
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE  
-- Found CUDA: /usr/local/cuda-10.2 (found version "10.2") 
CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
  Could NOT find TPLCUBLAS (missing: CUDA_CUBLAS_LIBRARIES)
Call Stack (most recent call first):
  /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
  kokkos-kernels/cmake/Modules/FindTPLCUBLAS.cmake:13 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  kokkos-kernels/cmake/kokkoskernels_tpls.cmake:335 (FIND_PACKAGE)
  kokkos-kernels/cmake/kokkoskernels_tpls.cmake:436 (KOKKOSKERNELS_IMPORT_TPL)
  kokkos-kernels/CMakeLists.txt:376 (INCLUDE)


-- Configuring incomplete, errors occurred!

This is on Ubuntu, so I have tried locating CUBLAS myself,

➜  lib64 locate cublas
/usr/include/cublas.h
/usr/include/cublasLt.h
/usr/include/cublasXt.h
/usr/include/cublas_api.h
/usr/include/cublas_v2.h
/usr/lib/libreoffice/share/gallery/htmlexpo/cublast.gif
/usr/lib/libreoffice/share/gallery/htmlexpo/cublast_.gif
/usr/lib/pkgconfig/cublas-10.pc
/usr/lib/x86_64-linux-gnu/libcublas.so
/usr/lib/x86_64-linux-gnu/libcublas.so.10
/usr/lib/x86_64-linux-gnu/libcublas.so.10.2.2.89
/usr/lib/x86_64-linux-gnu/libcublasLt.so
/usr/lib/x86_64-linux-gnu/libcublasLt.so.10
/usr/lib/x86_64-linux-gnu/libcublasLt.so.10.2.2.89
/usr/lib/x86_64-linux-gnu/libcublasLt_static.a
/usr/lib/x86_64-linux-gnu/libcublas_static.a
/usr/lib/x86_64-linux-gnu/stubs/libcublas.so
/usr/lib/x86_64-linux-gnu/stubs/libcublasLt.so
/usr/local/MATLAB/R2019b/bin/glnxa64/libcublas.so.10
/usr/local/MATLAB/R2019b/bin/glnxa64/libcublas.so.10.1.0.105
/usr/local/MATLAB/R2019b/bin/glnxa64/libcublasLt.so.10
/usr/local/MATLAB/R2019b/bin/glnxa64/libcublasLt.so.10.1.0.105
/usr/local/MATLAB/R2019b/sys/cuda/glnxa64/cuda/include/cublas.h
/usr/local/MATLAB/R2019b/sys/cuda/glnxa64/cuda/include/cublasLt.h
/usr/local/MATLAB/R2019b/sys/cuda/glnxa64/cuda/include/cublasXt.h
/usr/local/MATLAB/R2019b/sys/cuda/glnxa64/cuda/include/cublas_api.h
/usr/local/MATLAB/R2019b/sys/cuda/glnxa64/cuda/include/cublas_v2.h
/usr/local/MATLAB/R2019b/sys/cuda/glnxa64/cuda/include/cublas_version.h
/usr/local/cuda-10.2/doc/html/cublas
/usr/local/cuda-10.2/doc/html/cublas/graphics
/usr/local/cuda-10.2/doc/html/cublas/index.html
/usr/local/cuda-10.2/doc/html/cublas/graphics/cublasmg_gemm.jpg
/usr/local/cuda-10.2/doc/man/man7/libcublas.7
/usr/local/cuda-10.2/doc/man/man7/libcublas.so.7
/usr/share/doc/libcublas-dev
/usr/share/doc/libcublas10
/usr/share/doc/libcublas-dev/changelog.Debian.gz
/usr/share/doc/libcublas10/changelog.Debian.gz
/var/cuda-repo-10-1-local-10.1.243-418.87.00/libcublas-dev_10.2.1.243-1_amd64.deb
/var/cuda-repo-10-1-local-10.1.243-418.87.00/libcublas10_10.2.1.243-1_amd64.deb
/var/cuda-repo-10-2-local-10.2.89-440.33.01/libcublas-dev_10.2.2.89-1_amd64.deb
/var/cuda-repo-10-2-local-10.2.89-440.33.01/libcublas10_10.2.2.89-1_amd64.deb
/var/lib/dpkg/info/libcublas-dev.list
/var/lib/dpkg/info/libcublas-dev.md5sums
/var/lib/dpkg/info/libcublas10.list
/var/lib/dpkg/info/libcublas10.md5sums
/var/lib/dpkg/info/libcublas10.postinst
/var/lib/dpkg/info/libcublas10.postrm
/var/lib/dpkg/info/libcublas10.shlibs

So it looks like CUBLAS is available inside /usr/lib/x86_64-linux-gnu, in which I have set the Cmake variable CUDA_CUBLAS_ROOT to, but it’s still not liking it. Any suggestions?

The error complains about TPLCUBLAS, not CUBLAS. Did you follow the build instructions listed in the link below?