[mathgl] MPI support
Dmitrij S. Kryzhevich
krege at fedoraproject.org
Wed Apr 17 08:08:34 UTC 2013
commit a24724a92f779cfd2ae8194505bf108544b67bf1
Author: Dmitrij S. Kryzhevich <krege at land.ru>
Date: Wed Apr 17 15:08:25 2013 +0700
MPI support
mathgl.spec | 255 +++++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 189 insertions(+), 66 deletions(-)
---
diff --git a/mathgl.spec b/mathgl.spec
index 57029a4..8348b08 100644
--- a/mathgl.spec
+++ b/mathgl.spec
@@ -1,36 +1,39 @@
-Name: mathgl
-Version: 2.1.2
-Release: 2%{?dist}
-Summary: Cross-platform library for making high-quality scientific graphics
-Summary(de): Plattformübergreifende Bibliothek für hochwertige wissenschaftliche Graphiken
-Summary(ru): MathGL - это библиотека для осуществления высококачественной визуализации данных
-License: GPLv2+
-Group: Development/Libraries
-Url: http://mathgl.sourceforge.net
-Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
+Name: mathgl
+Version: 2.1.2
+Release: 3%{?dist}
+Summary: Cross-platform library for making high-quality scientific graphics
+Summary(de): Plattformübergreifende Bibliothek für hochwertige wissenschaftliche Graphiken
+Summary(ru): Библиотека для осуществления высококачественной визуализации данных
+License: GPLv2+
+Group: Development/Libraries
+Url: http://mathgl.sourceforge.net
+Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
#Mathgl's enable all tries to use hdf4 and 5 at the same time
-Patch0: mathgl-no-hdf4-and-hdf5-simultaneously.patch
+Patch0: mathgl-no-hdf4-and-hdf5-simultaneously.patch
#CMake looks for "FLUID" - the fltk UI designer.
#This is not needed - instruct cmake to skip it at build time
-Patch1: mathgl-fltk-skip-fluid.patch
+Patch1: mathgl-fltk-skip-fluid.patch
#Mathgl hardcodes the libdir as lib, then puts it in a var.
# we will simply pass it as an arg to cmake.
-Patch2: mathgl-disable-lib-installdir.patch
+Patch2: mathgl-disable-lib-installdir.patch
#Fix segfault due to overflow when initalising textures
-Patch3: mathgl-fix-overflow.patch
+Patch3: mathgl-fix-overflow.patch
# Fix udav.desktop: Encoding and Icon keys
-Patch4: mathgl-2.1.2-udav_desktop.patch
+Patch4: mathgl-2.1.2-udav_desktop.patch
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+
+Requires: %{name}-common = %{version}-%{release}
# mandatory packages
BuildRequires: gsl-devel libpng-devel
BuildRequires: desktop-file-utils
+BuildRequires: cmake
# optional packages
BuildRequires: freeglut-devel hdf-devel hdf5-static libjpeg-devel libtiff-devel fltk-devel qt4-devel
@@ -39,7 +42,6 @@ BuildRequires: libharu-devel
BuildRequires: swig octave-devel
BuildRequires: libXmu-devel
BuildRequires: python2-devel numpy
-BuildRequires: cmake
Requires(post): info
@@ -60,34 +62,35 @@ Mathgl - это кроссплатформенная библиотека для
использована в FLTK, Qt и OpenGL приложениях.
%package devel
-Summary: Libraries and header files for %{name} library
-Group: Development/Libraries
-Requires: %{name} = %{version}-%{release}
-Requires: gsl-devel
+Summary: Libraries and header files for %{name} library
+Summary(ru): Библиотеки и файлы заголовков для %{name}
+Group: Development/Libraries
+Requires: %{name} = %{version}-%{release}
+Requires: gsl-devel
%description devel
The %{name}-devel package contains libraries and header files for
-developing applications that use %{name}.
+developing applications that use serial version of %{name}.
%description devel -l ru
-Пакет %{name}-devel содержит библиотеки и файлы заголовков необходимые
-для разработки приложений с использованием %{name}.
+Пакет %{name}-devel содержит библиотеки и файлы заголовков, необходимые
+для разработки приложений с использованием однопоточной версии %{name}.
%package doc
-Group: Documentation
-Summary: HTML documentation and tutorial for the %{name} applications
-BuildArch: noarch
-BuildRequires: texi2html texinfo-tex
+Group: Documentation
+Summary: HTML documentation and tutorial for the %{name} applications
+BuildArch: noarch
+BuildRequires: texi2html texinfo-tex
%description doc
-This package contains the documentation in the HTML format of the %{name}
+This package contains the documentation in the HTML and PDF format of the %{name}
package.
%package -n udav
-Summary: UDAV viewer and editor for mathgl graphs
-Summary(ru): UDAV - редактор и средство визуализации для MathGL
-Group: Applications/Engineering
-Requires: %{name} = %{version}-%{release}
+Summary: Viewer and editor for mathgl graphs
+Summary(ru): Редактор и средство визуализации для MathGL
+Group: Applications/Engineering
+Requires: %{name} = %{version}-%{release}
%description -n udav
UDAV is cross-platform program for interactive data array visualization
@@ -100,15 +103,59 @@ UDAV - это кроссплатформенное приложение для
данных с применением библиотеки MathGL. UDAV, как GUI для MathGL, может быть
использован для формирования различного вида научных иллюстраций.
+%package common
+Summary: Common files for %{name}
+Group: Applications/Engineering
+Requires: %{name} = %{version}-%{release}
+
+%description common
+%{summary}.
+
+%package openmpi
+Summary: OpenMPI version of %{name} library
+Group: Applications/Engineering
+BuildRequires: openmpi-devel
+Requires: openmpi
+Requires: %{name}-common = %{version}-%{release}
+
+%description openmpi
+%{summary}.
+
+%package openmpi-devel
+Summary: Devel files for OpenMPI version of %{name} library
+Group: Applications/Engineering
+Requires: %{name}-openmpi%{_isa} = %{version}-%{release}
+
+%description openmpi-devel
+%{summary}.
+
+%package mpich2
+Summary: MPICH2 version of %{name} library
+Group: Applications/Engineering
+BuildRequires: mpich2-devel
+Requires: mpich2
+Requires: %{name}-common = %{version}-%{release}
+
+%description mpich2
+%{summary}.
+
+%package mpich2-devel
+Summary: Devel files for MPICH2 version of %{name} library
+Group: Applications/Engineering
+Requires: %{name}-mpich2%{_isa} = %{version}-%{release}
+
+%description mpich2-devel
+%{summary}.
+
%prep
%setup -q
#convert EOL encodings, maintaining timestames
for file in AUTHORS ChangeLog.txt README ; do
- sed 's/\r//' $file > $file.new && \
- touch -r $file $file.new && \
- mv $file.new $file
+ sed 's/\r//' $file > $file.new && \
+ touch -r $file $file.new && \
+ mv $file.new $file
done
%patch0
@@ -117,25 +164,74 @@ done
%patch3
%patch4 -p1
+# Fix hardcoded paths
+sed -i s,/usr/local/share/doc/mathgl/,%{_docdir}/%{name}/, udav/udav_wnd.h
+sed -i s,/usr/local/share/udav/,%{_datadir}/udav/, udav/udav_wnd.cpp
+
%build
-mkdir -p %{_target_platform}
-pushd %{_target_platform}
-%{cmake} \
- -DMGL_LIB_INSTALL_DIR=%{_libdir} \
- -Denable-all=on \
- -Denable-hdf4=off \
- -Denable-doc=on \
- -Denable-all-swig=on \
- -Denable-all-widgets=on \
- -Denable-mpi=off \
- ..
-popd
-
-make %{?_smp_mflags} -C %{_target_platform}
+
+%define building() \
+BUILD_MPI="-Denable-mpi=on" %buildcommon
+
+%define building_serial() \
+BUILD_MPI="-Denable-mpi=off" %buildcommon
+
+%define buildcommon() \
+mkdir -p %{_target_platform}_$MPI_COMPILER_NAME; \
+pushd %{_target_platform}_$MPI_COMPILER_NAME; \
+%{cmake} \\\
+ -DMGL_LIB_INSTALL_DIR=%{_libdir} \\\
+ -Denable-all=on \\\
+ -Denable-hdf4=off \\\
+ -Denable-doc=on \\\
+ -Denable-all-swig=on \\\
+ -Denable-all-widgets=on \\\
+ $BUILD_MPI \\\
+ ..; \
+popd; \
+make %{?_smp_mflags} -C %{_target_platform}_$MPI_COMPILER_NAME
+
+# serial
+MPI_COMPILER_NAME=serial %building_serial
+
+# MPI vars
+export CC=mpicc
+export CXX=mpicxx
+
+# OpenMPI
+%{_openmpi_load}
+MPI_COMPILER_NAME=openmpi %building
+%{_openmpi_unload}
+
+# MPICH2
+%{_mpich2_load}
+MPI_COMPILER_NAME=mpich2 %building
+%{_mpich2_unload}
%install
rm -rf %{buildroot}
-make install DESTDIR=%{buildroot} -C %{_target_platform} INSTALL="install -p"
+
+# MPI install libs only
+%define installing() \
+make install DESTDIR=%{buildroot}%{_libdir}/$MPI_COMPILER_NAME -C %{_target_platform}_$MPI_COMPILER_NAME INSTALL="install -p"; \
+mv %{buildroot}%{_libdir}/$MPI_COMPILER_NAME/%{_libdir} %{buildroot}%{_libdir}/$MPI_COMPILER_NAME/lib; \
+mkdir -p %{buildroot}%{_includedir}/$MPI_COMPILER/mgl2; \
+mv %{buildroot}%{_libdir}/$MPI_COMPILER_NAME/%{_includedir}/mgl2/* %{buildroot}%{_includedir}/$MPI_COMPILER/mgl2/; \
+rm -f %{buildroot}%{_libdir}/$MPI_COMPILER_NAME/lib/*.a; \
+rm -r %{buildroot}%{_libdir}/$MPI_COMPILER_NAME/usr
+
+# Serial
+make install DESTDIR=%{buildroot} -C %{_target_platform}_serial INSTALL="install -p"
+
+# OpenMPI
+%{_openmpi_load}
+MPI_COMPILER_NAME=openmpi %installing
+%{_openmpi_unload}
+
+# MPICH2
+%{_mpich2_load}
+MPI_COMPILER_NAME=mpich2 %installing
+%{_mpich2_unload}
#Remove symlink to .so file in python dir. Let python find libs normally
unlink %{buildroot}/%{python_sitelib}/_mathgl.so
@@ -154,11 +250,13 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/udav.desktop
%post
/sbin/ldconfig
+
+%post common
/sbin/install-info %{_infodir}/%{name}_en.info %{_infodir}/dir || :
-%preun
+%preun common
if [ $1 = 0 ] ; then
- /sbin/install-info --delete %{_infodir}/%{name}_en.info %{_infodir}/dir || :
+ /sbin/install-info --delete %{_infodir}/%{name}_en.info %{_infodir}/dir || :
fi
%postun -p /sbin/ldconfig
@@ -172,12 +270,13 @@ rm -rf %{buildroot}
%doc AUTHORS ChangeLog.txt README COPYING README_V2
%{_libdir}/*.so.*
%{_bindir}/mgl*
-%{_datadir}/%{name}/
-%{python_sitelib}/*
-%{_mandir}/man5/mgl.5.gz
%{_mandir}/man1/mglconv.1.gz
%{_mandir}/man1/mglview.1.gz
-%{_infodir}/%{name}*.gz
+
+%files devel
+%defattr(-,root,root,-)
+%{_libdir}/*.so
+%{_includedir}/mgl2/
%files -n udav -f udav.lang
%{_bindir}/udav
@@ -186,23 +285,49 @@ rm -rf %{buildroot}
%dir %{_datadir}/udav/
%{_datadir}/pixmaps/*.png
-%files devel
-%defattr(-,root,root,-)
-%{_includedir}/mgl2/
-%{_libdir}/*.so
-
%files doc
%defattr(-,root,root,-)
%doc %{_docdir}/%{name}
+%files common
+%defattr(-,root,root,-)
+%{python_sitelib}/*
+%{_datadir}/%{name}/
+%{_infodir}/%{name}*.gz
+%{_mandir}/man5/mgl.5.gz
+
+%files openmpi
+%defattr(-,root,root,-)
+%doc COPYING
+%{_libdir}/openmpi/lib/*.so.*
+
+%files openmpi-devel
+%defattr(-,root,root,-)
+%{_libdir}/openmpi/lib/*.so
+%{_includedir}/openmpi-%{_arch}/mgl2/
+
+%files mpich2
+%doc COPYING
+%defattr(-,root,root,-)
+%{_libdir}/mpich2/lib/*.so.*
+
+%files mpich2-devel
+%defattr(-,root,root,-)
+%{_libdir}/mpich2/lib/*.so
+%{_includedir}/mpich2-%{_arch}/mgl2/
%changelog
+* Mon Apr 15 2013 Dmitrij S. Kryzhevich <krege at land.ru> - 2.1.2-3
+- MPI suport for MathGL library: add -common subpackage.
+- MPI enabled for MathGL library: add OpenMPI and MPICH2 support.
+- Reformat spec for better reading (spaces vs tabs, aligning).
+
* Mon Apr 15 2013 Dmitrij S. Kryzhevich <krege at land.ru> - 2.1.2-2
- Fix spec for better cmake use.
- Make vars in spec to be in one style.
- Add some Russian translation.
-- .info is installed. Remove copy.
-- Make udav sub-package with name "udav".
+- .info is installed. Remove copying.
+- Make udav sub-package to be with name "udav".
- Maintain traslation for udav.
* Sun Apr 14 2013 <mycae(a!)gmx.com> 2.1.2-1
@@ -371,5 +496,3 @@ rm -rf %{buildroot}
* Fri Feb 29 2008 Nik <niktr at mail.ru>
- initial build of version 1.5
-
-
More information about the scm-commits
mailing list