From 569ed57d05ea7cb865abc24514d93ededf680b71 Mon Sep 17 00:00:00 2001 From: Charles Coulombe Date: Mon, 11 Jul 2022 17:18:53 -0400 Subject: [PATCH 1/2] Include FlexiBLAS as available vendor. Find BLAS libs --- cmake/ChooseBlas.cmake | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmake/ChooseBlas.cmake b/cmake/ChooseBlas.cmake index ed6c7337acd4..36cb73bbf4ee 100644 --- a/cmake/ChooseBlas.cmake +++ b/cmake/ChooseBlas.cmake @@ -16,13 +16,14 @@ # under the License. set(BLAS "Open" CACHE STRING "Selected BLAS library") -set_property(CACHE BLAS PROPERTY STRINGS "Atlas;Open;MKL") +set_property(CACHE BLAS PROPERTY STRINGS "Atlas;Open;MKL;FlexiBLAS") # ---[ Root folders set(INTEL_HOME_ROOT "$ENV{HOME}/intel" CACHE PATH "Folder contains user-installed intel libs") set(INTEL_OPT_ROOT "/opt/intel" CACHE PATH "Folder contains root-installed intel libs") if(DEFINED USE_BLAS) set(BLAS "${USE_BLAS}") + message(STATUS "BLAS is set to ${USE_BLAS}") endif() if(USE_BLAS MATCHES "MKL" OR USE_BLAS MATCHES "mkl" OR NOT DEFINED USE_BLAS) find_path(MKL_INCLUDE_DIR mkl_version.h @@ -33,7 +34,14 @@ if(USE_BLAS MATCHES "MKL" OR USE_BLAS MATCHES "mkl" OR NOT DEFINED USE_BLAS) endif() endif() -if(BLAS STREQUAL "Atlas" OR BLAS STREQUAL "atlas") +if(BLAS STREQUAL "FlexiBLAS" OR BLAS STREQUAL "flexiblas") + find_package(BLAS REQUIRED) + include_directories(SYSTEM ${BLAS_INCLUDE_DIR}) + list(APPEND mshadow_LINKER_LIBS ${BLAS_LIBRARIES}) + add_definitions(-DMSHADOW_USE_CBLAS=1) + add_definitions(-DMSHADOW_USE_MKL=0) + add_definitions(-DMXNET_USE_LAPACK=1) +elseif(BLAS STREQUAL "Atlas" OR BLAS STREQUAL "atlas") find_package(Atlas REQUIRED) include_directories(SYSTEM ${Atlas_INCLUDE_DIR}) list(APPEND mshadow_LINKER_LIBS ${Atlas_LIBRARIES}) From 126fd3079646f6ce2c6f8d0eefa195cf7fcfbdbc Mon Sep 17 00:00:00 2001 From: Charles Coulombe Date: Wed, 27 Jul 2022 10:00:45 -0400 Subject: [PATCH 2/2] Ensure Flexiblas is used when looking for it. Set BLA_VENDOR and bump minimum CMake version accordingly. --- CMakeLists.txt | 2 +- cmake/ChooseBlas.cmake | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5343c324a5a3..66f8488dabf8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.13) +cmake_minimum_required(VERSION 3.19) # workaround to store CMAKE_CROSSCOMPILING because is getting reset by the project command if(CMAKE_CROSSCOMPILING) diff --git a/cmake/ChooseBlas.cmake b/cmake/ChooseBlas.cmake index 36cb73bbf4ee..d37c17b302e7 100644 --- a/cmake/ChooseBlas.cmake +++ b/cmake/ChooseBlas.cmake @@ -35,6 +35,7 @@ if(USE_BLAS MATCHES "MKL" OR USE_BLAS MATCHES "mkl" OR NOT DEFINED USE_BLAS) endif() if(BLAS STREQUAL "FlexiBLAS" OR BLAS STREQUAL "flexiblas") + set(BLA_VENDOR FlexiBLAS) find_package(BLAS REQUIRED) include_directories(SYSTEM ${BLAS_INCLUDE_DIR}) list(APPEND mshadow_LINKER_LIBS ${BLAS_LIBRARIES})