build against openblas on supported arches to match scalapack

update URL and Source URL, switch to https
factorize build process
fix Fortran mods path (#1409235)
don't run the testsuite on ARM 32bit (takes 6.5 hours)
execstack is not available on some arches for EPEL (#1460531)
This commit is contained in:
Dominik 'Rathann' Mierzejewski 2017-06-12 10:06:22 +02:00
parent 52b903c934
commit cbaf4c30f2
4 changed files with 86 additions and 65 deletions

View File

@ -6,7 +6,7 @@ diff -up mpich/configure.ac.atlas mpich/configure.ac
dnl first check blas
- AC_SEARCH_LIBS([dgemm],[blas],[have_blas=yes],[have_blas=no])
+ AC_SEARCH_LIBS([dgemm],[satlas blas],[have_blas=yes],[have_blas=no])
+ AC_SEARCH_LIBS([dgemm],[openblas satlas blas],[have_blas=yes],[have_blas=no])
AC_MSG_CHECKING([whether we can link a program with a blas lib])
AC_MSG_RESULT([${have_blas}])

View File

@ -6,4 +6,4 @@ diff -up mpich/elpa.pc.in.r mpich/elpa.pc.in
Libs: -L${libdir} -lelpa@SUFFIX@ @LIBS@ @OPENMP_FCFLAGS@
Cflags: -I${includedir}/elpa@SUFFIX@-@PACKAGE_VERSION@ @OPENMP_CFLAGS@
-fcflags= -I${includedir}/elpa@SUFFIX@-@PACKAGE_VERSION@/modules @OPENMP_FCFLAGS@
+fcflags= -I${libdir}/gfortran/modules @OPENMP_FCFLAGS@
+fcflags= -I@MPI_FORTRAN_MOD_DIR@ @OPENMP_FCFLAGS@

View File

@ -1,19 +1,17 @@
diff -up mpich/configure.ac.avx mpich/configure.ac
--- mpich/configure.ac.avx 2016-04-03 16:02:10.334634259 +0200
+++ mpich/configure.ac 2016-04-03 16:03:45.419882924 +0200
@@ -196,8 +196,12 @@ AC_MSG_RESULT([${can_compile_sse}])
diff -up mpich/configure.ac.simd mpich/configure.ac
--- mpich/configure.ac.simd 2017-06-11 17:52:18.981738700 +0200
+++ mpich/configure.ac 2017-06-11 17:55:02.104726066 +0200
@@ -196,6 +196,10 @@ AC_MSG_RESULT([${can_compile_sse}])
dnl check whether one can compile with avx - gcc intrinsics
+save_CFLAGS="$CFLAGS"
+save_CXXFLAGS="$CXXFLAGS"
+CFLAGS="$CFLAGS -mavx"
+
dnl first pass: try with specified CFLAGS and CXXFLAGS
AC_MSG_CHECKING([whether we can compile AVX intrinsics in C])
+CFLAGS="$CFLAGS -mavx"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <x86intrin.h>
int main(int argc, char **argv){
@@ -211,6 +215,8 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
)
AC_MSG_RESULT([${can_compile_avx}])
@ -23,7 +21,7 @@ diff -up mpich/configure.ac.avx mpich/configure.ac
AC_MSG_CHECKING([whether we can compile AVX intrinsics in C++])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
@@ -228,10 +234,16 @@ if test "${can_compile_avx}" = "yes" ; t
@@ -228,9 +234,15 @@ if test "${can_compile_avx}" = "yes" ; t
AC_MSG_RESULT([${can_compile_avx}])
if test "${can_compile_avx}" = "no" ; then
AC_MSG_WARN([Cannot compile C++ with AVX: disabling AVX alltogether])
@ -34,12 +32,11 @@ diff -up mpich/configure.ac.avx mpich/configure.ac
+CFLAGS=$save_CFLAGS
+CXXFLAGS=$save_CXXFLAGS
+CFLAGS="$CFLAGS -mavx2 -mfma"
+
AC_MSG_CHECKING([whether we can compile AVX2 intrinsics in C])
+CFLAGS="$CFLAGS -mavx2 -mfma"
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
#include <x86intrin.h>
int main(int argc, char **argv){
@@ -246,6 +258,8 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
)
AC_MSG_RESULT([${can_compile_avx2}])
@ -72,9 +69,9 @@ diff -up mpich/configure.ac.avx mpich/configure.ac
rm -rf modules/ .fortran_dependencies/
mkdir modules
diff -up mpich/Makefile.am.avx mpich/Makefile.am
--- mpich/Makefile.am.avx 2015-11-22 20:05:49.000000000 +0100
+++ mpich/Makefile.am 2016-04-03 16:02:10.336634243 +0200
diff -up mpich/Makefile.am.simd mpich/Makefile.am
--- mpich/Makefile.am.simd 2015-11-22 20:05:49.000000000 +0100
+++ mpich/Makefile.am 2017-06-11 17:52:18.983738737 +0200
@@ -8,6 +8,8 @@ AM_LDFLAGS = $(SCALAPACK_LDFLAGS)
# libelpa
lib_LTLIBRARIES = libelpa@SUFFIX@.la

124
elpa.spec
View File

@ -1,9 +1,27 @@
%if 0%{?fedora} >= 26
%ifnarch x86_64 %{ix86} armv7hl %{power64} aarch64
# matches openblas/scalapack ExclusiveArch
%global with_atlas 1
%endif
%else
%global with_atlas 1
%endif
%if 0%{?rhel}
# execstack (prelink) is built only for x86_64 and ppc64 on RHEL
%ifarch x86_64 ppc64
%global with_execstack 1
%endif
%else
%global with_execstack 1
%endif
Summary: High-performance library for parallel solution of eigenvalue problems
Name: elpa
Version: 2015.11.001
Release: 4%{?dist}
URL: http://elpa.mpcdf.mpg.de/software
Source0: http://elpa.mpcdf.mpg.de/elpa-%{version}.tar.gz
Release: 5%{?dist}
URL: https://elpa.mpcdf.mpg.de/software
Source0: https://elpa.mpcdf.mpg.de/html/Releases/%{version}/elpa-%{version}.tar.gz
# fix pkgconfig file
Patch1: elpa-pc.patch
# build against atlas instead of reference blas
@ -11,10 +29,16 @@ Patch2: elpa-blas.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: libtool
%if %{with execstack}
BuildRequires: /usr/bin/execstack
%endif
%description
ELPA is a Fortran-based high-performance computational library for the
@ -125,69 +149,60 @@ mkdir _openmp
cp -pr mpich openmpi _openmp/
%build
%global defopts --disable-silent-rules --disable-static
%global ldflags -L%{_libdir}/atlas
%global fcflags -ffree-line-length-none
%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
%{_mpich_load}
export LDFLAGS="%{ldflags} -L$MPI_LIB"
export FCFLAGS="%{fcflags} -I$MPI_FORTRAN_MOD_DIR"
pushd mpich
%configure %{defopts} \
--libdir=$MPI_LIB
. /etc/profile.d/modules.sh
make %{?_smp_mflags} V=1
popd
for mpi in mpich openmpi ; do
module load mpi/${mpi}-%{_arch}
export CFLAGS="%{optflags}"
export LDFLAGS="%{ldflags} -L$MPI_LIB"
export FCFLAGS="%{fcflags} -I$MPI_FORTRAN_MOD_DIR"
for s in '' _openmp ; do
pushd ${s:-.}/${mpi}
sed -i -e "s,@MPI_FORTRAN_MOD_DIR@,$MPI_FORTRAN_MOD_DIR," elpa.pc.in
%configure %{defopts} \
${s:+--enable-openmp} \
--libdir=$MPI_LIB
pushd _openmp/mpich
%configure %{defopts} \
--enable-openmp \
--libdir=$MPI_LIB
make %{?_smp_mflags} V=1
popd
%{_mpich_unload}
%{_openmpi_load}
export LDFLAGS="%{ldflags} -L$MPI_LIB"
export FCFLAGS="%{fcflags} -I$MPI_FORTRAN_MOD_DIR"
pushd openmpi
%configure %{defopts} \
--libdir=$MPI_LIB
make %{?_smp_mflags} V=1
popd
pushd _openmp/openmpi
%configure %{defopts} \
--enable-openmp \
--libdir=$MPI_LIB
make %{?_smp_mflags} V=1
popd
%{_openmpi_unload}
make %{?_smp_mflags} V=1
popd
done
module unload mpi/${mpi}-%{_arch}
done
%install
. /etc/profile.d/modules.sh
for s in '' _openmp ; do
for mpi in mpich openmpi ; do
module load mpi/${mpi}-%{_arch}
pushd ${s:-.}/${mpi}
make DESTDIR=%{buildroot} install
rm %{buildroot}%{_bindir}/elpa?_test_*
mkdir -p %{buildroot}%{_libdir}/${mpi}/bin
mv %{buildroot}%{_bindir}/elpa2_print_kernels${s} %{buildroot}%{_libdir}/${mpi}/bin/
mkdir -p %{buildroot}$MPI_BIN
mv %{buildroot}%{_bindir}/elpa2_print_kernels${s} %{buildroot}$MPI_BIN
%if %{with execstack}
execstack -c .libs/libelpa${s}.so.?.* %{buildroot}%{_libdir}/${mpi}/lib/libelpa${s}.so.?.*
mkdir -p %{buildroot}%{_fmoddir}/${mpi}
%endif
mkdir -p %{buildroot}$MPI_FORTRAN_MOD_DIR
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}/${mpi}/${m}${s}.mod
mv %{buildroot}%{_includedir}/elpa${s}-%{version}/modules/${m}.mod %{buildroot}$MPI_FORTRAN_MOD_DIR/${m}${s}.mod
done
rmdir %{buildroot}%{_includedir}/elpa${s}-%{version}/modules
rm %{buildroot}%{_libdir}/${mpi}/lib/libelpa${s}.la
# fix-up fcflags include path per mpi implementation
sed -i -e "/^fcflags.*modules/s,/modules,/modules/${mpi}," %{buildroot}%{_libdir}/${mpi}/lib/pkgconfig/elpa${s}-%{version}.pc
popd
module unload mpi/${mpi}-%{_arch}
done
done
# testsuite takes 6.5 hours on ARMv7
%ifnarch %{arm}
%if 1
%check
%{_mpich_load}
@ -206,6 +221,7 @@ make check V=1 || cat ./test-suite.log
popd
%{_openmpi_unload}
%endif
%endif
%post mpich -p /sbin/ldconfig
@ -237,7 +253,7 @@ popd
%{_libdir}/mpich/lib/libelpa_openmp.so
%{_libdir}/mpich/lib/pkgconfig/elpa-%{version}.pc
%{_libdir}/mpich/lib/pkgconfig/elpa_openmp-%{version}.pc
%{_fmoddir}/mpich/*.mod
%{_fmoddir}/mpich*/*.mod
# only non-mt openmpi build, see bug #1105902
%files openmpi
@ -251,10 +267,18 @@ popd
%exclude %{_libdir}/openmpi/lib/libelpa_openmp.so
%{_libdir}/openmpi/lib/pkgconfig/elpa-%{version}.pc
%exclude %{_libdir}/openmpi/lib/pkgconfig/elpa_openmp-%{version}.pc
%{_fmoddir}/openmpi/*.mod
%exclude %{_fmoddir}/openmpi/*_openmp.mod
%{_fmoddir}/openmpi*/*.mod
%exclude %{_fmoddir}/openmpi*/*_openmp.mod
%changelog
* 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