Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenBLAS v0.3.28 #178

Merged
merged 3 commits into from
Aug 11, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/posix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

env:
REPO_DIR: OpenBLAS
OPENBLAS_COMMIT: "d11e7340"
OPENBLAS_COMMIT: "v0.3.28"
MACOSX_DEPLOYMENT_TARGET: 10.9

jobs:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
workflow_dispatch: null

env:
OPENBLAS_COMMIT: "d11e7340"
OPENBLAS_COMMIT: "v0.3.28"
OPENBLAS_ROOT: "c:\\opt"
# Preserve working directory for calls into bash
# Without this, invoking bash will cd to the home directory
Expand Down Expand Up @@ -45,13 +45,14 @@ jobs:
echo "PLAT=i686" >> $env:GITHUB_ENV
echo "WHEEL_PLAT=win32" >> $env:GITHUB_ENV
echo "MSYSTEM=MINGW32" >> $env:GITHUB_ENV
echo "LDFLAGS=-static -static-libgcc" >> $env:GITHUB_ENV
# No ucrt on 32-bits, so use _snprintf_c instead
echo "LDFLAGS=-static -static-libgcc -Wl,--defsym,_quadmath_snprintf=__snprintf_c" >> $env:GITHUB_ENV
echo "BUILD_BITS=32" >> $env:GITHUB_ENV
} else {
echo "PLAT=x86_64" >> $env:GITHUB_ENV
echo "WHEEL_PLAT=win_amd64" >> $env:GITHUB_ENV
echo "MSYSTEM=UCRT64" >> $env:GITHUB_ENV
echo "LDFLAGS=-lucrt -static -static-libgcc" >> $env:GITHUB_ENV
echo "LDFLAGS=-lucrt -static -static-libgcc -Wl,--defsym,quadmath_snprintf=snprintf" >> $env:GITHUB_ENV
echo "BUILD_BITS=64" >> $env:GITHUB_ENV
}
if ( ${{ matrix.INTERFACE64 }} -eq "1" ) {
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ env:
global:
# The archive that gets built has name from ``git describe`` on this
# commit.
- OPENBLAS_COMMIT: "d11e7340"
- OPENBLAS_COMMIT: "v0.3.28"
- REPO_DIR=OpenBLAS

sudo: required
Expand Down
15 changes: 15 additions & 0 deletions patches-windows/openblas-make-libs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/exports/Makefile b/exports/Makefile
index 668a4866e..956b51bf4 100644
--- a/exports/Makefile
+++ b/exports/Makefile
@@ -126,8 +126,9 @@ dll : ../$(LIBDLLNAME)
../$(LIBDLLNAME) : ../$(LIBNAME) $(LIBPREFIX).def dllinit.$(SUFFIX)
$(RANLIB) ../$(LIBNAME)
$(CC) $(CFLAGS) $(LDFLAGS) $(LIBPREFIX).def dllinit.$(SUFFIX) \
- -shared -o ../$(LIBDLLNAME) -Wl,--out-implib,../$(IMPLIBNAME) \
+ -shared -o ../$(LIBDLLNAME) -Wl,-gc-sections -Wl,-s -Wl,-Map,output.map \
-Wl,--whole-archive ../$(LIBNAME) -Wl,--no-whole-archive $(FEXTRALIB) $(EXTRALIB)
+ dlltool -D $(LIBDLLNAME) -d $(LIBPREFIX).def -l ../$(LIBDLLNAME).a

$(LIBPREFIX).def : $(GENSYM)
./$(GENSYM) win2k $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) "$(SYMBOLPREFIX)" "$(SYMBOLSUFFIX)" $(BUILD_LAPACK_DEPRECATED) $(BUILD_BFLOAT16) $(BUILD_SINGLE) $(BUILD_DOUBLE) $(BUILD_COMPLEX) $(BUILD_COMPLEX16) > $(@F)
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ build-backend = "setuptools.build_meta"

[project]
name = "scipy-openblas64"
# v0.3.27-350-gd11e7340
version = "0.3.27.350.0"
# v0.3.28
version = "0.3.28.0.0"
requires-python = ">=3.7"
description = "Provides OpenBLAS for python packaging"
readme = "README.md"
Expand Down
4 changes: 2 additions & 2 deletions tools/LICENSE_linux.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This binary distribution of NumPy also bundles the following software:


Name: OpenBLAS
Files: numpy.libs/libopenblas*.so
Files: numpy.libs/libscipy_openblas*.so
Description: bundled as a dynamically linked library
Availability: https://github.com/OpenMathLib/OpenBLAS/
License: BSD-3-Clause-Attribution
Expand Down Expand Up @@ -41,7 +41,7 @@ License: BSD-3-Clause-Attribution


Name: LAPACK
Files: numpy.libs/libopenblas*.so
Files: numpy.libs/libscipy_openblas*.so
Description: bundled in OpenBLAS
Availability: https://github.com/OpenMathLib/OpenBLAS/
License: BSD-3-Clause-Attribution
Expand Down
4 changes: 2 additions & 2 deletions tools/LICENSE_osx.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
This binary distribution of NumPy also bundles the following software:

Name: OpenBLAS
Files: numpy/.dylibs/libopenblas*.so
Files: numpy/.dylibs/libscipy_openblas*.so
Description: bundled as a dynamically linked library
Availability: https://github.com/OpenMathLib/OpenBLAS/
License: BSD-3-Clause-Attribution
Expand Down Expand Up @@ -40,7 +40,7 @@ License: BSD-3-Clause-Attribution


Name: LAPACK
Files: numpy/.dylibs/libopenblas*.so
Files: numpy/.dylibs/libscipy_openblas*.so
Description: bundled in OpenBLAS
Availability: https://github.com/OpenMathLib/OpenBLAS/
License: BSD-3-Clause-Attribution
Expand Down
28 changes: 3 additions & 25 deletions tools/LICENSE_win32.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This binary distribution of NumPy also bundles the following software:


Name: OpenBLAS
Files: numpy.libs\libopenblas*.dll
Files: libs/libscipy_openblas*.dll
Description: bundled as a dynamically linked library
Availability: https://github.com/OpenMathLib/OpenBLAS/
License: BSD-3-Clause-Attribution
Expand Down Expand Up @@ -41,7 +41,7 @@ License: BSD-3-Clause-Attribution


Name: LAPACK
Files: numpy.libs\libopenblas*.dll
Files: libs/libscipy_openblas*.dll
Description: bundled in OpenBLAS
Availability: https://github.com/OpenMathLib/OpenBLAS/
License: BSD-3-Clause-Attribution
Expand Down Expand Up @@ -96,7 +96,7 @@ License: BSD-3-Clause-Attribution


Name: GCC runtime library
Files: numpy.libs\libopenblas*.dll
Files: libs/libscipy_openblas*.dll
Description: statically linked to files compiled with gcc
Availability: https://gcc.gnu.org/git/?p=gcc.git;a=tree;f=libgfortran
License: GPL-3.0-with-GCC-exception
Expand Down Expand Up @@ -878,25 +878,3 @@ may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

Name: libquadmath
Files: numpy.libs\libopenb*.dll
Description: statically linked to files compiled with gcc
Availability: https://gcc.gnu.org/git/?p=gcc.git;a=tree;f=libquadmath
License: LGPL-2.1-or-later

GCC Quad-Precision Math Library
Copyright (C) 2010-2019 Free Software Foundation, Inc.
Written by Francois-Xavier Coudert <[email protected]>

This file is part of the libquadmath library.
Libquadmath is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

Libquadmath is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
51 changes: 39 additions & 12 deletions tools/build_openblas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fflags="$fextra $cflags -frecursive -ffpe-summary=invalid,zero"

# Set suffixed-ILP64 flags
if [ "$if_bits" == "64" ]; then
SYMBOLSUFFIX="64_"
LIBNAMESUFFIX="64_"
interface_flags="INTERFACE64=1 SYMBOLSUFFIX=64_ LIBNAMESUFFIX=64_"
# We override FCOMMON_OPT, so we need to set default integer manually
fflags="$fflags -fdefault-integer-8"
Expand All @@ -90,8 +90,13 @@ interface_flags="$interface_flags SYMBOLPREFIX=scipy_ LIBNAMEPREFIX=scipy_ FIXED
# Build name for output library from gcc version and OpenBLAS commit.
GCC_TAG="gcc_$(gcc -dumpversion | tr .- _)"
OPENBLAS_VERSION=$(git describe --tags --abbrev=8)

# Patch OpenBLAS build to resolve all symbols and avoid linking
# with libquadmath
patch -p1 < ../patches-windows/openblas-make-libs.patch

# Build OpenBLAS
# Variable used in creating output libraries
CFLAGS="$CFLAGS -fvisibility=protected -fno-ident" \
make BINARY=$build_bits DYNAMIC_ARCH=1 USE_THREAD=1 USE_OPENMP=0 \
NUM_THREADS=24 NO_WARMUP=1 NO_AFFINITY=1 CONSISTENT_FPCSR=1 \
BUILD_LAPACK_DEPRECATED=1 TARGET=PRESCOTT BUFFERSIZE=20\
Expand All @@ -100,8 +105,38 @@ make BINARY=$build_bits DYNAMIC_ARCH=1 USE_THREAD=1 USE_OPENMP=0 \
FCOMMON_OPT="$fflags" \
MAX_STACK_ALLOC=2048 \
$interface_flags

# Make sure quadmath library is not statically linked in to the DLL by checking
# the output.map generated by the linker when using `-Wl,-gc-sections -Wl,-s`
# the map will have libname(o-filename) for each function pulled out of the
# library libname
# The file itself appears in the map, so look for "libquadmath.a(". Use '-A 3'
# to show a bit of context if any symbols appear (which should not happen)
set +e
grep -A 2 "libquadmath.a(" exports/output.map
case $? in
0)
echo "link uses libquadmath.a when it should not"
exit -1
;;
1)
if [ -f exports/output.map ]; then
echo "Good, verified no 'libquadmath' used when linking"
else
echo "error occurred"
exit -1
fi
;;
*)
echo "grep returned $?, error occurred"
exit -1
;;
esac
set -e

make PREFIX=$openblas_root/$build_bits $interface_flags install
DLL_BASENAME=libscipy_openblas${SYMBOLSUFFIX}${LIBNAMESUFFIX}
DLL_BASENAME=libscipy_openblas${LIBNAMESUFFIX}
cp -f *.dll.a $openblas_root/$build_bits/lib/${DLL_BASENAME}.dll.a

# OpenBLAS does not build a symbol-suffixed static library on Windows:
# do it ourselves. On 32-bit builds, the objcopy.def names need a '_' prefix
Expand Down Expand Up @@ -143,16 +178,8 @@ else
sed -e "s/^Cflags.*/\0 -DBLAS_SYMBOL_PREFIX=scipy_/" -i pkgconfig/scipy-openblas.pc
fi
popd
# Build template site.cfg for using this build
cat > ${build_bits}/site.cfg.template << EOF
[openblas${SYMBOLSUFFIX}]
libraries = $DLL_BASENAME
library_dirs = {openblas_root}\\${build_bits}\\lib
include_dirs = {openblas_root}\\${build_bits}\\include
EOF

ls $openblas_root/$build_bits/lib

zip_name="openblas${SYMBOLSUFFIX}-${OPENBLAS_VERSION}-${plat_tag}-${GCC_TAG}.zip"
zip_name="openblas${LIBNAMESUFFIX}-${OPENBLAS_VERSION}-${plat_tag}-${GCC_TAG}.zip"
zip -r $zip_name $build_bits
cp $zip_name ${builds_dir}
4 changes: 2 additions & 2 deletions tools/build_steps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,13 @@ function do_build_lib {
patch_source
echo start building
if [ -v dynamic_list ]; then
CFLAGS="$CFLAGS -fvisibility=protected -Wno-uninitialized" \
CFLAGS="$CFLAGS -fvisibility=protected -Wno-uninitialized -fno-ident" \
make BUFFERSIZE=20 DYNAMIC_ARCH=1 \
USE_OPENMP=0 NUM_THREADS=64 \
DYNAMIC_LIST="$dynamic_list" \
BINARY=$bitness $interface_flags $target_flags shared 2>&1 1>/dev/null
else
CFLAGS="$CFLAGS -fvisibility=protected -Wno-uninitialized" \
CFLAGS="$CFLAGS -fvisibility=protected -Wno-uninitialized -fno-ident" \
make BUFFERSIZE=20 DYNAMIC_ARCH=1 \
USE_OPENMP=0 NUM_THREADS=64 \
BINARY=$bitness $interface_flags $target_flags shared 2>&1 1>/dev/null
Expand Down
Loading