Blob Blame History Raw
%global rel 008
%global snap 20140321

Summary: High-performance library for parallel solution of eigenvalue problems
Name: elpa
Version: 2013.11
Release: 3.%{rel}%{?dist}
URL: http://elpa.rzg.mpg.de/
# http://elpa.rzg.mpg.de/elpa-tar-archive/elpa-2013-11.006/at_download/file
Source0: ELPA_%{version}.%{rel}_%{snap}.tar.gz
# fix blacs/scalapack detection on <F21
Patch0: elpa-blacs.patch
# fix pkgconfig files and linking against mpi libraries
Patch1: elpa-rpm.patch
# build against atlas instead of reference blas
Patch2: elpa-atlas.patch
License: LGPLv3+
BuildRequires: atlas-devel
BuildRequires: gcc-gfortran
BuildRequires: libtool
BuildRequires: prelink

%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 mpich
Summary: Fast library for parallel solution of eigenvalue problems (MPICH version)
BuildRequires: mpich-devel
BuildRequires: blacs-mpich-devel
BuildRequires: scalapack-mpich-devel
Requires: blacs-mpich
Requires: scalapack-mpich
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}

%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)
BuildRequires: openmpi-devel
BuildRequires: blacs-openmpi-devel
BuildRequires: scalapack-openmpi-devel
# for regression tests using openmpi
BuildRequires: rsh
Requires: blacs-openmpi
Requires: scalapack-openmpi
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}

%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).

%global configure_in \\\
%configure \\\
 --disable-silent-rules \\\
 --disable-static \\\
%ifarch x86_64 \
 --with-sse-assembler \\\
%else \
 --with-generic \\\
%endif \

%prep
%setup -q -c -T -a 0
mv ELPA_%{version} mpich
pushd mpich
%patch0 -p1 -b .blacs
%patch1 -p1 -b .r
%patch2 -p1 -b .atlas
autoreconf -vifs
popd
cp -pr mpich openmpi
mkdir _mt
cp -pr mpich openmpi _mt/

%build
export LDFLAGS="-L%{_libdir}/atlas"
export BLACS_LDFLAGS="-lmpiblacs -lmpiblacsF77init"
export FCFLAGS=-ffree-line-length-none

%{_mpich_load}
export LDFLAGS="$LDFLAGS -L$MPI_LIB"
pushd mpich
%configure_in \
 --libdir=%{_libdir}/mpich%{?_opt_cc_suffix}/lib

# work around libtool bug
sed -i -e 's/-l -l //' libtool
make
# %{?_smp_mflags}
popd

pushd _mt/mpich
%configure_in \
 --with-openmp \
 --libdir=%{_libdir}/mpich%{?_opt_cc_suffix}/lib

# work around libtool bug
sed -i -e 's/-l -l //' libtool
make
# %{?_smp_mflags}
popd
%{_mpich_unload}

%{_openmpi_load}
export LDFLAGS="$LDFLAGS -L$MPI_LIB"
pushd openmpi
%configure_in \
 --libdir=%{_libdir}/openmpi%{?_opt_cc_suffix}/lib

# work around libtool bug
sed -i -e 's/-l -l //' libtool
make
# %{?_smp_mflags}
popd

pushd _mt/openmpi
%configure_in \
 --with-openmp \
 --libdir=%{_libdir}/openmpi%{?_opt_cc_suffix}/lib

# work around libtool bug
sed -i -e 's/-l -l //' libtool
make
# %{?_smp_mflags}
popd
%{_openmpi_unload}

%install
for s in '' _mt ; do
  for mpi in mpich openmpi ; do
    pushd ${s:-.}/${mpi}
    make DESTDIR=%{buildroot} install
    execstack -c .libs/libelpa${s}.so.0.* %{buildroot}%{_libdir}/${mpi}%{?_opt_cc_suffix}/lib/libelpa${s}.so.0.*
    mkdir -p %{buildroot}%{_fmoddir}/${mpi}%{?_opt_cc_suffix}
    mv %{buildroot}%{_includedir}/elpa/modules/elpa1.mod %{buildroot}%{_fmoddir}/${mpi}%{?_cc_name_suffix}/elpa1${s}.mod
    mv %{buildroot}%{_includedir}/elpa/modules/elpa2.mod %{buildroot}%{_fmoddir}/${mpi}%{?_cc_name_suffix}/elpa2${s}.mod
    rm %{buildroot}%{_libdir}/${mpi}%{?_opt_cc_suffix}/lib/libelpa${s}.la
# fix-up fcflags include path per mpi implementation
    sed -i -e "/^fcflags.*modules/s,$,/${mpi}," %{buildroot}%{_libdir}/${mpi}/lib/pkgconfig/elpa${s}.pc
    popd
  done
done
rm %{buildroot}%{_datadir}/*.F90
rm %{buildroot}%{_bindir}/test*

%if 1
%check
# tests on i686 with mpich never complete, disable for now
%ifnarch i686
%{_mpich_load}
pushd mpich
make check
popd
pushd _mt/mpich
make check
popd
%{_mpich_unload}
%endif

# only non-mt openmpi build can be tested, see bug #1105902
%{_openmpi_load}
pushd openmpi
make check
popd
%{_openmpi_unload}
%endif

%post mpich -p /sbin/ldconfig

%postun mpich -p /sbin/ldconfig

%post openmpi -p /sbin/ldconfig

%postun openmpi -p /sbin/ldconfig

%files common
%doc mpich/COPYING/* mpich/README

%files mpich
%{_libdir}/mpich%{?_opt_cc_suffix}/lib/libelpa.so.0*
%{_libdir}/mpich%{?_opt_cc_suffix}/lib/libelpa_mt.so.0*

%files mpich-devel
%{_libdir}/mpich%{?_opt_cc_suffix}/lib/libelpa.so
%{_libdir}/mpich%{?_opt_cc_suffix}/lib/libelpa_mt.so
%{_libdir}/mpich%{?_opt_cc_suffix}/lib/pkgconfig/elpa.pc
%{_libdir}/mpich%{?_opt_cc_suffix}/lib/pkgconfig/elpa_mt.pc
%{_fmoddir}/mpich%{?_cc_name_suffix}/elpa1.mod
%{_fmoddir}/mpich%{?_cc_name_suffix}/elpa2.mod
%{_fmoddir}/mpich%{?_cc_name_suffix}/elpa1_mt.mod
%{_fmoddir}/mpich%{?_cc_name_suffix}/elpa2_mt.mod

# only non-mt openmpi build, see bug #1105902
%files openmpi
%{_libdir}/openmpi%{?_opt_cc_suffix}/lib/libelpa.so.0*
%exclude %{_libdir}/openmpi%{?_opt_cc_suffix}/lib/libelpa_mt.so.0*

%files openmpi-devel
%{_libdir}/openmpi%{?_opt_cc_suffix}/lib/libelpa.so
%exclude %{_libdir}/openmpi%{?_opt_cc_suffix}/lib/libelpa_mt.so
%{_libdir}/openmpi%{?_opt_cc_suffix}/lib/pkgconfig/elpa.pc
%exclude %{_libdir}/openmpi%{?_opt_cc_suffix}/lib/pkgconfig/elpa_mt.pc
%{_fmoddir}/openmpi%{?_cc_name_suffix}/elpa1.mod
%{_fmoddir}/openmpi%{?_cc_name_suffix}/elpa2.mod
%exclude %{_fmoddir}/openmpi%{?_cc_name_suffix}/elpa1_mt.mod
%exclude %{_fmoddir}/openmpi%{?_cc_name_suffix}/elpa2_mt.mod

%changelog
* 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