CMake Guide¶
NVPL provides CMake Package Config files for the each component library.
Finding NVPL Packages¶
If NVPL was installed via the OS package manager under the /usr
directory, the NVPL packages will already
be on the default CMAKE_PREFIX_PATH
. The nvpl_ROOT
environment variable should be used to override
the default search path and force a search for nvpl under a specific prefix. If you have downloaded
nvpl as a standalone tarball expand the tarball and set the full path to the resulting directory as nvpl_ROOT
.
The find_package() command is used to find nvpl and any component libraries:
find_package(nvpl)
Each NVPL component library found will print a brief status message with important locations.
Tip
Variable
nvpl_FOUND
will be true if nvpl is successfully foundVariable
nvpl_VERSION
will contain the found versionPass the
REQUIRED
keyword to raise an error ifnvpl
package is not found.Regardless of the
COMPONENTS
keyword, all available nvpl component libraries installed in the same prefix will be found.To raise an error if a particular component is not found, use
REQUIRED COMPONENTS ...
Set
QUIET
to avoid printing status messages, or reporting an error if nvpl is not foundfind_package(nvpl)
can safely be called multiple times from different locations in a project.
Linking to NVPL Packages¶
The NVPL component libraries provide Imported Interface Targets
under the common nvpl::
namespace.
To add all the necessary flags to compile and link against NVPL libraries,
use the target_link_libraries() command:
target_link_libraries(my_target PUBLIC nvpl::<lib>_<opts>)
Here <lib>
is the lowercase shorthand for the library/API and and <opts>
are defined by the library.
NVPL Targets¶
NVPL component and target names use all-lowercase naming schema. See individual libraries for details on available options.
Component |
Targets |
Options / Notes |
---|---|---|
blas |
|
|
fft |
|
FFTW API interface |
lapack |
|
|
rand |
|
Single-threaded Multi-threaded (OpenMP) |
scalapack |
|
|
sparse |
|
|
tensor |
|
NVPL Variables¶
Each nvpl component library also exports variables
nvpl_<comp>_VERSION
- Version of component librarynvpl_<comp>_INCLUDE_DIR
- Full path to component headers directorynvpl_<comp>_LIBRARY_DIR
- Full path to component libraries directory
Examples¶
See the NVPLSamples Repo for example CMake usage for each library.