%if 0%{?fedora} > 12
%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])")
%{?filter_setup:
%filter_provides_in %{python_sitearch}.*\.so$
%filter_requires_in %{python_sitearch}/openmpi/mpi4py/lib-pmpi/lib.*\.so
%if 0%{?fedora} > 12 || 0%{?rhel} > 6
%filter_provides_in %{python3_sitearch}.*\.so$
%filter_requires_in %{python3_sitearch}/openmpi/mpi4py/lib-pmpi/lib.*\.so
%endif
%filter_setup
}
%global with_mpich2 1
%if 0%{?rhel}
%ifarch ppc64
%global with_mpich2 0
%endif
%endif
### TESTSUITE ###
# The testsuite currently fails only on the buildsystem, but works localy.
# So to easy enable/disable the testsuite, I introduce the following
# variables:
#
# * MPD: if '1' enable mpich2, which requires mpd to start
# * OPENMPI: if '1' enable openmpi
%global MPD 0
%global OPENMPI 0
Name: mpi4py
Version: 1.3
Release: 6%{?dist}
Summary: Python bindings of the Message Passing Interface (MPI)
Group: Development/Languages
License: BSD
URL: http://mpi4py.scipy.org
Source0: http://mpi4py.googlecode.com/files/mpi4py-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: python-devel
Provides: python2-mpi4py = %{version}-%{release}
%if 0%{?with_python3}
BuildRequires: python3-devel
%endif
Requires: %{name}-common = %{version}-%{release}
# for the testsuite: 'pwgen' is needed to create a random password
BuildRequires: pwgen
%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 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
%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: openmpi
Requires: %{name}-common = %{version}-%{release}
Summary: Python bindings of MPI, Open MPI version
Provides: python3-mpi4py-runtime = %{version}-%{release}
%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_mpich2}
%package -n python3-mpi4py-mpich2
BuildRequires: mpich2-devel
Requires: mpich2
Requires: %{name}-common = %{version}-%{release}
Summary: Python bindings of MPI, MPICH2 version
Provides: python3-mpi4py-runtime = %{version}-%{release}
%description -n python3-mpi4py-mpich2
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 MPICH2.
%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 openmpi
BuildRequires: openmpi-devel
Requires: openmpi
Requires: %{name}-common = %{version}-%{release}
Provides: python2-mpi4py-openmpi = %{version}-%{release}
Summary: Python bindings of MPI, Open MPI version
Provides: mpi4py-runtime = %{version}-%{release}
%description 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_mpich2}
%package mpich2
BuildRequires: mpich2-devel
Requires: mpich2
Requires: %{name}-common = %{version}-%{release}
Provides: python2-mpi4py-mpich2 = %{version}-%{release}
Summary: Python bindings of MPI, MPICH2 version
Provides: mpi4py-runtime = %{version}-%{release}
%description mpich2
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 MPICH2.
%endif
%prep
%setup -q
# 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
%if 0%{?with_python3}
rm -rf %{py3dir}
cp -a . %{py3dir}
%endif
%build
# Build parallel versions: set compiler variables to MPI wrappers
export CC=mpicc
export CXX=mpicxx
# Build OpenMPI version
%{_openmpi_load}
CFLAGS="%{optflags}" %{__python} setup.py build
mv build openmpi
%{_openmpi_unload}
%if %{with_mpich2}
# Build mpich2 version
%{_mpich2_load}
CFLAGS="%{optflags}" %{__python} setup.py build
mv build mpich2
%{_mpich2_unload}
%endif
%if 0%{?with_python3}
pushd %{py3dir}
# Build parallel versions: set compiler variables to MPI wrappers
export CC=mpicc
export CXX=mpicxx
# Build OpenMPI version
%{_openmpi_load}
CFLAGS="%{optflags}" %{__python3} setup.py build
mv build openmpi
%{_openmpi_unload}
%if %{with_mpich2}
# Build mpich2 version
%{_mpich2_load}
CFLAGS="%{optflags}" %{__python3} setup.py build
mv build mpich2
%{_mpich2_unload}
%endif
popd
%endif
%install
rm -rf %{buildroot}
# Install OpenMPI version
%{_openmpi_load}
mv openmpi build
%{__python} setup.py install -O1 --skip-build --root %{buildroot}
mkdir -p %{buildroot}%{python_sitearch}/openmpi
mv %{buildroot}%{python_sitearch}/%{name}/ %{buildroot}%{python_sitearch}/%{name}*.egg-info %{buildroot}%{python_sitearch}/openmpi
mv build openmpi
%{_openmpi_unload}
%if %{with_mpich2}
# Install MPICH2 version
%{_mpich2_load}
mv mpich2 build
%{__python} setup.py install -O1 --skip-build --root %{buildroot}
mkdir -p %{buildroot}%{python_sitearch}/mpich2
mv %{buildroot}%{python_sitearch}/%{name}/ %{buildroot}%{python_sitearch}/%{name}*.egg-info %{buildroot}%{python_sitearch}/mpich2
mv build mpich2
%{_mpich2_unload}
%endif
%if 0%{?with_python3}
pushd %{py3dir}
# Install OpenMPI version
%{_openmpi_load}
mv openmpi build
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
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_mpich2}
# Install MPICH2 version
%{_mpich2_load}
mv mpich2 build
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
mkdir -p %{buildroot}%{python3_sitearch}/mpich2
mv %{buildroot}%{python3_sitearch}/%{name}/ %{buildroot}%{python3_sitearch}/%{name}*.egg-info %{buildroot}%{python3_sitearch}/mpich2
mv build mpich2
%{_mpich2_unload}
%endif
popd
%endif
%check
# test openmpi?
%if 0%{?OPENMPI}
%{_openmpi_load}
PYTHONPATH=%{buildroot}%{python_sitearch}/openmpi \
mpiexec -np 1 python2 test/runtests.py
PYTHONPATH=%{buildroot}%{python_sitearch}/openmpi \
mpiexec -np 5 python2 test/runtests.py
PYTHONPATH=%{buildroot}%{python_sitearch}/openmpi \
mpiexec -np 8 python2 test/runtests.py
%{_openmpi_unload}
%endif
# test mpd?
%if 0%{?MPD}
%if %{with_mpich2}
%{_mpich2_load}
# create mpd.conf
#export MPD_CONF_FILE=mpd.conf
#echo MPD_SECRETWORD=$(pwgen -s 50 1) > mpd.conf
#chmod 600 mpd.conf
#mpd --daemon
PYTHONPATH=%{buildroot}%{python_sitearch}/mpich2 \
mpiexec.gforker -np 1 python2 test/runtests.py
PYTHONPATH=%{buildroot}%{python_sitearch}/mpich2 \
mpiexec.gforker -np 5 python2 test/runtests.py
PYTHONPATH=%{buildroot}%{python_sitearch}/mpich2 \
mpiexec.gforker -np 8 python2 test/runtests.py
#mpdallexit
# delte mpd.conf again
#rm mpd.conf
#unset MPD_CONF_FILE
%{_mpich2_unload}
%endif
%endif
%if 0%{?with_python3}
# test openmpi?
%if 0%{?OPENMPI}
%{_openmpi_load}
PYTHONPATH=%{buildroot}%{python3_sitearch}/openmpi \
mpiexec -np 1 python3 test/runtests.py
PYTHONPATH=%{buildroot}%{python3_sitearch}/openmpi \
mpiexec -np 5 python3 test/runtests.py
PYTHONPATH=%{buildroot}%{python3_sitearch}/openmpi \
mpiexec -np 8 python3 test/runtests.py
%{_openmpi_unload}
%endif
# test mpd?
%if 0%{?MPD}
%if %{with_mpich2}
%{_mpich2_load}
# create mpd.conf
#export MPD_CONF_FILE=mpd.conf
#echo MPD_SECRETWORD=$(pwgen -s 50 1) > mpd.conf
#chmod 600 mpd.conf
#mpd --daemon
PYTHONPATH=%{buildroot}%{python3_sitearch}/mpich2 \
mpiexec.gforker -np 1 python3 test/runtests.py
PYTHONPATH=%{buildroot}%{python3_sitearch}/mpich2 \
mpiexec.gforker -np 5 python3 test/runtests.py
PYTHONPATH=%{buildroot}%{python3_sitearch}/mpich2 \
mpiexec.gforker -np 8 python3 test/runtests.py
#mpdallexit
# delte mpd.conf again
#rm mpd.conf
#unset MPD_CONF_FILE
%{_mpich2_unload}
%endif
%endif # mpd disable
%endif # with_python3
%clean
rm -rf %{buildroot}
%files common
%defattr(-,root,root,-)
%doc HISTORY.txt LICENSE.txt
%files openmpi
%defattr(-,root,root,-)
%{python_sitearch}/openmpi/%{name}-%{version}-py?.?.egg-info
%{python_sitearch}/openmpi/%{name}
%if %{with_mpich2}
%files mpich2
%defattr(-,root,root,-)
%{python_sitearch}/mpich2/%{name}-%{version}-py?.?.egg-info
%{python_sitearch}/mpich2/%{name}
%endif
%if 0%{?with_python3}
%files -n python3-mpi4py-openmpi
%defattr(-,root,root,-)
%{python3_sitearch}/openmpi/%{name}-%{version}-py?.?.egg-info
%{python3_sitearch}/openmpi/%{name}
%if %{with_mpich2}
%files -n python3-mpi4py-mpich2
%defattr(-,root,root,-)
%{python3_sitearch}/mpich2/%{name}-%{version}-py?.?.egg-info
%{python3_sitearch}/mpich2/%{name}
%endif
%endif # with_python3
%files docs
%defattr(-,root,root,-)
%doc docs/* demo
%changelog
* 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