diff --git a/CMakeLists.txt b/CMakeLists.txt index 891a7d5095c74bb292ca5ce65ec79c972b348cdb..540e998b58270efa981ab3171b9dc5d73e537b73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -306,8 +306,9 @@ if(NOT CHAMELEON_SIMULATION) #---------------------------------------------- if ( CUDA_FOUND ) if ( CHAMELEON_USE_MAGMA ) + set(CHAMELEON_CACHE_VERSION "1.4" CACHE STRING "oldest MAGMA version desired") set(MAGMA_DIR "" CACHE PATH "Root directory of MAGMA library") - find_package(MAGMA REQUIRED COMPONENTS CBLAS LAPACK CUDA) + find_package(MAGMA ${CHAMELEON_CACHE_VERSION} REQUIRED COMPONENTS CBLAS LAPACK CUDA) set(HAVE_MAGMA ${MAGMA_FOUND}) if ( MAGMA_FOUND ) diff --git a/cmake_modules/morse/find/FindMAGMA.cmake b/cmake_modules/morse/find/FindMAGMA.cmake index 315cf87c746ccfb2e67b8e4eef9540120a28cc76..bd1f44a0d35c042b992e3fe9b120680cf95e62cb 100644 --- a/cmake_modules/morse/find/FindMAGMA.cmake +++ b/cmake_modules/morse/find/FindMAGMA.cmake @@ -94,6 +94,27 @@ if(PKG_CONFIG_EXECUTABLE) endif() endif() + if (MAGMA_FIND_VERSION_EXACT STREQUAL 1) + if( NOT (MAGMA_FIND_VERSION_MAJOR STREQUAL MAGMA_VERSION_MAJOR) OR + NOT (MAGMA_FIND_VERSION_MINOR STREQUAL MAGMA_VERSION_MINOR) ) + if(NOT MAGMA_FIND_QUIETLY) + message(FATAL_ERROR + "MAGMA version found is ${MAGMA_VERSION_STRING}" + "when required is ${MAGMA_FIND_VERSION}") + endif() + endif() + else() + # if the version found is older than the required then error + if( (MAGMA_FIND_VERSION_MAJOR STRGREATER MAGMA_VERSION_MAJOR) OR + (MAGMA_FIND_VERSION_MINOR STRGREATER MAGMA_VERSION_MINOR) ) + if(NOT MAGMA_FIND_QUIETLY) + message(FATAL_ERROR + "MAGMA version found is ${MAGMA_VERSION_STRING}" + "when required is ${MAGMA_FIND_VERSION} or newer") + endif() + endif() + endif() + endif(PKG_CONFIG_EXECUTABLE) if(NOT MAGMA_FOUND OR NOT MAGMA_LIBRARIES)