Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/cutorch.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoumith Chintala <soumith@gmail.com>2017-07-18 09:10:35 +0300
committerSoumith Chintala <soumith@gmail.com>2017-07-19 18:22:23 +0300
commit07939f76d5259db7d6a014430bbb599109343fd7 (patch)
treebf04ea5f96a206ba3423026e5be7b51d376d1b79
parent5227de5b0fc14d77de227b3d9e58fd1d0355740c (diff)
add explicit BLAS linkage to THC when linked against magma (in binary build)
-rw-r--r--lib/THC/CMakeLists.txt15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/THC/CMakeLists.txt b/lib/THC/CMakeLists.txt
index 1ea6039..3643904 100644
--- a/lib/THC/CMakeLists.txt
+++ b/lib/THC/CMakeLists.txt
@@ -226,6 +226,21 @@ ELSE()
IF(USE_MAGMA)
TARGET_LINK_LIBRARIES(THC ${MAGMA_LIBRARIES})
+ IF ($ENV{TH_BINARY_BUILD})
+ # because magma is linked statically and it wants a BLAS,
+ # we need to link the BLAS lib against THC. Usually TH will
+ # load a BLAS library and it's all fine, but in the binary builds,
+ # TH uses static linkage to MKL, so it doesn't have all symbols that
+ # magma needs. So in this case, explicitly find a BLAS and link against it
+ # just like in TH
+ SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../TH/cmake ${CMAKE_MODULE_PATH})
+ FIND_PACKAGE(BLAS)
+ IF(BLAS_FOUND)
+ TARGET_LINK_LIBRARIES(THC "${BLAS_LIBRARIES};${BLAS_LIBRARIES};${BLAS_LIBRARIES}")
+ ELSE(BLAS_FOUND)
+ MESSAGE(FATAL_ERROR "Binary build needs blas to be found here")
+ ENDIF(BLAS_FOUND)
+ ENDIF($ENV{TH_BINARY_BUILD})
ENDIF(USE_MAGMA)
IF(NOT THC_SO_VERSION)