[MUMPS] Changed MUMPS sequential build.

Antonio Trande sagitter at fedoraproject.org
Wed Jun 25 18:25:09 UTC 2014


commit 7e6d45125cbdc0505dd1022b1b2ffe53b5e792f7
Author: sagitter <anto.trande at gmail.com>
Date:   Wed Jun 25 20:25:03 2014 +0200

    Changed MUMPS sequential build.

 MUMPS-Makefile.seq.inc |   90 ++++++++++++++++++++++++++++++++++++++++++++++++
 MUMPS-shared-seq.patch |   53 ++++++++++++++++++++++++++++
 MUMPS.spec             |   89 ++++++++++++++++++++++++++++-------------------
 3 files changed, 196 insertions(+), 36 deletions(-)
---
diff --git a/MUMPS-Makefile.seq.inc b/MUMPS-Makefile.seq.inc
new file mode 100644
index 0000000..a4cca0b
--- /dev/null
+++ b/MUMPS-Makefile.seq.inc
@@ -0,0 +1,90 @@
+#
+#  This file is part of MUMPS 4.10.0, built on Tue May 10 12:56:32 UTC 2011
+#
+#Begin orderings
+
+# NOTE that PORD is distributed within MUMPS by default. If you would like to
+# use other orderings, you need to obtain the corresponding package and modify
+# the variables below accordingly.
+# For example, to have Metis available within MUMPS:
+#          1/ download Metis and compile it
+#          2/ uncomment (suppress # in first column) lines
+#             starting with LMETISDIR,  LMETIS
+#          3/ add -Dmetis in line ORDERINGSF
+#             ORDERINGSF  = -Dpord -Dmetis
+#          4/ Compile and install MUMPS
+#             make clean; make   (to clean up previous installation)
+#
+#          Metis/ParMetis and SCOTCH/PT-SCOTCH (ver 5.1 and later) orderings are now available for MUMPS.
+#
+
+#SCOTCHDIR  = ${HOME}/scotch_5.1_esmumps
+#ISCOTCH    = -I$(SCOTCHDIR)/include 
+# You have to choose one among the following two lines depending on
+# the type of analysis you want to perform. If you want to perform only
+# sequential analysis choose the first (remember to add -Dscotch in the ORDERINGSF
+# variable below); for both parallel and sequential analysis choose the second 
+# line (remember to add -Dptscotch in the ORDERINGSF variable below)
+
+#LSCOTCH    = -L$(SCOTCHDIR)/lib -lesmumps -lscotch -lscotcherr
+#LSCOTCH    = -L$(SCOTCHDIR)/lib -lptesmumps -lptscotch -lptscotcherr
+
+
+LPORDDIR = $(topdir)/PORD/lib/
+IPORD    = -I$(topdir)/PORD/include/
+LPORD    = -L$(LPORDDIR) -lpord
+
+#LMETISDIR = /local/metis/
+#IMETIS    = # Should be provided if you use parmetis
+
+# You have to choose one among the following two lines depending on
+# the type of analysis you want to perform. If you want to perform only
+# sequential analysis choose the first (remember to add -Dmetis in the ORDERINGSF
+# variable below); for both parallel and sequential analysis choose the second 
+# line (remember to add -Dparmetis in the ORDERINGSF variable below)
+
+#LMETIS    = -L$(LMETISDIR) -lmetis
+#LMETIS    = -L$(LMETISDIR) -lparmetis -lmetis
+
+# The following variables will be used in the compilation process.
+# Please note that -Dptscotch and -Dparmetis imply -Dscotch and -Dmetis respectively.
+#ORDERINGSF = -Dscotch -Dmetis -Dpord -Dptscotch -Dparmetis
+ORDERINGSF  = -Dpord
+ORDERINGSC  = $(ORDERINGSF)
+
+LORDERINGS = $(LMETIS) $(LPORD) $(LSCOTCH)
+IORDERINGSF = $(ISCOTCH)
+IORDERINGSC = $(IMETIS) $(IPORD) $(ISCOTCH)
+
+#End orderings
+########################################################################
+################################################################################
+
+PLAT    =
+LIBEXT  = .a
+OUTC    = -o 
+OUTF    = -o 
+RM = /bin/rm -f
+CC = gcc
+FC = gfortran
+FL = gfortran
+AR = ar vr 
+#RANLIB = ranlib
+RANLIB  = echo
+# See point 17 in the FAQ to have more details on the compilation of mpich with gfortran
+INCSEQ = -I$(topdir)/libseq
+LIBSEQ  =  -L$(topdir)/libseq -lmpiseq
+#LIBBLAS = -L/usr/lib/xmm/ -lf77blas -latlas
+LIBBLAS = -lblas -llapack
+LIBOTHERS = -lpthread
+#Preprocessor defs for calling Fortran from C (-DAdd_ or -DAdd__ or -DUPPER)
+CDEFS   = -DAdd_
+
+#Begin Optimized options
+OPTF    = @@CFLAGS@@ -Dintel_ -DALLOW_NON_INIT
+OPTL    = @@-O@@
+OPTC    = @@CFLAGS@@
+#End Optimized options
+INCS = $(INCSEQ)
+LIBS = $(LIBSEQ)
+LIBSEQNEEDED = libseqneeded
diff --git a/MUMPS-shared-seq.patch b/MUMPS-shared-seq.patch
new file mode 100644
index 0000000..089c6a1
--- /dev/null
+++ b/MUMPS-shared-seq.patch
@@ -0,0 +1,53 @@
+Create a shared version of the sequential library, MUST BE LAST IN SERIES
+
+--- libseq/Makefile
++++ libseq/Makefile
+@@ -12,10 +12,13 @@
+ libmpiseq$(PLAT)$(LIBEXT): mpi.o mpic.o elapse.o
+ 	$(AR)$@ mpi.o mpic.o elapse.o
+ 	$(RANLIB) $@
++libmpiseq$(PLAT).so: mpi.o mpic.o elapse.o
++	$(FC) -shared $^ -Wl,-soname,libmpiseq$(PLAT).so.4.10.0 -o libmpiseq$(PLAT).so.4.10.0
++	ln -s libmpiseq$(PLAT).so.4.10.0 $@
+ .f.o:
+-	$(FC) $(OPTF)              -c $*.f $(OUTF)$*.o
++	$(FC) $(OPTF)              -fPIC -c $*.f $(OUTF)$*.o
+ .c.o:
+-	$(CC) $(OPTC) $(CDEFS) -I. -c $*.c $(OUTC)$*.o
++	$(CC) $(OPTC) $(CDEFS) -I. -fPIC -c $*.c $(OUTC)$*.o
+ 
+ clean:
+ 	$(RM) *.o *$(LIBEXT)
+
+--- Makefile
++++ Makefile
+@@ -57,6 +57,7 @@
+ 
+ libseqneeded:
+ 	(cd libseq; $(MAKE))
++	cp libseq/lib* $(libdir)
+ 
+ # Build the libpord.a library and copy it into $(topdir)/lib
+ $(libdir)/libpord$(PLAT).a:
+
+--- src/Makefile.orig	2014-06-24 23:07:51.684304000 +0200
++++ src/Makefile	2014-06-24 23:10:12.263494831 +0200
+@@ -59,7 +59,7 @@
+ 	$(RANLIB) $@
+ 
+ $(libdir)/libmumps_common$(PLAT).so:	$(OBJS_COMMON)
+-	$(FC) -shared $^ -Wl,-soname,libmumps_common$(PLAT)-4.10.0.so -L$(libdir) $(LORDERINGS) -lpthread $(MUMPS_LIBF77) $(OPTL) -lopen-rte $(OPTL) -lopen-pal $(MPIFLIB) $(MPICLIB) -o $(libdir)/libmumps_common$(PLAT)-4.10.0.so $(OPTL) -Wl,-z,defs
++	$(FC) -shared $^ -Wl,-soname,libmumps_common$(PLAT)-4.10.0.so -L$(libdir) $(LORDERINGS) -lpthread $(MUMPS_LIBF77) $(OPTL) -o $(libdir)/libmumps_common$(PLAT)-4.10.0.so $(OPTL) -Wl,-z,defs
+ 	ln -s libmumps_common$(PLAT)-4.10.0.so $@
+ 
+ $(libdir)/lib$(ARITH)mumps$(PLAT).a:    $(OBJS)
+@@ -67,7 +67,7 @@
+ 	$(RANLIB) $@
+ 
+ $(libdir)/lib$(ARITH)mumps$(PLAT).so:    $(OBJS)
+-	$(FC) -shared $^ -Wl,-soname,lib$(ARITH)mumps$(PLAT)-4.10.0.so -L$(libdir) -lmumps_common$(PLAT) $(MUMPS_LIBF77) $(OPTL) -lopen-rte $(OPTL) -lopen-pal $(LORDERINGS) $(MPIFLIB) -lblas $(SCALAP) -o $(libdir)/lib$(ARITH)mumps$(PLAT)-4.10.0.so $(OPTL) -Wl,-z,defs
++	$(FC) -shared $^ -Wl,-soname,lib$(ARITH)mumps$(PLAT)-4.10.0.so -L$(libdir) -lmumps_common$(PLAT) $(LORDERINGS) $(MUMPS_LIBF77) $(OPTL) -lblas $(SCALAP) -o $(libdir)/lib$(ARITH)mumps$(PLAT)-4.10.0.so $(OPTL) -Wl,-z,defs
+ 	ln -s lib$(ARITH)mumps$(PLAT)-4.10.0.so $@
+ 
+ $(ARITH)mumps_load.o:		$(ARITH)mumps_comm_buffer.o \
+
diff --git a/MUMPS.spec b/MUMPS.spec
index c944b1d..da8ca64 100644
--- a/MUMPS.spec
+++ b/MUMPS.spec
@@ -13,7 +13,7 @@
 
 Name: MUMPS
 Version: 4.10.0
-Release: 16%{?dist}
+Release: 17%{?dist}
 Summary: A MUltifrontal Massively Parallel sparse direct Solver
 License: Public Domain
 Group: Development/Libraries
@@ -23,12 +23,16 @@ Source0: http://mumps.enseeiht.fr/%{name}_%{version}.tar.gz
 # Custom Makefile changed for Fedora and built from Make.inc/Makefile.gfortran.PAR in the source.
 Source1: %{name}-Makefile.par.inc
 
+# Custom Makefile changed for Fedora and built from Make.inc/Makefile.gfortran.SEQ in the source.
+Source2: %{name}-Makefile.seq.inc
+
 # These patches create static and shared versions of pord, sequential and mumps libraries
 # They are changed for Fedora and  derive from patches for Debian on 
 # http://bazaar.launchpad.net/~ubuntu-branches/ubuntu/raring/mumps/raring/files/head:/debian/patches/
 Patch0: %{name}-examples-mpilibs.patch
 Patch1: %{name}-shared-pord.patch
 Patch2: %{name}-shared.patch
+Patch3: %{name}-shared-seq.patch
 
 %if 0%{?fedora} >= 20
 BuildRequires: openmpi-devel >= 1.7.2
@@ -80,12 +84,13 @@ BuildArch: noarch
 This package contains common documentation files for MUMPS.
 
 ########################################################
-%if %{with_openmpi}
+%if 0%{?with_openmpi}
 %package openmpi
 Summary: MUMPS libraries compiled against openmpi
 Group: Development/Libraries
 BuildRequires: openmpi-devel
 Requires: %{name}-common = %{version}-%{release}
+Requires: openmpi
 %description openmpi
 MUMPS libraries compiled against openmpi
 
@@ -107,6 +112,7 @@ Shared links, header files for MUMPS.
 %patch1 -p1
 %patch2 -p1
 
+
 mv examples/README examples/README-examples
 
 %build
@@ -129,39 +135,44 @@ MUMPS_MPI=openmpi
 MUMPS_INCDIR=-I/usr/include/openmpi-%{_arch}
 
 %if 0%{?fedora} >= 21
-%global mpiblacslibs "-lmpiblacs"
-%else
-%global	mpiblacslibs "-lmpiblacs -lmpiblacsF77init -lmpiblacsCinit"
-%endif
-
-%if 0%{?fedora} >= 20
-MUMPS_LIBF77="\
--L%{_libdir}/openmpi -L%{_libdir}/openmpi/lib -lmpi \
- -lmpi_mpifh -lscalapack %{mpiblacslibs} -llapack"
+export MPIBLACSLIBS="-lmpiblacs"
 %else
-MUMPS_LIBF77="\
--L%{_libdir}/openmpi -L%{_libdir}/openmpi/lib -lmpi \
- -lmpi_f77 -lscalapack %{mpiblacslibs} -llapack"
+export MPIBLACSLIBS="-lmpiblacs -lmpiblacsF77init -lmpiblacsCinit"
 %endif
 
 #######################################################
 ## Build MPI version
-%if %{with_openmpi}
+%if 0%{?with_openmpi}
+export MPI_COMPILER_NAME=openmpi
 %{_openmpi_load}
-make MUMPS_MPI="$MUMPS_MPI" \
-     MUMPS_INCDIR="$MUMPS_INCDIR" \
-     MUMPS_LIBF77="$MUMPS_LIBF77" \
-     all
+export LD_LIBRARY_PATH="%{_libdir}/openmpi/lib"
+mkdir -p %{name}-%{version}-$MPI_COMPILER_NAME/lib
+make \
+ FC=%{_libdir}/openmpi/bin/mpif77 \
+ MUMPS_MPI="$MUMPS_MPI" \
+ MUMPS_INCDIR="$MUMPS_INCDIR" \
+%if 0%{?fedora} >= 20
+ MUMPS_LIBF77="-L%{_libdir}/openmpi -L%{_libdir}/openmpi/lib -lmpi -lmpi_mpifh -lscalapack $MPIBLACSLIBS -llapack" all
+%else
+ MUMPS_LIBF77="-L%{_libdir}/openmpi -L%{_libdir}/openmpi/lib -lmpi -lmpi_f77 -lscalapack $MPIBLACSLIBS -llapack" all
+%endif
 %{_openmpi_unload}
+cp -pr lib/* %{name}-%{version}-$MPI_COMPILER_NAME/lib
+rm -rf lib/*
+make clean
+%endif
 
-%else
+patch -p0 < %{PATCH3}
 
 ## Build serial version
-make MUMPS_MPI="$MUMPS_MPI" \
-     MUMPS_INCDIR="$MUMPS_INCDIR" \
-     MUMPS_LIBF77="$MUMPS_LIBF77" \
-     all
-%endif
+rm -f Makefile.inc
+cp -f %{SOURCE2} Makefile.inc
+
+# Set build flags macro
+sed -e 's|@@CFLAGS@@|%{optflags}|g' -i Makefile.inc
+sed -e 's|@@-O@@|-Wl,--as-needed|g' -i Makefile.inc
+
+make MUMPS_LIBF77="-lmpiseq" all
 #######################################################
 
 # Make sure documentation is using Unicode.
@@ -170,7 +181,7 @@ iconv -f iso8859-1 -t utf-8 README > README-t && mv README-t README
 %post -p /sbin/ldconfig
 %postun -p /sbin/ldconfig
 
-%if %{with_openmpi}
+%if 0%{?with_openmpi}
 %post openmpi -p /sbin/ldconfig
 %postun openmpi -p /sbin/ldconfig
 %endif
@@ -179,15 +190,17 @@ iconv -f iso8859-1 -t utf-8 README > README-t && mv README-t README
 # Running test programs showing how MUMPS can be used
 cd examples
 
+%if 0%{?with_openmpi}
 %if 0%{?rhel}
 module load %{_sysconfdir}/modulefiles/openmpi-%{_arch}
 %else
 %{_openmpi_load}
 %endif
-LD_LIBRARY_PATH=$PWD:../lib:$LD_LIBRARY_PATH ./ssimpletest < input_simpletest_real
-LD_LIBRARY_PATH=$PWD:../lib:$LD_LIBRARY_PATH ./csimpletest < input_simpletest_cmplx
+LD_LIBRARY_PATH=$PWD:../%{name}-%{version}-openmpi/lib:$LD_LIBRARY_PATH ./ssimpletest < input_simpletest_real
+LD_LIBRARY_PATH=$PWD:../%{name}-%{version}-openmpi/lib:$LD_LIBRARY_PATH ./csimpletest < input_simpletest_cmplx
 %{_openmpi_unload}
 cd ../
+%endif
 
 %install
 
@@ -197,21 +210,21 @@ mkdir -p $RPM_BUILD_ROOT%{_libdir}
 mkdir -p $RPM_BUILD_ROOT%{_includedir}/%{name}
 
 #########################################################
-%if %{with_openmpi}
+%if 0%{?with_openmpi}
 mkdir -p $RPM_BUILD_ROOT%{_libmpidir}
 mkdir -p $RPM_BUILD_ROOT%{_libmpidir}/%{name}-%{version}/examples
 mkdir -p $RPM_BUILD_ROOT%{_incmpidir}
 
 %{_openmpi_load}
 # Install libraries.
-install -cpm 755 lib/lib*-*.so $RPM_BUILD_ROOT%{_libmpidir}
+install -cpm 755 %{name}-%{version}-openmpi/lib/lib*-*.so $RPM_BUILD_ROOT%{_libmpidir}
 
 # Install development files.
-install -cpm 755 lib/libmumps_common.so $RPM_BUILD_ROOT%{_libmpidir}
-install -cpm 755 lib/lib*mumps.so $RPM_BUILD_ROOT%{_libmpidir}
-install -cpm 755 lib/lib*mumps-%{version}.so $RPM_BUILD_ROOT%{_libmpidir}
-install -cpm 755 lib/libpord-%{version}.so $RPM_BUILD_ROOT%{_libmpidir}
-install -cpm 755 lib/libpord.so $RPM_BUILD_ROOT%{_libmpidir}
+install -cpm 755 %{name}-%{version}-openmpi/lib/libmumps_common.so $RPM_BUILD_ROOT%{_libmpidir}
+install -cpm 755 %{name}-%{version}-openmpi/lib/lib*mumps.so $RPM_BUILD_ROOT%{_libmpidir}
+install -cpm 755 %{name}-%{version}-openmpi/lib/lib*mumps-%{version}.so $RPM_BUILD_ROOT%{_libmpidir}
+install -cpm 755 %{name}-%{version}-openmpi/lib/libpord-%{version}.so $RPM_BUILD_ROOT%{_libmpidir}
+install -cpm 755 %{name}-%{version}-openmpi/lib/libpord.so $RPM_BUILD_ROOT%{_libmpidir}
 
 # Make symbolic links instead hard-link 
 ln -sf %{_libmpidir}/libsmumps-%{version}.so $RPM_BUILD_ROOT%{_libmpidir}/libsmumps.so
@@ -253,7 +266,7 @@ install -cpm 644 doc/*.pdf $RPM_BUILD_ROOT%{_pkgdocdir}
 install -cpm 644 ChangeLog LICENSE README $RPM_BUILD_ROOT%{_pkgdocdir}
 
 #######################################################
-%if %{with_openmpi}
+%if 0%{?with_openmpi}
 %files openmpi
 %{_libmpidir}/libpord-%{version}.so
 %{_libmpidir}/lib?mumps-%{version}.so
@@ -288,6 +301,10 @@ install -cpm 644 ChangeLog LICENSE README $RPM_BUILD_ROOT%{_pkgdocdir}
 %{_libexecdir}/%{name}-%{version}/examples/
 
 %changelog
+* Tue Jun 24 2014 Antonio Trande <sagitter at fedoraproject.org> - 4.10.0-17
+- Some MPI packaging fixes
+- Changed MUMPS sequential build
+
 * Fri Jun 06 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 4.10.0-16
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
 


More information about the scm-commits mailing list