Files
TheRock/rocm-libraries/projects/rocsolver/clients/gtest/CMakeLists.txt
T
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

295 lines
9.0 KiB
CMake
Executable File

# ##########################################################################
# Copyright (C) 2019-2026 Advanced Micro Devices, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
# ##########################################################################
find_package(GTest REQUIRED)
set(roclapack_test_source
# linear systems solvers
lapack/getri_gtest.cpp
lapack/getrs_gtest.cpp
lapack/getrs_npvt_gtest.cpp
lapack/gesv_gtest.cpp
lapack/potrs_gtest.cpp
lapack/posv_gtest.cpp
lapack/potri_gtest.cpp
lapack/trtri_gtest.cpp
lapack/geblttrs_gtest.cpp
# least squares solvers
lapack/gels_gtest.cpp
# triangular factorizations
lapack/getf2_getrf_gtest.cpp
lapack/getrf_large_gtest.cpp
lapack/potf2_potrf_gtest.cpp
lapack/sytf2_sytrf_gtest.cpp
lapack/sytrs_gtest.cpp
lapack/sytrs2_gtest.cpp
lapack/geblttrf_gtest.cpp
# orthogonal factorizations
lapack/geqr2_geqrf_gtest.cpp
lapack/gerq2_gerqf_gtest.cpp
lapack/geql2_geqlf_gtest.cpp
lapack/gelq2_gelqf_gtest.cpp
# problem and matrix reductions (diagonalizations)
lapack/gebd2_gebrd_gtest.cpp
lapack/sytxx_hetxx_gtest.cpp
lapack/sygsx_hegsx_gtest.cpp
# singular value decomposition
lapack/gesvd_gtest.cpp
lapack/gesdd_gtest.cpp
lapack/gesvdj_gtest.cpp
lapack/gesvdx_gtest.cpp
# symmetric eigensolvers
lapack/syev_heev_gtest.cpp
lapack/syevd_heevd_gtest.cpp
lapack/sygv_hegv_gtest.cpp
lapack/sygvd_hegvd_gtest.cpp
lapack/syevj_heevj_gtest.cpp
lapack/syevdj_heevdj_gtest.cpp
lapack/sygvj_hegvj_gtest.cpp
lapack/sygvdj_hegvdj_gtest.cpp
lapack/syevx_heevx_gtest.cpp
lapack/syevdx_heevdx_gtest.cpp
lapack/sygvx_hegvx_gtest.cpp
lapack/sygvdx_hegvdx_gtest.cpp
)
set(rocauxiliary_test_source
# vector & matrix manipulations
auxiliary/lacgv_gtest.cpp
auxiliary/laswp_gtest.cpp
# householder reflections
auxiliary/larf_gtest.cpp
auxiliary/larfg_gtest.cpp
auxiliary/larft_gtest.cpp
auxiliary/larfb_gtest.cpp
# norm and condition number
auxiliary/lange_gtest.cpp
auxiliary/gecon_gtest.cpp
# plane rotations
auxiliary/lasr_gtest.cpp
# orthonormal/unitary matrices
auxiliary/orgxr_ungxr_gtest.cpp
auxiliary/orglx_unglx_gtest.cpp
auxiliary/orgxl_ungxl_gtest.cpp
auxiliary/orgbr_ungbr_gtest.cpp
auxiliary/orgtr_ungtr_gtest.cpp
auxiliary/ormxr_unmxr_gtest.cpp
auxiliary/ormlx_unmlx_gtest.cpp
auxiliary/ormxl_unmxl_gtest.cpp
auxiliary/ormbr_unmbr_gtest.cpp
auxiliary/ormtr_unmtr_gtest.cpp
# bidiagonal matrices
auxiliary/labrd_gtest.cpp
auxiliary/bdsqr_gtest.cpp
auxiliary/bdsvdx_gtest.cpp
# tridiagonal matrices
auxiliary/sterf_gtest.cpp
auxiliary/steqr_gtest.cpp
auxiliary/stedc_gtest.cpp
auxiliary/stedcj_gtest.cpp
auxiliary/stedcx_gtest.cpp
auxiliary/stebz_gtest.cpp
auxiliary/stein_gtest.cpp
auxiliary/latrd_gtest.cpp
# symmetric matrices
auxiliary/lasyf_gtest.cpp
# triangular matrices
auxiliary/lauum_gtest.cpp
)
set(rocrefact_test_source
# rfinfo analysis
refact/csrrf_analysis_gtest.cpp
refact/csrrf_workflow_gtest.cpp
# lu refactorization
refact/csrrf_sumlu_gtest.cpp
refact/csrrf_splitlu_gtest.cpp
refact/csrrf_refactlu_gtest.cpp
refact/csrrf_refactchol_gtest.cpp
# sparse solver
refact/csrrf_solve_gtest.cpp
)
set(rocunit_test_source
# gemm
unit/gemm_gtest.cpp
)
set(others_test_source
# unified memory model
managed_malloc_gtest.cpp
# rocblas memory model
memory_model_gtest.cpp
# rocsolver logging
logging_gtest.cpp
asan_helpers_gtest.cpp
# helpers
#common/client_environment_helpers.cpp
)
set(rocsolver_test_source
rocsolver_gtest_main.cpp
)
set(rocsolver_test_common_source
${PROJECT_SOURCE_DIR}/common/src/common_host_helpers.cpp
)
if(USE_HIPCXX)
set_source_files_properties(
${common_source_paths}
${rocsolver_test_common_source}
${roclapack_test_source}
${rocauxiliary_test_source}
${rocrefact_test_source}
${others_test_source}
${rocsolver_test_source}
PROPERTIES
LANGUAGE HIP
)
endif()
add_executable(rocsolver-test
${common_source_paths}
${rocsolver_test_common_source}
${roclapack_test_source}
${rocauxiliary_test_source}
${rocrefact_test_source}
${rocunit_test_source}
${others_test_source}
${rocsolver_test_source}
)
add_armor_flags(rocsolver-test "${ARMOR_LEVEL}")
if(WIN32)
file(GLOB third_party_dlls
LIST_DIRECTORIES OFF
CONFIGURE_DEPENDS
${ROCSOLVER_LAPACK_PATH}/bin/*.dll
${GTest_DIR}/bin/*.dll
$ENV{rocblas_DIR}/bin/*.dll
$ENV{HIP_DIR}/bin/*.dll
$ENV{HIP_DIR}/bin/hipinfo.exe
${CMAKE_SOURCE_DIR}/rtest.*
)
foreach(file_i ${third_party_dlls})
add_custom_command(TARGET rocsolver-test
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy ${file_i} $<TARGET_FILE_DIR:rocsolver-test>
)
endforeach()
if(DEFINED ENV{rocblas_DIR})
add_custom_command(TARGET rocsolver-test
POST_BUILD
COMMAND ${CMAKE_COMMAND}
ARGS -E copy_directory $ENV{rocblas_DIR}/bin/rocblas/library $<TARGET_FILE_DIR:rocsolver-test>/library
)
else()
message(WARNING "rocblas_DIR not set. rocBLAS Tensile runtime kernels will not be copied to client staging directory (insitu testing affected).")
endif()
endif()
target_link_libraries(rocsolver-test PRIVATE
$<IF:$<TARGET_EXISTS:GTest::gtest>,GTest::gtest,GTest::GTest>
hip::host
rocsolver-common
clients-common
$<$<PLATFORM_ID:Linux>:stdc++fs>
$<$<PLATFORM_ID:Linux>:m>
roc::rocsolver
roc::rocblas
)
if(NOT USE_HIPCXX)
target_link_libraries(rocsolver-test PRIVATE hip::device)
endif()
target_compile_definitions(rocsolver-test PRIVATE
ROCM_USE_FLOAT16
ROCSOLVER_CLIENTS_TEST
)
# Mirror the library's 64-bit eigensolver feature flag so the tests assert the
# correct behavior (real run when ON, rocblas_status_not_implemented when OFF).
if(ROCSOLVER_ENABLE_EIGENSOLVERS_64)
target_compile_definitions(rocsolver-test PRIVATE ROCSOLVER_ENABLE_EIGENSOLVERS_64)
endif()
add_test(
NAME rocsolver-test
COMMAND rocsolver-test
)
# Optional: CTest test categorization when building in rocm-libraries with shared/ctest.
# Skipped when shared/ is not present (e.g. standalone rocSOLVER or sparse checkout in CI).
if(DEFINED ROCM_LIBRARIES_ROOT AND EXISTS "${ROCM_LIBRARIES_ROOT}/shared/ctest/TestCategories.cmake")
include("${ROCM_LIBRARIES_ROOT}/shared/ctest/TestCategories.cmake")
set(ROCSOLVER_HAS_CTEST_CATEGORIES ON)
endif()
# Only when both test_categories.yaml and shared/ctest exist (full rocm-libraries tree).
set(ROCSOLVER_CTEST_INSTALL_FILE "")
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test_categories.yaml")
if(ROCSOLVER_HAS_CTEST_CATEGORIES)
enable_testing()
message(STATUS "rocSOLVER: YAML-based test categorization")
file(MAKE_DIRECTORY "${PROJECT_BINARY_DIR}/staging")
# Install-time CTestTestfile for TheRock: relative paths so ctest can run from installed location
set(ROCSOLVER_CTEST_INSTALL_FILE "${CMAKE_CURRENT_BINARY_DIR}/install_CTestTestfile.cmake")
file(WRITE "${ROCSOLVER_CTEST_INSTALL_FILE}"
[=[
# This is a test file generated by rocSOLVER for install time.
# Tests are defined with relative paths to work in the installed location.
]=]
)
apply_test_category_labels(
rocsolver-test
"${CMAKE_CURRENT_SOURCE_DIR}/test_categories.yaml"
"${PROJECT_BINARY_DIR}/staging"
"${ROCSOLVER_CTEST_INSTALL_FILE}"
)
else()
message(STATUS "rocSOLVER: shared/ctest not found (e.g. standalone checkout), skipping CTest categories")
endif()
else()
message(STATUS "rocSOLVER: No test_categories.yaml (CTest categories not used)")
endif()
# Install CTestTestfile.cmake to bin/rocsolver/ for TheRock (relocatable tests; run ctest from that dir)
if(ROCSOLVER_CTEST_INSTALL_FILE)
rocm_install(
FILES "${ROCSOLVER_CTEST_INSTALL_FILE}"
DESTINATION "${CMAKE_INSTALL_BINDIR}/rocsolver"
COMPONENT tests
RENAME "CTestTestfile.cmake"
)
endif()
rocm_install(TARGETS rocsolver-test COMPONENT tests)