Skip to content

Commit

Permalink
[Unit tests] skip BLAS and LAPACK unit tests if Netlib is not found
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrainiuk committed Oct 1, 2024
1 parent afb9d5c commit f9703ec
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 44 deletions.
20 changes: 16 additions & 4 deletions tests/unit_tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,21 @@
#===============================================================================

if("blas" IN_LIST TARGET_DOMAINS)
find_package(CBLAS REQUIRED)
find_package(CBLAS)
if(NOT CBLAS_FOUND)
# TODO: add list of tests without Netlib dependency
message(WARNING "Netlib CBLAS headers or libraries are not found, BLAS unit tests will be skipped")
list(REMOVE_ITEM TARGET_DOMAINS "blas")
endif()
endif()

if("lapack" IN_LIST TARGET_DOMAINS)
find_package(LAPACKE REQUIRED)
find_package(LAPACKE)
if(NOT LAPACKE_FOUND)
# TODO: add list of tests without Netlib dependency
message(WARNING "Netlib LAPACKE headers or libraries are not found, LAPACK unit tests will be skipped")
list(REMOVE_ITEM TARGET_DOMAINS "lapack")
endif()
endif()

foreach(domain ${TARGET_DOMAINS})
Expand Down Expand Up @@ -50,7 +60,9 @@ set(blas_TEST_LINK "")
set(lapack_TEST_LIST
lapack_source)

set(lapack_TEST_LINK ${LAPACKE_LINK})
if(LAPACKE_FOUND)
set(lapack_TEST_LINK ${LAPACKE_LINK})
endif()

# RNG config
set(rng_TEST_LIST
Expand Down Expand Up @@ -195,7 +207,7 @@ foreach(domain ${TARGET_DOMAINS})

string(TOUPPER ${domain} DOMAIN_PREFIX)

if(domain STREQUAL "blas")
if(domain STREQUAL "blas" AND CBLAS_FOUND)
set(TEST_LD_LIBRARY_PATH ${CMAKE_BINARY_DIR}/lib:${CBLAS_LIB_DIR}:$ENV{LD_LIBRARY_PATH})
else()
set(TEST_LD_LIBRARY_PATH ${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH})
Expand Down
16 changes: 9 additions & 7 deletions tests/unit_tests/blas/batch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,40 @@
#===============================================================================

# Build object from all test sources
set(BATCH_SOURCES "copy_batch_stride.cpp" "axpy_batch_stride.cpp" "dgmm_batch_stride.cpp" "gemm_batch_stride.cpp" "gemv_batch_stride.cpp" "trsm_batch_stride.cpp" "syrk_batch_stride.cpp" "copy_batch_usm.cpp" "copy_batch_stride_usm.cpp" "axpy_batch_usm.cpp" "axpy_batch_stride_usm.cpp" "dgmm_batch_usm.cpp" "dgmm_batch_stride_usm.cpp" "gemm_batch_usm.cpp" "gemm_batch_stride_usm.cpp" "gemv_batch_usm.cpp" "gemv_batch_stride_usm.cpp" "trsm_batch_usm.cpp" "trsm_batch_stride_usm.cpp" "syrk_batch_usm.cpp" "syrk_batch_stride_usm.cpp" "omatcopy_batch_stride.cpp" "omatcopy_batch_stride_usm.cpp" "imatcopy_batch_stride.cpp" "imatcopy_batch_stride_usm.cpp" "omatadd_batch_stride.cpp" "omatadd_batch_stride_usm.cpp" "omatcopy_batch_usm.cpp" "imatcopy_batch_usm.cpp")
set(BATCH_SOURCES_W_CBLAS "copy_batch_stride.cpp" "axpy_batch_stride.cpp" "dgmm_batch_stride.cpp" "gemm_batch_stride.cpp" "gemv_batch_stride.cpp" "trsm_batch_stride.cpp" "syrk_batch_stride.cpp" "copy_batch_usm.cpp" "copy_batch_stride_usm.cpp" "axpy_batch_usm.cpp" "axpy_batch_stride_usm.cpp" "dgmm_batch_usm.cpp" "dgmm_batch_stride_usm.cpp" "gemm_batch_usm.cpp" "gemm_batch_stride_usm.cpp" "gemv_batch_usm.cpp" "gemv_batch_stride_usm.cpp" "trsm_batch_usm.cpp" "trsm_batch_stride_usm.cpp" "syrk_batch_usm.cpp" "syrk_batch_stride_usm.cpp" "omatcopy_batch_stride.cpp" "omatcopy_batch_stride_usm.cpp" "imatcopy_batch_stride.cpp" "imatcopy_batch_stride_usm.cpp" "omatadd_batch_stride.cpp" "omatadd_batch_stride_usm.cpp" "omatcopy_batch_usm.cpp" "imatcopy_batch_usm.cpp")
# TODO: add list of tests without Netlib dependency
set(BATCH_SOURCES)

if(BUILD_SHARED_LIBS)
add_library(blas_batch_rt OBJECT ${BATCH_SOURCES})
add_library(blas_batch_rt OBJECT $<$<BOOL:${CBLAS_FOUND}>:${BATCH_SOURCES_W_CBLAS}> ${BATCH_SOURCES})
target_compile_options(blas_batch_rt PRIVATE -DCALL_RT_API -DNOMINMAX)
target_include_directories(blas_batch_rt
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../include
PUBLIC ${PROJECT_SOURCE_DIR}/include
PUBLIC ${PROJECT_SOURCE_DIR}/deps/googletest/include
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${CBLAS_INCLUDE}
$<$<BOOL:${CBLAS_FOUND}>:${CBLAS_INCLUDE}>
)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET blas_batch_rt SOURCES ${BATCH_SOURCES})
add_sycl_to_target(TARGET blas_batch_rt SOURCES $<$<BOOL:${CBLAS_FOUND}>:${BATCH_SOURCES_W_CBLAS}> ${BATCH_SOURCES})
else()
target_link_libraries(blas_batch_rt PUBLIC ONEMKL::SYCL::SYCL)
endif()
endif()

add_library(blas_batch_ct OBJECT ${BATCH_SOURCES})
add_library(blas_batch_ct OBJECT $<$<BOOL:${CBLAS_FOUND}>:${BATCH_SOURCES_W_CBLAS}> ${BATCH_SOURCES})
target_compile_options(blas_batch_ct PRIVATE -DNOMINMAX)
target_include_directories(blas_batch_ct
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../include
PUBLIC ${PROJECT_SOURCE_DIR}/include
PUBLIC ${PROJECT_SOURCE_DIR}/deps/googletest/include
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${CBLAS_INCLUDE}
$<$<BOOL:${CBLAS_FOUND}>:${CBLAS_INCLUDE}>
)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET blas_batch_ct SOURCES ${BATCH_SOURCES})
add_sycl_to_target(TARGET blas_batch_ct SOURCES $<$<BOOL:${CBLAS_FOUND}>:${BATCH_SOURCES_W_CBLAS}> ${BATCH_SOURCES})
else()
target_link_libraries(blas_batch_ct PUBLIC ONEMKL::SYCL::SYCL)
endif()
16 changes: 9 additions & 7 deletions tests/unit_tests/blas/extensions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,40 @@
#===============================================================================

# Build object from all test sources
set(EXTENSIONS_SOURCES "gemm_bias.cpp" "gemmt.cpp" "gemm_bias_usm.cpp" "gemmt_usm.cpp" "omatcopy.cpp" "omatcopy_usm.cpp" "imatcopy.cpp" "imatcopy_usm.cpp" "omatadd.cpp" "omatadd_usm.cpp" "omatcopy2.cpp" "omatcopy2_usm.cpp")
set(EXTENSIONS_SOURCES_W_CBLAS "gemm_bias.cpp" "gemmt.cpp" "gemm_bias_usm.cpp" "gemmt_usm.cpp" "omatcopy.cpp" "omatcopy_usm.cpp" "imatcopy.cpp" "imatcopy_usm.cpp" "omatadd.cpp" "omatadd_usm.cpp" "omatcopy2.cpp" "omatcopy2_usm.cpp")
# TODO: add list of tests without Netlib dependency
set(EXTENSIONS_SOURCES)

if(BUILD_SHARED_LIBS)
add_library(blas_extensions_rt OBJECT ${EXTENSIONS_SOURCES})
add_library(blas_extensions_rt OBJECT $<$<BOOL:${CBLAS_FOUND}>:${EXTENSIONS_SOURCES_W_CBLAS}> ${EXTENSIONS_SOURCES})
target_compile_options(blas_extensions_rt PRIVATE -DCALL_RT_API -DNOMINMAX)
target_include_directories(blas_extensions_rt
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../include
PUBLIC ${PROJECT_SOURCE_DIR}/include
PUBLIC ${PROJECT_SOURCE_DIR}/deps/googletest/include
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${CBLAS_INCLUDE}
$<$<BOOL:${CBLAS_FOUND}>:${CBLAS_INCLUDE}>
)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET blas_extensions_rt SOURCES ${EXTENSIONS_SOURCES})
add_sycl_to_target(TARGET blas_extensions_rt SOURCES $<$<BOOL:${CBLAS_FOUND}>:${EXTENSIONS_SOURCES_W_CBLAS}> ${EXTENSIONS_SOURCES})
else()
target_link_libraries(blas_extensions_rt PUBLIC ONEMKL::SYCL::SYCL)
endif()
endif()

add_library(blas_extensions_ct OBJECT ${EXTENSIONS_SOURCES})
add_library(blas_extensions_ct OBJECT $<$<BOOL:${CBLAS_FOUND}>:${EXTENSIONS_SOURCES_W_CBLAS}> ${EXTENSIONS_SOURCES})
target_compile_options(blas_extensions_ct PRIVATE -DNOMINMAX)
target_include_directories(blas_extensions_ct
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../include
PUBLIC ${PROJECT_SOURCE_DIR}/include
PUBLIC ${PROJECT_SOURCE_DIR}/deps/googletest/include
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${CBLAS_INCLUDE}
$<$<BOOL:${CBLAS_FOUND}>:${CBLAS_INCLUDE}>
)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET blas_extensions_ct SOURCES ${EXTENSIONS_SOURCES})
add_sycl_to_target(TARGET blas_extensions_ct SOURCES $<$<BOOL:${CBLAS_FOUND}>:${EXTENSIONS_SOURCES_W_CBLAS}> ${EXTENSIONS_SOURCES})
else()
target_link_libraries(blas_extensions_ct PUBLIC ONEMKL::SYCL::SYCL)
endif()
16 changes: 9 additions & 7 deletions tests/unit_tests/blas/level1/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,40 @@
#===============================================================================

# Build object from all test sources
set(L1_SOURCES "nrm2.cpp" "iamin.cpp" "iamax.cpp" "dotu.cpp" "dot.cpp" "dotc.cpp" "copy.cpp" "axpy.cpp" "axpby.cpp" "asum.cpp" "swap.cpp" "sdsdot.cpp" "scal.cpp" "rotmg.cpp" "rotm.cpp" "rotg.cpp" "rot.cpp" "nrm2_usm.cpp" "iamin_usm.cpp" "iamax_usm.cpp" "dotu_usm.cpp" "dot_usm.cpp" "dotc_usm.cpp" "copy_usm.cpp" "axpy_usm.cpp" "axpby_usm.cpp" "asum_usm.cpp" "swap_usm.cpp" "sdsdot_usm.cpp" "scal_usm.cpp" "rotmg_usm.cpp" "rotm_usm.cpp" "rotg_usm.cpp" "rot_usm.cpp")
set(L1_SOURCES_W_CBLAS "nrm2.cpp" "iamin.cpp" "iamax.cpp" "dotu.cpp" "dot.cpp" "dotc.cpp" "copy.cpp" "axpy.cpp" "axpby.cpp" "asum.cpp" "swap.cpp" "sdsdot.cpp" "scal.cpp" "rotmg.cpp" "rotm.cpp" "rotg.cpp" "rot.cpp" "nrm2_usm.cpp" "iamin_usm.cpp" "iamax_usm.cpp" "dotu_usm.cpp" "dot_usm.cpp" "dotc_usm.cpp" "copy_usm.cpp" "axpy_usm.cpp" "axpby_usm.cpp" "asum_usm.cpp" "swap_usm.cpp" "sdsdot_usm.cpp" "scal_usm.cpp" "rotmg_usm.cpp" "rotm_usm.cpp" "rotg_usm.cpp" "rot_usm.cpp")
# TODO: add list of tests without Netlib dependency
set(L1_SOURCES)

if(BUILD_SHARED_LIBS)
add_library(blas_level1_rt OBJECT ${L1_SOURCES})
add_library(blas_level1_rt OBJECT $<$<BOOL:${CBLAS_FOUND}>:${L1_SOURCES_W_CBLAS}> ${L1_SOURCES})
target_compile_options(blas_level1_rt PRIVATE -DCALL_RT_API -DNOMINMAX)
target_include_directories(blas_level1_rt
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../include
PUBLIC ${PROJECT_SOURCE_DIR}/include
PUBLIC ${PROJECT_SOURCE_DIR}/deps/googletest/include
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${CBLAS_INCLUDE}
$<$<BOOL:${CBLAS_FOUND}>:${CBLAS_INCLUDE}>
)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET blas_level1_rt SOURCES ${L1_SOURCES})
add_sycl_to_target(TARGET blas_level1_rt SOURCES $<$<BOOL:${CBLAS_FOUND}>:${L1_SOURCES_W_CBLAS}> ${L1_SOURCES})
else()
target_link_libraries(blas_level1_rt PUBLIC ONEMKL::SYCL::SYCL)
endif()
endif()

add_library(blas_level1_ct OBJECT ${L1_SOURCES})
add_library(blas_level1_ct OBJECT $<$<BOOL:${CBLAS_FOUND}>:${L1_SOURCES_W_CBLAS}> ${L1_SOURCES})
target_compile_options(blas_level1_ct PRIVATE -DNOMINMAX)
target_include_directories(blas_level1_ct
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../include
PUBLIC ${PROJECT_SOURCE_DIR}/include
PUBLIC ${PROJECT_SOURCE_DIR}/deps/googletest/include
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${CBLAS_INCLUDE}
$<$<BOOL:${CBLAS_FOUND}>:${CBLAS_INCLUDE}>
)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET blas_level1_ct SOURCES ${L1_SOURCES})
add_sycl_to_target(TARGET blas_level1_ct SOURCES $<$<BOOL:${CBLAS_FOUND}>:${L1_SOURCES_W_CBLAS}> ${L1_SOURCES})
else()
target_link_libraries(blas_level1_ct PUBLIC ONEMKL::SYCL::SYCL)
endif()
16 changes: 9 additions & 7 deletions tests/unit_tests/blas/level2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,40 @@
#===============================================================================

# Build object from all test sources
set(L2_SOURCES "hpr2.cpp" "hpmv.cpp" "her.cpp" "her2.cpp" "hemv.cpp" "hbmv.cpp" "geru.cpp" "ger.cpp" "gerc.cpp" "gemv.cpp" "gbmv.cpp" "trsv.cpp" "trmv.cpp" "tpsv.cpp" "tpmv.cpp" "tbsv.cpp" "tbmv.cpp" "syr.cpp" "syr2.cpp" "symv.cpp" "spr.cpp" "spr2.cpp" "spmv.cpp" "sbmv.cpp" "hpr.cpp" "hpr2_usm.cpp" "hpmv_usm.cpp" "her_usm.cpp" "her2_usm.cpp" "hemv_usm.cpp" "hbmv_usm.cpp" "geru_usm.cpp" "ger_usm.cpp" "gerc_usm.cpp" "gemv_usm.cpp" "gbmv_usm.cpp" "trsv_usm.cpp" "trmv_usm.cpp" "tpsv_usm.cpp" "tpmv_usm.cpp" "tbsv_usm.cpp" "tbmv_usm.cpp" "syr_usm.cpp" "syr2_usm.cpp" "symv_usm.cpp" "spr_usm.cpp" "spr2_usm.cpp" "spmv_usm.cpp" "sbmv_usm.cpp" "hpr_usm.cpp")
set(L2_SOURCES_W_CBLAS "hpr2.cpp" "hpmv.cpp" "her.cpp" "her2.cpp" "hemv.cpp" "hbmv.cpp" "geru.cpp" "ger.cpp" "gerc.cpp" "gemv.cpp" "gbmv.cpp" "trsv.cpp" "trmv.cpp" "tpsv.cpp" "tpmv.cpp" "tbsv.cpp" "tbmv.cpp" "syr.cpp" "syr2.cpp" "symv.cpp" "spr.cpp" "spr2.cpp" "spmv.cpp" "sbmv.cpp" "hpr.cpp" "hpr2_usm.cpp" "hpmv_usm.cpp" "her_usm.cpp" "her2_usm.cpp" "hemv_usm.cpp" "hbmv_usm.cpp" "geru_usm.cpp" "ger_usm.cpp" "gerc_usm.cpp" "gemv_usm.cpp" "gbmv_usm.cpp" "trsv_usm.cpp" "trmv_usm.cpp" "tpsv_usm.cpp" "tpmv_usm.cpp" "tbsv_usm.cpp" "tbmv_usm.cpp" "syr_usm.cpp" "syr2_usm.cpp" "symv_usm.cpp" "spr_usm.cpp" "spr2_usm.cpp" "spmv_usm.cpp" "sbmv_usm.cpp" "hpr_usm.cpp")
# TODO: add list of tests without Netlib dependency
set(L2_SOURCES)

if(BUILD_SHARED_LIBS)
add_library(blas_level2_rt OBJECT ${L2_SOURCES})
add_library(blas_level2_rt OBJECT $<$<BOOL:${CBLAS_FOUND}>:${L2_SOURCES_W_CBLAS}> ${L2_SOURCES})
target_compile_options(blas_level2_rt PRIVATE -DCALL_RT_API -DNOMINMAX)
target_include_directories(blas_level2_rt
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../include
PUBLIC ${PROJECT_SOURCE_DIR}/include
PUBLIC ${PROJECT_SOURCE_DIR}/deps/googletest/include
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${CBLAS_INCLUDE}
$<$<BOOL:${CBLAS_FOUND}>:${CBLAS_INCLUDE}>
)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET blas_level2_rt SOURCES ${L2_SOURCES})
add_sycl_to_target(TARGET blas_level2_rt SOURCES $<$<BOOL:${CBLAS_FOUND}>:${L2_SOURCES_W_CBLAS}> ${L2_SOURCES})
else()
target_link_libraries(blas_level2_rt PUBLIC ONEMKL::SYCL::SYCL)
endif()
endif()

add_library(blas_level2_ct OBJECT ${L2_SOURCES})
add_library(blas_level2_ct OBJECT $<$<BOOL:${CBLAS_FOUND}>:${L2_SOURCES_W_CBLAS}> ${L2_SOURCES})
target_compile_options(blas_level2_ct PRIVATE -DNOMINMAX)
target_include_directories(blas_level2_ct
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../include
PUBLIC ${PROJECT_SOURCE_DIR}/include
PUBLIC ${PROJECT_SOURCE_DIR}/deps/googletest/include
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${CBLAS_INCLUDE}
$<$<BOOL:${CBLAS_FOUND}>:${CBLAS_INCLUDE}>
)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET blas_level2_ct SOURCES ${L2_SOURCES})
add_sycl_to_target(TARGET blas_level2_ct SOURCES $<$<BOOL:${CBLAS_FOUND}>:${L2_SOURCES_W_CBLAS}> ${L2_SOURCES})
else()
target_link_libraries(blas_level2_ct PUBLIC ONEMKL::SYCL::SYCL)
endif()
Expand Down
16 changes: 9 additions & 7 deletions tests/unit_tests/blas/level3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,40 @@
#===============================================================================

# Build object from all test sources
set(L3_SOURCES "gemm.cpp" "symm.cpp" "syrk.cpp" "hemm.cpp" "herk.cpp" "syr2k.cpp" "her2k.cpp" "trmm.cpp" "trsm.cpp" "gemm_usm.cpp" "symm_usm.cpp" "syrk_usm.cpp" "hemm_usm.cpp" "herk_usm.cpp" "syr2k_usm.cpp" "her2k_usm.cpp" "trmm_usm.cpp" "trsm_usm.cpp")
set(L3_SOURCES_W_CBLAS "gemm.cpp" "symm.cpp" "syrk.cpp" "hemm.cpp" "herk.cpp" "syr2k.cpp" "her2k.cpp" "trmm.cpp" "trsm.cpp" "gemm_usm.cpp" "symm_usm.cpp" "syrk_usm.cpp" "hemm_usm.cpp" "herk_usm.cpp" "syr2k_usm.cpp" "her2k_usm.cpp" "trmm_usm.cpp" "trsm_usm.cpp")
# TODO: add list of tests without Netlib dependency
set(L3_SOURCES)

if(BUILD_SHARED_LIBS)
add_library(blas_level3_rt OBJECT ${L3_SOURCES})
add_library(blas_level3_rt OBJECT $<$<BOOL:${CBLAS_FOUND}>:${L3_SOURCES_W_CBLAS}> ${L3_SOURCES})
target_compile_options(blas_level3_rt PRIVATE -DCALL_RT_API -DNOMINMAX)
target_include_directories(blas_level3_rt
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../include
PUBLIC ${PROJECT_SOURCE_DIR}/include
PUBLIC ${PROJECT_SOURCE_DIR}/deps/googletest/include
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${CBLAS_INCLUDE}
$<$<BOOL:${CBLAS_FOUND}>:${CBLAS_INCLUDE}>
)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET blas_level3_rt SOURCES ${L3_SOURCES})
add_sycl_to_target(TARGET blas_level3_rt SOURCES $<$<BOOL:${CBLAS_FOUND}>:${L3_SOURCES_W_CBLAS}> ${L3_SOURCES})
else()
target_link_libraries(blas_level3_rt PUBLIC ONEMKL::SYCL::SYCL)
endif()
endif()

add_library(blas_level3_ct OBJECT ${L3_SOURCES})
add_library(blas_level3_ct OBJECT $<$<BOOL:${CBLAS_FOUND}>:${L3_SOURCES_W_CBLAS}> ${L3_SOURCES})
target_compile_options(blas_level3_ct PRIVATE -DNOMINMAX)
target_include_directories(blas_level3_ct
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../include
PUBLIC ${PROJECT_SOURCE_DIR}/include
PUBLIC ${PROJECT_SOURCE_DIR}/deps/googletest/include
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${CBLAS_INCLUDE}
$<$<BOOL:${CBLAS_FOUND}>:${CBLAS_INCLUDE}>
)
if (USE_ADD_SYCL_TO_TARGET_INTEGRATION)
add_sycl_to_target(TARGET blas_level3_ct SOURCES ${L3_SOURCES})
add_sycl_to_target(TARGET blas_level3_ct SOURCES $<$<BOOL:${CBLAS_FOUND}>:${L3_SOURCES_W_CBLAS}> ${L3_SOURCES})
else()
target_link_libraries(blas_level3_ct PUBLIC ONEMKL::SYCL::SYCL)
endif()
Expand Down
12 changes: 7 additions & 5 deletions tests/unit_tests/lapack/source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#===============================================================================

#Build object from all test sources
set(LAPACK_SOURCES
set(LAPACK_SOURCES_W_LAPACKE
"gebrd.cpp"
"geqrf.cpp"
"geqrf_batch_group.cpp"
Expand Down Expand Up @@ -67,29 +67,31 @@ set(LAPACK_SOURCES
"unmrq.cpp"
"unmtr.cpp"
)
# TODO: add list of tests without Netlib dependency
set(LAPACK_SOURCES)

if(BUILD_SHARED_LIBS)
add_library(lapack_source_rt OBJECT ${LAPACK_SOURCES})
add_library(lapack_source_rt OBJECT $<$<BOOL:${LAPACKE_FOUND}>:${LAPACK_SOURCES_W_LAPACKE}> ${LAPACK_SOURCES})
target_compile_options(lapack_source_rt PRIVATE -DCALL_RT_API -DNOMINMAX)
target_include_directories(lapack_source_rt
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../include
PUBLIC ${PROJECT_SOURCE_DIR}/include
PUBLIC ${PROJECT_SOURCE_DIR}/deps/googletest/include
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${LAPACKE_INCLUDE}
$<$<BOOL:${LAPACKE_FOUND}>:${LAPACKE_INCLUDE}>
)
target_link_libraries(lapack_source_rt PUBLIC ONEMKL::SYCL::SYCL)
endif()

add_library(lapack_source_ct OBJECT ${LAPACK_SOURCES})
add_library(lapack_source_ct OBJECT $<$<BOOL:${LAPACKE_FOUND}>:${LAPACK_SOURCES_W_LAPACKE}> ${LAPACK_SOURCES})
target_compile_options(lapack_source_ct PRIVATE -DNOMINMAX)
target_include_directories(lapack_source_ct
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../../include
PUBLIC ${PROJECT_SOURCE_DIR}/include
PUBLIC ${PROJECT_SOURCE_DIR}/deps/googletest/include
PUBLIC ${CMAKE_BINARY_DIR}/bin
PUBLIC ${LAPACKE_INCLUDE}
$<$<BOOL:${LAPACKE_FOUND}>:${LAPACKE_INCLUDE}>
)
target_link_libraries(lapack_source_ct PUBLIC ONEMKL::SYCL::SYCL)

0 comments on commit f9703ec

Please sign in to comment.