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
134 lines
5.2 KiB
CMake
134 lines
5.2 KiB
CMake
# Copyright Advanced Micro Devices, Inc., or its affiliates.
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
# Optional: CTest test categorization when building in rocm-libraries with shared/ctest.
|
|
# Skipped when shared/ is not present (e.g. standalone rocblas 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(HIPSPARSELT_HAS_CTEST_CATEGORIES ON)
|
|
endif()
|
|
|
|
include(fetch_google_test)
|
|
|
|
set(TEST_SOURCES
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/hipsparselt_gtest_main.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/hipsparselt_test.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/prune_gtest.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/compress_gtest.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/spmm_gtest.cpp"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/auxiliary_gtest.cpp"
|
|
)
|
|
|
|
add_executable(hipsparselt-test ${TEST_SOURCES})
|
|
|
|
target_compile_features(hipsparselt-test PRIVATE cxx_std_17)
|
|
|
|
target_compile_definitions(
|
|
hipsparselt-test PRIVATE GOOGLE_TEST ROCM_USE_FLOAT16 HIPSPARSELT_INTERNAL_API
|
|
"__HIP_HCC_COMPAT_MODE__=1"
|
|
)
|
|
if(HIPSPARSELT_CXX_HAS_MF16C)
|
|
target_compile_options(hipsparselt-test PRIVATE -mf16c)
|
|
endif()
|
|
|
|
target_link_libraries(
|
|
hipsparselt-test PRIVATE hipsparselt-clients-common GTest::gtest GTest::gtest_main
|
|
)
|
|
hipsparselt_link_blas_libraries(hipsparselt-test)
|
|
|
|
if(NOT WIN32)
|
|
target_link_libraries(hipsparselt-test PRIVATE -lm -lstdc++fs)
|
|
|
|
if(HIPSPARSELT_ENABLE_FORTRAN)
|
|
if(CMAKE_Fortran_COMPILER_ID MATCH "Flang")
|
|
target_link_libraries(hipsparselt-bench PRIVATE -lflang_rt.runtime lapack)
|
|
else()
|
|
target_link_libraries(hipsparselt-bench PRIVATE -lgfortran lapack)
|
|
endif()
|
|
endif()
|
|
endif()
|
|
|
|
configure_file(
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/../include/hipsparselt_common.yaml"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/hipsparselt_common.yaml" COPYONLY
|
|
)
|
|
|
|
configure_file(
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/../include/hipsparselt_template.yaml"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/hipsparselt_template.yaml" COPYONLY
|
|
)
|
|
|
|
configure_file(
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/../common/hipsparselt_gentest.py"
|
|
"${CMAKE_CURRENT_BINARY_DIR}/hipsparselt_gentest.py" COPYONLY
|
|
)
|
|
|
|
set(hipsparselt_test_install_program "${CMAKE_CURRENT_SOURCE_DIR}/../common/hipsparselt_gentest.py")
|
|
set(hipsparselt_test_install_data_file "${CMAKE_CURRENT_BINARY_DIR}/hipsparselt_gtest.data")
|
|
set(hipsparselt_test_install_yaml_files)
|
|
list(APPEND hipsparselt_test_install_yaml_files
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/../include/hipsparselt_common.yaml"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/../include/hipsparselt_template.yaml"
|
|
)
|
|
|
|
add_custom_command(
|
|
OUTPUT "${hipsparselt_test_install_data_file}"
|
|
COMMAND
|
|
${Python3_EXECUTABLE} "${hipsparselt_test_install_program}" -I
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/../include"
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/hipsparselt_gtest.yaml" -o
|
|
"${hipsparselt_test_install_data_file}"
|
|
DEPENDS ${hipsparselt_test_install_yaml_files}
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/hipsparselt_gtest.yaml"
|
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
|
COMMENT "Generating test data for hipsparselt-test"
|
|
)
|
|
|
|
add_custom_target(
|
|
hipsparselt-test-files ALL
|
|
DEPENDS ${hipsparselt_test_install_yaml_files} ${hipsparselt_test_install_data_file}
|
|
${hipsparselt_test_install_program} COMMENT "Building hipsparselt test files"
|
|
)
|
|
set_target_properties(
|
|
hipsparselt-test-files
|
|
PROPERTIES HIPSPARSELT_INSTALL_YAML_FILES "${hipsparselt_test_install_yaml_files}"
|
|
HIPSPARSELT_INSTALL_DATA_FILE "${hipsparselt_test_install_data_file}"
|
|
HIPSPARSELT_INSTALL_PROGRAM "${hipsparselt_test_install_program}"
|
|
)
|
|
|
|
add_dependencies(hipsparselt-test hipsparselt-test-files)
|
|
|
|
# CTest categories: quick (= smoke), standard (= precheckin), comprehensive (= extended), stress (= weekly)
|
|
# Only when both test_categories.yaml and shared/ctest exist (full rocm-libraries tree).
|
|
set(HIPSPARSELT_CTEST_INSTALL_FILE "")
|
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test_categories.yaml")
|
|
if(HIPSPARSELT_HAS_CTEST_CATEGORIES)
|
|
enable_testing()
|
|
message(STATUS "hipSPARSELt: 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(HIPSPARSELT_CTEST_INSTALL_FILE "${CMAKE_CURRENT_BINARY_DIR}/install_CTestTestfile.cmake")
|
|
file(WRITE "${HIPSPARSELT_CTEST_INSTALL_FILE}"
|
|
[=[
|
|
# This is a test file generated by hipSPARSELt for install time.
|
|
# Tests are defined with relative paths to work in the installed location.
|
|
]=]
|
|
)
|
|
apply_test_category_labels(
|
|
hipsparselt-test
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/test_categories.yaml"
|
|
"${PROJECT_BINARY_DIR}/staging"
|
|
"${HIPSPARSELT_CTEST_INSTALL_FILE}"
|
|
)
|
|
rocm_install(
|
|
FILES "${HIPSPARSELT_CTEST_INSTALL_FILE}"
|
|
DESTINATION "${CMAKE_INSTALL_BINDIR}/hipsparselt"
|
|
COMPONENT tests
|
|
RENAME "CTestTestfile.cmake"
|
|
)
|
|
else()
|
|
message(STATUS "hipSPARSELt: shared/ctest not found (e.g. standalone checkout), skipping CTest categories")
|
|
endif()
|
|
else()
|
|
message(STATUS "hipSPARSELt: No test_categories.yaml (CTest categories not used)")
|
|
endif() |