Blob Blame History Raw
%{!?openblas_arches:%global openblas_arches x86_64 %{ix86} armv7hl %{power64} aarch64 s390x}
%ifnarch %{openblas_arches}
# matches openblas/scalapack ExclusiveArch
%global with_atlas 1
%endif

%ifnarch s390 s390x
%global with_papi 1
%endif

%bcond_without check

%global sover 8

Summary: High-performance library for parallel solution of eigenvalue problems
Name: elpa
Version: 2017.05.003
Release: 2%{?dist}
URL: https://elpa.mpcdf.mpg.de/software
Source0: https://elpa.mpcdf.mpg.de/html/Releases/%{version}/elpa-%{version}.tar.gz
Source1: https://elpa.mpcdf.mpg.de/html/Releases/%{version}/elpa-%{version}.tar.gz.asc
Source2: gpg-keyring-05288C27E0CF6B3D7F4FEF6A52C18F6F0A355F25.gpg
# drop _onenode suffix from non-MPI builds
Patch1: elpa-onenode.patch
# fix detection of papi
Patch2: elpa-papi.patch
# fix detection of AVX(2) compiler support and use them only in the library
Patch3: elpa-simd.patch
License: LGPLv3+
%if %{with atlas}
BuildRequires: atlas-devel
%else
BuildRequires: openblas-devel
%endif
BuildRequires: gcc-gfortran
BuildRequires: gnupg2
BuildRequires: libtool
BuildRequires: /usr/bin/execstack
%if %{with papi}
BuildRequires: papi-devel
%endif
Requires: %{name}-common = %{version}-%{release}

%description
ELPA is a Fortran-based high-performance computational library for the
(massively) parallel solution of symmetric or Hermitian, standard or generalized
eigenvalue problems.

This is the kind of eigenvalue problem which is frequently encountered in
Electronic Structure Theory (solution of Schrödinger's Equation or variants
thereof), but also in many other fields. Typically, the solution effort scales
as O(size^3), where "size" is a measure of the system size, for example the
dimension of the associated matrices or the number of required
eigenvalue/eigenvector pairs (less than or equal to the matrix dimension). Thus,
an algebraically exact solution of the eigenproblem may quickly become the
bottleneck in a practical application.

%package common
Summary: Common files for ELPA
BuildArch: noarch

%description common
ELPA is a Fortran-based high-performance computational library for the
(massively) parallel solution of symmetric or Hermitian, standard or generalized
eigenvalue problems.

This package contains common files for ELPA.

%package common-devel
Summary: Common development files for ELPA (non-MPI version)
Requires: %{name}-common = %{version}-%{release}

%description common-devel
ELPA is a Fortran-based high-performance computational library for the
(massively) parallel solution of symmetric or Hermitian, standard or generalized
eigenvalue problems.

This package contains the common development files for ELPA (non-MPI version).

%package devel
Summary: Development files for ELPA (non-MPI version)
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: %{name}-common-devel = %{version}-%{release}

%description devel
ELPA is a Fortran-based high-performance computational library for the
(massively) parallel solution of symmetric or Hermitian, standard or generalized
eigenvalue problems.

This package contains the development files for ELPA (non-MPI version).

%package mpich
Summary: Fast library for parallel solution of eigenvalue problems (MPICH version)
BuildRequires: mpich-devel
BuildRequires: blacs-mpich-devel
BuildRequires: scalapack-mpich-devel
Requires: %{name}-common = %{version}-%{release}

%description mpich
ELPA is a Fortran-based high-performance computational library for the
(massively) parallel solution of symmetric or Hermitian, standard or generalized
eigenvalue problems.

This package contains ELPA built against MPICH.

%package mpich-devel
Summary: Development files for ELPA (MPICH version)
Requires: %{name}-mpich%{?_isa} = %{version}-%{release}
Requires: gcc-gfortran%{?_isa}
Requires: %{name}-common-devel = %{version}-%{release}
Provides: %{name}-mpi-devel = %{version}-%{release}

%description mpich-devel
ELPA is a Fortran-based high-performance computational library for the
(massively) parallel solution of symmetric or Hermitian, standard or generalized
eigenvalue problems.

This package contains the development files for ELPA (MPICH version).

%package openmpi
Summary: Fast library for parallel solution of eigenvalue problems (OpenMPI version)
# required for running the testsuite
%if %{with check}
BuildRequires: rsh
%endif
BuildRequires: openmpi-devel
BuildRequires: blacs-openmpi-devel
BuildRequires: scalapack-openmpi-devel
Requires: %{name}-common = %{version}-%{release}

%description openmpi
ELPA is a Fortran-based high-performance computational library for the
(massively) parallel solution of symmetric or Hermitian, standard or generalized
eigenvalue problems.

This package contains ELPA built against OpenMPI.

%package openmpi-devel
Summary: Development files for ELPA (OpenMPI version)
Requires: %{name}-openmpi%{?_isa} = %{version}-%{release}
Requires: gcc-gfortran%{?_isa}
Requires: %{name}-common-devel = %{version}-%{release}
Provides: %{name}-mpi-devel = %{version}-%{release}

%description openmpi-devel
ELPA is a Fortran-based high-performance computational library for the
(massively) parallel solution of symmetric or Hermitian, standard or generalized
eigenvalue problems.

This package contains the development files for ELPA (OpenMPI version).

%prep
gpgv2 --keyring %{S:2} %{S:1} %{S:0}
%setup -q -c -T -a 0
mv elpa-%{version} mpich
pushd mpich
%patch1 -p1 -b .onenode
%patch2 -p1 -b .papi
%patch3 -p1 -b .simd
autoreconf -vifs
popd
cp -pr mpich openmpi
cp -pr mpich serial
mkdir _openmp
cp -pr mpich openmpi serial _openmp/

%build
%global defopts --disable-silent-rules --disable-static --docdir=%{_pkgdocdir}
%global ldflags %{__global_ldflags}
%if %{with atlas}
%global ldflags %{ldflags} -L%{_libdir}/atlas
%endif
%global fcflags %{optflags} -I%{_fmoddir} -ffree-line-length-none

. /etc/profile.d/modules.sh

for mpi in '' mpich openmpi ; do
  export CFLAGS="%{optflags}"
  export LDFLAGS="%{ldflags}"
  export FCFLAGS="%{fcflags}"
  if [ -n "$mpi" ]; then
    module load mpi/${mpi}-%{_arch}
    export LDFLAGS="${LDFLAGS} -L$MPI_LIB"
    export FCFLAGS="${FCFLAGS} -I$MPI_FORTRAN_MOD_DIR"
  fi
  for s in '' _openmp ; do
    pushd ${s:-.}/${mpi:-serial}
    if [ -n "$mpi" ]; then
      fmoddir="$MPI_FORTRAN_MOD_DIR"
      mpiflag="--libdir=$MPI_LIB"
    else
      fmoddir="%{_fmoddir}"
      mpiflag="--with-mpi=no"
    fi
    sed -i -e "s,\${includedir}/elpa@SUFFIX@-@PACKAGE_VERSION@/modules,${fmoddir}," elpa.pc.in
    %configure %{defopts} \
%ifnarch x86_64
      --disable-sse-assembly \
      --disable-sse \
      --disable-avx \
      --disable-avx2 \
%endif
      ${s:+--enable-openmp} \
%if %{with papi}
      --with-papi \
%endif
      $mpiflag || cat config.log

    make %{?_smp_mflags} V=1
    popd
  done
  if [ -n "$mpi" ]; then
    module unload mpi/${mpi}-%{_arch}
  fi
done

%install
. /etc/profile.d/modules.sh
for s in '' _openmp ; do
# install serial last to avoid overwriting non-MPI binaries in _bindir
  for mpi in mpich openmpi '' ; do
    pushd ${s:-.}/${mpi:-serial}
    make DESTDIR=%{buildroot} install
    if [ -n "$mpi" ]; then
      module load mpi/${mpi}-%{_arch}
      libdir=%{_libdir}/${mpi}/lib
      fmoddir=$MPI_FORTRAN_MOD_DIR
      mkdir -p %{buildroot}$MPI_BIN
      mv %{buildroot}%{_bindir}/elpa2_print_kernels${s} %{buildroot}$MPI_BIN
      module unload mpi/${mpi}-%{_arch}
    else
      libdir=%{_libdir}
      fmoddir=%{_fmoddir}
    fi
    execstack -c .libs/libelpa${s}.so.%{sover}.* %{buildroot}${libdir}/libelpa${s}.so.%{sover}.*
    mkdir -p %{buildroot}${fmoddir}
    for f in $(ls -1 %{buildroot}%{_includedir}/elpa${s}-%{version}/modules/*.mod) ; do
      m=$(basename ${f} .mod)
      mv %{buildroot}%{_includedir}/elpa${s}-%{version}/modules/${m}.mod %{buildroot}${fmoddir}/${m}${s}.mod
    done
    rmdir %{buildroot}%{_includedir}/elpa${s}-%{version}/modules
    rm %{buildroot}${libdir}/libelpa${s}.la
    popd
  done
done
echo ".so elpa2_print_kernels.1" > %{buildroot}%{_mandir}/man1/elpa2_print_kernels_openmp.1

# testsuite takes:
#  1 hour  on aarch64 (all PASS)
#  1 hour  on armv7hl (all PASS)
#  1 hour  on i686    (serial/mpich PASS, OpenMPI disabled)
#  1 hour  on ppc64le ( 9/50 FAIL for serial+openmp, 4/73 FAIL for mpich+openmp)
#  1 hour  on ppc64   ( 1/50 FAIL for serial+openmp)
#  1 hour  on s390x   (25/50 FAIL for serial, 39/73 FAIL for mpi)
#  3 hours on x86_64  (all PASS)
%if %{with check}
%check
. /etc/profile.d/modules.sh
for s in '' _openmp ; do
# openmpi tests get randomly stuck on i686 https://bugzilla.redhat.com/show_bug.cgi?id=1512229
%ifnarch i686
  for mpi in '' mpich openmpi ; do
%else
  for mpi in '' mpich ; do
%endif
    pushd ${s:-.}/${mpi:-serial}
    if [ -n "$mpi" ]; then
      module load mpi/${mpi}-%{_arch}
    fi
    make check V=1 TEST_FLAGS="500 150 16" || cat ./test-suite.log
    if [ -n "$mpi" ]; then
      module unload mpi/${mpi}-%{_arch}
    fi
    popd
  done
done
%endif

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%post mpich -p /sbin/ldconfig

%postun mpich -p /sbin/ldconfig

%post openmpi -p /sbin/ldconfig

%postun openmpi -p /sbin/ldconfig

%files
%{_bindir}/elpa2_print_kernels
%{_bindir}/elpa2_print_kernels_openmp
%{_libdir}/libelpa.so.%{sover}*
%{_libdir}/libelpa_openmp.so.%{sover}*

%files common
%license %{_pkgdocdir}/COPYING
%license %{_pkgdocdir}/LICENSE
%license %{_pkgdocdir}/gpl.txt
%license %{_pkgdocdir}/lgpl.txt
%{_pkgdocdir}/README.md
%{_mandir}/man1/elpa2_print_kernels.1*
%{_mandir}/man1/elpa2_print_kernels_openmp.1*

%files common-devel
%{_includedir}/elpa-%{version}
%{_includedir}/elpa_openmp-%{version}
%{_pkgdocdir}/Changelog
%{_pkgdocdir}/CONTRIBUTING.md
%exclude %{_pkgdocdir}/INSTALL.md
%{_pkgdocdir}/USERS_GUIDE.md
%{_mandir}/man3/elpa_*.3*
%{_mandir}/man3/get_elpa_*.3*
%{_mandir}/man3/solve_evp_*.3*

%files devel
%{_libdir}/libelpa.so
%{_libdir}/libelpa_openmp.so
%{_libdir}/pkgconfig/elpa-%{version}.pc
%{_libdir}/pkgconfig/elpa_openmp-%{version}.pc
%{_fmoddir}/*.mod

%files mpich
%{_libdir}/mpich/bin/elpa2_print_kernels
%{_libdir}/mpich/bin/elpa2_print_kernels_openmp
%{_libdir}/mpich/lib/libelpa.so.%{sover}*
%{_libdir}/mpich/lib/libelpa_openmp.so.%{sover}*

%files mpich-devel
%{_libdir}/mpich/lib/libelpa.so
%{_libdir}/mpich/lib/libelpa_openmp.so
%{_libdir}/mpich/lib/pkgconfig/elpa-%{version}.pc
%{_libdir}/mpich/lib/pkgconfig/elpa_openmp-%{version}.pc
%{_fmoddir}/mpich*/*.mod

%files openmpi
%{_libdir}/openmpi/bin/elpa2_print_kernels
%{_libdir}/openmpi/bin/elpa2_print_kernels_openmp
%{_libdir}/openmpi/lib/libelpa.so.%{sover}*
%{_libdir}/openmpi/lib/libelpa_openmp.so.%{sover}*

%files openmpi-devel
%{_libdir}/openmpi/lib/libelpa.so
%{_libdir}/openmpi/lib/libelpa_openmp.so
%{_libdir}/openmpi/lib/pkgconfig/elpa-%{version}.pc
%{_libdir}/openmpi/lib/pkgconfig/elpa_openmp-%{version}.pc
%{_fmoddir}/openmpi*/*.mod

%changelog
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2017.05.003-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Fri Nov 10 2017 Dominik Mierzejewski <rpm@greysector.net> 2017.05.003-1
- update to 2017.05.003 (ABI and API break)
- drop obsolete openblas patch
- re-enable OpenMPI OpenMP builds
- enable papi on supported arches
- build and ship non-MPI version (without _onenode suffix)
- provide a man-link for openmp version of elpa2_print_kernels
- execstack is now available everywhere
- include and verify GPG signature
- conditionalize running tests and reduce testsuite runtime per upstream
  recommendation
- split out API documentation and headers into -common-devel subpackage
- disable all non-generic kernels on non-x86_64 for now
- disable testing under OpenMPI for now (rhbz#1512229)

* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2015.11.001-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2015.11.001-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Mon Jun 12 2017 Dominik Mierzejewski <rpm@greysector.net> 2015.11.001-6
- fix AVX2 instructions usage enablement (#1383412)

* Sun Jun 11 2017 Dominik Mierzejewski <rpm@greysector.net> 2015.11.001-5
- update URL and Source URL, switch to https
- factorize build process
- fix Fortran mods path (#1409235)
- build against openblas on supported arches to match scalapack
- don't run the testsuite on ARM 32bit (takes 6.5 hours)
- execstack is not available on some arches for EPEL (#1460531)

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2015.11.001-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Sun Nov 13 2016 Peter Robinson <pbrobinson@fedoraproject.org> 2015.11.001-3
- Rebuild (Power64)

* Fri Oct 21 2016 Orion Poplawski <orion@cora.nwra.com> - 2015.11.001-2
- Rebuild for openmpi 2.0

* Sun Apr 03 2016 Dominik Mierzejewski <rpm@greysector.net> 2015.11.001-1
- update to 2015.11.001 release
- update URL and Source URL
- fix AVX(2) support detection and usage
- drop condition around execstack usage, it's available everywhere now
- drop _opt_cc_suffix usage and factor out more stuff into common macros

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2015.05.001-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Sep 15 2015 Orion Poplawski <orion@cora.nwra.com> - 2015.05.001-3
- Rebuild for openmpi 1.10.0

* Mon Aug 10 2015 Sandro Mani <manisandro@gmail.com> - 2015.05.001-2
- Rebuild for RPM MPI Requires Provides Change

* Thu Aug 06 2015 Dominik Mierzejewski <rpm@greysector.net> 2015.05.001-1
- update to 2015.05.001 release
- don't use all available cores for the testsuite (interferes with OpenMP)
  (work around #1220161)
- drop obsolete comments and rename patch0 appropriately
- fix AVX support detection

* Tue Aug 04 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2015.02.002-6
- Use new execstack (#1247795)

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2015.02.002-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Mon May 04 2015 Dominik Mierzejewski <rpm@greysector.net> 2015.02.002-4
- fix build on EPEL7 (missing _pkgdocdir macro and BR: rsh for openmpi)
- move examples to -devel subpackage
- print whole testsuite log in case of test failure
- re-enable openmpi tests on i686 and armv7hl

* Sat May 02 2015 Kalev Lember <kalevlember@gmail.com> - 2015.02.002-3
- Rebuilt for GCC 5 C++11 ABI change

* Mon Mar 23 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2015.02.002-2
- Rebuild for fortran update (#1204420)

* Thu Mar 19 2015 Dominik Mierzejewski <rpm@greysector.net> 2015.02.002-1
- update to 2015.02.002 release (ABI change)
- drop libtool bug workaround
- make builds more verbose
- take advantage of upstream build system improvements
- ship C headers in -devel subpackage

* Mon Mar 16 2015 Thomas Spura <tomspur@fedoraproject.org> - 2013.11-6.008
- Rebuild for changed mpich libraries

* Tue Sep 16 2014 Dominik Mierzejewski <rpm@greysector.net> 2013.11-5.008
- fix release string broken by previous bump by releng script
- disable openmpi tests on armv7hl (bug #1144408)

* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2013.11-4.9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Thu Jul  3 2014 Peter Robinson <pbrobinson@fedoraproject.org> 2013.11-4.008
- aarch64/ppc64le don't have prelink

* Sun Jun 29 2014 Dominik Mierzejewski <rpm@greysector.net> 2013.11-3.008
- fix typo in execstack -c call
- link against atlas

* Thu Jun 26 2014 Dominik Mierzejewski <rpm@greysector.net> 2013.11-2.008
- remove executable stack from installed libraries
- fix undefined non-weak mpi symbols
- reorder build section and drop some redundant parts
- add missing gfortran Requires for -devel subpackages
- use correct URL and provide link to source tarball

* Tue Jun 24 2014 Dominik Mierzejewski <rpm@greysector.net> 2013.11-1.008
- initial build