Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[POC] Statically link to openblas #19068

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ option(BUILD_CYTHON_MODULES "Build cython modules." OFF)
option(LOG_FATAL_THROW "Log exceptions but do not abort" ON)
cmake_dependent_option(USE_SPLIT_ARCH_DLL "Build a separate DLL for each Cuda arch (Windows only)." ON "MSVC" OFF)
cmake_dependent_option(USE_CCACHE "Attempt using CCache to wrap the compilation" ON "UNIX" OFF)
option(USE_STATIC_LINK_TO_OPENBLAS "Statically link to openblas to avoid name clashing" ON)


message(STATUS "CMAKE_CROSSCOMPILING ${CMAKE_CROSSCOMPILING}")
Expand Down Expand Up @@ -889,3 +890,7 @@ if(BUILD_CYTHON_MODULES)
message(FATAL_ERROR "No python interpreter found to build cython modules")
endif()
endif()

if(USE_STATIC_LINK_TO_OPENBLAS AND USE_BLAS STREQUAL "open")
set_target_properties(mxnet PROPERTIES LINK_FLAGS "-Wl,--version-script=${PROJECT_SOURCE_DIR}/cmake/exclude_openblas.ver")
endif()
2 changes: 1 addition & 1 deletion cmake/Modules/FindOpenBLAS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ SET(Open_BLAS_LIB_SEARCH_PATHS
)

FIND_PATH(OpenBLAS_INCLUDE_DIR NAMES cblas.h PATHS ${Open_BLAS_INCLUDE_SEARCH_PATHS})
FIND_LIBRARY(OpenBLAS_LIB NAMES openblas PATHS ${Open_BLAS_LIB_SEARCH_PATHS})
FIND_LIBRARY(OpenBLAS_LIB NAMES libopenblas.a openblas PATHS ${Open_BLAS_LIB_SEARCH_PATHS})
IF(NOT OpenBLAS_LIB)
FIND_FILE(OpenBLAS_LIB NAMES libopenblas.dll.a PATHS ${Open_BLAS_LIB_SEARCH_PATHS})
ENDIF()
Expand Down
21 changes: 21 additions & 0 deletions cmake/exclude_openblas.ver
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

{
local:
cblas_*;
*portrf_;
*portri_;
*gelqf_;
*orglq_;
*geqrf_;
*orgqr_;
*syevd_;
*gesvd_;
*gesdd_;
*geev_;
*getrf_;
*getri_;
*gesv_;
*gelsd_;
};