Skip to content

Commit aacba21

Browse files
authored
Merge pull request #125 from mattip/prefix
Add symbolprefix=scipy
2 parents 80fcba3 + 3053c45 commit aacba21

File tree

13 files changed

+76
-69
lines changed

13 files changed

+76
-69
lines changed

.github/workflows/posix.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
INTERFACE64: '1'
4747
env:
4848
REPO_DIR: OpenBLAS
49-
OPENBLAS_COMMIT: "c2f4bdb"
49+
OPENBLAS_COMMIT: "9d425a5f"
5050
NIGHTLY: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}
5151
MACOSX_DEPLOYMENT_TARGET: 10.9
5252
MB_PYTHON_VERSION: ${{ matrix.python-version }}
@@ -68,17 +68,15 @@ jobs:
6868
python-version: 3.7
6969
- name: Set extra env
7070
run: |
71-
if [ "macos-11" == "${{ matrix.os }}" ]; then
72-
echo "TRAVIS_OS_NAME=osx" >> $GITHUB_ENV;
73-
echo "LDFLAGS=-L/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/lib" >> $GITHUB_ENV;
74-
echo "LIBRARY_PATH=-L/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/lib" >> $GITHUB_ENV;
75-
else
76-
echo "TRAVIS_OS_NAME=${{ matrix.os }}" >> $GITHUB_ENV;
77-
fi
71+
# if [ "macos-11" == "${{ matrix.os }}" ]; then
72+
# Use xcrun --sdk macosx --show-sdk-path instead of hardcoding the path
73+
# echo "LDFLAGS=-L/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/lib" >> $GITHUB_ENV;
74+
# echo "LIBRARY_PATH=-L/Library/Developer/CommandLineTools/SDKs/MacOSX12.1.sdk/usr/lib" >> $GITHUB_ENV;
75+
# else
76+
# fi
7877
echo "DOCKER_TEST_IMAGE=$(echo multibuild/xenial_${{ matrix.PLAT}})" >> $GITHUB_ENV;
7978
- name: Print some Environment variable
8079
run: |
81-
echo "TRAVIS_OS_NAME: ${TRAVIS_OS_NAME}"
8280
echo "PLAT: ${PLAT}"
8381
echo "DOCKER_TEST_IMAGE: ${DOCKER_TEST_IMAGE}"
8482
- name: Install VirtualEnv
@@ -115,7 +113,7 @@ jobs:
115113
version=$(cd OpenBLAS && git describe --tags --abbrev=8 | sed -e "s/^v\(.*\)-g.*/\1/" | sed -e "s/-/./g")
116114
sed -e "s/^version = .*/version = \"${version}\"/" -i.bak pyproject.toml
117115
fi
118-
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
116+
if [ "macos-11" == "${{ matrix.os }}" ]; then
119117
source tools/build_wheel.sh
120118
else
121119
libc=${MB_ML_LIBC:-manylinux}

.github/workflows/windows.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
branches: [ main ]
88

99
env:
10-
OPENBLAS_COMMIT: "c2f4bdb"
10+
OPENBLAS_COMMIT: "9d425a5f"
1111
OPENBLAS_ROOT: "c:\\opt"
1212
# Preserve working directory for calls into bash
1313
# Without this, invoking bash will cd to the home directory
@@ -32,7 +32,7 @@ jobs:
3232
- name: install-rtools
3333
run: |
3434
# rtools 42+ does not support 32 bits builds.
35-
choco install -y rtools --noprogress --force --version=4.0.0.20220206
35+
choco install -y rtools --no-progress --force --version=4.0.0.20220206
3636
3737
- name: Set env variables
3838
run: |
@@ -94,7 +94,7 @@ jobs:
9494
fi
9595
mv local/scipy_openblas64/bin/*.dll local/scipy_openblas64/lib
9696
rm local/scipy_openblas64/lib/*.a
97-
rm local/scipy_openblas64/lib/*.exp
97+
rm -f local/scipy_openblas64/lib/*.exp # may not exist?
9898
rm local/scipy_openblas64/lib/*.def
9999
rm -rf local/scipy_openblas64/lib/pkgconfig
100100
if [[ -d local/scipy_openblas64/64 ]]; then
@@ -109,7 +109,7 @@ jobs:
109109
# of a pyproject.toml project
110110
sed -e "s/openblas64/openblas32/" -i pyproject.toml
111111
sed -e "s/openblas_get_config64_/openblas_get_config/" -i local/scipy_openblas32/__init__.py
112-
sed -e "s/cflags_suffix64 =.*/cflags_suffix64 = ''/" -i local/scipy_openblas32/__init__.py
112+
sed -e "s/cflags =.*/cflags = '-DBLAS_SYMBOL_PREFIX=scipy_'/" -i local/scipy_openblas32/__init__.py
113113
sed -e "s/openblas64/openblas32/" -i local/scipy_openblas32/__init__.py
114114
sed -e "s/openblas64/openblas32/" -i local/scipy_openblas32/__main__.py
115115
fi

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ env:
22
global:
33
# The archive that gets built has name from ``git describe`` on this
44
# commit.
5-
- OPENBLAS_COMMIT="c2f4bdb"
5+
- OPENBLAS_COMMIT="9d425a5f"
66
- REPO_DIR=OpenBLAS
77
# Following generated with:
88
# travis encrypt -r MacPython/openblas-libs OPENBLAS_LIBS_STAGING_UPLOAD_TOKEN=<secret token value>

OpenBLAS

local/scipy_openblas64/__init__.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ def get_library():
4949
libs = [x for x in os.listdir(get_lib_dir()) if x.endswith(".lib")]
5050
return os.path.splitext(libs[0])[0]
5151
else:
52-
return "openblas_python"
52+
libs = [x for x in os.listdir(get_lib_dir()) if x.startswith("libscipy_openblas")]
53+
# remove the leading lib from libscipy_openblas*
54+
return os.path.splitext(libs[0])[0][3:]
5355

5456
def get_pkg_config():
5557
"""Return a multi-line string that, when saved to a file, can be used with
@@ -59,9 +61,9 @@ def get_pkg_config():
5961
extralib = "-defaultlib:advapi32 -lgfortran -lquadmath"
6062
libs_flags = f"-L${{libdir}} -l{get_library()}"
6163
else:
62-
extralib = "-lm -lpthread -lgfortran -lquadmath -L${libdir} -lopenblas_python"
64+
extralib = "-lm -lpthread -lgfortran -lquadmath -L${libdir} -l{get_library()}"
6365
libs_flags = ""
64-
cflags_suffix64 = "-DBLAS_SYMBOL_SUFFIX=64_ -DHAVE_BLAS_ILP64"
66+
cflags = "-DBLAS_SYMBOL_PREFIX=scipy_ -DBLAS_SYMBOL_SUFFIX=64_ -DHAVE_BLAS_ILP64 -DOPENBLAS_ILP64_NAMING_SCHEME"
6567
return dedent(f"""\
6668
libdir={get_lib_dir()}
6769
includedir={get_include_dir()}
@@ -74,7 +76,7 @@ def get_pkg_config():
7476
URL: https://github.com/xianyi/OpenBLAS
7577
Libs: {libs_flags}
7678
Libs.private: ${{extralib}}
77-
Cflags: -I${{includedir}} {cflags_suffix64}
79+
Cflags: -I${{includedir}} {cflags}
7880
""")
7981

8082

@@ -109,10 +111,10 @@ def get_openblas_config():
109111
libnames = [x for x in os.listdir(lib_dir) if x.endswith(".dll")]
110112
else:
111113
# Get openblas*
112-
libnames = [x for x in os.listdir(lib_dir) if x.startswith("libopenblas")]
114+
libnames = [x for x in os.listdir(lib_dir) if x.startswith("libscipy")]
113115

114116
dll = ctypes.CDLL(os.path.join(lib_dir, libnames[0]), ctypes.RTLD_GLOBAL)
115-
openblas_config = dll.openblas_get_config64_
117+
openblas_config = dll.scipy_openblas_get_config64_
116118
openblas_config.restype = ctypes.c_char_p
117119
bytes = openblas_config()
118120
return bytes.decode("utf8")

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ build-backend = "setuptools.build_meta"
88

99
[project]
1010
name = "scipy_openblas64"
11-
version = "0.3.23.293.2"
11+
version = "0.3.24.95.0"
1212
requires-python = ">=3.7"
1313
description = "Provides OpenBLAS for python packaging"
1414
readme = "README.md"

test.f90

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
!testdpotr_test_gh_2691.f90
1+
!testdpotr_test_gh_2691.f90 with scipy_ prefix
22
subroutine garbage(okflag)
33
implicit none
44
integer, intent(out) :: okflag
@@ -23,7 +23,7 @@ subroutine garbage(okflag)
2323

2424
a2 = a
2525

26-
call dpotrf('L', 3, a, 3, info)
26+
call scipy_dpotrf('L', 3, a, 3, info)
2727
if (info.ne.0) then
2828
okflag = 0
2929
write(*,*) 'DPOTRF failed'
@@ -39,20 +39,20 @@ subroutine garbage(okflag)
3939
a(i,j) = 0
4040
end do
4141
end do
42-
call dpotri('L', 3, a, 3, info)
42+
call scipy_dpotri('L', 3, a, 3, info)
4343
if (info.ne.0) then
4444
okflag = 0
4545
write(*,*) 'DPOTRI failed'
4646
return
4747
end if
4848

49-
call dgetrf(3, 3, a2, 3, ipiv, info)
49+
call scipy_dgetrf(3, 3, a2, 3, ipiv, info)
5050
if (info.ne.0) then
5151
okflag = 0
5252
write(*,*) 'DGETRF failed'
5353
return
5454
end if
55-
call dgetri(3, a2, 3, ipiv, work, lwork, info)
55+
call scipy_dgetri(3, a2, 3, ipiv, work, lwork, info)
5656
if (info.ne.0) then
5757
okflag = 0
5858
write(*,*) 'DGETRI failed'

test64_.f90

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
!testdpotr_test_gh_2691.f90 with _64 suffix
1+
!testdpotr_test_gh_2691.f90 with _64 suffix and scipy_ prefix
22
subroutine garbage(okflag)
33
implicit none
44
integer, intent(out) :: okflag
@@ -23,7 +23,7 @@ subroutine garbage(okflag)
2323

2424
a2 = a
2525

26-
call dpotrf_64('L', 3, a, 3, info)
26+
call scipy_dpotrf_64('L', 3, a, 3, info)
2727
if (info.ne.0) then
2828
okflag = 0
2929
write(*,*) 'DPOTRF failed'
@@ -39,20 +39,20 @@ subroutine garbage(okflag)
3939
a(i,j) = 0
4040
end do
4141
end do
42-
call dpotri_64('L', 3, a, 3, info)
42+
call scipy_dpotri_64('L', 3, a, 3, info)
4343
if (info.ne.0) then
4444
okflag = 0
4545
write(*,*) 'DPOTRI failed'
4646
return
4747
end if
4848

49-
call dgetrf_64(3, 3, a2, 3, ipiv, info)
49+
call scipy_dgetrf_64(3, 3, a2, 3, ipiv, info)
5050
if (info.ne.0) then
5151
okflag = 0
5252
write(*,*) 'DGETRF failed'
5353
return
5454
end if
55-
call dgetri_64(3, a2, 3, ipiv, work, lwork, info)
55+
call scipy_dgetri_64(3, a2, 3, ipiv, work, lwork, info)
5656
if (info.ne.0) then
5757
okflag = 0
5858
write(*,*) 'DGETRI failed'

tools/build_gfortran.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Build gfortran binary against OpenBLAS
22

3-
set -e
3+
set -ex
44

55
rm -rf for_test
66
mkdir for_test
@@ -13,6 +13,9 @@ static_libname=$(find $OBP/lib -maxdepth 1 -type f -name '*.a' \! -name '*.dll.a
1313
dynamic_libname=$(find $OBP/lib -maxdepth 1 -type f -name '*.dll.a' | tail -1)
1414
dll_name=$(echo $dynamic_libname | sed 's#/lib/#/bin/#' | sed 's/.a$//')
1515

16+
grep dpotrf $OBP/include/*
17+
nm $static_libname | grep dpotrf
18+
1619
cp $dll_name .
1720

1821
if [ "$INTERFACE64" == "1" ]; then

0 commit comments

Comments
 (0)