## Define libraries' destination %global _incmpidir %{_includedir}/openmpi-%{_arch} %global _libmpidir %{_libdir}/openmpi/lib %global _incmpichdir %{_includedir}/mpich-%{_arch} %global _libmpichdir %{_libdir}/mpich/lib %global soname_version 5.8 # Due to OpenMPI-5.0 dropping in i686 %if 0%{?rhel} || 0%{?fedora} %ifarch %{ix86} %global with_openmpi 0 %global with_openmpi_check 0 %else %global with_openmpi 0 %global with_openmpi_check 0 %endif # rhbz#2225803 %ifnarch s390x %global with_mpich_check 0 %else %global with_mpich_check 0 %endif %global with_mpich 0 %endif ## Due to rhbz#1744780 %if 0%{?rhel} %global with_mpich 1 %global with_mpich_check 1 %global with_openmpi 1 %global with_openmpi_check 1 %endif # Workarounf for GCC-10 # https://gcc.gnu.org/gcc-10/porting_to.html %if 0%{?fedora} || 0%{?rhel} >= 9 %global optflags %{optflags} -fallow-argument-mismatch %endif Name: MUMPS Version: %{soname_version}.2 Release: %autorelease Summary: A MUltifrontal Massively Parallel sparse direct Solver License: CECILL-C URL: https://mumps-solver.org Source0: https://mumps-solver.org/%{name}_%{version}.tar.gz # Custom Makefile changed for Fedora and built from Make.inc/Makefile.gfortran.PAR in the source. Source1: Makefile.parMUMPS.inc # Custom Makefile changed for Fedora and built from Make.inc/Makefile.gfortran.SEQ in the source. Source2: Makefile.seqMUMPS.inc # This patch creates versioned shared libraries of pord, sequential and mumps libraries Patch0: %{name}-set_soname.patch Patch1: %{name}-fix_make_clean.patch Patch2: %{name}-fix_PORD_make.patch BuildRequires: make BuildRequires: gcc-gfortran BuildRequires: gcc BuildRequires: pkgconfig(flexiblas) BuildRequires: metis-devel BuildRequires: scotch-devel >= 7.0.1 BuildRequires: scotch-devel-metis >= 7.0.1 BuildRequires: openssh-clients BuildRequires: hwloc-devel Requires: %{name}-common = %{version}-%{release} Obsoletes: %{name}-openmp < 0:5.4.0-1 %description MUMPS implements a direct solver for large sparse linear systems, with a particular focus on symmetric positive definite matrices. It can operate on distributed matrices e.g. over a cluster. It has Fortran and C interfaces, and can interface with ordering tools such as Scotch. %package devel Summary: The MUMPS headers and development-related files Requires: %{name}%{?_isa} = %{version}-%{release} Requires: gcc-gfortran%{?_isa} Requires: %{name}-srpm-macros = %{version}-%{release} # FlexiBLAS takes advantage of flexiblas-openmp by default. # OpenMP sub-package will be obsoleted in future. Obsoletes: %{name}-openmp-devel < 0:5.4.0-1 %description devel Shared links and header files. This package contains dummy MPI header file including symbols used by MUMPS. %package examples Summary: The MUMPS common illustrative test programs Requires: %{name}%{?_isa} = %{version}-%{release} %description examples This package contains common illustrative test programs about how MUMPS can be used. %package common Summary: Documentation files for MUMPS BuildArch: noarch %description common This package contains common documentation files for MUMPS. %package srpm-macros Summary: Additional RPM macros for MUMPS BuildArch: noarch %description srpm-macros Additional RPM macros for MUMPS. ######################################################## %if 0%{?with_openmpi} %package openmpi Summary: MUMPS libraries compiled against openmpi BuildRequires: openmpi-devel BuildRequires: blacs-openmpi-devel BuildRequires: scalapack-openmpi-devel #BuildRequires: metis-devel BuildRequires: ptscotch-openmpi-devel >= 7.0.1 BuildRequires: ptscotch-openmpi-devel-parmetis >= 7.0.1 %if 0%{?fedora} BuildRequires: rpm-mpi-hooks %endif Requires: %{name}-common = %{version}-%{release} Requires: openmpi%{?_isa} Requires: scalapack-openmpi%{?_isa} Requires: ptscotch-openmpi%{?_isa} >= 7.0.1 %description openmpi MUMPS libraries compiled against openmpi. %package openmpi-devel Summary: The MUMPS headers and development-related files BuildRequires: openmpi-devel Requires: %{name}-openmpi%{?_isa} = %{version}-%{release} Requires: gcc-gfortran%{?_isa} Requires: %{name}-srpm-macros = %{version}-%{release} %if 0%{?fedora} Requires: rpm-mpi-hooks %endif %description openmpi-devel Shared links, header files for MUMPS. %package openmpi-examples Summary: The MUMPS OpenMPI common illustrative test programs Requires: %{name}-openmpi%{?_isa} = %{version}-%{release} Requires: openmpi %if 0%{?fedora} BuildRequires: rpm-mpi-hooks %endif %description openmpi-examples This package contains common illustrative test programs about how MUMPS-openmpi can be used. %endif ########################################################## ######################################################## %if 0%{?with_mpich} %package mpich Summary: MUMPS libraries compiled against MPICH BuildRequires: mpich-devel BuildRequires: blacs-mpich-devel BuildRequires: scalapack-mpich-devel #BuildRequires: metis-devel BuildRequires: ptscotch-mpich-devel >= 7.0.1 BuildRequires: ptscotch-mpich-devel-parmetis >= 7.0.1 %if 0%{?fedora} BuildRequires: rpm-mpi-hooks %endif Requires: %{name}-common = %{version}-%{release} Requires: mpich%{?_isa} Requires: scalapack-mpich%{?_isa} Requires: ptscotch-mpich%{?_isa} >= 7.0.1 %description mpich MUMPS libraries compiled against MPICH. %package mpich-devel Summary: The MUMPS headers and development-related files BuildRequires: mpich-devel Requires: %{name}-mpich%{?_isa} = %{version}-%{release} Requires: %{name}-srpm-macros = %{version}-%{release} %if 0%{?fedora} Requires: rpm-mpi-hooks %endif %description mpich-devel Shared links, header files for MUMPS. %package mpich-examples Summary: The MUMPS MPICH common illustrative test programs Requires: %{name}-mpich%{?_isa} = %{version}-%{release} Requires: gcc-gfortran%{?_isa} Requires: mpich %if 0%{?fedora} BuildRequires: rpm-mpi-hooks %endif %description mpich-examples This package contains common illustrative test programs about how MUMPS-mpich can be used. %endif ########################################################## %prep %setup -q -n %{name}_%{version} #patch -P 0 -p1 -b .backup %patch -P 2 -p1 -b .backup mv examples/README examples/README-examples %build ## Build serial version rm -f Makefile.inc cp -f %{SOURCE2} Makefile.inc mkdir -p %{name}-%{version}/lib mkdir -p %{name}-%{version}/examples mkdir -p %{name}-%{version}/modules export ISCOTCH=-I%{_includedir}/scotch %make_build allshared \ CC=gcc \ FC=gfortran \ FL=gfortran \ CFLAGS="%{optflags} -fopenmp -fPIC" \ FFLAGS="%{optflags} -fopenmp -fPIC" \ LDFLAGS="%{__global_ldflags} -fPIC" \ SHARED_OPT="%{__global_ldflags} -shared -fPIC" \ SONAMEVER=%{soname_version} \ LIBSEQ="-L../libseq -lmpiseq" \ INCSEQ="-I../libseq -I%{_includedir}/flexiblas" \ LMETISDIR=%{_libdir} \ IMETIS=-I%{_includedir} \ LMETIS="-L%{_libdir} -lmetis -lscotchmetis" \ SCOTCHDIR=%{_prefix} \ ISCOTCH=-I%{_includedir}/scotch \ LSCOTCH=" -L%{_libdir} -lesmumps -lscotch -lscotcherr -lflexiblas" cp -pr lib/* %{name}-%{version}/lib/ cp -pr PORD/lib/lib* %{name}-%{version}/lib/ cp -pr libseq/lib* %{name}-%{version}/lib/ cp -pr examples/* %{name}-%{version}/examples/ cp -a include %{name}-%{version}/ rm -f lib/* libseq/lib* PORD/lib/lib* cp -pr src/*.mod %{name}-%{version}/modules/ make clean ####################################################### patch -p1 < %{PATCH1} ####################################################### ## Build MPI version rm -f Makefile.inc cp -f %{SOURCE1} Makefile.inc %if 0%{?with_openmpi} %{_openmpi_load} export MPI_COMPILER_NAME=openmpi mkdir -p %{name}-%{version}-$MPI_COMPILER_NAME/lib mkdir -p %{name}-%{version}-$MPI_COMPILER_NAME/examples mkdir -p %{name}-%{version}-$MPI_COMPILER_NAME/modules make -j1 sharedlibseq allshared \ CC=$MPI_BIN/mpicc \ FC=$MPI_BIN/mpif77 \ FL=$MPI_BIN/mpif77 \ SONAMEVER=%{soname_version} \ SCALAP="-L$MPI_LIB -lscalapack -lflexiblas" \ MPIFORTRANLIB="%(pkgconf --libs ompi-f77)" \ MPICLIB=%(pkgconf --libs ompi) \ MUMPS_INCDIR=-I%{_includedir}/flexiblas \ SCOTCHDIR=$MPI_LIB \ ISCOTCH=-I$MPI_INCLUDE/scotch \ LSCOTCH="-L$MPI_LIB -lesmumps -lscotch -lscotcherr -lptesmumps -lptscotch -lptscotcherr -lscotchmetis -lscalapack -lflexiblas" \ LMETISDIR=%{_libdir} \ METISLIB=-lmetis \ IMETIS=-I%{_includedir}/metis %{_openmpi_unload} cp -pr lib/* %{name}-%{version}-$MPI_COMPILER_NAME/lib/ cp -pr PORD/lib/* %{name}-%{version}-$MPI_COMPILER_NAME/lib/ cp -pr examples/* %{name}-%{version}-$MPI_COMPILER_NAME/examples/ rm -f lib/* PORD/lib/lib* cp -a include %{name}-%{version}-$MPI_COMPILER_NAME/ cp -pr src/*.mod %{name}-%{version}-$MPI_COMPILER_NAME/modules/ make clean %endif ###################################################### ####################################################### ## Build MPICH version rm -f Makefile.inc cp -f %{SOURCE1} Makefile.inc %if 0%{?with_mpich} %{_mpich_load} export MPI_COMPILER_NAME=mpich mkdir -p %{name}-%{version}-$MPI_COMPILER_NAME/lib mkdir -p %{name}-%{version}-$MPI_COMPILER_NAME/examples mkdir -p %{name}-%{version}-$MPI_COMPILER_NAME/modules make -j1 sharedlibseq allshared \ CC=$MPI_BIN/mpicc \ FC=$MPI_BIN/mpif77 \ FL=$MPI_BIN/mpif77 \ SONAMEVER=%{soname_version} \ SCALAP="-L$MPI_LIB -lscalapack -lflexiblas" \ MPIFORTRANLIB="%(pkgconf --libs ompi-f77) -lscalapack -lflexiblas" \ MPICLIB=%(pkgconf --libs ompi) \ MUMPS_INCDIR=-I%{_includedir}/flexiblas \ SCOTCHDIR=$MPI_LIB \ ISCOTCH=-I$MPI_INCLUDE/scotch \ LSCOTCH="-L$MPI_LIB -lesmumps -lscotch -lscotcherr -lptesmumps -lptscotch -lptscotcherr -lscotchmetis -lscalapack -lflexiblas" \ LMETISDIR=%{_libdir} \ METISLIB=-lmetis \ IMETIS=-I%{_includedir}/metis %{_mpich_unload} cp -pr lib/* %{name}-%{version}-$MPI_COMPILER_NAME/lib/ cp -pr PORD/lib/lib* %{name}-%{version}-$MPI_COMPILER_NAME/lib/ cp -pr examples/* %{name}-%{version}-$MPI_COMPILER_NAME/examples/ cp -a include %{name}-%{version}-$MPI_COMPILER_NAME/ rm -f lib/* PORD/lib/lib* cp -pr src/*.mod %{name}-%{version}-$MPI_COMPILER_NAME/modules/ make clean %endif ###################################################### # Make sure documentation is using Unicode. iconv -f iso8859-1 -t utf-8 README > README-t && mv README-t README %check # Running test programs pushd %{name}-%{version}/examples export LD_LIBRARY_PATH=../lib ./ssimpletest < input_simpletest_real && exit 1 ./dsimpletest < input_simpletest_real && exit 1 ./csimpletest < input_simpletest_cmplx && exit 1 ./zsimpletest < input_simpletest_cmplx && exit 1 ./c_example && exit 1 popd %if 0%{?with_openmpi_check} %{_openmpi_load} pushd %{name}-%{version}-openmpi/examples export LD_LIBRARY_PATH=../lib mpirun -np 2 ./ssimpletest < input_simpletest_real mpirun -np 2 ./dsimpletest < input_simpletest_real mpirun -np 2 ./csimpletest < input_simpletest_cmplx mpirun -np 2 ./zsimpletest < input_simpletest_cmplx mpirun -np 3 ./c_example popd %{_openmpi_unload} %endif %if 0%{?with_mpich_check} %{_mpich_load} pushd %{name}-%{version}-mpich/examples export LD_LIBRARY_PATH=../lib mpirun -np 2 ./ssimpletest < input_simpletest_real mpirun -np 2 ./dsimpletest < input_simpletest_real mpirun -np 2 ./csimpletest < input_simpletest_cmplx mpirun -np 2 ./zsimpletest < input_simpletest_cmplx mpirun -np 3 ./c_example popd %{_mpich_unload} %endif %install ######################################################### %if 0%{?with_openmpi} %{_openmpi_load} mkdir -p $RPM_BUILD_ROOT$MPI_LIB mkdir -p $RPM_BUILD_ROOT%{_libdir}/openmpi/%{name}-%{version}-examples mkdir -p $RPM_BUILD_ROOT$MPI_INCLUDE mkdir -p $RPM_BUILD_ROOT$MPI_FORTRAN_MOD_DIR/%{name}-%{version} # Install libraries. install -cpm 755 %{name}-%{version}-openmpi/lib/lib*-*.so $RPM_BUILD_ROOT$MPI_LIB # Install development files. install -cpm 755 %{name}-%{version}-openmpi/lib/libmumps_common.so $RPM_BUILD_ROOT$MPI_LIB install -cpm 755 %{name}-%{version}-openmpi/lib/lib*mumps.so $RPM_BUILD_ROOT$MPI_LIB install -cpm 755 %{name}-%{version}-openmpi/lib/lib*mumps-%{soname_version}.so $RPM_BUILD_ROOT$MPI_LIB install -cpm 755 %{name}-%{version}-openmpi/lib/libpord-%{soname_version}.so $RPM_BUILD_ROOT$MPI_LIB # Make symbolic links instead hard-link ln -sf libsmumps-%{soname_version}.so $RPM_BUILD_ROOT$MPI_LIB/libsmumps.so ln -sf libcmumps-%{soname_version}.so $RPM_BUILD_ROOT$MPI_LIB/libcmumps.so ln -sf libzmumps-%{soname_version}.so $RPM_BUILD_ROOT$MPI_LIB/libzmumps.so ln -sf libdmumps-%{soname_version}.so $RPM_BUILD_ROOT$MPI_LIB/libdmumps.so ln -sf libmumps_common-%{soname_version}.so $RPM_BUILD_ROOT$MPI_LIB/libmumps_common.so ln -sf libpord-%{soname_version}.so $RPM_BUILD_ROOT$MPI_LIB/libpord.so install -cpm 755 %{name}-%{version}-openmpi/examples/?simpletest $RPM_BUILD_ROOT%{_libdir}/openmpi/%{name}-%{version}-examples install -cpm 755 %{name}-%{version}-openmpi/examples/input_* $RPM_BUILD_ROOT%{_libdir}/openmpi/%{name}-%{version}-examples install -cpm 755 %{name}-%{version}-openmpi/examples/README-* $RPM_BUILD_ROOT%{_libdir}/openmpi/%{name}-%{version}-examples install -cpm 644 %{name}-%{version}-openmpi/include/*.h $RPM_BUILD_ROOT$MPI_INCLUDE install -cpm 644 PORD/include/* $RPM_BUILD_ROOT$MPI_INCLUDE install -cpm 644 %{name}-%{version}-openmpi/modules/* $RPM_BUILD_ROOT$MPI_FORTRAN_MOD_DIR/%{name}-%{version}/ %{_openmpi_unload} %endif ########################################################## ######################################################### %if 0%{?with_mpich} %{_mpich_load} mkdir -p $RPM_BUILD_ROOT$MPI_LIB mkdir -p $RPM_BUILD_ROOT%{_libdir}/mpich/%{name}-%{version}-examples mkdir -p $RPM_BUILD_ROOT$MPI_INCLUDE mkdir -p $RPM_BUILD_ROOT$MPI_FORTRAN_MOD_DIR/%{name}-%{version} # Install libraries. install -cpm 755 %{name}-%{version}-mpich/lib/lib*-*.so $RPM_BUILD_ROOT$MPI_LIB # Install development files. install -cpm 755 %{name}-%{version}-mpich/lib/libmumps_common.so $RPM_BUILD_ROOT$MPI_LIB install -cpm 755 %{name}-%{version}-mpich/lib/lib*mumps.so $RPM_BUILD_ROOT$MPI_LIB install -cpm 755 %{name}-%{version}-mpich/lib/lib*mumps-%{soname_version}.so $RPM_BUILD_ROOT$MPI_LIB install -cpm 755 %{name}-%{version}-mpich/lib/libpord-%{soname_version}.so $RPM_BUILD_ROOT$MPI_LIB # Make symbolic links instead hard-link ln -sf libsmumps-%{soname_version}.so $RPM_BUILD_ROOT$MPI_LIB/libsmumps.so ln -sf libcmumps-%{soname_version}.so $RPM_BUILD_ROOT$MPI_LIB/libcmumps.so ln -sf libzmumps-%{soname_version}.so $RPM_BUILD_ROOT$MPI_LIB/libzmumps.so ln -sf libdmumps-%{soname_version}.so $RPM_BUILD_ROOT$MPI_LIB/libdmumps.so ln -sf libmumps_common-%{soname_version}.so $RPM_BUILD_ROOT$MPI_LIB/libmumps_common.so ln -sf libpord-%{soname_version}.so $RPM_BUILD_ROOT$MPI_LIB/libpord.so install -cpm 755 %{name}-%{version}-mpich/examples/?simpletest $RPM_BUILD_ROOT%{_libdir}/mpich/%{name}-%{version}-examples install -cpm 755 %{name}-%{version}-mpich/examples/input_* $RPM_BUILD_ROOT%{_libdir}/mpich/%{name}-%{version}-examples install -cpm 755 %{name}-%{version}-mpich/examples/README-* $RPM_BUILD_ROOT%{_libdir}/mpich/%{name}-%{version}-examples install -cpm 644 %{name}-%{version}-mpich/include/*.h $RPM_BUILD_ROOT$MPI_INCLUDE install -cpm 644 PORD/include/* $RPM_BUILD_ROOT$MPI_INCLUDE install -cpm 644 %{name}-%{version}-mpich/modules/* $RPM_BUILD_ROOT$MPI_FORTRAN_MOD_DIR/%{name}-%{version}/ %{_mpich_unload} %endif ########################################################## mkdir -p $RPM_BUILD_ROOT%{_libexecdir}/%{name}-%{version}/examples mkdir -p $RPM_BUILD_ROOT%{_libdir} mkdir -p $RPM_BUILD_ROOT%{_includedir}/%{name} mkdir -p $RPM_BUILD_ROOT%{_fmoddir}/%{name}-%{version} # Install libraries. install -cpm 755 %{name}-%{version}/lib/lib*.so $RPM_BUILD_ROOT%{_libdir}/ install -cpm 755 %{name}-%{version}/examples/?simpletest $RPM_BUILD_ROOT%{_libexecdir}/%{name}-%{version}/examples/ install -cpm 755 %{name}-%{version}/examples/input_* $RPM_BUILD_ROOT%{_libexecdir}/%{name}-%{version}/examples/ install -cpm 755 %{name}-%{version}/examples/c_example $RPM_BUILD_ROOT%{_libexecdir}/%{name}-%{version}/examples/ install -cpm 755 %{name}-%{version}/examples/*_save_restore $RPM_BUILD_ROOT%{_libexecdir}/%{name}-%{version}/examples/ install -cpm 755 %{name}-%{version}/examples/multiple_arithmetics_example $RPM_BUILD_ROOT%{_libexecdir}/%{name}-%{version}/examples/ install -cpm 644 %{name}-%{version}/examples/README-* $RPM_BUILD_ROOT%{_libexecdir}/%{name}-%{version}/examples/ install -cpm 644 %{name}-%{version}/modules/* $RPM_BUILD_ROOT%{_fmoddir}/%{name}-%{version}/ install -cpm 644 %{name}-%{version}/include/*.h $RPM_BUILD_ROOT%{_includedir}/%{name}/ #install -cpm 644 libseq/*.h $RPM_BUILD_ROOT%%{_includedir}/%%{name}/ install -cpm 644 PORD/include/* $RPM_BUILD_ROOT%{_includedir}/%{name}/ # rpm macro for version checking mkdir -p $RPM_BUILD_ROOT%{_rpmmacrodir} cat > $RPM_BUILD_ROOT%{_rpmmacrodir}/macros.MUMPS <