diff --git a/.gitignore b/.gitignore index 0ff1bd028e3..858879d3a24 100644 --- a/.gitignore +++ b/.gitignore @@ -232,3 +232,4 @@ spack-* .DS_Store BUILD/ +!tools/fedora/dbcsr.spec diff --git a/.packit.yaml b/.packit.yaml new file mode 100644 index 00000000000..adece13f3f6 --- /dev/null +++ b/.packit.yaml @@ -0,0 +1,58 @@ +specfile_path: tools/fedora/dbcsr.spec +files_to_sync: + - src: tools/fedora/ + dest: ./ + delete: true + filters: + - "protect .git*" + - "protect sources" + - "protect changelog" + - "- plans/rpminspect" + - "- plans/rpmlint" + # No packaged tmt jobs described yet, removing the .fmf as well + - "- .fmf/" + - .packit.yaml +upstream_package_name: dbcsr +downstream_package_name: dbcsr +update_release: false +upstream_tag_template: v{version} + +jobs: + - &copr_build + job: copr_build + trigger: release + owner: lecris + project: release + targets: &targets + - fedora-all-x86_64 + - fedora-all-aarch64 + - <<: *copr_build + trigger: commit + branch: master + project: nightly + additional_repos: + - copr://@scikit-build/release + - &tests + job: tests + trigger: commit + targets: *targets + fmf_path: tools/fedora + - <<: *copr_build + trigger: pull_request + project: dbcsr + update_release: true + release_suffix: "{PACKIT_RPMSPEC_RELEASE}" + - <<: *tests + trigger: pull_request + - job: propose_downstream + trigger: release + dist_git_branches: + - fedora-rawhide + - job: koji_build + trigger: commit + dist_git_branches: + - fedora-all + - job: bodhi_update + trigger: commit + dist_git_branches: + - fedora-branched diff --git a/tools/fedora/.fmf/version b/tools/fedora/.fmf/version new file mode 100644 index 00000000000..d00491fd7e5 --- /dev/null +++ b/tools/fedora/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/tools/fedora/dbcsr.rpmlintrc b/tools/fedora/dbcsr.rpmlintrc new file mode 100644 index 00000000000..e69de29bb2d diff --git a/tools/fedora/dbcsr.spec b/tools/fedora/dbcsr.spec new file mode 100644 index 00000000000..2a054a6b1cd --- /dev/null +++ b/tools/fedora/dbcsr.spec @@ -0,0 +1,199 @@ +# Currently does not build with opencl/libxsmm +%bcond_with opencl + +# No openmpi on i668 with openmpi 5 in Fedora 40+ +%if 0%{?fedora} >= 40 +%ifarch %{ix86} +%bcond_with openmpi +%else +%bcond_without openmpi +%endif +%else +%bcond_without openmpi +%endif + +Name: dbcsr +Version: 0.0.0 +Release: %autorelease +Summary: Distributed Block Compressed Sparse Row matrix library +License: GPL-2.0-or-later +URL: https://cp2k.github.io/dbcsr/develop/ +Source0: https://github.com/cp2k/dbcsr/releases/download/v%{version}/dbcsr-%{version}.tar.gz + +BuildRequires: cmake +BuildRequires: gcc-c++ +BuildRequires: gcc-gfortran +BuildRequires: make +BuildRequires: flexiblas-devel +%if %{with opencl} +BuildRequires: libxsmm-devel +%endif +BuildRequires: python3-fypp + +%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} + +This package contains the non-MPI single process and multi-threaded versions. + +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: gcc-gfortran%{_isa} + +%description devel +The %{name}-devel package contains libraries and header files for +developing applications that use %{name}. + +%global mpi_list mpich + +%if %{with openmpi} +%global mpi_list %{mpi_list} openmpi +%package openmpi +Summary: DBCSR - openmpi version +BuildRequires: openmpi-devel + +%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%{?_isa} = %{version}-%{release} + +%description openmpi-devel +The %{name}-openmpi-devel package contains libraries and header files for +developing applications that use %{name}-openmpi. +%endif + +%package mpich +Summary: DBCSR - mpich version +BuildRequires: mpich-devel + +%description mpich +%{_description} + +This package contains the parallel single- and multi-threaded versions +using mpich. + +%package mpich-devel +Summary: Development files for %{name}-mpich +Requires: %{name}-mpich%{?_isa} = %{version}-%{release} + +%description mpich-devel +The %{name}-mpich-devel package contains libraries and header files for +developing applications that use %{name}-mpich. + + +%prep +%autosetup -p1 +# Use cmake's version so it can find flexiblas +rm cmake/Find{BLAS,LAPACK}.cmake +# Use system fypp, other tools not needed +rm -r tools + + +# $mpi will be evaluated in the loops below +%global _vpath_builddir %{_vendor}-%{_target_os}-build-${mpi:-serial} + +%build +export CFLAGS="%{optflags} -fPIC" +export CXXFLAGS="%{optflags} -fPIC" +export FFLAGS="%{optflags} -fPIC" +%cmake \ + -DCMAKE_INSTALL_Fortran_MODULES=%{_fmoddir} \ + -DUSE_MPI=OFF \ + %{?with_opencl:-DUSE_ACCEL=opencl -DUSE_SMM=libxsmm} +%cmake_build +for mpi in %{mpi_list} +do + module load mpi/$mpi-%{_arch} + %cmake \ + -DCMAKE_INSTALL_Fortran_MODULES=$MPI_FORTRAN_MOD_DIR \ + %{?with_opencl:-DUSE_ACCEL=opencl -DUSE_SMM=libxsmm} \ + -DCMAKE_INSTALL_PREFIX:PATH=$MPI_HOME \ + -DCMAKE_INSTALL_LIBDIR:PATH=$MPI_LIB \ + -DUSE_MPI_F08=ON \ + -DTEST_MPI_RANKS=2 + %cmake_build + module purge +done + + +%install +%cmake_install +for mpi in %{mpi_list} +do + module load mpi/$mpi-%{_arch} + %cmake_install + module purge +done + + +%check +%ctest +for mpi in %{mpi_list} +do + module load mpi/$mpi-%{_arch} + fail= + # mpich tests fail on s390x - reported https://github.com/cp2k/dbcsr/issues/703 + [ $mpi = mpich -a %{_arch} = s390x ] && fail=no + %ctest || test $fail + module purge +done + + +%files +%license LICENSE +%doc README.md +%{_libdir}/libdbcsr.so.* + +%files devel +%{_fmoddir}/dbcsr_api.mod +%{_fmoddir}/dbcsr_tensor_api.mod +%{_libdir}/cmake/dbcsr/ +%{_libdir}/libdbcsr.so + +%if %{with openmpi} +%files openmpi +%license LICENSE +%doc README.md +%{_libdir}/openmpi/lib/libdbcsr.so.* +%{_libdir}/openmpi/lib/libdbcsr_c.so.* + +%files openmpi-devel +%{_libdir}/openmpi/include/dbcsr.h +%{_libdir}/openmpi/include/dbcsr_tensor.h +%{_fmoddir}/openmpi/dbcsr_api.mod +%{_fmoddir}/openmpi/dbcsr_tensor_api.mod +%{_libdir}/openmpi/lib/cmake/dbcsr/ +%{_libdir}/openmpi/lib/libdbcsr.so +%{_libdir}/openmpi/lib/libdbcsr_c.so +%endif + +%files mpich +%license LICENSE +%doc README.md +%{_libdir}/mpich/lib/libdbcsr.so.* +%{_libdir}/mpich/lib/libdbcsr_c.so.* + +%files mpich-devel +%{_libdir}/mpich/include/dbcsr.h +%{_libdir}/mpich/include/dbcsr_tensor.h +%{_fmoddir}/mpich/dbcsr_api.mod +%{_fmoddir}/mpich/dbcsr_tensor_api.mod +%{_libdir}/mpich/lib/cmake/dbcsr/ +%{_libdir}/mpich/lib/libdbcsr.so +%{_libdir}/mpich/lib/libdbcsr_c.so + +%changelog +%autochangelog diff --git a/tools/fedora/plans/main.fmf b/tools/fedora/plans/main.fmf new file mode 100644 index 00000000000..4993dba0235 --- /dev/null +++ b/tools/fedora/plans/main.fmf @@ -0,0 +1,7 @@ +adjust: + # TODO: use initiator == fedora-ci instead + when: initiator is not defined or initiator != packit + discover: + how: fmf + dist-git-source: true + dist-git-extract: dbcsr-*/ diff --git a/tools/fedora/plans/rpminspect.fmf b/tools/fedora/plans/rpminspect.fmf new file mode 100644 index 00000000000..59e9b248b23 --- /dev/null +++ b/tools/fedora/plans/rpminspect.fmf @@ -0,0 +1,5 @@ +plan: + import: + url: https://github.com/packit/tmt-plans + ref: main + name: /plans/rpminspect diff --git a/tools/fedora/plans/rpmlint.fmf b/tools/fedora/plans/rpmlint.fmf new file mode 100644 index 00000000000..1d28ff95260 --- /dev/null +++ b/tools/fedora/plans/rpmlint.fmf @@ -0,0 +1,10 @@ +prepare: + - how: shell + script: cp ./*.rpmlintrc $TMT_PLAN_DATA/ +discover: + how: fmf + filter: "tag: rpmlint" + url: https://github.com/packit/tmt-plans + ref: main +execute: + how: tmt