File mvapich2-psm.spec of Package mvapich2.4642

#
# spec file for package mvapich2-psm
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


#############################################################################
#                                                                           #
# NOTE: If you modify this spec file, or the .changes file you MUST run     #
#       'bash ./pre_checkin.sh' to create spec and changes for              #
#       mvapich2-testuite.                                                  #
#                                                                           #
#############################################################################

%define rc_ver rc1

Name:           mvapich2-psm
Summary:        OSU MVAPICH2 MPI package
License:        BSD-3-Clause
Group:          Development/Libraries/Parallel
Version:        2.2
Release:        0
Source0:        http://mvapich.cse.ohio-state.edu/download/mvapich2/mv2/mvapich2-%{version}%{?rc_ver}.tar.gz
Source1:        mpivars.sh
Source2:        mpivars.csh
Patch0:         mvapich-s390_get_cycles.patch
Patch1:         mvapich2-pthread_yield.patch
Url:            http://mvapich.cse.ohio-state.edu/overview/mvapich2/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  autoconf
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  automake
BuildRequires:  bison
BuildRequires:  gcc-c++
BuildRequires:  gcc-fortran
BuildRequires:  libibmad-devel
BuildRequires:  libibumad-devel
BuildRequires:  libibverbs-devel
%ifnarch s390 s390x
BuildRequires:  libnuma-devel
%endif
BuildRequires:  librdmacm-devel
BuildRequires:  libtool
BuildRequires:  libtool
BuildRequires:  mpi-selector
BuildRequires:  python-devel
BuildRequires:  sysfsutils
BuildRequires:  xorg-x11-devel
# mvapich needs asm/timex.h which seems to be missing from the glibc kernel headers
ExcludeArch:    aarch64

%if "%{name}" == "mvapich2-psm"
ExclusiveArch:  %ix86 x86_64
BuildRequires:  infinipath-psm-devel
Conflicts:      mvapich2 <= %{version}-%{release}
Conflicts:      mvapich2-psm2 <= %{version}-%{release}
%endif
%if "%{name}" == "mvapich2-psm2"
ExclusiveArch:  x86_64
Conflicts:      mvapich2 <= %{version}-%{release}
Conflicts:      mvapich2-psm <= %{version}-%{release}
BuildRequires:  libpsm2-devel
%endif
%if  "%{name}" == "mvapich2"
Conflicts:      mvapich2-psm <= %{version}-%{release}
Conflicts:      mvapich2-psm2 <= %{version}-%{release}
%endif

Requires:       mpi-selector

%define _prefix /usr/%_lib/mpi/gcc/mvapich2
%define _libexecdir %{_prefix}/%{_lib}
%define _benchmarkdir %{_libexecdir}/osu-micro-benchmarks

%description
This is an MPI-3 implementation which includes all MPI-1 features. It
is based on MPICH2 and MVICH.

%if "%{name}" == "mvapich2" || "%{name}" == "mvapich2-psm" || "%{name}" == "mvapich2-psm2"

%package        devel
Summary:        OSU MVAPICH2 MPI package
Group:          Development/Libraries/Parallel
Requires:       %{name} = %{version}
Requires:       libibumad-devel
Requires:       libibverbs-devel
Requires:       librdmacm-devel
%if "%{name}" == "mvapich2-psm"
Requires:       infinipath-psm-devel
Conflicts:      mvapich2-devel <= %{version}-%{release}
Conflicts:      mvapich2-psm2-devel <= %{version}-%{release}
%endif
%if "%{name}" == "mvapich2-psm2"
Conflicts:      mvapich2-devel <= %{version}-%{release}
Conflicts:      mvapich2-psm-devel <= %{version}-%{release}
Requires:       libpsm2-devel
%endif
%if  "%{name}" == "mvapich2"
Conflicts:      mvapich2-psm-devel <= %{version}-%{release}
Conflicts:      mvapich2-psm2-devel <= %{version}-%{release}
%endif

%description devel
This is an MPI-2 implementation which includes all MPI-1 features.  It
is based on MPICH2 and MVICH.



%package        devel-static
Summary:        OSU MVAPICH2 MPI package - static libraries
Group:          Development/Libraries/Parallel
Requires:       %{name}-devel = %{version}

%description devel-static
This is an MPI-3 implementation which includes all MPI-1 and MPI-2 features.  It
is based on MPICH2 and MVICH. This package contains the static libraries

%if "%{name}" == "mvapich2-psm"
Conflicts:      mvapich2-devel-static <= %{version}-%{release}
Conflicts:      mvapich2-psm2-devel-static <= %{version}-%{release}
%endif
%if "%{name}" == "mvapich2-psm2"
Conflicts:      mvapich2-devel-static <= %{version}-%{release}
Conflicts:      mvapich2-psm-devel-static <= %{version}-%{release}
%endif
%if  "%{name}" == "mvapich2"
Conflicts:      mvapich2-psm-devel-static <= %{version}-%{release}
Conflicts:      mvapich2-psm2-devel-static <= %{version}-%{release}
%endif
%endif

%prep
%setup -q -n mvapich2-%{version}%{?rc_ver}
%patch0
%patch1
cp /usr/share/automake*/config.* .

%build
#./autogen.sh
%configure  --prefix=%_prefix --libdir=%_libdir --mandir=%_mandir --sysconfdir=%_sysconfdir --libexecdir=%{_libexecdir} \
%if "%{name}" == "mvapich2-psm"
   --with-device=ch3:psm \
   --with-psm=/usr/ \
%endif
%if "%{name}" == "mvapich2-psm2"
   --with-device=ch3:psm \
   --with-psm2=/usr/ \
%endif
    --enable-shared --without-mpe --disable-silent-rules
make %{?_smp_mflags}

%if "%{name}" == "mvapich2-testsuite"
%check
make check
%endif

%install
make DESTDIR=%{buildroot} install
# make and install mpivars files
sed 's,prefix,%_prefix,g' %{S:1} > %{buildroot}%{_bindir}/mpivars.sh
sed 's,prefix,%_prefix,g' %{S:2} > %{buildroot}%{_bindir}/mpivars.csh
rm -f %{buildroot}%{_libdir}/libfmpich.la \
      %{buildroot}%{_libdir}/libmpich.la \
      %{buildroot}%{_libdir}/libmpichcxx.la \
      %{buildroot}%{_libdir}/libmpichf90.la \
      %{buildroot}%{_libdir}/libmpl.la \
      %{buildroot}%{_libdir}/libopa.la \
      %{buildroot}%{_libdir}/libmpi.la \
      %{buildroot}%{_libdir}/libmpicxx.la \
      %{buildroot}%{_libdir}/libmpifort.la 

%if "%{name}" == "mvapich2-testsuite"
rm -rf %{buildroot}%{_libdir}/pkgconfig
rm -rf %{buildroot}%{_includedir}
rm -rf %{buildroot}%{_mandir}/man3/*
rm -rf %{buildroot}%{_libdir}/*.so
rm -rf %{buildroot}%{_libdir}/pkgconfig/mvapich2.pc
rm -rf %{buildroot}%{_libdir}/pkgconfig/openpa.pc

rm -rf %{buildroot}%{_libdir}/*.a
%else
mkdir -p %{buildroot}/usr/share/modules/gnu-mvapich2

cat << EOF > %{buildroot}/usr/share/modules/gnu-mvapich2/%{version}
#%%Module
proc ModulesHelp { } {
        global dotversion
        puts stderr "\tLoads the gnu - mvapich2 %{version}  Environment"
}

module-whatis  "Loads the gnu mvapich2 %{version} Environment."
conflict gnu-mvapich2
prepend-path PATH %{_bindir}
prepend-path INCLUDE %{_includedir}
prepend-path INCLUDE %{_libdir}
prepend-path MANPATH %{_mandir}
prepend-path LD_LIBRARY_PATH %{_libdir}

EOF

cat << EOF > %{buildroot}/usr/share/modules/gnu-mvapich2/.version
#%%Module1.0
set ModulesVersion "%{version}"

EOF
%endif

install -m 0644 COPYRIGHT* %{buildroot}%{_datadir}/doc/mvapich2
install -m 0644 CHANGE* %{buildroot}%{_datadir}/doc/mvapich2

%post
/sbin/ldconfig
/usr/bin/mpi-selector \
        --register %{name}-%{version} \
        --source-dir %{_bindir} \
        --yes

%postun
/sbin/ldconfig
/usr/bin/mpi-selector --unregister %{name}-%{version} --yes --silent

%files
%defattr(-, root, root)
%doc %{_datadir}/doc
%dir /usr/%_lib/mpi
%dir /usr/%_lib/mpi/gcc
%dir /usr/%_lib/mpi/gcc/mvapich2
%dir %{_prefix}
%dir %{_bindir}
%dir %{_datadir}
%if "%{name}" == "mvapich2" || "%{name}" == "mvapich2-psm" || "%{name}" == "mvapich2-psm2"
%dir /usr/share/modules
%endif
%if "%{name}" == "mvapich2"
%dir %{_includedir}
%endif
%dir %{_mandir}
%dir %{_mandir}/man1
%dir %{_mandir}/man3
%dir %{_libdir}
%dir %{_libdir}
%{_bindir}/*
%{_benchmarkdir}
%if "%{name}" == "mvapich2" || "%{name}" == "mvapich2-psm" || "%{name}" == "mvapich2-psm2"
/usr/share/modules/gnu-mvapich2
%endif

%{_mandir}/man1/*
%{_libdir}/*.so.*

%if "%{name}" == "mvapich2" || "%{name}" == "mvapich2-psm" || "%{name}" == "mvapich2-psm2"
%files devel
%defattr(-,root,root)
%dir %{_libdir}/pkgconfig
%{_mandir}/man3/*
%{_includedir}
%{_libdir}/*.so
%{_libdir}/pkgconfig/mvapich2.pc
%{_libdir}/pkgconfig/openpa.pc

%files devel-static
%defattr(-,root,root)
%{_libdir}/*.a

%endif

%changelog
openSUSE Build Service is sponsored by