Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Improve openblas CMake logic #376

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions cmake/mshadow.cmake
Original file line number Diff line number Diff line change
@@ -1,34 +1,40 @@
set(mshadow_LINKER_LIBS "")

set(BLAS "Open" CACHE STRING "Selected BLAS library")
set_property(CACHE BLAS PROPERTY STRINGS "Atlas;Open;MKL")
set(BLAS "openblas" CACHE STRING "Selected BLAS library")
set_property(CACHE BLAS PROPERTY STRINGS "atlas;openblas;mkl;blas")

if(USE_MKL_IF_AVAILABLE)
if(NOT MKL_FOUND)
find_package(MKL)
endif()
if(MKL_FOUND)
if(USE_MKLML_MKL)
set(BLAS "open")
set(BLAS "mkl")
else()
set(BLAS "MKL")
set(BLAS "openblas")
endif()
endif()
endif()

if(BLAS STREQUAL "Atlas" OR BLAS STREQUAL "atlas")
if(BLAS STREQUAL "atlas")
find_package(Atlas REQUIRED)
include_directories(SYSTEM ${Atlas_INCLUDE_DIR})
list(APPEND mshadow_LINKER_LIBS ${Atlas_LIBRARIES})
add_definitions(-DMSHADOW_USE_CBLAS=1)
add_definitions(-DMSHADOW_USE_MKL=0)
elseif(BLAS STREQUAL "Open" OR BLAS STREQUAL "open")
elseif(BLAS STREQUAL "openblas")
find_package(OpenBLAS REQUIRED)
include_directories(SYSTEM ${OpenBLAS_INCLUDE_DIR})
list(APPEND mshadow_LINKER_LIBS ${OpenBLAS_LIB})
add_definitions(-DMSHADOW_USE_CBLAS=1)
add_definitions(-DMSHADOW_USE_MKL=0)
elseif(BLAS STREQUAL "MKL" OR BLAS STREQUAL "mkl")
elseif(BLAS STREQUAL "blas")
set(BLA_VENDOR "Generic")
find_package(BLAS REQUIRED)
list(APPEND mshadow_LINKER_LIBS ${BLAS_LIBRARIES})
add_definitions(-DMSHADOW_USE_CBLAS=1)
add_definitions(-DMSHADOW_USE_MKL=0)
elseif(BLAS STREQUAL "mkl")
find_package(MKL REQUIRED)
include_directories(SYSTEM ${MKL_INCLUDE_DIR})
list(APPEND mshadow_LINKER_LIBS ${MKL_LIBRARIES})
Expand Down