This work was completed thanks to Rob Maynard in cmake/#4093,
the FindCUDAToolkit module should be available in CMake 3.17 🎉 The
master branch docs can be found here,
this repository will likely be archived once this is officially released.
This repository is being used to implement FindCUDALibs.cmake for making
the NVIDIA CUDA Toolkit libraries such as cuBLAS or cuSOLVER available in
CMake. This work is intended to resolve issue
cmake/#17816.
WARNING: this is very much a work in progress, not ready for production use. You are advised to resist using the
FindCUDALibs.cmakefound here, it will become a part of CMake proper when it has been fleshed out / tested by more users.
The intent of FindCUDALibs.cmake is to enable convenient usage of the NVIDIA
libraries in pure C/C++, as the majority of these APIs do not require writing
native CUDA code. As such, all of the examples (except for NVTX) are just
samples grabbed from the NVIDIA documentation for each respective library.
The listing of libraries was ascertained by listing the contents of my local
Linux CUDA installation under /usr/local/cuda/lib64. Some libraries are not
(currently) included, as I do not know what they do...see
Miscellaneous Un-handled Libraries.
When linking against a given CUDA::xxx library vs a CUDA::xxx_static
library, any dependencies encoded will cascade where dynamic vs static libraries
are concerned. For example, cuSOLVER depends on both cuBLAS and cuSPARSE.
So
- Linking against
CUDA::cusolverlinks dynamically againstCUDA::cublasandCUDA::cusparse. - Linking against
CUDA::cusolver_staticlinks statically againstCUDA::cublas_staticandCUDA::cusparse_static.
When choosing static linkage, the CUDA::culibos static library will also
automatically be included in your linking dependencies for the libraries that
need this. See the cuLIBOS section.
TODO: there are many TODO left, both in this README as well as in the
implementation (FindCUDALibs.cmake).
Contents
- CUDA Runtime Libraries
- cuBLAS
- cuFFT
- cuFFTW
- cuLIBOS
- cuRAND
- cuSOLVER
- cuSPARSE
- NPP
- nvBLAS
- nvGRAPH
- nvToolsExt
- Miscellaneous Un-handled Libraries
The CUDA Runtime libraries (cudart) are what most applications will typically
need to link against to make any calls such as cudaMalloc and cudaFree.
They are an explicit dependency of almost every library.
Targets Created:
CUDA::cudartlibcudart.so@
CUDA::cudart_staticlibcudart_static.a
The cuBLAS library.
Targets Created:
-
CUDA::cublaslibcublas.so@
-
CUDA::cublas_staticlibcublas_static.a
Testing Program: tests/cublas.cpp
TODO: what is libcublas_device.a for?
The cuFFT library.
Targets Created:
CUDA::cufftlibcufft.so@
CUDA::cufft_staticlibcufft_static.a
Testing Program tests/cufft.cpp
TODO: cufft_static test program is not able to link which is why it is
commented out in CMakeLists.txt.
It is unclear what the difference is between cuFFT and cuFFTW to the author
of this document.
TODO: after fixing cufft_static, create CUDA::cufftw and
CUDA::cufftw_static targets.
libcufftw.so@libcufftw_static.a
The cuLIBOS library is a backend thread abstraction layer library which is
static only. The CUDA::cublas_static, CUDA::cusparse_static,
CUDA::cufft_static, CUDA::curand_static, and (when implemented) NPP
libraries all automatically have this dependency linked. Search for the phrase
Static CUDA Libraries on
this blog post.
Target Created:
CUDA::culiboslibculibos.a
Test Program: not applicable, e.g., cublas static executable tests this.
Note: direct usage of this target by consumers should not be necessary.
The cuRAND library.
Targets Created:
CUDA::curandlibcurand.so@
CUDA::curand_staticlibcurand_static.a
Testing Program: tests/curand.cpp
The cuSOLVER library.
Targets Created:
CUDA::cusolverlibcusolver.so@
CUDA::cusolver_staticlibcusolver_static.a
Testing Program: tests/cusolver.cpp
The cuSPARSE library.
Targets Created:
CUDA::cusparselibcusparse.so@
CUDA::cusparse_staticlibcusparse_static.a
The NPP libraries.
Targets Created:
-
nppc: TODO: descrption ???CUDA::nppclibnppc.so@
CUDA::nppc_staticlibnppc_static.a
Testing Program: TODO ??? it's statically linked in many
-
nppial: arithmetic and logical operation functions innppi_arithmetic_and_logical_operations.hCUDA::nppiallibnppial.so@
CUDA::nppial_staticlibnppial_static.a
Testing Program:
tests/nppial.cpp -
nppicc: color conversion and sampling functions innppi_color_conversion.hCUDA::nppicclibnppicc.so@
CUDA::nppicc_staticlibnppicc_static.a
Testing Program:
tests/nppicc.cpp -
nppicom: JPEG compression and decompression functions innppi_compression_functions.hCUDA::nppicomlibnppicom.so@
CUDA::nppicom_staticlibnppicom_static.a
Testing Program:
tests/nppicom.cpp -
nppidei: data exchange and initialization functions innppi_data_exchange_and_initialization.hCUDA::nppideilibnppidei.so@
CUDA::nppidei_staticlibnppidei_static.a
Testing Program:
tests/nppidei.cpp -
nppif: filtering and computer vision functions innppi_filter_functions.hCUDA::nppiflibnppif.so@
CUDA::nppif_staticlibnppif_static.a
Testing Program:
tests/nppif.cpp -
nppig: geometry transformation functions found innppi_geometry_transforms.hCUDA::nppiglibnppig.so@
CUDA::nppig_staticlibnppig_static.a
Testing Program:
tests/nppig.cpp -
nppim: morphological operation functions found innppi_morphological_operations.hCUDA::nppimlibnppim.so@
CUDA::nppim_staticlibnppim_static.a
Testing Program:
tests/nppim.cpp -
nppist: statistics and linear transform innppi_statistics_functions.handnppi_linear_transforms.hCUDA::nppistlibnppist.so@
CUDA::nppist_staticlibnppist_static.a
Testing Program:
tests/nppist.cpp -
nppisu: memory support functions innppi_support_functions.hCUDA::nppisulibnppisu.so@
CUDA::nppisu_staticlibnppisu_static.a
Testing Program:
tests/nppisu.cpp -
nppitc: threshold and compare operation functions innppi_threshold_and_compare_operations.hCUDA::nppitclibnppitc.so@
CUDA::nppitc_staticlibnppitc_static.a
Testing Program:
tests/nppitc.cpp -
npps: TODO: descrption ???CUDA::nppslibnpps.so@
CUDA::npps_staticlibnpps_static.a
Testing Program:
tests/npps.cpp
The nvBLAS libraries.
TODO: neither of these targets are currently created, as it is unclear how
to test. It seems I will need to find_package(BLAS) and call some level 3
operations (e.g., stick with gemm for simplicity?), but it is unclear how
to both enforce and verify GPU dispatch.
CUDA::nvblaslibnvblas.so@
No static (which makes sense).
The nvGRAPH library.
Targets Created:
CUDA::nvgraphlibnvgraph.so@
CUDA::nvgraph_staticlibnvgraph_static.a
Testing Program: tests/nvgraph.cpp
The nvRTC (Runtime Compilation) library.
This is a shared library only.
Targets Created:
CUDA::nvrtclibnvrtc.so@
Testing Program: tests/nvrtc.cpp
TODO: the libnvrtc-builtins.so@ shared library currently does not have a
target created, should it? How do I test this specifically?
The NVIDIA Tools Extension, see also this blog post.
This is a shared library only.
Targets Created:
CUDA::nvToolsExtlibnvToolsExt.so@
Testing Programs: this tooling library only makes sense with some native
CUDA code to actually instrument. Two applications are created, and by default
the all target will also run nvprof on these to generate two .nvvp files.
libaccinj64.so@libcublas_device.alibcudadevrt.alibcuinj64.so@
Libraries pertaining to OpenCL that should not be included:
libOpenCL.so@