[netcdf: 3/3] Enable MPI builds, merged from f16

Orion Poplawski orion at fedoraproject.org
Wed Mar 7 17:21:26 UTC 2012


commit f5068e6baa92e57a234de37f3a195f64536697bc
Merge: 2ed38af b9d7608
Author: Orion Poplawski <orion at cora.nwra.com>
Date:   Wed Mar 7 10:21:18 2012 -0700

    Enable MPI builds, merged from f16

 netcdf.spec |  230 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 207 insertions(+), 23 deletions(-)
---
diff --cc netcdf.spec
index dc6b323,4b41425..7b02c83
--- a/netcdf.spec
+++ b/netcdf.spec
@@@ -1,6 -1,6 +1,6 @@@
  Name:           netcdf
 -Version:        4.1.3
 -Release:        3%{?dist}
 +Version:        4.2
- Release:        0.2.rc2%{?dist}
++Release:        0.3.rc2%{?dist}
  Summary:        Libraries for the Unidata network Common Data Form
  
  Group:          Applications/Engineering
@@@ -23,20 -25,29 +23,30 @@@ BuildRequires:  zlib-deve
  %ifnarch s390 s390x %{arm}
  BuildRequires:  valgrind
  %endif
+ #mpiexec segfaults if ssh is not present
+ #https://trac.mcs.anl.gov/projects/mpich2/ticket/1576
+ BuildRequires:  openssh-clients
 +Requires:       hdf5 = %{_hdf5_version}
  
- %package devel
- Summary:        Development files for netcdf
- Group:          Development/Libraries
- Requires:       %{name} = %{version}-%{release}
- Requires:       pkgconfig
- Requires:       hdf5-devel
- Requires:       libcurl-devel
+ %global with_mpich2 1
+ %global with_openmpi 1
+ %if 0%{?rhel}
+ %ifarch ppc64
+ # No mpich2 on ppc64 in EL
+ %global with_mpich2 0
+ %endif
+ %endif
+ %ifarch s390 s390x
+ # No openmpi on s390(x)
+ %global with_openmpi 0
+ %endif
  
- %package static
- Summary:        Static libs for netcdf
- Group:          Development/Libraries
- Requires:       %{name} = %{version}-%{release}
+ %if %{with_mpich2}
+ %global mpi_list mpich2
+ %endif
+ %if %{with_openmpi}
+ %global mpi_list %{?mpi_list} openmpi
+ %endif
  
  %description
  NetCDF (network Common Data Form) is an interface for array-oriented 
@@@ -69,34 -80,176 +79,160 @@@ NetCDF data is
     o Sharable:  One writer and multiple readers may simultaneously
       access the same NetCDF file.
  
+ 
+ %package devel
+ Summary:        Development files for netcdf
+ Group:          Development/Libraries
+ Requires:       %{name} = %{version}-%{release}
 -Requires:       gcc-gfortran%{_isa}
+ Requires:       pkgconfig
+ Requires:       hdf5-devel
+ Requires:       libcurl-devel
+ 
  %description devel
 -This package contains the netCDF header files, shared devel libs, and 
 +This package contains the netCDF C header files, shared devel libs, and 
  man pages.
  
+ 
+ %package static
+ Summary:        Static libs for netcdf
+ Group:          Development/Libraries
+ Requires:       %{name} = %{version}-%{release}
+ 
  %description static
 -This package contains the netCDF static libs.
 +This package contains the netCDF C static libs.
  
  
+ %if %{with_mpich2}
+ %package mpich2
+ Summary: NetCDF mpich2 libraries
+ Group: Development/Libraries
+ Requires: mpich2
+ BuildRequires: mpich2-devel
+ BuildRequires: hdf5-mpich2-devel >= 1.8.4
+ 
+ %description mpich2
+ NetCDF parallel mpich2 libraries
+ 
+ 
+ %package mpich2-devel
+ Summary: NetCDF mpich2 development files
+ Group: Development/Libraries
+ Requires: %{name}-mpich2%{?_isa} = %{version}-%{release}
+ Requires: mpich2
 -Requires: gcc-gfortran%{_isa}
+ Requires: pkgconfig
+ Requires: hdf5-mpich2-devel
+ Requires: libcurl-devel
+ 
+ %description mpich2-devel
+ NetCDF parallel mpich2 development files
+ 
+ 
+ %package mpich2-static
+ Summary: NetCDF mpich2 static libraries
+ Group: Development/Libraries
+ Requires: %{name}-mpich2-devel%{?_isa} = %{version}-%{release}
+ 
+ %description mpich2-static
+ NetCDF parallel mpich2 static libraries
+ %endif
+ 
+ 
+ %if %{with_openmpi}
+ %package openmpi
+ Summary: NetCDF openmpi libraries
+ Group: Development/Libraries
+ Requires: openmpi
+ BuildRequires: openmpi-devel
+ BuildRequires: hdf5-openmpi-devel >= 1.8.4
+ 
+ %description openmpi
+ NetCDF parallel openmpi libraries
+ 
+ 
+ %package openmpi-devel
+ Summary: NetCDF openmpi development files
+ Group: Development/Libraries
+ Requires: %{name}-openmpi%{_isa} = %{version}-%{release}
+ Requires: openmpi-devel
 -Requires: gcc-gfortran%{_isa}
+ Requires: pkgconfig
+ Requires: hdf5-openmpi-devel
+ Requires: libcurl-devel
+ 
+ %description openmpi-devel
+ NetCDF parallel openmpi development files
+ 
+ 
+ %package openmpi-static
+ Summary: NetCDF openmpi static libraries
+ Group: Development/Libraries
+ Requires: %{name}-openmpi-devel%{?_isa} = %{version}-%{release}
+ 
+ %description openmpi-static
+ NetCDF parallel openmpi static libraries
+ %endif
+ 
+ 
  %prep
 -%setup -q
 +%setup -q -n %{name}-%{version}-rc2
  %patch0 -p1 -b .pkgconfig
  %patch1 -p1 -b .fflags
  
  
  %build
- %configure \
-            --enable-shared \
-            --enable-netcdf-4 \
-            --enable-dap \
-            --enable-extra-example-tests \
-            --disable-dap-remote-tests
+ #Do out of tree builds
+ %global _configure ../configure
+ #Common configure options
+ %global configure_opts \\\
+            --enable-shared \\\
+            --enable-netcdf-4 \\\
+            --enable-dap \\\
 -           --enable-ncgen4 \\\
+            --enable-extra-example-tests \\\
+            --disable-dap-remote-tests \\\
+ %{nil}
+ 
+ # Serial build
 -export F77="gfortran"
 -export FC="gfortran"
 -export FFLAGS="${RPM_OPT_FLAGS}"
 -export FCFLAGS="$FFLAGS"
+ mkdir build
+ pushd build
+ ln -s ../configure .
+ %configure %{configure_opts}
  make %{?_smp_mflags}
+ popd
+ 
+ # MPI builds
+ export CC=mpicc
 -export CXX=mpicxx
 -export F77=mpif90
 -export FC=mpif90
 -# netcdf gets confused about Fortran type
 -export CPPFLAGS=-DpgiFortran
+ for mpi in %{mpi_list}
+ do
+   mkdir $mpi
+   pushd $mpi
+   module load $mpi-%{_arch}
+   ln -s ../configure .
+   %configure %{configure_opts} \
+     --libdir=%{_libdir}/$mpi/lib \
+     --bindir=%{_libdir}/$mpi/bin \
+     --sbindir=%{_libdir}/$mpi/sbin \
+     --includedir=%{_includedir}/$mpi-%{_arch} \
+     --datarootdir=%{_libdir}/$mpi/share \
+     --mandir=%{_libdir}/$mpi/share/man \
+     --enable-parallel-tests
+   make %{?_smp_mflags}
+   module purge
+   popd
+ done
  
  
  %install
- make install DESTDIR=${RPM_BUILD_ROOT}
+ make -C build install DESTDIR=${RPM_BUILD_ROOT}
 -mkdir -p ${RPM_BUILD_ROOT}%{_fmoddir}
 -/bin/mv ${RPM_BUILD_ROOT}%{_includedir}/*.mod  \
 -  ${RPM_BUILD_ROOT}%{_fmoddir}
  /bin/rm -f ${RPM_BUILD_ROOT}%{_libdir}/*.la
 +chrpath --delete ${RPM_BUILD_ROOT}/%{_bindir}/nc{copy,dump,gen,gen3}
+ /bin/rm -f ${RPM_BUILD_ROOT}%{_infodir}/dir
+ for mpi in %{mpi_list}
+ do
+   module load $mpi-%{_arch}
+   make -C $mpi install DESTDIR=${RPM_BUILD_ROOT}
+   rm $RPM_BUILD_ROOT/%{_libdir}/$mpi/lib/*.la
++  chrpath --delete ${RPM_BUILD_ROOT}/%{_libdir}/$mpi/bin/nc{copy,dump,gen,gen3}
+   module purge
+ done
  
  
  %check
@@@ -121,34 -287,70 +262,77 @@@ rm -rf ${RPM_BUILD_ROOT
  %{_bindir}/ncgen3
  %{_libdir}/*.so.*
  %{_mandir}/man1/*
 -%{_infodir}/*
  
  %files devel
- %defattr(-,root,root,-)
  %{_bindir}/nc-config
 -%{_includedir}/ncvalues.h
  %{_includedir}/netcdf.h
 -%{_includedir}/netcdf.hh
 -%{_includedir}/netcdf.inc
 -%{_includedir}/netcdfcpp.h
 -%{_fmoddir}/*.mod
  %{_libdir}/*.so
  %{_libdir}/pkgconfig/netcdf.pc
  %{_mandir}/man3/*
  
  %files static
- %defattr(-,root,root,-)
  %{_libdir}/*.a
  
+ %if %{with_mpich2}
+ %files mpich2
+ %doc COPYRIGHT README
+ %{_libdir}/mpich2/bin/nccopy
+ %{_libdir}/mpich2/bin/ncdump
+ %{_libdir}/mpich2/bin/ncgen
+ %{_libdir}/mpich2/bin/ncgen3
+ %{_libdir}/mpich2/lib/*.so.*
+ %doc %{_libdir}/mpich2/share/man/man1/*.1*
+ 
+ %files mpich2-devel
+ %{_libdir}/mpich2/bin/nc-config
+ %{_includedir}/mpich2-%{_arch}
+ %{_libdir}/mpich2/lib/*.so
+ %{_libdir}/mpich2/lib/pkgconfig/%{name}.pc
+ %doc %{_libdir}/mpich2/share/man/man3/*.3*
+ 
+ %files mpich2-static
+ %{_libdir}/mpich2/lib/*.a
+ %endif
+ 
+ %if %{with_openmpi}
+ %files openmpi
+ %doc COPYRIGHT README
+ %{_libdir}/openmpi/bin/nccopy
+ %{_libdir}/openmpi/bin/ncdump
+ %{_libdir}/openmpi/bin/ncgen
+ %{_libdir}/openmpi/bin/ncgen3
+ %{_libdir}/openmpi/lib/*.so.*
+ %doc %{_libdir}/openmpi/share/man/man1/*.1*
+ 
+ %files openmpi-devel
+ %{_libdir}/openmpi/bin/nc-config
+ %{_includedir}/openmpi-%{_arch}
+ %{_libdir}/openmpi/lib/*.so
+ %{_libdir}/openmpi/lib/pkgconfig/%{name}.pc
+ %doc %{_libdir}/openmpi/share/man/man3/*.3*
+ 
+ %files openmpi-static
+ %{_libdir}/openmpi/lib/*.a
+ %endif
+ 
  
  %changelog
 -* Wed Feb 1 2012 Orion Poplawski <orion at cora.nwra.com> - 4.1.3-3
++* Wed Mar 7 2012 Orion Poplawski <orion at cora.nwra.com> - 4.2-0.3.rc2
+ - Enable MPI builds
+ 
 +* Tue Mar 6 2012 Orion Poplawski <orion at cora.nwra.com> - 4.2-0.2.rc2
 +- Update to 4.2-rc2
 +- Fortran and C++ APIs are now in separate packages
 +
 +* Tue Feb 28 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 4.1.3-5
 +- Rebuilt for c++ ABI breakage
 +
 +* Fri Jan 13 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 4.1.3-4
 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 +
 +* Fri Nov 18 2011 Orion Poplawski <orion at cora.nwra.com> - 4.1.3-3
 +- Rebuild for hdf5 1.8.8, add explicit requires
 +
  * Thu Aug 11 2011 Peter Robinson <pbrobinson at fedoraproject.org> - 4.1.3-2
  - Add ARM to valgrind excludes
  


More information about the scm-commits mailing list