Skip to content

Commit e77a9c1

Browse files
committed
test cmake build for linux+x64
Co-authored by: nijincheng@iscas.ac.cn;
1 parent 202309a commit e77a9c1

File tree

7 files changed

+105
-46
lines changed

7 files changed

+105
-46
lines changed

.github/workflows/posix.yml

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ name: posix
22

33
on:
44
push:
5-
branches: [ main ]
6-
pull_request:
7-
branches:
8-
- main
9-
- maintenance/**
10-
workflow_dispatch: null
11-
schedule:
12-
- cron: '0 0 * * 0'
5+
# branches: [ main ]
6+
# pull_request:
7+
# branches: [ main ]
8+
# workflow_dispatch: null
9+
# schedule:
10+
# - cron: '0 0 * * 0'
1311

1412
env:
1513
OPENBLAS_COMMIT: "v0.3.30-359-g29fab2b9"
@@ -24,25 +22,25 @@ jobs:
2422
fail-fast: false
2523
matrix:
2624
include:
27-
- { os: ubuntu-latest, PLAT: i686, INTERFACE64: '0', MB_ML_VER: '2014', MB_ML_LIBC: manylinux}
25+
# - { os: ubuntu-latest, PLAT: i686, INTERFACE64: '0', MB_ML_VER: '2014', MB_ML_LIBC: manylinux}
2826

29-
- { os: ubuntu-latest, PLAT: x86_64, INTERFACE64: '0', MB_ML_VER: '2014', MB_ML_LIBC: manylinux}
27+
# - { os: ubuntu-latest, PLAT: x86_64, INTERFACE64: '0', MB_ML_VER: '2014', MB_ML_LIBC: manylinux}
3028
- { os: ubuntu-latest, PLAT: x86_64, INTERFACE64: '1', MB_ML_VER: '2014', MB_ML_LIBC: manylinux}
3129

32-
- { os: macos-14, PLAT: x86_64, INTERFACE64: '0', MB_ML_LIBC: macosx}
33-
- { os: macos-14, PLAT: x86_64, INTERFACE64: '1', MB_ML_LIBC: macosx}
30+
# - { os: macos-14, PLAT: x86_64, INTERFACE64: '0', MB_ML_LIBC: macosx}
31+
# - { os: macos-14, PLAT: x86_64, INTERFACE64: '1', MB_ML_LIBC: macosx}
3432

35-
- { os: macos-latest, PLAT: arm64, INTERFACE64: '0', MB_ML_LIBC: macosx}
36-
- { os: macos-latest, PLAT: arm64, INTERFACE64: '1', MB_ML_LIBC: macosx}
33+
# - { os: macos-latest, PLAT: arm64, INTERFACE64: '0', MB_ML_LIBC: macosx}
34+
# - { os: macos-latest, PLAT: arm64, INTERFACE64: '1', MB_ML_LIBC: macosx}
3735

38-
- { os: ubuntu-latest, PLAT: x86_64, INTERFACE64: '0', MB_ML_VER: '_1_2', MB_ML_LIBC: musllinux}
39-
- { os: ubuntu-latest, PLAT: x86_64, INTERFACE64: '1', MB_ML_VER: '_1_2', MB_ML_LIBC: musllinux}
36+
# - { os: ubuntu-latest, PLAT: x86_64, INTERFACE64: '0', MB_ML_VER: '_1_2', MB_ML_LIBC: musllinux}
37+
# - { os: ubuntu-latest, PLAT: x86_64, INTERFACE64: '1', MB_ML_VER: '_1_2', MB_ML_LIBC: musllinux}
4038

41-
- { os: ubuntu-24.04-arm, PLAT: aarch64, INTERFACE64: '0', MB_ML_VER: '2014', MB_ML_LIBC: manylinux}
42-
- { os: ubuntu-24.04-arm, PLAT: aarch64, INTERFACE64: '1', MB_ML_VER: '2014', MB_ML_LIBC: manylinux}
39+
# - { os: ubuntu-24.04-arm, PLAT: aarch64, INTERFACE64: '0', MB_ML_VER: '2014', MB_ML_LIBC: manylinux}
40+
# - { os: ubuntu-24.04-arm, PLAT: aarch64, INTERFACE64: '1', MB_ML_VER: '2014', MB_ML_LIBC: manylinux}
4341

44-
- { os: ubuntu-24.04-arm, PLAT: aarch64, INTERFACE64: '0', MB_ML_VER: '_1_2', MB_ML_LIBC: musllinux}
45-
- { os: ubuntu-24.04-arm, PLAT: aarch64, INTERFACE64: '1', MB_ML_VER: '_1_2', MB_ML_LIBC: musllinux}
42+
# - { os: ubuntu-24.04-arm, PLAT: aarch64, INTERFACE64: '0', MB_ML_VER: '_1_2', MB_ML_LIBC: musllinux}
43+
# - { os: ubuntu-24.04-arm, PLAT: aarch64, INTERFACE64: '1', MB_ML_VER: '_1_2', MB_ML_LIBC: musllinux}
4644

4745
- { os: ubuntu-24.04-arm, PLAT: ppc64le, INTERFACE64: '0', MB_ML_VER: '2014', MB_ML_LIBC: manylinux}
4846
- { os: ubuntu-24.04-arm, PLAT: ppc64le, INTERFACE64: '1', MB_ML_VER: '2014', MB_ML_LIBC: manylinux}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,5 @@ local/scipy_openblas64/*.so
1818
local/scipy_openblas64/*.pyd
1919
local/scipy_openblas64/*.dylib
2020
objconv/
21+
22+
build.log

local/scipy_openblas64/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def get_include_dir():
3939
def get_lib_dir():
4040
"""Return the lib directory needed for linking
4141
"""
42-
return os.path.join(_HERE, "lib").replace("\\", "/")
42+
return os.path.join(_HERE, "lib64").replace("\\", "/")
4343

4444

4545
def get_library(fullname=False):

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ where = ["local"]
3838
install_requires = "importlib-metadata ~= 1.0 ; python_version < '3.8'"
3939

4040
[tool.setuptools.package-data]
41-
scipy_openblas64 = ["lib/*", "include/*", "lib/pkgconfig/*", "lib/cmake/openblas/*"]
41+
scipy_openblas64 = ["lib64/*", "include/openblas64/*", "lib64/pkgconfig/*", "lib/cmake/openblas/OpenBLAS64/*"]
4242

4343
[tool.cibuildwheel]
4444
before-build = "bash ci-before-build.sh"

tools/build_prepare.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ mkdir -p dist
1414
$PYTHON -m pip install wheel auditwheel
1515

1616
# This will fail if there is more than one file in libs
17-
tar -C local/scipy_openblas64 --strip-components=2 -xf libs/openblas*.tar.gz
17+
tar -vC local/scipy_openblas64 --strip-components=2 -xf libs/openblas*.tar.gz
1818

1919
# do not package the static libs and symlinks, only take the shared object
20-
find local/scipy_openblas64/lib -maxdepth 1 -type l -delete
21-
rm local/scipy_openblas64/lib/*.a
20+
# find local/scipy_openblas64/lib -maxdepth 1 -type l -delete
21+
# rm local/scipy_openblas64/lib/*.a
2222
# Check that the pyproject.toml and the pkgconfig versions agree.
2323
py_version=$(grep "^version" pyproject.toml | sed -e "s/version = \"//")
24-
pkg_version=$(grep "version=" ./local/scipy_openblas64/lib/pkgconfig/scipy-openblas*.pc | sed -e "s/version=//" | sed -e "s/dev//")
24+
# Version: 0.3.30
25+
pkg_version=$(grep "^Version:" ./local/scipy_openblas64/lib64/pkgconfig/scipy-openblas*.pc | sed -e "s/Version: *//" | sed -e "s/dev//")
2526
if [[ -z "$pkg_version" ]]; then
2627
echo Could not read version from pkgconfig file
2728
exit 1
@@ -40,7 +41,7 @@ if [ $(uname) == "Darwin" ]; then
4041
install_name_tool -id @rpath/$soname local/scipy_openblas64/lib/$soname
4142
fi
4243

43-
rm -rf local/scipy_openblas64/lib/pkgconfig
44+
rm -rf local/scipy_openblas64/lib64/pkgconfig
4445
echo "" >> LICENSE.txt
4546
echo "----" >> LICENSE.txt
4647
echo "" >> LICENSE.txt

tools/build_steps.sh

Lines changed: 59 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -207,48 +207,88 @@ function do_build_lib {
207207
sed -i 's/CTEST(fork, safety_after_fork_in_parent)/CTEST_SKIP(fork, safety_after_fork_in_parent)/g' ./utest/test_post_fork.c
208208
echo "QEMU has a race condition preventing fork tests to work as expected"
209209
fi
210+
211+
mkdir build
212+
pushd build
213+
210214
if [ -n "$dynamic_list" ]; then
215+
# CFLAGS="$CFLAGS -fvisibility=protected -Wno-uninitialized" \
216+
# make BUFFERSIZE=20 DYNAMIC_ARCH=1 QUIET_MAKE=1 \
217+
# USE_OPENMP=0 NUM_THREADS=64 \
218+
# DYNAMIC_LIST="$dynamic_list" \
219+
# BINARY="$bitness" $interface_flags \
220+
# TARGET="$target"
221+
cmake_interface_flags=""
222+
for flag in $interface_flags; do
223+
cmake_interface_flags="$cmake_interface_flags -D$flag"
224+
done
225+
226+
227+
# cmake will build below for x86_64
228+
# PRESCOTT CORE2 NEHALEM BARCELONA SANDYBRIDGE BULLDOZER PILEDRIVER STEAMROLLER EXCAVATOR HASWELL ZEN SKYLAKEX COOPERLAKE SAPPHIRERAPIDS
229+
211230
CFLAGS="$CFLAGS -fvisibility=protected -Wno-uninitialized" \
212-
make BUFFERSIZE=20 DYNAMIC_ARCH=1 QUIET_MAKE=1 \
213-
USE_OPENMP=0 NUM_THREADS=64 \
214-
DYNAMIC_LIST="$dynamic_list" \
215-
BINARY="$bitness" $interface_flags \
216-
TARGET="$target"
231+
cmake -DCMAKE_BUILD_TYPE=Release -DBUFFERSIZE=20 -DDYNAMIC_ARCH=on \
232+
-DUSE_OPENMP=0 -DNUM_THREADS=64 \
233+
-DBUILD_SHARED_LIBS=ON \
234+
-DUSE_PERL=on \
235+
-DBINARY="$bitness" $cmake_interface_flags \
236+
-DCMAKE_INSTALL_PREFIX=$BUILD_PREFIX \
237+
-DTARGET="$target" \
238+
..
239+
240+
cmake --build . -j$(nproc)
241+
242+
grep openblas_get_config objcopy.def
243+
244+
# can be found, scipy_openblas_get_config64_
245+
nm lib/libscipy_openblas64__64.so | grep openblas_get_config
246+
247+
248+
# only openblas_get_config
249+
nm -D lib/libscipy_openblas64__64.so | grep openblas_get_config
250+
251+
252+
253+
ctest -j$(nproc)
217254
else
218255
CFLAGS="$CFLAGS -fvisibility=protected -Wno-uninitialized" \
219256
make BUFFERSIZE=20 DYNAMIC_ARCH=1 QUIET_MAKE=1 \
220257
USE_OPENMP=0 NUM_THREADS=64 \
221258
BINARY="$bitness" $interface_flags \
222259
TARGET="$target"
223260
fi
224-
make PREFIX=$BUILD_PREFIX $interface_flags install
261+
262+
# make PREFIX=$BUILD_PREFIX $interface_flags install
263+
cmake --build . --target install
264+
popd
265+
225266
popd
226267
if [ "$nightly" = "1" ]; then
227268
local version="HEAD"
228269
else
229270
local version=$(cd OpenBLAS && git describe --tags --abbrev=8)
230271
fi
231-
mv $BUILD_PREFIX/lib/pkgconfig/openblas*.pc $BUILD_PREFIX/lib/pkgconfig/scipy-openblas.pc
272+
mv $BUILD_PREFIX/lib64/pkgconfig/openblas*.pc $BUILD_PREFIX/lib64/pkgconfig/scipy-openblas.pc
232273
local plat_tag=$(get_plat_tag $plat)
233274
if [ "$interface64" = "1" ]; then
234275
# OpenBLAS does not install the symbol suffixed static library,
235276
# do it ourselves
236-
static_libname=$(basename `find OpenBLAS -maxdepth 1 -type f -name '*.a' \! -name '*.dll.a'`)
237-
renamed_libname=$(basename `find OpenBLAS -maxdepth 1 -type f -name '*.renamed'`)
238-
cp -f "OpenBLAS/${renamed_libname}" "$BUILD_PREFIX/lib/${static_libname}"
239-
sed -e "s/\(^Cflags.*\)/\1 -DBLAS_SYMBOL_PREFIX=scipy_ -DBLAS_SYMBOL_SUFFIX=64_/" -i.bak $BUILD_PREFIX/lib/pkgconfig/scipy-openblas.pc
277+
# static_libname=$(basename `find OpenBLAS -type f -name '*.a' \! -name '*.dll.a'`)
278+
# renamed_libname=$(basename `find OpenBLAS -type f -name '*.renamed'`)
279+
# cp -f "OpenBLAS/${renamed_libname}" "$BUILD_PREFIX/lib64/${static_libname}"
280+
sed -e "s/\(^Cflags.*\)/\1 -DBLAS_SYMBOL_PREFIX=scipy_ -DBLAS_SYMBOL_SUFFIX=64_/" -i.bak $BUILD_PREFIX/lib64/pkgconfig/scipy-openblas.pc
240281
else
241-
sed -e "s/\(^Cflags.*\)/\1 -DBLAS_SYMBOL_PREFIX=scipy_/" -i.bak $BUILD_PREFIX/lib/pkgconfig/scipy-openblas.pc
242-
rm $BUILD_PREFIX/lib/pkgconfig/scipy-openblas.pc.bak
282+
sed -e "s/\(^Cflags.*\)/\1 -DBLAS_SYMBOL_PREFIX=scipy_/" -i.bak $BUILD_PREFIX/lib64/pkgconfig/scipy-openblas.pc
283+
# rm $BUILD_PREFIX/lib64/pkgconfig/scipy-openblas.pc.bak
243284
fi
244-
245-
local out_name="openblas${symbolsuffix}-${version}-${plat_tag}.tar.gz"
285+
cat $BUILD_PREFIX/lib64/pkgconfig/scipy-openblas.pc
286+
local out_name="openblas${symbolsuffix}-${version}-${plat_tag}${suff}.tar.gz"
246287
tar zcvf libs/$out_name \
247288
$BUILD_PREFIX/include/*blas* \
248-
$BUILD_PREFIX/include/*lapack* \
249-
$BUILD_PREFIX/lib/libscipy_openblas* \
250-
$BUILD_PREFIX/lib/pkgconfig/scipy-openblas* \
251-
$BUILD_PREFIX/lib/cmake/openblas
289+
$BUILD_PREFIX/lib64/libscipy_openblas* \
290+
$BUILD_PREFIX/lib64/pkgconfig/scipy-openblas* \
291+
$BUILD_PREFIX/lib64/cmake/OpenBLAS64
252292
}
253293

254294

x64-cmake.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
export OPENBLAS_COMMIT="v0.3.30"
3+
export MACOSX_DEPLOYMENT_TARGET=10.9
4+
5+
6+
export NIGHTLY=0
7+
export MB_ML_LIBC="manylinux"
8+
export MB_ML_VER="2014"
9+
export INTERFACE64=1
10+
export BUILD_DIR="."
11+
export PLAT="x86_64"
12+
export OS-NAME="ubuntu-latest"
13+
export CIBW_ARCHS=${PLAT}
14+
export CIBW_BUILD_VERBOSITY=1
15+
export CIBW_BUILD="cp39-${MB_ML_LIBC}_${PLAT}"
16+
export CIBW_MANYLINUX_X86_64_IMAGE=${MB_ML_LIBC}${MB_ML_VER}
17+
18+
cibuildwheel "." --output-dir "dist" > build.log 2>&1

0 commit comments

Comments
 (0)