diff options
author | CoprDistGit <infra@openeuler.org> | 2025-08-06 12:22:24 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2025-08-06 12:22:24 +0000 |
commit | 64a6ef34e3f1922209d67bd7078829a56859da61 (patch) | |
tree | d50b19ba4b8f59140f4b7a0c89dbb73fb0f2eb65 | |
parent | 3b169e2a80794abbc57f4e6e10574a38651a6b96 (diff) |
automatic import of mpi4py
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | mpi4py.spec | 224 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 226 insertions, 0 deletions
@@ -0,0 +1 @@ +/mpi4py-3.1.3.tar.gz diff --git a/mpi4py.spec b/mpi4py.spec new file mode 100644 index 0000000..fd9c231 --- /dev/null +++ b/mpi4py.spec @@ -0,0 +1,224 @@ +%global with_mpich 1 + +%global MPICH 1 +%global OPENMPI 1 +# Run full testsuite or just with 1 core +%global FULLTESTS 0 + + +Name: mpi4py +Version: 3.1.3 +Release: 2 +Summary: Python bindings of the Message Passing Interface (MPI) + +License: BSD +URL: https://mpi4py.readthedocs.io/en/stable/ +Source0: https://bitbucket.org/mpi4py/mpi4py/downloads/mpi4py-%{version}.tar.gz + + +BuildRequires: python%{python3_pkgversion}-devel +BuildRequires: python%{python3_pkgversion}-setuptools +BuildRequires: python%{python3_pkgversion}-Cython >= 0.22 +# For testing +BuildRequires: python%{python3_pkgversion}-numpy +BuildRequires: python%{python3_pkgversion}-simplejson +BuildRequires: python%{python3_pkgversion}-yaml +BuildRequires: python%{python3_pkgversion}-dill +BuildRequires: environment-modules + + +%global _description %{expand: +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).} + +%description %_description + +%package docs +Summary: Documentation for %{name} +Requires: %{name}-common = %{version}-%{release} +BuildArch: noarch +%description docs +This package contains the documentation and examples for %{name}. + +%package -n python%{python3_pkgversion}-mpi4py +Requires: %{name}-common = %{version}-%{release} +Summary: Python %{python3_version} bindings of the Message Passing Interface (MPI) +%{?python_provide:%python_provide python%{python3_pkgversion}-mpi4py} +%description -n python%{python3_pkgversion}-mpi4py %_description + +%package -n python%{python3_pkgversion}-mpi4py-openmpi +BuildRequires: openmpi-devel +Requires: %{name}-common = %{version}-%{release} +Requires: python%{python3_pkgversion}-openmpi%{?_isa} +Summary: Python %{python3_version} bindings of MPI, Open MPI version +Provides: python%{python3_pkgversion}-mpi4py-runtime = %{version}-%{release} +%{?python_provide:%python_provide python%{python3_pkgversion}-mpi4py-openmpi} +%description -n python%{python3_pkgversion}-mpi4py-openmpi %_description + +This package contains %{name} compiled against Open MPI. + + +%if %{with_mpich} +%package -n python%{python3_pkgversion}-mpi4py-mpich +BuildRequires: mpich-devel +Requires: %{name}-common = %{version}-%{release} +Requires: python%{python3_pkgversion}-mpich%{?_isa} +Summary: Python %{python3_version} bindings of MPI, MPICH version +Provides: python%{python3_pkgversion}-mpi4py-runtime = %{version}-%{release} +Provides: python%{python3_pkgversion}-%{name}-mpich2 = %{version}-%{release} +Obsoletes: python%{python3_pkgversion}-%{name}-mpich2 < 1.3-8 +%{?python_provide:%python_provide python%{python3_pkgversion}-mpi4py-mpich} +%description -n python%{python3_pkgversion}-mpi4py-mpich %_description + +This package contains %{name} compiled against MPICH. +%endif + +%package common +Summary: Common files for mpi4py packages +BuildArch: noarch +Requires: %{name}-common = %{version}-%{release} +%description common +This package contains the license file shared between the subpackages of %{name}. + + +%prep +%autosetup -p1 %{?commit:-n %{name}-%{name}-%{shortcommit}} +# 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 + +# Save current src/__init__.py for mpich +cp src/mpi4py/__init__.py .__init__mpich.py +cp src/mpi4py/__init__.py .__init__openmpi.py + +# Remove precythonized C sources +rm $(grep -rl '/\* Generated by Cython') + + +%build +# Build parallel versions: set compiler variables to MPI wrappers +export CC=mpicc +export CXX=mpicxx + +# Build OpenMPI version +%{_openmpi_load} +ompi_info +cp .__init__openmpi.py src/mpi4py/__init__.py +%py3_build +mv build openmpi +%{_openmpi_unload} + +%if %{with_mpich} +# Build mpich version +%{_mpich_load} +cp .__init__mpich.py src/mpi4py/__init__.py +%py3_build +mv build mpich +%{_mpich_unload} +%endif + + + +%install +# Install OpenMPI version +%{_openmpi_load} +cp .__init__openmpi.py src/mpi4py/__init__.py +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} +cp .__init__mpich.py src/mpi4py/__init__.py +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 + +%check +# test openmpi? +%if 0%{?OPENMPI} +%{_openmpi_load} +cp .__init__openmpi.py src/mpi4py/__init__.py +mv openmpi build +PYTHONPATH=%{buildroot}%{python3_sitearch}/openmpi \ + mpiexec -np 1 python3 test/runtests.py -v --no-builddir \ + -e spawn \ +%ifarch ppc64le + -e test_datatype +%endif + + +%if 0%{?FULLTESTS} +# Allow running with more processes than cores +export OMPI_MCA_rmaps_base_oversubscribe=1 +PYTHONPATH=%{buildroot}%{python3_sitearch}/openmpi \ + mpiexec -np 5 python3 test/runtests.py -v --no-builddir -e spawn +PYTHONPATH=%{buildroot}%{python3_sitearch}/openmpi \ + mpiexec -np 8 python3 test/runtests.py -v --no-builddir -e spawn +%endif +mv build openmpi +%{_openmpi_unload} +%endif + +#test mpich? +%if 0%{?MPICH} +%if %{with_mpich} +%{_mpich_load} +cp .__init__mpich.py src/mpi4py/__init__.py +mv mpich build +PYTHONPATH=%{buildroot}%{python3_sitearch}/mpich \ + mpiexec -np 1 python3 test/runtests.py -v --no-builddir -e spawn +%if 0%{?FULLTESTS} +PYTHONPATH=%{buildroot}%{python3_sitearch}/mpich \ + mpiexec -np 5 python3 test/runtests.py -v --no-builddir -e spawn +PYTHONPATH=%{buildroot}%{python3_sitearch}/mpich \ + mpiexec -np 8 python3 test/runtests.py -v --no-builddir -e spawn +%endif +mv build mpich +%{_mpich_unload} +%endif +%endif + + + +%files common +%license LICENSE.rst +%doc CHANGES.rst DESCRIPTION.rst README.rst + +%files -n python%{python3_pkgversion}-mpi4py-openmpi +%{python3_sitearch}/openmpi/%{name}-*.egg-info +%{python3_sitearch}/openmpi/%{name} + +%if %{with_mpich} +%files -n python%{python3_pkgversion}-mpi4py-mpich +%{python3_sitearch}/mpich/%{name}-*.egg-info +%{python3_sitearch}/mpich/%{name} +%endif + +%files docs +%doc docs/* demo + +%changelog +* Fri Apr 15 2022 tanyulong <tanyulong@kylinos.cn> - 3.1.3-2 +- rebuild + +* Thu Mar 24 2022 tanyulong <tanyulong@kylinos.cn> - 3.1.3-1 +- init package for openEuler @@ -0,0 +1 @@ +e6d0644a2a3c7aa5119825d35ebeb8ee mpi4py-3.1.3.tar.gz |