-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test project which finds and validates CMake packages and config.
Includes some tweaks discovered along the way.
- Loading branch information
1 parent
7ba9eba
commit b37d422
Showing
4 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Build with: | ||
# cmake -GNinja -S. -Bbuild -DCMAKE_PREFIX_PATH=path/to/rocm | ||
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") | ||
message(FATAL_ERROR "In-source builds are not allowed. Please create a separate build directory.") | ||
endif() | ||
|
||
cmake_minimum_required(VERSION 3.25) | ||
|
||
project(rocm-cpp-sdk-user) | ||
set(CMAKE_CXX_STANDARD 17) | ||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") | ||
|
||
# Because we use this project as a test, we include validation that the found | ||
# packages are sound. Users do not need to include this or call any of the | ||
# `validate_*` functions. | ||
include(validate_rocm_sdk) | ||
|
||
# TODO: Don't require HIP_PLATFORM https://github.com/nod-ai/TheRock/issues/68 | ||
set(HIP_PLATFORM "amd") | ||
find_package(hip CONFIG REQUIRED) | ||
validate_hip_package_found() | ||
|
||
find_package(hipsparse CONFIG REQUIRED) | ||
find_package(rocsolver CONFIG REQUIRED) | ||
find_package(rocprim CONFIG REQUIRED) | ||
find_package(rocrand CONFIG REQUIRED) | ||
|
||
find_package(rccl CONFIG REQUIRED) | ||
find_package(hipblaslt CONFIG REQUIRED) | ||
find_package(hipblas CONFIG REQUIRED) | ||
find_package(miopen CONFIG REQUIRED) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# ROCM SDK User Example | ||
|
||
This example shows a CMake project with the supported way to depend on various | ||
ROCM libraries and tools from C++. We attempt to keep this up to date and | ||
build/test it as part of the overall project. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
function(validate_hip_package_found) | ||
if(NOT hip_FOUND) | ||
message(FATAL_ERROR "'hip' package is not found") | ||
endif() | ||
|
||
message(STATUS "**** HIP Configuration:") | ||
string(APPEND CMAKE_MESSAGE_INDENT "* ") | ||
message(STATUS "VERSION: ${hip_VERSION}") | ||
message(STATUS "INCLUDE: ${hip_INCLUDE_DIRS}") | ||
message(STATUS "LIBRARIES: ${hip_LIBRARIES}") | ||
message(STATUS "GPU_TARGETS: ${GPU_TARGETS}") | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters