diff --git a/cmake/finders/FindBLAS.cmake b/cmake/finders/FindBLAS.cmake index f2f5be11d5..25d0f909f5 100644 --- a/cmake/finders/FindBLAS.cmake +++ b/cmake/finders/FindBLAS.cmake @@ -6,14 +6,33 @@ cmake_policy(PUSH) cmake_policy(SET CMP0057 NEW) -if("OpenBLAS" IN_LIST THEROCK_PROVIDED_PACKAGES) - cmake_policy(POP) +if(("OpenBLAS" IN_LIST THEROCK_PROVIDED_PACKAGES) OR ("OpenBLAS64" IN_LIST + THEROCK_PROVIDED_PACKAGES)) message(STATUS "Resolving bundled host-blas library from super-project") + set(_want_ilp64 FALSE) if(DEFINED BLA_SIZEOF_INTEGER AND BLA_SIZEOF_INTEGER EQUAL 8) + set(_want_ilp64 TRUE) + endif() + + if(_want_ilp64) + if(NOT "OpenBLAS64" IN_LIST THEROCK_PROVIDED_PACKAGES) + message( + FATAL_ERROR + "BLA_SIZEOF_INTEGER=8 (ILP64) requested but the super-project did not " + "provide OpenBLAS64. Add therock-host-blas64 to this subproject's " + "BUILD_DEPS or RUNTIME_DEPS.") + endif() find_package(OpenBLAS64 CONFIG REQUIRED) set(_OPENBLAS OpenBLAS64) else() + if(NOT "OpenBLAS" IN_LIST THEROCK_PROVIDED_PACKAGES) + message( + FATAL_ERROR + "LP64 BLAS requested but the super-project did not provide OpenBLAS. " + "Add therock-host-blas, or set BLA_SIZEOF_INTEGER=8 if only OpenBLAS64 " + "is available.") + endif() find_package(OpenBLAS CONFIG REQUIRED) set(_OPENBLAS OpenBLAS) endif() @@ -25,6 +44,7 @@ if("OpenBLAS" IN_LIST THEROCK_PROVIDED_PACKAGES) set(BLAS95_LIBRARIES) set(BLAS95_FOUND FALSE) set(BLAS_FOUND TRUE) + cmake_policy(POP) else() cmake_policy(POP) set(BLAS_FOUND FALSE) diff --git a/cmake/finders/FindLAPACK.cmake b/cmake/finders/FindLAPACK.cmake index a5cfa57c28..20263aa71a 100644 --- a/cmake/finders/FindLAPACK.cmake +++ b/cmake/finders/FindLAPACK.cmake @@ -6,25 +6,45 @@ cmake_policy(PUSH) cmake_policy(SET CMP0057 NEW) -if("OpenBLAS" IN_LIST THEROCK_PROVIDED_PACKAGES) - cmake_policy(POP) +if(("OpenBLAS" IN_LIST THEROCK_PROVIDED_PACKAGES) OR ("OpenBLAS64" IN_LIST + THEROCK_PROVIDED_PACKAGES)) message(STATUS "Resolving bundled host-blas library from super-project") + set(_want_ilp64 FALSE) if(DEFINED BLA_SIZEOF_INTEGER AND BLA_SIZEOF_INTEGER EQUAL 8) + set(_want_ilp64 TRUE) + endif() + + if(_want_ilp64) + if(NOT "OpenBLAS64" IN_LIST THEROCK_PROVIDED_PACKAGES) + message( + FATAL_ERROR + "BLA_SIZEOF_INTEGER=8 (ILP64) requested but the super-project did not " + "provide OpenBLAS64. Add therock-host-blas64 to this subproject's " + "BUILD_DEPS or RUNTIME_DEPS.") + endif() find_package(OpenBLAS64 CONFIG REQUIRED) set(_OPENBLAS OpenBLAS64) else() + if(NOT "OpenBLAS" IN_LIST THEROCK_PROVIDED_PACKAGES) + message( + FATAL_ERROR + "LP64 LAPACK requested but the super-project did not provide OpenBLAS. " + "Add therock-host-blas, or set BLA_SIZEOF_INTEGER=8 if only OpenBLAS64 " + "is available.") + endif() find_package(OpenBLAS CONFIG REQUIRED) set(_OPENBLAS OpenBLAS) endif() - # See: https://cmake.org/cmake/help/latest/module/FindBLAS.html + # See: https://cmake.org/cmake/help/latest/module/FindLAPACK.html set(LAPACK_LINKER_FLAGS) set(LAPACK_LIBRARIES ${_OPENBLAS}::OpenBLAS) add_library(LAPACK::LAPACK ALIAS ${_OPENBLAS}::OpenBLAS) set(LAPACK95_LIBRARIES) set(LAPACK95_FOUND FALSE) set(LAPACK_FOUND TRUE) + cmake_policy(POP) else() cmake_policy(POP) set(LAPACK_FOUND FALSE) diff --git a/math-libs/BLAS/CMakeLists.txt b/math-libs/BLAS/CMakeLists.txt index 623cb8e977..14f3019c31 100644 --- a/math-libs/BLAS/CMakeLists.txt +++ b/math-libs/BLAS/CMakeLists.txt @@ -173,8 +173,15 @@ if(NOT WIN32) if(TARGET rocm_smi_lib) list(APPEND rocBLAS_optional_runtime_deps rocm_smi_lib) endif() -elseif(THEROCK_BUILD_TESTING) - list(APPEND rocBLAS_optional_runtime_deps therock-host-blas) +endif() +if(THEROCK_BUILD_TESTING) + # Client tests link ILP64 reference BLAS (see cmake/finders/FindBLAS.cmake + BLA_SIZEOF_INTEGER=8). + list(APPEND rocBLAS_optional_runtime_deps therock-host-blas64) +endif() + +set(rocBLAS_extra_cmake_args) +if(THEROCK_BUILD_TESTING) + list(APPEND rocBLAS_extra_cmake_args -DROCBLAS_CLIENTS_REFERENCE_ILP64=ON) endif() # Disable rocBLAS samples on Windows due to use of deprecated @@ -206,6 +213,7 @@ therock_cmake_subproject_declare(rocBLAS -DBUILD_CLIENTS_SAMPLES=${_blas_build_samples} -DBUILD_CLIENTS_BENCHMARKS=${THEROCK_BUILD_TESTING} -DLINK_BLIS=OFF + ${rocBLAS_extra_cmake_args} CMAKE_INCLUDES therock_explicit_finders.cmake COMPILER_TOOLCHAIN diff --git a/rocm-libraries b/rocm-libraries index f000f7786e..83700a79d2 160000 --- a/rocm-libraries +++ b/rocm-libraries @@ -1 +1 @@ -Subproject commit f000f7786e9ac67510549f4d17784d327705e295 +Subproject commit 83700a79d25b025dabb30095e4e6ec45bc05ccb1