Skip to content

Commit a034e65

Browse files
Merge branch 'develop' into develop
2 parents 8c3386b + 1e3ada6 commit a034e65

File tree

410 files changed

+27260
-3001
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

410 files changed

+27260
-3001
lines changed

.travis.yml

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ dist: precise
44
sudo: true
55
language: c
66

7-
jobs:
7+
matrix:
88
include:
99
- &test-ubuntu
10-
stage: test
10+
os: linux
1111
compiler: gcc
1212
addons:
1313
apt:
@@ -57,7 +57,7 @@ jobs:
5757
- TARGET_BOX=LINUX32
5858
- BTYPE="BINARY=32"
5959

60-
- stage: test
60+
- os: linux
6161
compiler: gcc
6262
addons:
6363
apt:
@@ -77,13 +77,13 @@ jobs:
7777
# which is slower than container-based infrastructure used for jobs
7878
# that don't require sudo.
7979
- &test-alpine
80-
stage: test
80+
os: linux
8181
dist: trusty
8282
sudo: true
8383
language: minimal
8484
before_install:
85-
- "wget 'https://raw.githubusercontent.com/alpinelinux/alpine-chroot-install/v0.6.0/alpine-chroot-install' \
86-
&& echo 'a827a4ba3d0817e7c88bae17fe34e50204983d1e alpine-chroot-install' | sha1sum -c || exit 1"
85+
- "wget 'https://raw.githubusercontent.com/alpinelinux/alpine-chroot-install/v0.9.0/alpine-chroot-install' \
86+
&& echo 'e5dfbbdc0c4b3363b99334510976c86bfa6cb251 alpine-chroot-install' | sha1sum -c || exit 1"
8787
- alpine() { /alpine/enter-chroot -u "$USER" "$@"; }
8888
install:
8989
- sudo sh alpine-chroot-install -p 'build-base gfortran perl linux-headers'
@@ -117,10 +117,10 @@ jobs:
117117
- <<: *test-alpine
118118
env:
119119
- TARGET_BOX=LINUX64_MUSL
120-
- BTYPE="BINARY=64 NO_AFFINITY=1 USE_OPENMP=0 NO_LAPACK=0 TARGET=core2"
120+
- BTYPE="BINARY=64 NO_AFFINITY=1 USE_OPENMP=0 NO_LAPACK=0 TARGET=CORE2"
121121

122122
- &test-cmake
123-
stage: test
123+
os: linux
124124
compiler: clang
125125
addons:
126126
apt:
@@ -147,6 +147,58 @@ jobs:
147147
env:
148148
- CMAKE=1
149149

150+
- &test-macos
151+
os: osx
152+
osx_image: xcode8.3
153+
before_script:
154+
- COMMON_FLAGS="DYNAMIC_ARCH=1 TARGET=NEHALEM NUM_THREADS=32"
155+
- brew update
156+
- brew install gcc # for gfortran
157+
script:
158+
- travis_wait 45 make QUIET_MAKE=1 $COMMON_FLAGS $BTYPE
159+
env:
160+
- BTYPE="BINARY=64 INTERFACE64=1"
161+
162+
- <<: *test-macos
163+
env:
164+
- BTYPE="BINARY=32"
165+
166+
- &emulated-arm
167+
dist: trusty
168+
sudo: required
169+
services: docker
170+
env: IMAGE_ARCH=arm32 TARGET_ARCH=ARMV6 COMPILER=gcc
171+
name: "Emulated Build for ARMV6 with gcc"
172+
before_install: sudo docker run --rm --privileged multiarch/qemu-user-static:register --reset
173+
script: |
174+
echo "FROM openblas/alpine:${IMAGE_ARCH}
175+
COPY . /tmp/openblas
176+
RUN mkdir /tmp/openblas/build && \
177+
cd /tmp/openblas/build && \
178+
CC=${COMPILER} cmake -D DYNAMIC_ARCH=OFF \
179+
-D TARGET=${TARGET_ARCH} \
180+
-D BUILD_SHARED_LIBS=ON \
181+
-D BUILD_WITHOUT_LAPACK=ON \
182+
-D BUILD_WITHOUT_CBLAS=ON \
183+
-D CMAKE_BUILD_TYPE=Release ../ && \
184+
cmake --build ." > Dockerfile
185+
docker build .
186+
- <<: *emulated-arm
187+
env: IMAGE_ARCH=arm32 TARGET_ARCH=ARMV6 COMPILER=clang
188+
name: "Emulated Build for ARMV6 with clang"
189+
- <<: *emulated-arm
190+
env: IMAGE_ARCH=arm64 TARGET_ARCH=ARMV8 COMPILER=gcc
191+
name: "Emulated Build for ARMV8 with gcc"
192+
- <<: *emulated-arm
193+
env: IMAGE_ARCH=arm64 TARGET_ARCH=ARMV8 COMPILER=clang
194+
name: "Emulated Build for ARMV8 with clang"
195+
196+
allow_failures:
197+
- env: IMAGE_ARCH=arm32 TARGET_ARCH=ARMV6 COMPILER=gcc
198+
- env: IMAGE_ARCH=arm32 TARGET_ARCH=ARMV6 COMPILER=clang
199+
- env: IMAGE_ARCH=arm64 TARGET_ARCH=ARMV8 COMPILER=gcc
200+
- env: IMAGE_ARCH=arm64 TARGET_ARCH=ARMV8 COMPILER=clang
201+
150202
# whitelist
151203
branches:
152204
only:

CMakeLists.txt

Lines changed: 113 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,30 @@ cmake_minimum_required(VERSION 2.8.5)
66
project(OpenBLAS C ASM)
77
set(OpenBLAS_MAJOR_VERSION 0)
88
set(OpenBLAS_MINOR_VERSION 3)
9-
set(OpenBLAS_PATCH_VERSION 0.dev)
9+
set(OpenBLAS_PATCH_VERSION 6.dev)
1010
set(OpenBLAS_VERSION "${OpenBLAS_MAJOR_VERSION}.${OpenBLAS_MINOR_VERSION}.${OpenBLAS_PATCH_VERSION}")
1111

1212
# Adhere to GNU filesystem layout conventions
1313
include(GNUInstallDirs)
1414

15-
set(OpenBLAS_LIBNAME openblas)
15+
include(CMakePackageConfigHelpers)
16+
1617

1718
#######
1819
if(MSVC)
19-
option(BUILD_WITHOUT_LAPACK "Without LAPACK and LAPACKE (Only BLAS or CBLAS)" ON)
20+
option(BUILD_WITHOUT_LAPACK "Do not build LAPACK and LAPACKE (Only BLAS or CBLAS)" ON)
2021
endif()
21-
option(BUILD_WITHOUT_CBLAS "Without CBLAS" OFF)
22-
option(DYNAMIC_ARCH "Build with DYNAMIC_ARCH" OFF)
23-
option(BUILD_RELAPACK "Build with ReLAPACK (recursive LAPACK" OFF)
22+
option(BUILD_WITHOUT_CBLAS "Do not build the C interface (CBLAS) to the BLAS functions" OFF)
23+
option(DYNAMIC_ARCH "Include support for multiple CPU targets, with automatic selection at runtime (x86/x86_64 only)" OFF)
24+
option(DYNAMIC_OLDER "Include specific support for older cpu models (Penryn,Dunnington,Atom,Nano,Opteron) with DYNAMIC_ARCH" OFF)
25+
option(BUILD_RELAPACK "Build with ReLAPACK (recursive implementation of several LAPACK functions on top of standard LAPACK)" OFF)
26+
27+
# Add a prefix or suffix to all exported symbol names in the shared library.
28+
# Avoids conflicts with other BLAS libraries, especially when using
29+
# 64 bit integer interfaces in OpenBLAS.
30+
31+
set(SYMBOLPREFIX "" CACHE STRING "Add a prefix to all exported symbol names in the shared library to avoid conflicts with other BLAS libraries" )
32+
set(SYMBOLSUFFIX "" CACHE STRING "Add a suffix to all exported symbol names in the shared library, e.g. _64 for INTERFACE64 builds" )
2433
#######
2534
if(BUILD_WITHOUT_LAPACK)
2635
set(NO_LAPACK 1)
@@ -34,11 +43,13 @@ endif()
3443
#######
3544

3645

37-
message(WARNING "CMake support is experimental. This will not produce the same Makefiles that OpenBLAS ships with. Only x86 support is currently available.")
46+
message(WARNING "CMake support is experimental. It does not yet support all build options and may not produce the same Makefiles that OpenBLAS ships with.")
3847

3948
include("${PROJECT_SOURCE_DIR}/cmake/utils.cmake")
4049
include("${PROJECT_SOURCE_DIR}/cmake/system.cmake")
4150

51+
set(OpenBLAS_LIBNAME openblas${SUFFIX64_UNDERSCORE})
52+
4253
set(BLASDIRS interface driver/level2 driver/level3 driver/others)
4354

4455
if (NOT DYNAMIC_ARCH)
@@ -146,6 +157,7 @@ endif()
146157

147158
# add objects to the openblas lib
148159
add_library(${OpenBLAS_LIBNAME} ${LA_SOURCES} ${LAPACKE_SOURCES} ${RELA_SOURCES} ${TARGET_OBJS} ${OpenBLAS_DEF_FILE})
160+
target_include_directories(${OpenBLAS_LIBNAME} INTERFACE $<INSTALL_INTERFACE:include>)
149161

150162
# Android needs to explicitly link against libm
151163
if(ANDROID)
@@ -165,6 +177,7 @@ endif()
165177
# Set output for libopenblas
166178
set_target_properties( ${OpenBLAS_LIBNAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
167179
set_target_properties( ${OpenBLAS_LIBNAME} PROPERTIES LIBRARY_OUTPUT_NAME_DEBUG "${OpenBLAS_LIBNAME}_d")
180+
set_target_properties( ${OpenBLAS_LIBNAME} PROPERTIES EXPORT_NAME "OpenBLAS")
168181

169182
foreach (OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
170183
string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG )
@@ -204,14 +217,84 @@ set_target_properties(${OpenBLAS_LIBNAME} PROPERTIES
204217
SOVERSION ${OpenBLAS_MAJOR_VERSION}
205218
)
206219

220+
if (BUILD_SHARED_LIBS AND NOT ${SYMBOLPREFIX}${SYMBOLSUFIX} STREQUAL "")
221+
if (NOT DEFINED ARCH)
222+
set(ARCH_IN "x86_64")
223+
else()
224+
set(ARCH_IN ${ARCH})
225+
endif()
226+
227+
if (${CORE} STREQUAL "generic")
228+
set(ARCH_IN "GENERIC")
229+
endif ()
230+
231+
if (NOT DEFINED EXPRECISION)
232+
set(EXPRECISION_IN 0)
233+
else()
234+
set(EXPRECISION_IN ${EXPRECISION})
235+
endif()
236+
237+
if (NOT DEFINED NO_CBLAS)
238+
set(NO_CBLAS_IN 0)
239+
else()
240+
set(NO_CBLAS_IN ${NO_CBLAS})
241+
endif()
242+
243+
if (NOT DEFINED NO_LAPACK)
244+
set(NO_LAPACK_IN 0)
245+
else()
246+
set(NO_LAPACK_IN ${NO_LAPACK})
247+
endif()
248+
249+
if (NOT DEFINED NO_LAPACKE)
250+
set(NO_LAPACKE_IN 0)
251+
else()
252+
set(NO_LAPACKE_IN ${NO_LAPACKE})
253+
endif()
254+
255+
if (NOT DEFINED NEED2UNDERSCORES)
256+
set(NEED2UNDERSCORES_IN 0)
257+
else()
258+
set(NEED2UNDERSCORES_IN ${NEED2UNDERSCORES})
259+
endif()
260+
261+
if (NOT DEFINED ONLY_CBLAS)
262+
set(ONLY_CBLAS_IN 0)
263+
else()
264+
set(ONLY_CBLAS_IN ${ONLY_CBLAS})
265+
endif()
266+
267+
if (NOT DEFINED BU)
268+
set(BU _)
269+
endif()
270+
271+
if (NOT ${SYMBOLPREFIX} STREQUAL "")
272+
message(STATUS "adding prefix ${SYMBOLPREFIX} to names of exported symbols in ${OpenBLAS_LIBNAME}")
273+
endif()
274+
if (NOT ${SYMBOLSUFFIX} STREQUAL "")
275+
message(STATUS "adding suffix ${SYMBOLSUFFIX} to names of exported symbols in ${OpenBLAS_LIBNAME}")
276+
endif()
277+
add_custom_command(TARGET ${OpenBLAS_LIBNAME} POST_BUILD
278+
COMMAND perl ${PROJECT_SOURCE_DIR}/exports/gensymbol "objcopy" "${ARCH}" "${BU}" "${EXPRECISION_IN}" "${NO_CBLAS_IN}" "${NO_LAPACK_IN}" "${NO_LAPACKE_IN}" "${NEED2UNDERSCORES_IN}" "${ONLY_CBLAS_IN}" \"${SYMBOLPREFIX}\" \"${SYMBOLSUFFIX}\" "${BUILD_LAPACK_DEPRECATED}" > ${PROJECT_BINARY_DIR}/objcopy.def
279+
COMMAND objcopy -v --redefine-syms ${PROJECT_BINARY_DIR}/objcopy.def ${PROJECT_BINARY_DIR}/lib/lib${OpenBLAS_LIBNAME}.so
280+
COMMENT "renaming symbols"
281+
)
282+
endif()
283+
284+
207285
# Install project
208286
209287
# Install libraries
210288
install(TARGETS ${OpenBLAS_LIBNAME}
289+
EXPORT "OpenBLAS${SUFFIX64}Targets"
211290
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
212291
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
213292
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} )
214293
294+
# Install headers
295+
set(CMAKE_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR}/openblas${SUFFIX64})
296+
set(CMAKE_INSTALL_FULL_INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
297+
215298
message(STATUS "Generating openblas_config.h in ${CMAKE_INSTALL_INCLUDEDIR}")
216299
217300
set(OPENBLAS_CONFIG_H ${CMAKE_BINARY_DIR}/openblas_config.h)
@@ -259,11 +342,31 @@ if(NOT NO_LAPACKE)
259342
ADD_CUSTOM_TARGET(genlapacke
260343
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/lapack-netlib/LAPACKE/include/lapacke_mangling_with_flags.h.in "${CMAKE_BINARY_DIR}/lapacke_mangling.h"
261344
)
262-
install (FILES ${CMAKE_BINARY_DIR}/lapacke_mangling.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
345+
install (FILES ${CMAKE_BINARY_DIR}/lapacke_mangling.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/openblas${SUFFIX64})
263346
endif()
264347

265348
include(FindPkgConfig QUIET)
266349
if(PKG_CONFIG_FOUND)
267-
configure_file(${PROJECT_SOURCE_DIR}/cmake/openblas.pc.in ${PROJECT_BINARY_DIR}/openblas.pc @ONLY)
268-
install (FILES ${PROJECT_BINARY_DIR}/openblas.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/)
350+
configure_file(${PROJECT_SOURCE_DIR}/cmake/openblas.pc.in ${PROJECT_BINARY_DIR}/openblas${SUFFIX64}.pc @ONLY)
351+
install (FILES ${PROJECT_BINARY_DIR}/openblas${SUFFIX64}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig/)
269352
endif()
353+
354+
355+
# GNUInstallDirs "DATADIR" wrong here; CMake search path wants "share".
356+
set(PN OpenBLAS)
357+
set(CMAKECONFIG_INSTALL_DIR "share/cmake/${PN}${SUFFIX64}")
358+
configure_package_config_file(cmake/${PN}Config.cmake.in
359+
"${CMAKE_CURRENT_BINARY_DIR}/${PN}${SUFFIX64}Config.cmake"
360+
INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR})
361+
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PN}ConfigVersion.cmake
362+
VERSION ${${PN}_VERSION}
363+
COMPATIBILITY AnyNewerVersion)
364+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PN}${SUFFIX64}Config.cmake
365+
DESTINATION ${CMAKECONFIG_INSTALL_DIR})
366+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PN}ConfigVersion.cmake
367+
RENAME ${PN}${SUFFIX64}ConfigVersion.cmake
368+
DESTINATION ${CMAKECONFIG_INSTALL_DIR})
369+
install(EXPORT "${PN}${SUFFIX64}Targets"
370+
NAMESPACE "${PN}${SUFFIX64}::"
371+
DESTINATION ${CMAKECONFIG_INSTALL_DIR})
372+

0 commit comments

Comments
 (0)