2.4 KiB
Consumer Quick Start
This guide shows how to consume an already-installed hipDNN in a CMake project. For building hipDNN from source, see the Building Guide.
Table of Contents
Prerequisites
- ROCm / TheRock installed with hipDNN packages (see TheRock Releases)
- CMake
- Ninja (recommended)
- C++17 compatible compiler
Project Setup
CMakeLists.txt
cmake_minimum_required(VERSION <your_minimum>)
project(my_app LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
find_package(hipdnn_frontend CONFIG REQUIRED)
add_executable(my_app main.cpp)
target_link_libraries(my_app PRIVATE hipdnn_frontend)
Note
find_package(hipdnn_frontend)transitively brings inhipdnn_backend,hipdnn_data_sdk, andhip— only onefind_packagecall is needed. HIP runtime APIs (hipMalloc,hipFree, etc.) are available through the transitivehip::hostlink dependency.
Note
Link
hipdnn_frontend_dynamicinstead ofhipdnn_frontendwhen your application should loadlibhipdnn_backendat runtime instead of recording a direct link dependency on it. This target uses the same frontend headers and API; the backend package is still required when configuring and must be available at runtime.
Note
If CMake cannot find the packages, set
CMAKE_PREFIX_PATHto the install location. hipDNN CMake files are installed to/opt/rocm/lib/cmakeby default, which CMake may already search automatically depending on your system configuration.
Source File
Include the frontend header to access the hipDNN graph API:
#include <hipdnn_frontend.hpp>
See the Samples for complete working examples of building and executing operation graphs.
Building
mkdir build && cd build
cmake -GNinja -DCMAKE_PREFIX_PATH=/opt/rocm ..
ninja
Next Steps
- Samples — Working examples including convolution, batch normalization, and fused operations
- Operation Support — Currently supported operations and their status
- How-To Guide — Detailed component usage, CMake integration for all packages, and extending hipDNN
- Environment Configuration — Runtime configuration and logging setup