[arrayfire] 60/408: Add support for BLAS symbol renaming
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Sep 21 19:11:16 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch debian/sid
in repository arrayfire.
commit 91cea3bf96914645dabc539273106c48b6219df9
Author: Keno Fischer <keno at juliacomputing.com>
Date: Tue Jun 30 02:53:11 2015 +0000
Add support for BLAS symbol renaming
OpenBLAS (and potentially other BLASes), generate a symbol rename file to
move symbols out of a namespace where they might conflict with other BLASes
(if the right options are set). Teach ArrayFire to make use of this file
to be able to still link against that library.
---
src/backend/cpu/CMakeLists.txt | 57 ++++++++++++++++++++++-----
src/backend/opencl/CMakeLists.txt | 81 ++++++++++++++++++++++++++++++---------
2 files changed, 110 insertions(+), 28 deletions(-)
diff --git a/src/backend/cpu/CMakeLists.txt b/src/backend/cpu/CMakeLists.txt
index c892905..dd1b1b5 100644
--- a/src/backend/cpu/CMakeLists.txt
+++ b/src/backend/cpu/CMakeLists.txt
@@ -102,19 +102,56 @@ ELSE(${UNIX}) #Windows
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
ENDIF()
-ADD_LIBRARY(afcpu SHARED
- ${cpu_headers}
- ${cpu_sources}
- ${backend_headers}
- ${backend_sources}
- ${c_headers}
- ${c_sources}
- ${cpp_sources})
-
-TARGET_LINK_LIBRARIES(afcpu PRIVATE ${FreeImage_LIBS}
+
+IF(DEFINED BLAS_SYM_FILE)
+ ADD_LIBRARY(afcpu_static STATIC
+ ${cpu_headers}
+ ${cpu_sources}
+ ${backend_headers}
+ ${backend_sources})
+
+ ADD_LIBRARY(afcpu SHARED
+ ${c_headers}
+ ${c_sources}
+ ${cpp_sources})
+
+ IF(FORGE_FOUND)
+ ADD_DEPENDENCIES(afcpu_static forge)
+ ENDIF()
+
+ IF(APPLE)
+ SET_TARGET_PROPERTIES(afcpu_static
+ PROPERTIES LINK_FLAGS -Wl,-exported_symbols_list,${BLAS_SYM_FILE})
+ TARGET_LINK_LIBRARIES(afcpu PUBLIC $<TARGET_FILE:afcpu_static>)
+ ELSE(APPLE)
+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/afcpu_static.renamed
+ COMMAND objcopy --redefine-syms ${BLAS_SYM_FILE} $<TARGET_FILE:afcpu_static> ${CMAKE_BINARY_DIR}/afcpu_static.renamed
+ DEPENDS $<TARGET_FILE:afcpu_static>)
+ TARGET_LINK_LIBRARIES(afcpu PUBLIC ${CMAKE_BINARY_DIR}/afcpu_static.renamed)
+ ENDIF(APPLE)
+
+ELSE(DEFINED BLAS_SYM_FILE)
+
+ ADD_LIBRARY(afcpu SHARED
+ ${cpu_headers}
+ ${cpu_sources}
+ ${backend_headers}
+ ${backend_sources}
+ ${c_headers}
+ ${c_sources}
+ ${cpp_sources})
+
+ENDIF(DEFINED BLAS_SYM_FILE)
+
+TARGET_LINK_LIBRARIES(afcpu
+ PRIVATE ${FreeImage_LIBS}
PRIVATE ${CBLAS_LIBRARIES}
PRIVATE ${FFTW_LIBRARIES})
+IF(FORGE_FOUND)
+ ADD_DEPENDENCIES(afcpu forge)
+ENDIF()
+
IF(LAPACK_FOUND)
TARGET_LINK_LIBRARIES(afcpu PRIVATE ${LAPACK_LIBRARIES})
ENDIF()
diff --git a/src/backend/opencl/CMakeLists.txt b/src/backend/opencl/CMakeLists.txt
index 95570d8..9b8576c 100644
--- a/src/backend/opencl/CMakeLists.txt
+++ b/src/backend/opencl/CMakeLists.txt
@@ -169,34 +169,79 @@ ELSE(${UNIX}) #Windows
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /bigobj")
ENDIF()
+IF(DEFINED BLAS_SYM_FILE)
+
+ ADD_LIBRARY(afopencl_static STATIC
+ ${opencl_headers}
+ ${opencl_sources}
+ ${jit_sources}
+ ${kernel_headers}
+ ${opencl_kernels}
+ ${kernel_sources}
+ ${conv_ker_headers}
+ ${conv_ker_sources}
+ ${backend_headers}
+ ${backend_sources}
+ ${magma_sources}
+ ${magma_headers})
+
+ ADD_LIBRARY(afopencl SHARED
+ ${c_headers}
+ ${c_sources}
+ ${cpp_sources})
+
+
+ IF(FORGE_FOUND)
+ ADD_DEPENDENCIES(afopencl_static forge)
+ ENDIF()
+
+ IF(APPLE)
+ SET_TARGET_PROPERTIES(afopencl_static
+ PROPERTIES LINK_FLAGS -Wl,-exported_symbols_list,${BLAS_SYM_FILE})
+ TARGET_LINK_LIBRARIES(afopencl PUBLIC $<TARGET_FILE:afopencl_static>)
+ ELSE(APPLE)
+ add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/afopencl_static.renamed
+ COMMAND objcopy --redefine-syms ${BLAS_SYM_FILE} $<TARGET_FILE:afopencl_static> ${CMAKE_BINARY_DIR}/afopencl_static.renamed
+ DEPENDS $<TARGET_FILE:afopencl_static>)
+ TARGET_LINK_LIBRARIES(afopencl PUBLIC ${CMAKE_BINARY_DIR}/afopencl_static.renamed)
+ ENDIF(APPLE)
+
+
+ELSE(DEFINED BLAS_SYM_FILE)
+
+ ADD_LIBRARY(afopencl SHARED
+ ${opencl_headers}
+ ${opencl_sources}
+ ${jit_sources}
+ ${kernel_headers}
+ ${opencl_kernels}
+ ${kernel_sources}
+ ${conv_ker_headers}
+ ${conv_ker_sources}
+ ${backend_headers}
+ ${backend_sources}
+ ${c_headers}
+ ${c_sources}
+ ${cpp_sources}
+ ${magma_sources}
+ ${magma_headers})
-ADD_LIBRARY(afopencl SHARED
- ${opencl_headers}
- ${opencl_sources}
- ${jit_sources}
- ${kernel_headers}
- ${opencl_kernels}
- ${kernel_sources}
- ${conv_ker_headers}
- ${conv_ker_sources}
- ${backend_headers}
- ${backend_sources}
- ${c_sources}
- ${c_headers}
- ${cpp_sources}
- ${magma_sources}
- ${magma_headers}
- )
+ENDIF()
ADD_DEPENDENCIES(afopencl ${cl_kernel_targets})
-TARGET_LINK_LIBRARIES(afopencl PRIVATE ${OpenCL_LIBRARIES}
+TARGET_LINK_LIBRARIES(afopencl
+ PRIVATE ${OpenCL_LIBRARIES}
PRIVATE ${FreeImage_LIBS}
PRIVATE ${CLBLAS_LIBRARIES}
PRIVATE ${CLFFT_LIBRARIES}
PRIVATE ${CMAKE_DL_LIBS}
PRIVATE ${Boost_LIBRARIES})
+IF(FORGE_FOUND)
+ ADD_DEPENDENCIES(afopencl forge)
+ENDIF()
+
IF(LAPACK_FOUND)
TARGET_LINK_LIBRARIES(afopencl PRIVATE ${LAPACK_LIBRARIES})
ENDIF()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git
More information about the debian-science-commits
mailing list