1 Commits

Author SHA256 Message Date
df84337527 Sync changes to SLFO-1.2 branch 2025-08-20 09:58:39 +02:00
3 changed files with 258 additions and 12 deletions

23
README.HPC.SUSE Normal file
View File

@@ -0,0 +1,23 @@
openSUSE specific packaging
===========================
OpenBLAS provides optimized implementations of BLAS and LAPACK.
openSUSE provides two variants:
* With OpenMP support
* With threading support
The serial variant has been dropped. To run a program
which requires the serial version (ie. because it is
multi-threaded itself), either specify the environment
variable OMP_NUM_THREADS=1 or place a call to
void openblas_set_num_threads(int num_threads);
in your program to limit the number of threads this library
uses to 1.
On x86 systems OpenBLAS uses dynamic architectures support,
so it contains all CPU-related optimizations.
How to switch between the various BLAS/LAPACK implementations
=============================================================
The openmp and threaded variants may be installed in parallel.
To select which one to use please use the 'modules' command.

View File

@@ -4,11 +4,6 @@ Fri May 30 08:46:09 UTC 2025 - Richard Biener <rguenther@suse.com>
- For SLES16 target POWER9 instead of POWER8 which fixes the
issue with the reported sgemm testsuite fails. [bsc#1239545]
-------------------------------------------------------------------
Mon Mar 24 13:16:09 UTC 2025 - Nicolas Morey <nicolas.morey@suse.com>
- Disable and remove support for gnu-hpc build flavours (bsc#1239982)
-------------------------------------------------------------------
Mon Mar 17 08:51:26 UTC 2025 - Egbert Eich <eich@suse.com>

View File

@@ -19,6 +19,8 @@
%global flavor @BUILD_FLAVOR@%{nil}
%undefine sha1
%define _vers 0_3_29
%define vers 0.3.29
%define so_v 0
%define pname openblas
@@ -40,6 +42,7 @@ ExclusiveArch: do_not_build
%define openblas_so_prio 20
# we build devel packages only from one flavor
%define build_devel 1
%{bcond_with hpc}
%endif
%if "%flavor" == "pthreads"
@@ -50,6 +53,7 @@ ExclusiveArch: do_not_build
%else
%define openblas_so_prio 20
%endif
%{bcond_with hpc}
%endif
%if "%flavor" == "openmp"
@@ -59,6 +63,105 @@ ExclusiveArch: do_not_build
%define arch_flavor 1
%define openblas_so_prio 50
%endif
%{bcond_with hpc}
%endif
%if "%flavor" == "gnu-hpc"
%define compiler_family gnu
%undefine c_f_ver
%{bcond_without hpc}
%endif
%if "%flavor" == "gnu-hpc-pthreads"
%define compiler_family gnu
%undefine c_f_ver
%define ext pthreads
%define build_flags USE_THREAD=1 USE_OPENMP=0
%{bcond_without hpc}
%endif
%if "%flavor" == "gnu7-hpc"
%define compiler_family gnu
%define c_f_ver 7
%{bcond_without hpc}
%endif
%if "%flavor" == "gnu7-hpc-pthreads"
%define compiler_family gnu
%define c_f_ver 7
%define ext pthreads
%define build_flags USE_THREAD=1 USE_OPENMP=0
%{bcond_without hpc}
%endif
%if "%flavor" == "gnu8-hpc"
%define compiler_family gnu
%define c_f_ver 8
%{bcond_without hpc}
%endif
%if "%flavor" == "gnu8-hpc-pthreads"
%define compiler_family gnu
%define c_f_ver 8
%define ext pthreads
%define build_flags USE_THREAD=1 USE_OPENMP=0
%{bcond_without hpc}
%endif
%if "%flavor" == "gnu9-hpc"
%define compiler_family gnu
%define c_f_ver 9
%{bcond_without hpc}
%endif
%if "%flavor" == "gnu9-hpc-pthreads"
%define compiler_family gnu
%define c_f_ver 9
%define ext pthreads
%define build_flags USE_THREAD=1 USE_OPENMP=0
%{bcond_without hpc}
%endif
%if "%flavor" == "gnu10-hpc"
%define compiler_family gnu
%define c_f_ver 10
%{bcond_without hpc}
%endif
%if "%flavor" == "gnu10-hpc-pthreads"
%define compiler_family gnu
%define c_f_ver 10
%define ext pthreads
%define build_flags USE_THREAD=1 USE_OPENMP=0
%{bcond_without hpc}
%endif
%if "%flavor" == "gnu11-hpc"
%define compiler_family gnu
%define c_f_ver 11
%{bcond_without hpc}
%endif
%if "%flavor" == "gnu11-hpc-pthreads"
%define compiler_family gnu
%define c_f_ver 11
%define ext pthreads
%define build_flags USE_THREAD=1 USE_OPENMP=0
%{bcond_without hpc}
%endif
%if "%flavor" == "gnu12-hpc"
%define compiler_family gnu
%define c_f_ver 12
%{bcond_without hpc}
%endif
%if "%flavor" == "gnu12-hpc-pthreads"
%define compiler_family gnu
%define c_f_ver 12
%define ext pthreads
%define build_flags USE_THREAD=1 USE_OPENMP=0
%{bcond_without hpc}
%endif
%ifarch ppc64le
@@ -87,6 +190,7 @@ ExclusiveArch: do_not_build
%endif
%endif
%if %{without hpc}
%define so_a %{so_v}
%if 0%{!?package_name:1}
%define package_name %{pname}_%{flavor}
@@ -98,6 +202,26 @@ ExclusiveArch: do_not_build
%define p_cmakedir %{p_libdir}/cmake/%{pname}
%define num_threads 64
%else
%define so_a %{nil}
# Magic for OBS Staging. Only build the flavors required by
# other packages in the ring.
%if %{with ringdisabled}
ExclusiveArch: do_not_build
%endif
%define package_name %{hpc_package_name %_vers}
%define p_prefix %hpc_prefix
%define p_includedir %hpc_includedir
%define p_libdir %hpc_libdir
%define p_testdir %hpc_prefix/tests
%define p_cmakedir %{hpc_libdir}/cmake
%define num_threads 256
%{hpc_init -c %{compiler_family} %{?c_f_ver:-v %{c_f_ver}} %{?ext:-e %{ext}}}
%endif
%if 0%{?sha1:1}
%define v_string %{sha1}
%else
@@ -105,7 +229,7 @@ ExclusiveArch: do_not_build
%endif
Name: %{package_name}
Version: 0.3.29
Version: %vers
Release: 0
Summary: An optimized BLAS library based on GotoBLAS2
License: BSD-3-Clause
@@ -113,6 +237,7 @@ Group: Productivity/Scientific/Math
URL: http://www.openblas.net
Source0: https://github.com/xianyi/OpenBLAS/archive/%{v_string}.tar.gz#/OpenBLAS-%{version}%{?sha1:_%{sha1}}.tar.gz
Source1: README.SUSE
Source2: README.HPC.SUSE
Source3: openblas_tests.sh.in
Source4: openblas.rpmlintrc
# PATCH port
@@ -125,10 +250,17 @@ BuildRequires: memory-constraints
%if 0%{?cc_v:1}
BuildRequires: gcc%{?cc_v}-fortran
%endif
%if %{without hpc}
BuildRequires: gcc-fortran
BuildRequires: update-alternatives
Requires(post): update-alternatives
Requires(preun): update-alternatives
%else
BuildRequires: %{compiler_family}%{?c_f_ver}-compilers-hpc-macros-devel
BuildRequires: lua-lmod
BuildRequires: suse-hpc
%global dep_summary %{summary}
%endif
%description
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
@@ -136,6 +268,7 @@ OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
%package -n lib%{name}%{so_a}
Summary: An optimized BLAS library based on GotoBLAS2, %{flavor} version
Group: System/Libraries
%if %{without hpc}
Requires(post): update-alternatives
Requires(post): coreutils
Requires(preun): update-alternatives
@@ -151,27 +284,38 @@ Obsoletes: lib%{pname}p0
%if "%flavor" == "openmp"
Obsoletes: lib%{pname}o0
%endif
%else # with hpc
%hpc_requires
%endif
%description -n lib%{name}%{so_a}
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
%{?with_hpc:%{hpc_master_package -l -L}}
%package -n lib%{name}-devel
Summary: Development libraries for OpenBLAS, %{flavor} version
Group: Development/Libraries/C and C++
Requires: %{pname}-common-devel = %{version}
Requires: lib%{name}%{so_a} = %{version}
%if %{without hpc}
Requires: %{pname}-common-devel = %{version}
%if 0%{?arch_flavor}
Provides: %{pname}-devel = %version
Provides: %{pname}-devel(default) = %version
%else
Provides: %{pname}-devel(other) = %version
%endif
%else
%hpc_requires_devel
%endif
%description -n lib%{name}-devel
OpenBLAS is an optimized BLAS library based on GotoBLAS2 1.13 BSD version.
This package contains the development libraries for serial OpenBLAS version.
%{?with_hpc:%{hpc_master_package -l -L devel}}
%package devel-static
Summary: Static version of OpenBLAS
Group: Development/Libraries/C and C++
@@ -227,8 +371,13 @@ sed -i -e '/^OBJS_EXT+=/s@[^= ]*/test_dgemmt.o *@@' utest/Makefile
%endif
%endif
%if %{without hpc}
cp %{SOURCE1} .
%else
cp %{SOURCE2} .
%endif
%if %{without hpc}
# create baselibs.conf based on flavor
cat > %{_sourcedir}/baselibs.conf <<EOF
lib%{name}%{so_a}
@@ -238,6 +387,7 @@ lib%{name}-devel
requires -%{name}-<targettype>
requires "lib%{name}%{?so_a}-<targettype> = <version>"
EOF
%endif
%build
@@ -260,6 +410,11 @@ EOF
%global _lto_cflags %{nil}
%endif
%if %{with hpc}
%hpc_debug
%hpc_setup_compiler
%endif
# Use DYNAMIC_ARCH everywhere - not sure about PPC?
# Use DYNAMIC_ARCH to build for multiple targets, use TARGET to specify
# the CPU model assumed for the common code. It should be set to the
@@ -309,7 +464,7 @@ EOF
# set MAKE_NB_JOBS instead and let the build do the work!
# Do not use LIBNAMESUFFIX for new builds as it will not allow
# the different flavors to be plugin replacements of each other
%if 0%{?suse_version} <= 1500
%if 0%{?suse_version} <= 1500 && %{without hpc}
%define libnamesuffix LIBNAMESUFFIX=_%{flavor}
%endif
make MAKE_NB_JOBS=$jobs %{?openblas_target} %{?build_flags} \
@@ -322,10 +477,14 @@ make MAKE_NB_JOBS=$jobs %{?openblas_target} %{?build_flags} \
OPENBLAS_CMAKE_DIR=%{p_cmakedir} \
PREFIX=%{p_prefix} \
%{?dynamic_list} \
%{?libnamesuffix} FC=gfortran CC=gcc%{?cc_v:-%{cc_v}} %{?cc_v:CEXTRALIB=""} \
%{?ldflags_tests:LDFLAGS_TESTS=%{ldflags_tests}}
%{!?with_hpc:%{?libnamesuffix} FC=gfortran CC=gcc%{?cc_v:-%{cc_v}} %{?cc_v:CEXTRALIB=""}} \
%{?ldflags_tests:LDFLAGS_TESTS=%{ldflags_tests}} \
%{?with_hpc:%{?cc_v:CC=gcc-%{cc_v} FC=gfortran-%{cc_v} CEXTRALIB=""}}
%install
%if %{with hpc}
%hpc_setup_compiler
%endif
# Install library and headers
# Pass NUM_THREADS again, as it is not propagated from the build step
@@ -338,11 +497,12 @@ mkdir -p %{buildroot}/%{p_testdir}
OPENBLAS_INCLUDE_DIR=%{p_includedir} \
OPENBLAS_BINARY_DIR=%{p_testdir} \
OPENBLAS_CMAKE_DIR=%{p_cmakedir} \
%{?libnamesuffix} FC=gfortran CC=gcc%{?cc_v:-%{cc_v}} %{?cc_v:CEXTRALIB=""} \
%{!?with_hpc:%{?libnamesuffix} FC=gfortran CC=gcc%{?cc_v:-%{cc_v}} %{?cc_v:CEXTRALIB=""}} \
%{?ldflags_tests:LDFLAGS_TESTS=%{ldflags_tests}} \
%{?with_hpc:%{?cc_v:CC=gcc-%{cc_v} FC=gfortran-%{cc_v} CEXTRALIB=""}} \
PREFIX=%{p_prefix}
sed -e 's#@FLAVOR@#%{flavor}#' \
-e 's#@COMPILER@#%{?compiler_family:%compiler_family}}#' \
-e 's#@COMPILER@#%{?compiler_family:%compiler_family%{?hpc_gnu_dep_version:/%hpc_gnu_dep_version}}#' \
< %{S:3} > %{buildroot}/%{p_testdir}/openblas_tests.sh
chmod 0755 %{buildroot}/%{p_testdir}/openblas_tests.sh
for i in %{buildroot}/%{p_testdir}/*; do
@@ -358,6 +518,8 @@ done
%{buildroot}%{p_includedir}/openblas_config.h
%endif
%if %{without hpc}
%if 0%{!?build_devel:1}
# We need the includes only once
rm -rf %{buildroot}%{p_includedir}/
@@ -413,6 +575,52 @@ ln -s %{_sysconfdir}/alternatives/openblas-default%{?a_x}/cmake/openblas %{build
ln -s openblas-%{flavor}/lib%{pname}.so.%{so_v} %{buildroot}%{_libdir}/lib%{name}.so.%{so_v}
ln -s openblas-%{flavor}/lib%{pname}.so %{buildroot}%{_libdir}/lib%{name}.so
%endif
%else # with hpc
# HPC module file
%hpc_write_modules_files
#%%Module1.0#####################################################################
proc ModulesHelp { } {
puts stderr " "
puts stderr "This module loads the %{pname} library built with the %{compiler_family} compiler toolchain."
puts stderr "\nVersion %{version}\n"
}
module-whatis "Name: %{hpc_upcase %pname} built with %{compiler_family} toolchain"
module-whatis "Version: %{version}"
module-whatis "Category: runtime library"
module-whatis "Description: %{dep_summary}"
module-whatis "%{url}"
set version %{version}
prepend-path LD_LIBRARY_PATH %{p_libdir}
setenv %{hpc_upcase %pname}_DIR %{hpc_prefix}
if {[file isdirectory %{hpc_includedir}]} {
prepend-path LIBRARY_PATH %{p_libdir}
prepend-path CPATH %{p_includedir}
prepend-path C_INCLUDE_PATH %{p_includedir}
prepend-path CPLUS_INCLUDE_PATH %{p_includedir}
prepend-path INCLUDE %{p_includedir}
%hpc_modulefile_add_pkgconfig_path
setenv %{hpc_upcase %pname}_DIR %{hpc_prefix}
setenv %{hpc_upcase %pname}_LIB %{p_libdir}
setenv %{hpc_upcase %pname}_INC %{p_includedir}
}
family "openblas"
EOF
%{hpc_write_pkgconfig -l %{pname}}
%endif # with hpc
%if %{without hpc}
# Ensure directory used in older versions are replaced by symlink properly
%pre -n %{pname}-common-devel
@@ -448,9 +656,17 @@ if [ ! -d %{p_libdir} ]; then
fi
/sbin/ldconfig
%else
%postun -n lib%{name}
%hpc_module_delete_if_default
%endif
%files -n lib%{name}%{so_a}
%defattr(-,root,root,-)
%{p_libdir}/lib%{pname}.so.%{so_v}
%if %{without hpc}
%dir %{p_libdir}
%{?libnamesuffix:%{_libdir}/lib%{name}.so.%{so_v}}
# Created by %%post
@@ -465,14 +681,26 @@ fi
%ghost %{_sysconfdir}/alternatives/libcblas.so.3%{?a_x}
%ghost %{_sysconfdir}/alternatives/liblapack.so.3%{?a_x}
%ghost %{_sysconfdir}/alternatives/liblapacke.so.3%{?a_x}
%else
%hpc_dirs
%{p_libdir}/libopenblas*r*.so
%hpc_modules_files
%endif
%files -n lib%{name}-devel
%{p_libdir}/lib%{pname}.so
%{?libnamesuffix:%{_libdir}/lib%{name}.so}
%{p_cmakedir}/
%if %{with hpc}
%license LICENSE
%doc Changelog.txt GotoBLAS* README.md README.HPC.SUSE
%hpc_pkgconfig_file
%{p_includedir}/
%else
%dir %{p_libdir}/cmake
%dir %{p_libdir}/pkgconfig
%{p_libdir}/pkgconfig
%endif
%files tests
%dir %{p_testdir}