Skip to content

Commit 0532c11

Browse files
authored
Merge pull request #182 from mattip/shrink4
cherry-pick changes to shrink wheel
2 parents 5a9e021 + 7058937 commit 0532c11

File tree

3 files changed

+31
-27
lines changed

3 files changed

+31
-27
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ build-backend = "setuptools.build_meta"
99
[project]
1010
name = "scipy-openblas64"
1111
# v0.3.28
12-
version = "0.3.28.0.1"
12+
version = "0.3.28.0.2"
1313
requires-python = ">=3.7"
1414
description = "Provides OpenBLAS for python packaging"
1515
readme = "README.md"

tools/build_steps.sh

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ function build_lib {
6363
# BUILD_PREFIX - install suffix e.g. "/usr/local"
6464
# GFORTRAN_DMG
6565
# MB_ML_VER
66-
echo running build_lib
6766
set -x
6867
local plat=${1:-$PLAT}
6968
local interface64=${2:-$INTERFACE64}
@@ -72,16 +71,13 @@ function build_lib {
7271
# Make directory to store built archive
7372
if [ -n "$IS_OSX" ]; then
7473
# Do build, add gfortran hash to end of name
75-
echo building on macox since IS_OSX is defined
7674
wrap_wheel_builder do_build_lib "$plat" "gf_${GFORTRAN_SHA:0:7}" "$interface64" "$nightly"
7775
return
7876
fi
7977
# Manylinux wrapper
8078
local libc=${MB_ML_LIBC:-manylinux}
8179
local docker_image=quay.io/pypa/${libc}${manylinux}_${plat}
82-
echo pulling image ${docker_image}
8380
docker pull $docker_image
84-
echo done pulling image, starting docker run
8581
# Docker sources this script, and runs `do_build_lib`
8682
docker run --rm \
8783
-e BUILD_PREFIX="$BUILD_PREFIX" \
@@ -93,7 +89,6 @@ function build_lib {
9389
-e MB_ML_LIBC=${libc} \
9490
-v $PWD:/io \
9591
$docker_image /io/tools/docker_build_wrap.sh
96-
echo done docker run of docker_build_wrap.sh
9792
}
9893

9994
function patch_source {
@@ -102,7 +97,7 @@ function patch_source {
10297
for f in $(ls ../patches); do
10398
echo applying patch $f
10499
git apply ../patches/$f
105-
done
100+
done
106101
}
107102

108103
function do_build_lib {
@@ -124,34 +119,34 @@ function do_build_lib {
124119
case $(get_os)-$plat in
125120
Linux-x86_64)
126121
local bitness=64
127-
local target_flags="TARGET=PRESCOTT"
122+
local target="PRESCOTT"
128123
local dynamic_list="PRESCOTT NEHALEM SANDYBRIDGE HASWELL SKYLAKEX"
129124
;;
130125
Darwin-x86_64)
131126
local bitness=64
132-
local target_flags="TARGET=CORE2"
127+
local target="CORE2"
133128
# Pick up the gfortran runtime libraries
134129
export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH
135130
;;
136131
*-i686)
137132
local bitness=32
138-
local target_flags="TARGET=PRESCOTT"
133+
local target="PRESCOTT"
139134
local dynamic_list="PRESCOTT NEHALEM SANDYBRIDGE HASWELL"
140135
;;
141136
Linux-aarch64)
142137
local bitness=64
143-
local target_flags="TARGET=ARMV8"
138+
local target="ARMV8"
144139
;;
145140
Darwin-arm64)
146141
local bitness=64
147-
local target_flags="TARGET=VORTEX"
142+
local target="VORTEX"
148143
;;
149144
*-s390x)
150145
local bitness=64
151146
;;
152147
*-ppc64le)
153148
local bitness=64
154-
local target_flags="TARGET=POWER8"
149+
local target="POWER8"
155150
;;
156151
*) echo "Strange plat value $plat"; exit 1 ;;
157152
esac
@@ -176,21 +171,19 @@ function do_build_lib {
176171
patch_source
177172
echo start building
178173
if [ -v dynamic_list ]; then
179-
CFLAGS="$CFLAGS -fvisibility=protected -Wno-uninitialized -fno-ident" \
180-
make BUFFERSIZE=20 DYNAMIC_ARCH=1 \
174+
CFLAGS="$CFLAGS -fvisibility=protected -Wno-uninitialized" \
175+
make BUFFERSIZE=20 DYNAMIC_ARCH=1 QUIET_MAKE=1 \
181176
USE_OPENMP=0 NUM_THREADS=64 \
182177
DYNAMIC_LIST="$dynamic_list" \
183-
BINARY=$bitness $interface_flags $target_flags shared 2>&1 1>/dev/null
178+
BINARY="$bitness" $interface_flags \
179+
TARGET="$target"
184180
else
185-
CFLAGS="$CFLAGS -fvisibility=protected -Wno-uninitialized -fno-ident" \
186-
make BUFFERSIZE=20 DYNAMIC_ARCH=1 \
181+
CFLAGS="$CFLAGS -fvisibility=protected -Wno-uninitialized" \
182+
make BUFFERSIZE=20 DYNAMIC_ARCH=1 QUIET_MAKE=1 \
187183
USE_OPENMP=0 NUM_THREADS=64 \
188-
BINARY=$bitness $interface_flags $target_flags shared 2>&1 1>/dev/null
184+
BINARY="$bitness" $interface_flags \
185+
TARGET="$target"
189186
fi
190-
echo done building, now testing
191-
make BUFFERSIZE=20 DYNAMIC_ARCH=1 \
192-
USE_OPENMP=0 NUM_THREADS=64 \
193-
BINARY=$bitness $interface_flags $target_flags tests
194187
make PREFIX=$BUILD_PREFIX $interface_flags install
195188
popd
196189
if [ "$nightly" = "1" ]; then

tools/download-wheels.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def get_wheel_names(package, version):
6363
return soup.find_all(string=tmpl)
6464

6565

66-
def download_wheels(package, version, wheelhouse):
66+
def download_wheels(package, version, wheelhouse, test=False):
6767
"""Download release wheels.
6868
6969
The release wheels for the given package version are downloaded
@@ -87,8 +87,15 @@ def download_wheels(package, version, wheelhouse):
8787
wheel_path = os.path.join(wheelhouse, wheel_name)
8888
with open(wheel_path, "wb") as f:
8989
with http.request("GET", wheel_url, preload_content=False,) as r:
90-
print(f"{i + 1:<4}{wheel_name}")
91-
shutil.copyfileobj(r, f)
90+
info = r.info()
91+
length = int(info.get('Content-Length', '0'))
92+
if length == 0:
93+
length = 'unknown size'
94+
else:
95+
length = f"{(length / 1024 / 1024):.2f}MB"
96+
print(f"{i + 1:<4}{wheel_name} {length}")
97+
if not test:
98+
shutil.copyfileobj(r, f)
9299
print(f"\nTotal files downloaded: {len(wheel_names)}")
93100

94101

@@ -107,6 +114,10 @@ def download_wheels(package, version, wheelhouse):
107114
default=os.path.join(os.getcwd(), "release", "installers"),
108115
help="Directory in which to store downloaded wheels\n"
109116
"[defaults to <cwd>/release/installers]")
117+
parser.add_argument(
118+
"-t", "--test",
119+
action = 'store_true',
120+
help="only list available wheels, do not download")
110121

111122
args = parser.parse_args()
112123

@@ -116,4 +127,4 @@ def download_wheels(package, version, wheelhouse):
116127
f"{wheelhouse} wheelhouse directory is not present."
117128
" Perhaps you need to use the '-w' flag to specify one.")
118129

119-
download_wheels(args.package, args.version, wheelhouse)
130+
download_wheels(args.package, args.version, wheelhouse, test=args.test)

0 commit comments

Comments
 (0)