From 43b91c1c5b2ef65d3c0ff56da5d331ade34d2868 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Fri, 7 Oct 2016 09:53:19 -0600 Subject: [PATCH] Build mpich and openmpi versions --- fftw.spec | 295 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 284 insertions(+), 11 deletions(-) diff --git a/fftw.spec b/fftw.spec index a108722..91a0b51 100644 --- a/fftw.spec +++ b/fftw.spec @@ -1,6 +1,20 @@ +%bcond_without mpich +%ifarch s390 s390x +%bcond_with openmpi +%else +%bcond_without openmpi +%endif +%if %{with mpich} +%global mpi_list %{?mpi_list} mpich +%endif +%if %{with openmpi} +%global mpi_list %{?mpi_list} openmpi +%endif + + Name: fftw Version: 3.3.5 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A Fast Fourier Transform library Group: System Environment/Libraries License: GPLv2+ @@ -18,6 +32,12 @@ BuildRequires: gcc-gfortran # For check phase BuildRequires: time BuildRequires: perl +%if %{with mpich} +BuildRequires: mpich-devel +%endif +%if %{with openmpi} +BuildRequires: openmpi-devel +%endif Requires(post): info Requires(preun): info @@ -37,11 +57,11 @@ Obsoletes: fftw-libs-threads < %{version}-%{release} Obsoletes: fftw-libs-openmp < %{version}-%{release} # Pull in the actual libraries -Requires: %{name}-libs-single%{?_isa} = %{version}-%{release} -Requires: %{name}-libs-double%{?_isa} = %{version}-%{release} -Requires: %{name}-libs-long%{?_isa} = %{version}-%{release} +Requires: %{name}-libs-single%{?_isa} = %{version}-%{release} +Requires: %{name}-libs-double%{?_isa} = %{version}-%{release} +Requires: %{name}-libs-long%{?_isa} = %{version}-%{release} %if %{quad} -Requires: %{name}-libs-quad%{?_isa} = %{version}-%{release} +Requires: %{name}-libs-quad%{?_isa} = %{version}-%{release} %endif %description libs @@ -109,6 +129,150 @@ Provides: fftw3-static = %{version}-%{release} The fftw-static package contains the statically linkable version of the FFTW fast Fourier transform library. +%if %{with mpich} +%package mpich-libs +Summary: FFTW MPICH run-time library +Group: System Environment/Libraries +Provides: fftw3-mpich = %{version}-%{release} + +# Pull in the actual libraries +Requires: %{name}-mpich-libs-single%{?_isa} = %{version}-%{release} +Requires: %{name}-mpich-libs-double%{?_isa} = %{version}-%{release} +Requires: %{name}-mpich-libs-long%{?_isa} = %{version}-%{release} + +%description mpich-libs +This is a dummy package package, pulling in the individual FFTW +MPICH run-time libraries. + + +%package mpich-devel +Summary: Headers, libraries and docs for the FFTW MPICH library +Group: Development/Libraries +Requires: mpich-devel +Requires: pkgconfig +Requires: %{name}-devel%{?_isa} = %{version}-%{release} +Requires: %{name}-mpich-libs%{?_isa} = %{version}-%{release} +Provides: fftw3-mpich-devel%{?_isa} = %{version}-%{release} +Provides: fftw3-mpich-devel = %{version}-%{release} + +%description mpich-devel +FFTW is a C subroutine library for computing the Discrete Fourier +Transform (DFT) in one or more dimensions, of both real and complex +data, and of arbitrary input size. + +This package contains header files and development libraries needed to +develop programs using the FFTW fast Fourier transform library for MPICH. + +%package mpich-libs-double +Summary: FFTW MPICH library, double precision +Group: Development/Libraries +Requires: %{name}-libs-double%{?_isa} = %{version}-%{release} + +%description mpich-libs-double +This package contains the FFTW MPICH library compiled in double precision. + +%package mpich-libs-single +Summary: FFTW MPICH library, single precision +Group: Development/Libraries +Requires: %{name}-libs-single%{?_isa} = %{version}-%{release} + +%description mpich-libs-single +This package contains the FFTW MPICH library compiled in single precision. + +%package mpich-libs-long +Summary: FFTW MPICH library, long double precision +Group: Development/Libraries +Requires: %{name}-libs-long%{?_isa} = %{version}-%{release} + +%description mpich-libs-long +This package contains the FFTW MPICH library compiled in long double +precision. + +%package mpich-static +Summary: Static versions of the FFTW MPICH libraries +Group: Development/Libraries +Requires: %{name}-mpich-devel%{?_isa} = %{version}-%{release} +Requires: %{name}-static%{?_isa} = %{version}-%{release} +Provides: fftw3-mpich-static%{?_isa} = %{version}-%{release} +Provides: fftw3-mpich-static = %{version}-%{release} + +%description mpich-static +The fftw-mpich-static package contains the statically linkable version of +the FFTW fast Fourier transform library for MPICh. +%endif + +%if %{with openmpi} +%package openmpi-libs +Summary: FFTW OpenMPI run-time library +Group: System Environment/Libraries +Provides: fftw3-openmpi = %{version}-%{release} + +# Pull in the actual libraries +Requires: %{name}-openmpi-libs-single%{?_isa} = %{version}-%{release} +Requires: %{name}-openmpi-libs-double%{?_isa} = %{version}-%{release} +Requires: %{name}-openmpi-libs-long%{?_isa} = %{version}-%{release} + +%description openmpi-libs +This is a dummy package package, pulling in the individual FFTW +OpenMPI run-time libraries. + + +%package openmpi-devel +Summary: Headers, libraries and docs for the FFTW OpenMPI library +Group: Development/Libraries +Requires: openmpi-devel +Requires: pkgconfig +Requires: %{name}-devel%{?_isa} = %{version}-%{release} +Requires: %{name}-openmpi-libs%{?_isa} = %{version}-%{release} +Provides: fftw3-openmpi-devel%{?_isa} = %{version}-%{release} +Provides: fftw3-openmpi-devel = %{version}-%{release} + +%description openmpi-devel +FFTW is a C subroutine library for computing the Discrete Fourier +Transform (DFT) in one or more dimensions, of both real and complex +data, and of arbitrary input size. + +This package contains header files and development libraries needed to +develop programs using the FFTW fast Fourier transform library for OpenMPI. + +%package openmpi-libs-double +Summary: FFTW OpenMPI library, double precision +Group: Development/Libraries +Requires: %{name}-libs-double%{?_isa} = %{version}-%{release} + +%description openmpi-libs-double +This package contains the FFTW OpenMPI library compiled in double precision. + +%package openmpi-libs-single +Summary: FFTW OpenMPI library, single precision +Group: Development/Libraries +Requires: %{name}-libs-single%{?_isa} = %{version}-%{release} + +%description openmpi-libs-single +This package contains the FFTW OpenMPI library compiled in single precision. + +%package openmpi-libs-long +Summary: FFTW OpenMPI library, long double precision +Group: Development/Libraries +Requires: %{name}-libs-long%{?_isa} = %{version}-%{release} + +%description openmpi-libs-long +This package contains the FFTW OpenMPI library compiled in long double +precision. + +%package openmpi-static +Summary: Static versions of the FFTW OpenMPI libraries +Group: Development/Libraries +Requires: %{name}-openmpi-devel%{?_isa} = %{version}-%{release} +Requires: %{name}-static%{?_isa} = %{version}-%{release} +Provides: fftw3-openmpi-static%{?_isa} = %{version}-%{release} +Provides: fftw3-openmpi-static = %{version}-%{release} + +%description openmpi-static +The fftw-openmpi-static package contains the statically linkable version of +the FFTW fast Fourier transform library for MPICh. +%endif + %package doc Summary: FFTW library manual Group: Documentation @@ -179,6 +343,32 @@ do cd .. done +# MPI Builds - this duplicates the non-mpi builds, but oh well +for mpi in %{mpi_list} +do + module load mpi/${mpi}-%{_arch} + # Loop over precisions - no quad precision support with MPI + for((iprec=0;iprec<3;iprec++)) + do + mkdir ${mpi}-${prec_name[iprec]}${ver_name[iver]} + cd ${mpi}-${prec_name[iprec]}${ver_name[iver]} + ln -s ../configure . + # Force linking the _mpi.so libraries with the mpi libs. This works because + # we get rid of all of the non-mpi components of these builds + export CC=mpicc + %{configure} ${BASEFLAGS} ${prec_flags[iprec]} --enable-mpi \ + --libdir=%{_libdir}/$mpi/lib \ + --bindir=%{_libdir}/$mpi/bin \ + --sbindir=%{_libdir}/$mpi/sbin \ + --includedir=%{_includedir}/$mpi-%{_arch} \ + --mandir=%{_libdir}/$mpi/share/man + make %{?_smp_mflags} + cd .. + done + module unload mpi/${mpi}-%{_arch} +done + + %install %if %{quad} for ver in single double long quad @@ -188,8 +378,21 @@ for ver in single double long do make -C $ver install DESTDIR=%{buildroot} done +# MPI +for mpi in %{mpi_list} +do + module load mpi/${mpi}-%{_arch} + for ver in single double long + do + make -C ${mpi}-${ver} install DESTDIR=%{buildroot} + # Remove duplicated non-mpi libraries, binaries, and data + find %{buildroot}%{_libdir}/${mpi}/lib -name libfftw\* -a \! -name \*_mpi.\* -delete + rm -r %{buildroot}%{_libdir}/${mpi}/{bin,share} + done + module unload mpi/${mpi}-%{_arch} +done rm -f %{buildroot}%{_infodir}/dir -rm -f %{buildroot}%{_libdir}/*.la +find %{buildroot} -name \*.la -delete %check bdir=`pwd` @@ -200,7 +403,18 @@ for ver in single double long %endif do export LD_LIBRARY_PATH=$bdir/$ver/.libs:$bdir/$ver/threads/.libs - make -C $ver check + make %{?_smp_mflags} -C $ver check +done +# MPI +for mpi in %{mpi_list} +do + module load mpi/${mpi}-%{_arch} + for ver in single double long + do + export LD_LIBRARY_PATH=$bdir/$ver/.libs:$bdir/$ver/threads/.libs + make %{?_smp_mflags} -C ${mpi}-${ver}/mpi check + done + module unload mpi/${mpi}-%{_arch} done %post libs-single -p /sbin/ldconfig @@ -223,7 +437,7 @@ if [ "$1" = 0 ]; then fi %files -%doc %{_mandir}/man1/fftw*.1.* +%{_mandir}/man1/fftw*.1* %{_bindir}/fftw*-wisdom* %files libs @@ -265,13 +479,72 @@ fi %{_libdir}/pkgconfig/fftw3*.pc %{_libdir}/libfftw3*.so -%files doc -%doc doc/*.pdf doc/html/ - %files static %{_libdir}/libfftw3*.a +%files doc +%doc doc/*.pdf doc/html/ + +%if %{with mpich} +%files mpich-libs + +%files mpich-libs-single +%license COPYING COPYRIGHT +%doc AUTHORS ChangeLog NEWS README* TODO +%{_libdir}/mpich/lib/libfftw3f_mpi.so.* + +%files mpich-libs-double +%license COPYING COPYRIGHT +%doc AUTHORS ChangeLog NEWS README* TODO +%{_libdir}/mpich/lib/libfftw3_mpi.so.* + +%files mpich-libs-long +%license COPYING COPYRIGHT +%doc AUTHORS ChangeLog NEWS README* TODO +%{_libdir}/mpich/lib/libfftw3l_mpi.so.* + +%files mpich-devel +%doc doc/FAQ/fftw-faq.html/ +%{_includedir}/mpich-%{_arch} +%{_libdir}/mpich/lib/pkgconfig/fftw3*.pc +%{_libdir}/mpich/lib/libfftw3*.so + +%files mpich-static +%{_libdir}/mpich/lib/libfftw3*.a +%endif + +%if %{with openmpi} +%files openmpi-libs + +%files openmpi-libs-single +%license COPYING COPYRIGHT +%doc AUTHORS ChangeLog NEWS README* TODO +%{_libdir}/openmpi/lib/libfftw3f_mpi.so.* + +%files openmpi-libs-double +%license COPYING COPYRIGHT +%doc AUTHORS ChangeLog NEWS README* TODO +%{_libdir}/openmpi/lib/libfftw3_mpi.so.* + +%files openmpi-libs-long +%license COPYING COPYRIGHT +%doc AUTHORS ChangeLog NEWS README* TODO +%{_libdir}/openmpi/lib/libfftw3l_mpi.so.* + +%files openmpi-devel +%doc doc/FAQ/fftw-faq.html/ +%{_includedir}/openmpi-%{_arch} +%{_libdir}/openmpi/lib/pkgconfig/fftw3*.pc +%{_libdir}/openmpi/lib/libfftw3*.so + +%files openmpi-static +%{_libdir}/openmpi/lib/libfftw3*.a +%endif + %changelog +* Fri Oct 7 2016 Orion Poplawski - 3.3.5-2 +- Build mpich and openmpi versions + * Wed Oct 5 2016 Orion Poplawski - 3.3.5-1 - Update to 3.3.5 - Cleanup spec