Skip to content

Commit

Permalink
Test building our open openblas on macos
Browse files Browse the repository at this point in the history
  • Loading branch information
tskisner committed Oct 17, 2024
1 parent a4f4dce commit 7268f89
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 21 deletions.
7 changes: 6 additions & 1 deletion packaging/deps/openblas.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,16 @@ if [ "${STATIC}" = "yes" ]; then
targ="libs netlib"
fi

omp="USE_OPENMP=1"
if [ "x${OMPFLAGS}" = "x" ]; then
omp="USE_OPENMP=0"
fi

start_dir=$(pwd)
rm -rf ${openblas_dir}
tar xzf ${openblas_pkg} \
&& pushd ${openblas_dir} >/dev/null 2>&1 \
&& make USE_OPENMP=1 ${shr} \
&& make ${omp} ${shr} \
MAKE_NB_JOBS=${MAKEJ} \
CC="${CC}" FC="${FC}" DYNAMIC_ARCH=1 TARGET=GENERIC \
COMMON_OPT="${CFLAGS}" FCOMMON_OPT="${FCFLAGS}" \
Expand Down
48 changes: 28 additions & 20 deletions packaging/wheels/install_deps_osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,26 +95,27 @@ pyver=$(python3 --version 2>&1 | awk '{print $2}' | sed -e "s#\(.*\)\.\(.*\)\..*
numpy_ver="2.0.1"

# Install build requirements.
CC="${CC}" CFLAGS="${CFLAGS}" pip install -v -r "${scriptdir}/build_requirements.txt" "numpy==${numpy_ver}" "scipy_openblas32"
# CC="${CC}" CFLAGS="${CFLAGS}" pip install -v -r "${scriptdir}/build_requirements.txt" "numpy==${numpy_ver}" "scipy_openblas32"
CC="${CC}" CFLAGS="${CFLAGS}" pip install -v -r "${scriptdir}/build_requirements.txt" "numpy==${numpy_ver}"

# We use the scipy openblas wheel to get the openblas to use.
# # We use the scipy openblas wheel to get the openblas to use.

# First ensure that pkg-config is set to search somewhere
if [ -z "${PKG_CONFIG_PATH}" ]; then
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
fi
# # First ensure that pkg-config is set to search somewhere
# if [ -z "${PKG_CONFIG_PATH}" ]; then
# export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig"
# fi

python3 -c "import scipy_openblas32; print(scipy_openblas32.get_pkg_config())" > ${PKG_CONFIG_PATH}/scipy-openblas.pc
# python3 -c "import scipy_openblas32; print(scipy_openblas32.get_pkg_config())" > ${PKG_CONFIG_PATH}/scipy-openblas.pc

# To help delocate find the libraries, we copy them into /usr/local
python3 <<EOF
import os, scipy_openblas32, shutil
srcdir = os.path.dirname(scipy_openblas32.__file__)
incdir = os.path.join(srcdir, "include")
libdir = os.path.join(srcdir, "lib")
shutil.copytree(libdir, "/usr/local/lib", dirs_exist_ok=True)
shutil.copytree(incdir, "/usr/local/include", dirs_exist_ok=True)
EOF
# # To help delocate find the libraries, we copy them into /usr/local
# python3 <<EOF
# import os, scipy_openblas32, shutil
# srcdir = os.path.dirname(scipy_openblas32.__file__)
# incdir = os.path.join(srcdir, "include")
# libdir = os.path.join(srcdir, "lib")
# shutil.copytree(libdir, "/usr/local/lib", dirs_exist_ok=True)
# shutil.copytree(incdir, "/usr/local/include", dirs_exist_ok=True)
# EOF

# Build compiled dependencies

Expand All @@ -124,10 +125,17 @@ export STATIC=no
export SHLIBEXT="dylib"
export CLEANUP=yes

export BLAS_LIBRARIES="/usr/local/lib/libscipy_openblas.dylib"
export LAPACK_LIBRARIES="/usr/local/lib/libscipy_openblas.dylib"
export BLA_OPTIONS="-DBLA_PREFER_PKGCONFIG=1 -DBLA_PKGCONFIG_BLAS=scipy-openblas -DBLAS_NO_UNDERSCORE=1"
# export BLAS_LIBRARIES="/usr/local/lib/libscipy_openblas.dylib"
# export LAPACK_LIBRARIES="/usr/local/lib/libscipy_openblas.dylib"
# export BLA_OPTIONS="-DBLA_PREFER_PKGCONFIG=1 -DBLA_PKGCONFIG_BLAS=scipy-openblas -DBLAS_NO_UNDERSCORE=1"

# for pkg in fftw libflac suitesparse libaatm; do
# source "${depsdir}/${pkg}.sh"
# done

export BLAS_LIBRARIES="-L${PREFIX}/lib -lopenblas ${OMPFLAGS} -lm ${FCLIBS}"
export LAPACK_LIBRARIES="-L${PREFIX}/lib -lopenblas ${OMPFLAGS} -lm ${FCLIBS}"

for pkg in fftw libflac suitesparse libaatm; do
for pkg in openblas fftw libflac suitesparse libaatm; do
source "${depsdir}/${pkg}.sh"
done

0 comments on commit 7268f89

Please sign in to comment.