CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
96 lines
3.0 KiB
CMake
96 lines
3.0 KiB
CMake
# ########################################################################
|
|
# Copyright 2019-2025 Advanced Micro Devices, Inc.
|
|
# ########################################################################
|
|
|
|
cmake_minimum_required(VERSION 3.18 FATAL_ERROR)
|
|
|
|
# This project includes tests that should be run after
|
|
# rocThrust is installed from package or using `make install`
|
|
project(rocThrust_package_install_test CXX)
|
|
|
|
# CMake modules
|
|
list(APPEND CMAKE_MODULE_PATH
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../cmake
|
|
${ROCM_PATH}/lib/cmake/hip /opt/rocm/lib/cmake/hip # FindHIP.cmake
|
|
${HIP_PATH}/cmake /opt/rocm/hip/cmake # FindHIP.cmake
|
|
)
|
|
|
|
if (NOT DEFINED AMDGPU_TARGETS)
|
|
set(GPU_TARGETS gfx803;gfx900:xnack-;gfx906:xnack-;gfx908:xnack- CACHE STRING "List of specific machine types for library to target")
|
|
else()
|
|
set(GPU_TARGETS "${AMDGPU_TARGETS}" CACHE STRING "List of specific machine types for library to target")
|
|
endif()
|
|
|
|
# Verify that supported compilers are used
|
|
include(VerifyCompiler)
|
|
include(DownloadProject)
|
|
|
|
# Download rocPRIM (only for ROCm platform)
|
|
if(NOT DEFINED ROCPRIM_ROOT)
|
|
message(STATUS "Downloading and building rocPRIM.")
|
|
set(ROCPRIM_ROOT "${CMAKE_CURRENT_BINARY_DIR}/rocprim" CACHE PATH "")
|
|
download_project(
|
|
PROJ rocprim
|
|
GIT_REPOSITORY https://github.com/ROCmSoftwarePlatform/rocPRIM.git
|
|
GIT_TAG master
|
|
INSTALL_DIR ${ROCPRIM_ROOT}
|
|
CMAKE_ARGS -DBUILD_TEST=OFF -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
|
|
LOG_DOWNLOAD TRUE
|
|
LOG_CONFIGURE TRUE
|
|
LOG_BUILD TRUE
|
|
LOG_INSTALL TRUE
|
|
BUILD_PROJECT TRUE
|
|
UPDATE_DISCONNECTED TRUE
|
|
)
|
|
endif()
|
|
find_package(rocprim REQUIRED CONFIG PATHS "${ROCPRIM_ROOT}")
|
|
|
|
# Find rocThrust
|
|
find_package(rocthrust REQUIRED CONFIG HINTS ${rocthrust_DIR} PATHS "/opt/rocm/rocthrust")
|
|
|
|
# Build CXX flags
|
|
if (NOT DEFINED CMAKE_CXX_STANDARD)
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
endif()
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror")
|
|
|
|
if(NOT CMAKE_CXX_STANDARD EQUAL 17)
|
|
message(FATAL_ERROR "Only C++17 is supported")
|
|
endif()
|
|
|
|
# Enable testing (ctest)
|
|
enable_testing()
|
|
|
|
function(add_rocthrust_test TEST_NAME TEST_SOURCES)
|
|
list(GET TEST_SOURCES 0 TEST_MAIN_SOURCE)
|
|
get_filename_component(TEST_TARGET ${TEST_MAIN_SOURCE} NAME_WE)
|
|
|
|
foreach(test_file ${TEST_SOURCES})
|
|
if(USE_HIPCXX)
|
|
set_source_files_properties(${test_file} PROPERTIES LANGUAGE HIP)
|
|
else()
|
|
set_source_files_properties(${test_file} PROPERTIES LANGUAGE CXX)
|
|
endif()
|
|
endforeach()
|
|
|
|
add_executable(${TEST_TARGET} ${TEST_SOURCES})
|
|
target_link_libraries(${TEST_TARGET}
|
|
PRIVATE
|
|
${rocthrust_LIBRARIES} # rocthrust
|
|
)
|
|
if (NOT WIN32)
|
|
foreach(gpu_target ${GPU_TARGETS})
|
|
target_link_libraries(${TEST_TARGET}
|
|
PRIVATE
|
|
--offload-arch=${gpu_target}
|
|
)
|
|
endforeach()
|
|
endif()
|
|
add_test(${TEST_NAME} ${TEST_TARGET})
|
|
endfunction()
|
|
|
|
# rocThrust package test
|
|
add_rocthrust_test("test_rocthrust_package" test_rocthrust_package.cpp)
|