diff --git a/o/openblas/build_info.json b/o/openblas/build_info.json index a530f2ca94..7dd19ff7ac 100644 --- a/o/openblas/build_info.json +++ b/o/openblas/build_info.json @@ -1,16 +1,19 @@ { - "maintainer": "stutiibm", + "maintainer": "shivansh-ibm", "package_name": "OpenBLAS", "github_url": "https://github.com/OpenMathLib/OpenBLAS", - "version": "v0.3.29", + "version": "v0.3.33", "wheel_build" : true, "package_dir": "o/openblas", "default_branch": "develop", - "build_script": "openblas_ubi_9.3.sh", + "build_script": "openblas_0.3.33_ubi_10.1.sh", "docker_build": false, "validate_build_script": true, "use_non_root_user": "false", - "*": { + "0.3.29": { "build_script": "openblas_ubi_9.3.sh" + }, + "*": { + "build_script": "openblas_0.3.33_ubi_10.1.sh" } } diff --git a/o/openblas/openblas_0.3.33_ubi_10.1.sh b/o/openblas/openblas_0.3.33_ubi_10.1.sh new file mode 100644 index 0000000000..1c0cc6c719 --- /dev/null +++ b/o/openblas/openblas_0.3.33_ubi_10.1.sh @@ -0,0 +1,137 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# +# Package : OpenBLAS +# Version : v0.3.33 +# Source repo : https://github.com/OpenMathLib/OpenBLAS +# Tested on : UBI: 10.1 +# Language : C +# Ci-Check : True +# Script License : Apache License, Version 2 or later +# Maintainer : Shivansh Sharma +# +# 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. +# +# ----------------------------------------------------------------------------- + +set -ex + +# Variables +PACKAGE_NAME=OpenBLAS +PACKAGE_VERSION=${1:-v0.3.33} +PACKAGE_URL="https://github.com/xianyi/OpenBLAS" +OPENBLAS_VERSION=${PACKAGE_VERSION} +CURRENT_DIR=$(pwd) +PACKAGE_DIR=OpenBLAS + +echo "Installing dependencies..." +yum install -y git make cmake wget python3.12 python3.12-devel python3.12-pip pkgconfig g++ gcc-c++ gcc-gfortran + + +git clone -b $PACKAGE_VERSION $PACKAGE_URL +cd OpenBLAS +git submodule update --init +SRC_DIR=$(pwd) + +#Set pip config +python3.12 -m pip config set global.index-url https://pypi.python.org/simple +python3.12 -m pip config set global.no-index false + +#Install pre requisite wheels +python3.12 -m pip install setuptools +#Setting the env variables +LDFLAGS=$(echo "${LDFLAGS}" | sed "s/-Wl,--gc-sections//g") + +# See this workaround +# ( https://github.com/xianyi/OpenBLAS/issues/818#issuecomment-207365134 ). +export CF="${CFLAGS} -Wno-unused-parameter -Wno-old-style-declaration" +unset CFLAGS +export USE_OPENMP=1 + +#TODO: Pass path +export PREFIX=${SRC_DIR}/local/openblas + +#build options +build_opts=() +build_opts+=(USE_OPENMP=${USE_OPENMP}) + +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_opts+=(BINARY="64") +build_opts+=(DYNAMIC_ARCH=1) + +# Set target platform-/CPU-specific options +#only seeting option for x86-cpu platform +build_opts+=(TARGET="PRESCOTT") + +# Placeholder for future builds that may include ILP64 variants. +build_opts+=(INTERFACE64=0) +build_opts+=(SYMBOLSUFFIX="") + +# Build LAPACK. +build_opts+=(NO_LAPACK=0) + +# Enable threading. This can be controlled to a certain number by +# setting OPENBLAS_NUM_THREADS before loading the library. +build_opts+=(USE_THREAD=1) +build_opts+=(NUM_THREADS=8) + +# Disable CPU/memory affinity handling to avoid problems with NumPy and R +build_opts+=(NO_AFFINITY=1) + +#Build:- +make -j8 ${build_opts[@]} \ + HOST=${HOST} CROSS_SUFFIX="${HOST}-" \ + CFLAGS="${CF}" FFLAGS="${FFLAGS}" + +# Install OpenBLAS to PREFIX +CFLAGS="${CF}" FFLAGS="${FFLAGS}" \ + make install PREFIX="${PREFIX}" "${build_opts[@]}" + +# Verify installation succeeded +[ -d "${PREFIX}" ] || { echo "ERROR: make install failed — PREFIX dir not created: ${PREFIX}"; exit 1; } + +# Prepare package structure +#install pyproject.toml +wget -O pyproject.toml https://raw.githubusercontent.com/ppc64le/build-scripts/refs/heads/main/o/openblas/pyproject_v0.3.33.toml +sed -i s/{PACKAGE_VERSION}/$PACKAGE_VERSION/g pyproject.toml + +# Finalize OpenBLAS package layout +touch "${PREFIX}/__init__.py" +rm -rf "${PREFIX}/bin" + + +#building wheel +python3.12 -m pip wheel -v . --no-build-isolation --no-deps + +echo "------------------------Installing Python package-------------------" + +if ! python3.12 -m pip install . --no-build-isolation ; then + echo "------------------$PACKAGE_NAME:Python_Install_fails-------------------------------------" + exit 1 +fi + +# Run tests + +if ! make -C utest all; 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 + + diff --git a/o/openblas/pyproject_v0.3.33.toml b/o/openblas/pyproject_v0.3.33.toml new file mode 100644 index 0000000000..ed514302f3 --- /dev/null +++ b/o/openblas/pyproject_v0.3.33.toml @@ -0,0 +1,42 @@ +[build-system] +# Minimum requirements for the build system to execute. +# Do not include sys, subprocess and os as they are default packages +requires = [ + "setuptools", + "wheel", +] +# Set build backend to setuptools +build-backend = "setuptools.build_meta" + +# Project name and version +[project] +name = "openblas" +version = "v0.3.33" +# One line description +description = "OpenBLAS: An optimized BLAS library" +# Classifiers to improve package discoverability +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Programming Language :: C++", + "License :: OSI Approved :: BSD License", +] + +# Project URLs +[project.urls] +homepage = "https://github.com/xianyi/OpenBLAS" +upstream = "https://github.com/xianyi/OpenBLAS" + +# Find package files in local folder, this is needed as we are not following standard directory structure of setuptools +[tool.setuptools.packages.find] +# scanning for namespace packages is true by default in pyproject.toml, so +# you do NOT need to include the following line. +namespaces = true +where = ["local"] + +# Package data to add binaries in wheel, this is needed as they are not .py files +[tool.setuptools.package-data] +openblas = ["lib/*", "include/*", "lib/pkgconfig/*", "lib/cmake/openblas/*"] + +[tool.distutils.bdist_wheel] +plat-name = "linux_ppc64le" +universal = false # Disable universal wheel (forces platform-specific build)