mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
Summary: To enable building torch+dependencies, set WITH_BLAS=flexi BLAS=FlexiBLAS Fixes https://github.com/pytorch/pytorch/issues/64752 Pull Request resolved: https://github.com/pytorch/pytorch/pull/64815 Reviewed By: jbschlosser Differential Revision: D31997745 Pulled By: albanD fbshipit-source-id: db208d59002f5896608a03132616400f09d972aa
This commit is contained in:
committed by
Facebook GitHub Bot
parent
55b7387e45
commit
cee4e8f35d
@ -229,6 +229,10 @@ elseif(BLAS STREQUAL "vecLib")
|
||||
set(BLAS_INFO "veclib")
|
||||
set(BLAS_FOUND 1)
|
||||
set(BLAS_LIBRARIES ${vecLib_LINKER_LIBS})
|
||||
elseif(BLAS STREQUAL "FlexiBLAS")
|
||||
find_package(FlexiBLAS REQUIRED)
|
||||
include_directories(SYSTEM ${FlexiBLAS_INCLUDE_DIR})
|
||||
list(APPEND Caffe2_PUBLIC_DEPENDENCY_LIBS ${FlexiBLAS_LIB})
|
||||
elseif(BLAS STREQUAL "Generic")
|
||||
# On Debian family, the CBLAS ABIs have been merged into libblas.so
|
||||
find_library(BLAS_LIBRARIES blas)
|
||||
@ -245,7 +249,7 @@ if(NOT INTERN_BUILD_MOBILE)
|
||||
set(AT_MKL_ENABLED 0)
|
||||
set(AT_MKL_MT 0)
|
||||
set(USE_BLAS 1)
|
||||
if(NOT (ATLAS_FOUND OR BLIS_FOUND OR GENERIC_BLAS_FOUND OR MKL_FOUND OR OpenBLAS_FOUND OR VECLIB_FOUND))
|
||||
if(NOT (ATLAS_FOUND OR BLIS_FOUND OR GENERIC_BLAS_FOUND OR MKL_FOUND OR OpenBLAS_FOUND OR VECLIB_FOUND OR FlexiBLAS_FOUND))
|
||||
message(WARNING "Preferred BLAS (" ${BLAS} ") cannot be found, now searching for a general BLAS library")
|
||||
find_package(BLAS)
|
||||
if(NOT BLAS_FOUND)
|
||||
|
@ -152,6 +152,19 @@ if((NOT BLAS_LIBRARIES)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if((NOT BLAS_LIBRARIES)
|
||||
AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "flexi")))
|
||||
check_fortran_libraries(
|
||||
BLAS_LIBRARIES
|
||||
BLAS
|
||||
sgemm
|
||||
""
|
||||
"flexiblas")
|
||||
if(BLAS_LIBRARIES)
|
||||
set(BLAS_INFO "flexi")
|
||||
endif(BLAS_LIBRARIES)
|
||||
endif()
|
||||
|
||||
if((NOT BLAS_LIBRARIES)
|
||||
AND ((NOT WITH_BLAS) OR (WITH_BLAS STREQUAL "open")))
|
||||
check_fortran_libraries(
|
||||
|
65
cmake/Modules/FindFlexiBLAS.cmake
Normal file
65
cmake/Modules/FindFlexiBLAS.cmake
Normal file
@ -0,0 +1,65 @@
|
||||
|
||||
|
||||
SET(Flexi_BLAS_INCLUDE_SEARCH_PATHS
|
||||
/usr/include
|
||||
/usr/include/flexiblas
|
||||
/usr/include/flexiblas-base
|
||||
/usr/local/include
|
||||
/usr/local/include/flexiblas
|
||||
/usr/local/include/flexiblas-base
|
||||
/usr/local/opt/flexiblas/include
|
||||
/opt/Flexiblas/include
|
||||
$ENV{FlexiBLAS_HOME}
|
||||
$ENV{FlexiBLAS_HOME}/include
|
||||
)
|
||||
|
||||
SET(Flexi_BLAS_LIB_SEARCH_PATHS
|
||||
/lib/
|
||||
/lib/flexiblas-base
|
||||
/lib64/
|
||||
/usr/lib
|
||||
/usr/lib/flexiblas-base
|
||||
/usr/lib64
|
||||
/usr/local/lib
|
||||
/usr/local/lib64
|
||||
/usr/local/opt/flexiblas/lib
|
||||
/opt/FlexiBLAS/lib
|
||||
$ENV{FlexiBLAS}
|
||||
$ENV{FlexiBLAS}/lib
|
||||
$ENV{FlexiBLAS_HOME}
|
||||
$ENV{FlexiBLAS_HOME}/lib
|
||||
)
|
||||
|
||||
FIND_PATH(FlexiBLAS_INCLUDE_DIR NAMES cblas.h PATHS ${Flexi_BLAS_INCLUDE_SEARCH_PATHS})
|
||||
FIND_LIBRARY(FlexiBLAS_LIB NAMES flexiblas PATHS ${Flexi_BLAS_LIB_SEARCH_PATHS})
|
||||
|
||||
SET(FlexiBLAS_FOUND ON)
|
||||
|
||||
# Check include files
|
||||
IF(NOT FlexiBLAS_INCLUDE_DIR)
|
||||
SET(FlexiBLAS_FOUND OFF)
|
||||
MESSAGE(STATUS "Could not find FlexiBLAS include. Turning FlexiBLAS_FOUND off")
|
||||
ENDIF()
|
||||
|
||||
# Check libraries
|
||||
IF(NOT FlexiBLAS_LIB)
|
||||
SET(FlexiBLAS_FOUND OFF)
|
||||
MESSAGE(STATUS "Could not find FlexiBLAS lib. Turning FlexiBLAS_FOUND off")
|
||||
ENDIF()
|
||||
|
||||
IF (FlexiBLAS_FOUND)
|
||||
IF (NOT FlexiBLAS_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found FlexiBLAS libraries: ${FlexiBLAS_LIB}")
|
||||
MESSAGE(STATUS "Found FlexiBLAS include: ${FlexiBLAS_INCLUDE_DIR}")
|
||||
ENDIF (NOT FlexiBLAS_FIND_QUIETLY)
|
||||
ELSE (FlexiBLAS_FOUND)
|
||||
IF (FlexiBLAS_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find FlexiBLAS")
|
||||
ENDIF (FlexiBLAS_FIND_REQUIRED)
|
||||
ENDIF (FlexiBLAS_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
FlexiBLAS_INCLUDE_DIR
|
||||
FlexiBLAS_LIB
|
||||
FlexiBLAS
|
||||
)
|
@ -119,6 +119,18 @@ if(BLAS_FOUND)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# FlexiBLAS
|
||||
IF((NOT LAPACK_INFO) AND (BLAS_INFO STREQUAL "flexi"))
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${BLAS_LIBRARIES})
|
||||
check_function_exists("cheev_" FLEXIBLAS_LAPACK_WORKS)
|
||||
set(CMAKE_REQUIRED_LIBRARIES)
|
||||
if(FLEXIBLAS_LAPACK_WORKS)
|
||||
SET(LAPACK_INFO "flexi")
|
||||
else()
|
||||
message(STATUS "Strangely, this FlexiBLAS library does not support Lapack?!")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# OpenBlas
|
||||
IF((NOT LAPACK_INFO) AND (BLAS_INFO STREQUAL "open"))
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${BLAS_LIBRARIES})
|
||||
|
2
setup.py
2
setup.py
@ -121,7 +121,7 @@
|
||||
# one in this file; needed to build with other frameworks that share ONNX.
|
||||
#
|
||||
# BLAS
|
||||
# BLAS to be used by Caffe2. Can be MKL, Eigen, ATLAS, or OpenBLAS. If set
|
||||
# BLAS to be used by Caffe2. Can be MKL, Eigen, ATLAS, FlexiBLAS, or OpenBLAS. If set
|
||||
# then the build will fail if the requested BLAS is not found, otherwise
|
||||
# the BLAS will be chosen based on what is found on your system.
|
||||
#
|
||||
|
Reference in New Issue
Block a user