File dbcsr.spec of Package dbcsr

#
# spec file for package dbcsr
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

Name:	dbcsr
Version:	0
Release:	0
Summary:	Distributed Block Compressed Sparse Row matrix library
# FIXME: Select a correct license from https://github.com/openSUSE/spec-cleaner#spdx-licenses
License:	GPL-2.0-or-later
URL:	https://github.com/cp2k/dbcsr.git
Source:	_service
BuildRequires:	cmake
BuildRequires:	gcc-c++
BuildRequires:	gcc-fortran
BuildRequires:	libopenblas_openmp-devel
BuildRequires:	blacs-openmpi5-devel
BuildRequires:	libscalapack2-openmpi5-devel
BuildRequires:	python3-base
BuildRequires:	pkgconfig(libxcf03)
BuildRequires:	cmake(Spglib)
BuildRequires:	cmake(lapacke)
BuildRequires:	pkgconfig(spglib_f08)
BuildRequires:	pkgconfig(OpenCL-Headers)
BuildRequires:	pkgconfig(OpenCL)
BuildRequires:	fdupes
BuildRequires:	openmpi5-macros-devel
Requires:		libopenblas_openmp0
BuildRequires:	pkgconfig(libxsmm-shared)
%openmpi_requires

%global _description %{expand:
DBCSR stands for Distributed Blocked Compressed Sparse Row.
DBCSR is a library designed to efficiently perform sparse matrix-matrix
multiplication, among other operations.  It is MPI and OpenMP parallel and
can exploit Nvidia and AMD GPUs via CUDA and HIP.}
%description
%{_description}


%package devel
Summary: Development files for %{name}
Requires: %{name} = %{version}
%description devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%package openmpi
Summary: DBCSR - openmpi version
%description openmpi
%{_description}
This package contains the parallel single- and multi-threaded versions
using OpenMPI.
%package openmpi-devel
Summary: Development files for %{name}-openmpi
Requires: %{name}-openmpi = %{version}
Requires: %{name}-devel = %{version}
Obsoletes:  mpich
%openmpi_devel_requires
%description openmpi-devel
The %{name}-openmpi-devel package contains libraries and header files for
developing applications that use %{name}-openmpi.

%prep
%setup -q -n %_sourcedir/%name-%version -T -D
%__mkdir -p %_builddir/%_sourcedir
%__ln -rs %_sourcedir/%name-%version %_builddir/%_sourcedir
%build
%setup_openmpi
%cmake -DUSE_MPI_F08=ON \
-DUSE_ACCEL=opencl \
-DUSE_SMM=libxsmm \
-DUSE_OPENMP=ON \
-DCMAKE_INSTALL_PREFIX:PATH=%openmpi_prefix
%cmake_build

%install
%cmake_install
%__sed -i 's|#include "../acc.h"|#include "acc.h"|g' src/acc/opencl/acc_opencl.h 
%__install -m0644 src/acc/opencl/*.h %buildroot%openmpi_prefix/include/
%fdupes %{buildroot}

%files
%license LICENSE
%doc README.md
%openmpi_prefix/%{_lib}/libdbcsr.so.*
%files devel
%dir %openmpi_prefix/include
%dir %openmpi_prefix/%{_lib}
%dir %openmpi_prefix/%{_lib}/cmake
%openmpi_prefix/%{_lib}/cmake/dbcsr/
%openmpi_prefix/%{_lib}/libdbcsr.so
%openmpi_prefix/include/*
%files openmpi
%license LICENSE
%doc README.md
%openmpi_prefix/%{_lib}/libdbcsr_c.so.*
%files openmpi-devel
%openmpi_prefix/%{_lib}/libdbcsr_c.so

%changelog

openSUSE Build Service is sponsored by