Blob Blame History Raw
%if 0%{?fedora}
%global with_python3 1
%endif

%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
%global python3_version %(%{__python3} -c "import sys; sys.stdout.write(sys.version[:3])")

%global __provides_exclude_from %{python2_sitearch}.*\.so$|%{python3_sitearch}.*\.so$

%global with_mpich 1
%if 0%{?rhel} && 0%{?rhel} <= 6 || 0%{?fedora} && 0%{?fedora} < 20
%ifarch ppc64
%global with_mpich 0
%endif
%endif

### TESTSUITE ###
# The testsuite currently fails only on the buildsystem, but works localy.
# So to easy enable/disable the testsuite, the following variables are
# introduced:
#
# * MPICH:     if '1' enable mpich
# * OPENMPI:   if '1' enable openmpi
%ifarch %{arm}
# Disable tests on arm until upstream bug is fixed:
# https://bitbucket.org/mpi4py/mpi4py/issues/29/get_address-fails-on-arm
%global MPICH 0
%global OPENMPI 0
%else
%global MPICH 1
%global OPENMPI 1
%endif
# Run full testsuite or just with 1 core
%global FULLTESTS 0

Name:           mpi4py
Version:        2.0.0
Release:        6%{?dist}
Summary:        Python bindings of the Message Passing Interface (MPI)

Group:          Development/Languages
License:        BSD
URL:            http://pythonhosted.org/mpi4py/
Source0:        https://bitbucket.org/mpi4py/mpi4py/downloads/mpi4py-%{version}.tar.gz
Patch0:         mpi4py-2.0.0-fix-dl-open.patch

BuildRequires:  python-devel
Provides:       python2-mpi4py = %{version}-%{release}
%if 0%{?with_python3}
BuildRequires:  python3-devel
%endif
Requires:       %{name}-common = %{version}-%{release}



%description
This package is constructed on top of the MPI-1/MPI-2 specification and
provides an object oriented interface which closely follows MPI-2 C++
bindings. It supports point-to-point (sends, receives) and collective
(broadcasts, scatters, gathers) communications of any picklable Python
object as well as optimized communications of Python object exposing the
single-segment buffer interface (NumPy arrays, built-in bytes/string/array
objects).

%package -n python2-mpi4py
Requires:       %{name}-common = %{version}-%{release}
Summary:        Python bindings of the Message Passing Interface (MPI)
Group:          Development/Languages
%{?python_provide:%python_provide python2-mpi4py}
%description -n python2-mpi4py
This package is constructed on top of the MPI-1/MPI-2 specification and
provides an object oriented interface which closely follows MPI-2 C++
bindings. It supports point-to-point (sends, receives) and collective
(broadcasts, scatters, gathers) communications of any picklable Python
object as well as optimized communications of Python object exposing the
single-segment buffer interface (NumPy arrays, built-in bytes/string/array
objects).

%package docs
Summary:        Documentation for %{name}
Group:          Documentation
Requires:       %{name}-common = %{version}-%{release}
BuildArch:      noarch
%description docs
This package contains the documentation and examples for %{name}.

%if 0%{?with_python3}
%package -n python3-mpi4py
Requires:       %{name}-common = %{version}-%{release}
Summary:        Python bindings of the Message Passing Interface (MPI)
Group:          Development/Languages
%{?python_provide:%python_provide python3-mpi4py}
%description -n python3-mpi4py
This package is constructed on top of the MPI-1/MPI-2 specification and
provides an object oriented interface which closely follows MPI-2 C++
bindings. It supports point-to-point (sends, receives) and collective
(broadcasts, scatters, gathers) communications of any picklable Python
object as well as optimized communications of Python object exposing the
single-segment buffer interface (NumPy arrays, built-in bytes/string/array
objects).

%package -n python3-mpi4py-openmpi
BuildRequires:  openmpi-devel
Requires:       %{name}-common = %{version}-%{release}
Summary:        Python bindings of MPI, Open MPI version
Provides:       python3-mpi4py-runtime = %{version}-%{release}
%{?python_provide:%python_provide python3-mpi4py-openmpi}
%description -n python3-mpi4py-openmpi
This package is constructed on top of the MPI-1/MPI-2 specification and
provides an object oriented interface which closely follows MPI-2 C++
bindings. It supports point-to-point (sends, receives) and collective
(broadcasts, scatters, gathers) communications of any picklable Python
object as well as optimized communications of Python object exposing the
single-segment buffer interface (NumPy arrays, built-in bytes/string/array
objects).

This package contains %{name} compiled against Open MPI.


%if %{with_mpich}
%package -n python3-mpi4py-mpich
BuildRequires:  mpich-devel
Requires:       %{name}-common = %{version}-%{release}
Summary:        Python bindings of MPI, MPICH version
Provides:       python3-mpi4py-runtime = %{version}-%{release}
Provides:       python3-%{name}-mpich2 = %{version}-%{release}
Obsoletes:      python3-%{name}-mpich2 < 1.3-8
%{?python_provide:%python_provide python3-mpi4py-mpich}
%description -n python3-mpi4py-mpich
This package is constructed on top of the MPI-1/MPI-2 specification and
provides an object oriented interface which closely follows MPI-2 C++
bindings. It supports point-to-point (sends, receives) and collective
(broadcasts, scatters, gathers) communications of any picklable Python
object as well as optimized communications of Python object exposing the
single-segment buffer interface (NumPy arrays, built-in bytes/string/array
objects).

This package contains %{name} compiled against MPICH.
%endif
%endif # with_python3

%package common
Summary:        Common files for mpi4py packages
Group:          Documentation
BuildArch:      noarch
Requires:       %{name}-common = %{version}-%{release}
%description common
This package contains the license file shard between the subpackages of %{name}.

%package -n python2-mpi4py-openmpi
BuildRequires:  openmpi-devel
Requires:       %{name}-common = %{version}-%{release}
Provides:       python2-mpi4py-openmpi = %{version}-%{release}
Summary:        Python bindings of MPI, Open MPI version
Provides:       mpi4py-runtime = %{version}-%{release}
# Old mpi4py-foo provides added at F24
Provides:       mpi4py-openmpi = %{version}-%{release}
Obsoletes:      mpi4py-openmpi < 1.3.1-16
%{?python_provide:%python_provide python2-mpi4py-openmpi}
%description -n python2-mpi4py-openmpi
This package is constructed on top of the MPI-1/MPI-2 specification and
provides an object oriented interface which closely follows MPI-2 C++
bindings. It supports point-to-point (sends, receives) and collective
(broadcasts, scatters, gathers) communications of any picklable Python
object as well as optimized communications of Python object exposing the
single-segment buffer interface (NumPy arrays, built-in bytes/string/array
objects).

This package contains %{name} compiled against Open MPI.


%if %{with_mpich}
%package -n python2-mpi4py-mpich
BuildRequires:  mpich-devel
Requires:       %{name}-common = %{version}-%{release}
Provides:       python2-mpi4py-mpich = %{version}-%{release}
Summary:        Python bindings of MPI, MPICH version
Provides:       mpi4py-runtime = %{version}-%{release}
Provides:       %{name}-mpich2 = %{version}-%{release}
Obsoletes:      %{name}-mpich2 < 1.3-8
Provides:       mpi4py-mpich = %{version}-%{release}
Obsoletes:      mpi4py-mpich < 1.3.1-16
%{?python_provide:%python_provide python2-mpi4py-mpich}
%description -n python2-mpi4py-mpich
This package is constructed on top of the MPI-1/MPI-2 specification and
provides an object oriented interface which closely follows MPI-2 C++
bindings. It supports point-to-point (sends, receives) and collective
(broadcasts, scatters, gathers) communications of any picklable Python
object as well as optimized communications of Python object exposing the
single-segment buffer interface (NumPy arrays, built-in bytes/string/array
objects).

This package contains %{name} compiled against MPICH.
%endif


%prep
%setup -q
%patch0 -p1
# delete docs/source
# this is just needed to generate docs/*
rm -r docs/source

# work around "wrong-file-end-of-line-encoding"
for file in $(find | grep runtests.bat); do
    sed -i 's/\r//' $file
done


%build
# Build parallel versions: set compiler variables to MPI wrappers
export CC=mpicc
export CXX=mpicxx

# Build OpenMPI version
%{_openmpi_load}
%py2_build
mv build openmpi
%{_openmpi_unload}

%if %{with_mpich}
# Build mpich version
%{_mpich_load}
%py2_build
mv build mpich
%{_mpich_unload}
%endif

%if 0%{?with_python3}
# Build parallel versions: set compiler variables to MPI wrappers
export CC=mpicc
export CXX=mpicxx

# Build OpenMPI version
%{_openmpi_load}
mv openmpi build
%py3_build
mv build openmpi
%{_openmpi_unload}

%if %{with_mpich}
# Build mpich version
%{_mpich_load}
mv mpich build
%py3_build
mv build mpich
%{_mpich_unload}
%endif

%endif


%install
rm -rf %{buildroot}
# Install OpenMPI version
%{_openmpi_load}
mv openmpi build
%py2_install
mkdir -p %{buildroot}%{python2_sitearch}/openmpi
mv %{buildroot}%{python2_sitearch}/%{name}/ %{buildroot}%{python2_sitearch}/%{name}*.egg-info %{buildroot}%{python2_sitearch}/openmpi
mv build openmpi
%{_openmpi_unload}

%if %{with_mpich}
# Install MPICH version
%{_mpich_load}
mv mpich build
%py2_install
mkdir -p %{buildroot}%{python2_sitearch}/mpich
mv %{buildroot}%{python2_sitearch}/%{name}/ %{buildroot}%{python2_sitearch}/%{name}*.egg-info %{buildroot}%{python2_sitearch}/mpich
mv build mpich
%{_mpich_unload}
%endif


%if 0%{?with_python3}
# Install OpenMPI version
%{_openmpi_load}
mv openmpi build
%py3_install
mkdir -p %{buildroot}%{python3_sitearch}/openmpi
mv %{buildroot}%{python3_sitearch}/%{name}/ %{buildroot}%{python3_sitearch}/%{name}*.egg-info %{buildroot}%{python3_sitearch}/openmpi
mv build openmpi
%{_openmpi_unload}

%if %{with_mpich}
# Install MPICH version
%{_mpich_load}
mv mpich build
%py3_install
mkdir -p %{buildroot}%{python3_sitearch}/mpich
mv %{buildroot}%{python3_sitearch}/%{name}/ %{buildroot}%{python3_sitearch}/%{name}*.egg-info %{buildroot}%{python3_sitearch}/mpich
mv build mpich
%{_mpich_unload}
%endif

%endif


%check
# test openmpi?
%if 0%{?OPENMPI}
%{_openmpi_load}
mv openmpi build
PYTHONPATH=%{buildroot}%{python2_sitearch}/openmpi \
    mpiexec -np 1 python2 test/runtests.py -v --no-threads
%if 0%{?FULLTESTS}
PYTHONPATH=%{buildroot}%{python2_sitearch}/openmpi \
    mpiexec -np 5 python2 test/runtests.py -v --no-threads
PYTHONPATH=%{buildroot}%{python2_sitearch}/openmpi \
    mpiexec -np 8 python2 test/runtests.py -v --no-threads
%endif
mv build openmpi
%{_openmpi_unload}
%endif

# test mpich?
%if 0%{?MPICH}
%if %{with_mpich}
%{_mpich_load}
mv mpich build
PYTHONPATH=%{buildroot}%{python2_sitearch}/mpich \
    mpiexec -np 1 python2 test/runtests.py -v
%if 0%{?FULLTESTS}
PYTHONPATH=%{buildroot}%{python2_sitearch}/mpich \
    mpiexec -np 5 python2 test/runtests.py -v
PYTHONPATH=%{buildroot}%{python2_sitearch}/mpich \
    mpiexec -np 8 python2 test/runtests.py -v
%endif
mv build mpich
%{_mpich_unload}
%endif
%endif

%if 0%{?with_python3}
# test openmpi?
%if 0%{?OPENMPI}
%{_openmpi_load}
mv openmpi build
PYTHONPATH=%{buildroot}%{python3_sitearch}/openmpi \
    mpiexec -np 1 python3 test/runtests.py -v --no-threads
%if 0%{?FULLTESTS}
PYTHONPATH=%{buildroot}%{python3_sitearch}/openmpi \
    mpiexec -np 5 python3 test/runtests.py -v --no-threads
PYTHONPATH=%{buildroot}%{python3_sitearch}/openmpi \
    mpiexec -np 8 python3 test/runtests.py -v --no-threads
%endif
mv build openmpi
%{_openmpi_unload}
%endif

# test mpich?
%if 0%{?MPICH}
%if %{with_mpich}
%{_mpich_load}
mv mpich build
PYTHONPATH=%{buildroot}%{python3_sitearch}/mpich \
    mpiexec -np 1 python3 test/runtests.py -v
%if 0%{?FULLTESTS}
PYTHONPATH=%{buildroot}%{python3_sitearch}/mpich \
    mpiexec -np 5 python3 test/runtests.py -v
PYTHONPATH=%{buildroot}%{python3_sitearch}/mpich \
    mpiexec -np 8 python3 test/runtests.py -v
%endif
mv build mpich
%{_mpich_unload}
%endif
%endif # mpich disable
%endif # with_python3

%clean
rm -rf %{buildroot}


%files common
%doc CHANGES.rst DESCRIPTION.rst README.rst LICENSE.rst

%files -n python2-mpi4py-openmpi
%{python2_sitearch}/openmpi/%{name}-%{version}-py?.?.egg-info
%{python2_sitearch}/openmpi/%{name}

%if %{with_mpich}
%files -n python2-mpi4py-mpich
%{python2_sitearch}/mpich/%{name}-%{version}-py?.?.egg-info
%{python2_sitearch}/mpich/%{name}
%endif

%if 0%{?with_python3}
%files -n python3-mpi4py-openmpi
%{python3_sitearch}/openmpi/%{name}-%{version}-py?.?.egg-info
%{python3_sitearch}/openmpi/%{name}

%if %{with_mpich}
%files -n python3-mpi4py-mpich
%{python3_sitearch}/mpich/%{name}-%{version}-py?.?.egg-info
%{python3_sitearch}/mpich/%{name}
%endif
%endif  # with_python3

%files docs
%doc docs/* demo


%changelog
* Fri Oct 21 2016 Orion Poplawski <orion@cora.nwra.com> - 2.0.0-6
- Rebuild for openmpi 2.0

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0-5
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Thu Nov 12 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0.0-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5

* Mon Nov 9 2015 Orion Poplawski <orion@cora.nwra.com> - 2.0.0-2
- Bump obsoletes

* Sat Oct 24 2015 Thomas Spura <tomspur@fedoraproject.org> - 2.0.0-1
- update to 2.0.0

* Wed Oct 14 2015 Thomas Spura <tomspur@fedoraproject.org> - 1.3.1-16
- Rename mpi4py packages to python2-mpi4py

* Tue Sep 15 2015 Orion Poplawski <orion@cora.nwra.com> - 1.3.1-15
- Rebuild for openmpi 1.10.0

* Tue Aug 18 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.3.1-14
- Rebuild for rpm-mpi-hooks-3-2

* Mon Aug 17 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.3.1-13
- Rebuild for rpm-mpi-hooks-3-1

* Sat Aug 15 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 1.3.1-12
- Remove requires filtering... not necessary anymore

* Mon Aug 10 2015 Sandro Mani <manisandro@gmail.com> - 1.3.1-11
- Rebuild for RPM MPI Requires Provides Change

* Wed Jul 29 2015 Karsten Hopp <karsten@redhat.com> 1.3.1-10
- mpich is available on ppc64 now

* Mon Jun 29 2015 Thomas Spura <tomspur@fedoraproject.org> - 1.3.1-9
- Use new py_build/install macros

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sat Mar 14 2015 Thomas Spura <tomspur@fedoraproject.org> - 1.3.1-7
- remove %%py3dir
- use python2 macros instead of unversioned ones

* Thu Mar 12 2015 Thomas Spura <tomspur@fedoraproject.org> - 1.3.1-6
- Rebuild for changed mpich libraries

* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Fri May 9 2014 Orion Poplawski <orion@cora.nwra.com> - 1.3.1-3
- Rebuild for Python 3.4

* Mon Feb 24 2014 Thomas Spura <tomspur@fedoraproject.org> - 1.3.1-2
- Rebuilt for new mpich-3.1

* Thu Aug  8 2013 Thomas Spura <tomspur@fedoraproject.org> - 1.3.1-1
- update to 1.3.1

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Sat Jul 20 2013 Deji Akingunola <dakingun@gmail.com> - 1.3-8
- Rename mpich2 sub-packages to mpich and rebuild for mpich-3.0

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Wed Nov 14 2012 Thomas Spura <tomspur@fedoraproject.org> - 1.3-6
- rebuild for newer mpich2

* Sat Aug  4 2012 Thomas Spura <tomspur@fedoraproject.org> - 1.3-5
- conditionalize mpich2 support, there is no mpich2 on el6-ppc64

* Fri Aug 03 2012 David Malcolm <dmalcolm@redhat.com> - 1.3-4
- rebuild for https://fedoraproject.org/wiki/Features/Python_3.3

* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Wed Jan 25 2012 Thomas Spura <tomspur@fedoraproject.org> - 1.3-2
- filter requires in pysitearch/openmpi/mpi4py/lib-pmpi/lib (#741104)

* Fri Jan 20 2012 Thomas Spura <tomspur@fedoraproject.org> - 1.3-1
- update to 1.3
- filter provides in pythonsitearch
- run tests differently

* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.2-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Wed Mar 30 2011 Deji Akingunola <dakingun@gmail.com> - 1.2.2-6
- Rebuild for mpich2 soname bump

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.2-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Wed Dec 29 2010  David Malcolm <dmalcolm@redhat.com> - 1.2.2-4
- rebuild for newer python3

* Tue Oct 19 2010 Thomas Spura <tomspur@fedoraproject.org> - 1.2.2-3
- rebuild for new mpich2 and openmpi versions

* Wed Sep 29 2010 jkeating - 1.2.2-2
- Rebuilt for gcc bug 634757

* Wed Sep 15 2010 Thomas Spura <tomspur@fedoraproject.org> - 1.2.2-1
- update to new version

* Sun Aug 22 2010 Thomas Spura <tomspur@fedoraproject.org> - 1.2.1-6
- rebuild with python3.2
  http://lists.fedoraproject.org/pipermail/devel/2010-August/141368.html

* Wed Jul 21 2010 David Malcolm <dmalcolm@redhat.com> - 1.2.1-5
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild

* Wed Jul  7 2010 Thomas Spura <tomspur@fedoreproject.org> - 1.2.1-4
- doc package needs to require common package, because of licensing

* Sun Apr 11 2010 Thomas Spura <tomspur@fedoraproject.org> - 1.2.1-3
- also provides python2-mpi4py-*

* Sat Feb 27 2010 Thomas Spura <tomspur@fedoraproject.org> - 1.2.1-2
- delete R on the main package in docs subpackage
  (main package is empty -> would be an unresolved dependency)

* Sat Feb 27 2010 Thomas Spura <tomspur@fedoraproject.org> - 1.2.1-1
- new version
- removing of hidden file not needed anymore (done upstream)
- fix spelling error builtin -> built-in

* Fri Feb 26 2010 Thomas Spura <tomspur@fedoraproject.org> - 1.2-7
- introduce OPENMPI and MPD macros to easy enable/disable the testsuite

* Tue Feb 16 2010 Thomas Spura <tomspur@fedoraproject.org> - 1.2-6
- don't delete *.pyx/*.pyd
- delete docs/source

* Mon Feb  8 2010 Thomas Spura <tomspur@fedoraproject.org> - 1.2-5
- disable testsuite

* Sun Feb  7 2010 Thomas Spura <tomspur@fedoraproject.org> - 1.2-4
- enable testsuite
- move huge docs into docs subpackage

* Sun Feb  7 2010 Thomas Spura <tomspur@fedoraproject.org> - 1.2-3
- delete lam building
- install to correct locations

* Sun Feb  7 2010 Thomas Spura <tomspur@fedoraproject.org> - 1.2-2
- compile for different mpi versions

* Sun Feb  7 2010 Thomas Spura <tomspur@fedoraproject.org> - 1.2-1
- initial import