Skip to content
Open
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
7 changes: 5 additions & 2 deletions n/numpy/build_info.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"maintainer": "shubham-garud",
"maintainer": "SakshiJain0302",
"package_name": "numpy",
"github_url": "https://github.com/numpy/numpy.git",
"version": "v2.2.2",
Expand All @@ -26,6 +26,9 @@
"build_script": "numpy_v2.2.5_ubi_9.3.sh"
},
"*":{
"build_script": "numpy_v2.2.5_ubi_9.3.sh"
"build_script": [
"numpy_v2.2.5_ubi_9.3.sh",
"numpy_2.5.0_ubi_10.2.sh"
]
}
}
190 changes: 190 additions & 0 deletions n/numpy/numpy_2.5.0_ubi_10.2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
#!/bin/bash -e
# -----------------------------------------------------------------------------
#
# Package : numpy
# Version : v2.5.0
# Source repo : https://github.com/numpy/numpy
# Tested on : UBI:10.2
# Language : Python
# Ci-Check : True
# Script License: Apache License, Version 2 or later
# Maintainer : Sakshi Jain <sakshi.jain16@ibm.com>
#
# Disclaimer: This script has been tested in root mode on given
# ========== platform using the mentioned version of the package.
# It may not work as expected with newer versions of the
# package and/or distribution. In such case, please
# contact "Maintainer" of this script.
#
# ----------------------------------------------------------------------------
PACKAGE_NAME=numpy
PACKAGE_VERSION=${1:-v2.5.0}
PACKAGE_URL=https://github.com/numpy/numpy.git
PACKAGE_DIR=numpy
CURRENT_DIR="${PWD}"

yum install -y wget python3.14 python3.14-devel python3.14-pip git gcc gcc-c++ gcc-gfortran make pkgconf-pkg-config
python3.14 -m pip install --upgrade pip
python3.14 -m pip install tox Cython pytest hypothesis wheel meson ninja build meson-python patchelf

echo " --------------------------------------------------- OpenBlas Installing --------------------------------------------------- "

# OpenBLAS version and source
OPENBLAS_VERSION=v0.3.33
OPENBLAS_URL=https://github.com/OpenMathLib/OpenBLAS

# Clone OpenBLAS
git clone -b "${OPENBLAS_VERSION}" "${OPENBLAS_URL}"
cd OpenBLAS
git submodule update --init
SRC_DIR=$(pwd)

# Set pip config
python3.14 -m pip config set global.index-url https://pypi.python.org/simple
python3.14 -m pip config set global.no-index false

# Install prerequisites
python3.14 -m pip install setuptools

# Remove problematic linker flag
LDFLAGS=$(echo "${LDFLAGS}" | sed "s/-Wl,--gc-sections//g")
export LDFLAGS

# Compiler flags
export CF="${CFLAGS} -Wno-unused-parameter -Wno-old-style-declaration"
unset CFLAGS

export USE_OPENMP=1

# Installation prefix
export PREFIX="${SRC_DIR}/local/openblas"

# Build options
build_opts=()

build_opts+=(USE_OPENMP=${USE_OPENMP})
build_opts+=(BINARY="64")
build_opts+=(DYNAMIC_ARCH=1)

# ppc64le / POWER platform
build_opts+=(TARGET="POWER9")

# LP64 interface
build_opts+=(INTERFACE64=0)
build_opts+=(SYMBOLSUFFIX="")

# Build LAPACK
build_opts+=(NO_LAPACK=0)

# Enable threading
build_opts+=(USE_THREAD=1)
build_opts+=(NUM_THREADS=8)

# Disable CPU affinity
build_opts+=(NO_AFFINITY=1)

# Handle Fortran flags
if [ -n "${FFLAGS}" ]; then
# Don't use GNU OpenMP, which is not fork-safe
export FFLAGS="${FFLAGS/-fopenmp/ }"
export FFLAGS="${FFLAGS} -frecursive"
export LAPACK_FFLAGS="${FFLAGS}"
fi

# Build OpenBLAS
make -j8 "${build_opts[@]}" \
CFLAGS="${CF}" \
FFLAGS="${FFLAGS}"

# Install OpenBLAS
make install \
PREFIX="${PREFIX}" \
"${build_opts[@]}" \
CFLAGS="${CF}" \
FFLAGS="${FFLAGS}"

# Verify installation
[ -d "${PREFIX}" ] || {
echo "ERROR: make install failed — PREFIX directory was not created: ${PREFIX}"
exit 1
}

# Set OpenBLAS paths
export OPENBLAS_HOME="${PREFIX}"
export LD_LIBRARY_PATH="${OPENBLAS_HOME}/lib:${LD_LIBRARY_PATH}"
export LIBRARY_PATH="${OPENBLAS_HOME}/lib:${LIBRARY_PATH}"
export CPATH="${OPENBLAS_HOME}/include:${CPATH}"
export PKG_CONFIG_PATH="${OPENBLAS_HOME}/lib/pkgconfig:${PKG_CONFIG_PATH}"
export CMAKE_PREFIX_PATH="${OPENBLAS_HOME}:${CMAKE_PREFIX_PATH}"

# Prepare Python package structure
wget https://raw.githubusercontent.com/i-wheels-cpd/build-scripts/refs/heads/main/o/openblas/pyproject.toml

sed -i "s/{PACKAGE_VERSION}/${OPENBLAS_VERSION}/g" pyproject.toml

touch "${PREFIX}/__init__.py"
rm -rf "${PREFIX}/bin"

echo " --------------------------------------------------- OpenBLAS Successfully Installed --------------------------------------------------- "

cd $CURRENT_DIR


#clone package
git clone $PACKAGE_URL
cd $PACKAGE_NAME
git checkout $PACKAGE_VERSION
git submodule update --init
export CC=/usr/bin/gcc
export CXX=/usr/bin/g++
export FC=/usr/bin/gfortran
export AR=/usr/bin/ar
export LD=/usr/bin/ld
export NM=/usr/bin/nm
export OBJCOPY=/usr/bin/objcopy
export OBJDUMP=/usr/bin/objdump
export RANLIB=/usr/bin/ranlib
export STRIP=/usr/bin/strip
export READELF=/usr/bin/readelf
UNAME_M=$(uname -m)
case "$UNAME_M" in
ppc64*)
# Optimizations trigger compiler bug.
export CXXFLAGS="$(echo ${CXXFLAGS} | sed -e 's/ -fno-plt//')"
export CFLAGS="$(echo ${CFLAGS} | sed -e 's/ -fno-plt//')"
;;
*)
EXTRA_OPTS=""
;;
esac

if ! (python3.14 -m pip install . --no-build-isolation);then
echo "------------------$PACKAGE_NAME:Install_fails-------------------------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | GitHub | Fail | Install_Fails"
exit 1
fi

if ! python3.14 -m build --wheel --no-isolation --outdir="$CURRENT_DIR/"; then
echo "============ Wheel Creation Failed for Python $PYTHON_VERSION (without isolation) ================="
echo "Attempting to build with isolation..."

# Attempt to build the wheel without isolation
if ! python3.14 -m build --wheel --outdir="$CURRENT_DIR/"; then
echo "============ Wheel Creation Failed for Python $PYTHON_VERSION ================="
fi
fi

export CFLAGS="-DCYTHON_PEP489_MULTI_PHASE_INIT=0"

if ! (tox -e py3); then
echo "--------------------$PACKAGE_NAME:Install_success_but_test_fails---------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | GitHub | Fail | Install_success_but_test_Fails"
exit 2
else
echo "------------------$PACKAGE_NAME:Install_&_test_both_success-------------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | GitHub | Pass | Both_Install_and_Test_Success"
exit 0
fi