diff --git a/scotch-Makefile.shared.inc.in b/scotch-Makefile.shared.inc.in new file mode 100644 index 0000000000000000000000000000000000000000..5ae79a3a4777b21aa3ad21de31277005cb96ea25 --- /dev/null +++ b/scotch-Makefile.shared.inc.in @@ -0,0 +1,24 @@ +EXE = +LIB = .so +OBJ = .o + +MAKE = make +AR = gcc +CAT = cat +CCS = gcc +CCP = mpicc +CCD = mpicc +override CFLAGS += -DCOMMON_FILE_COMPRESS_GZ -DCOMMON_FILE_COMPRESS_BZ2 -DCOMMON_FILE_COMPRESS_LZMA \ + -DCOMMON_PTHREAD -DCOMMON_RANDOM_FIXED_SEED -DSCOTCH_RENAME \ + -Drestrict=__restrict -DIDXSIZE64 +CLIBFLAGS = -shared -fPIC +override LDFLAGS += -lz -lbz2 -llzma -lm -lrt -lpthread +# LDFLAGS added to AR rule in Makefiles to come after objects to work with -Wl,--as-needed +ARFLAGS = -shared -Wl,-soname=$@.$(SOMAJ) -o +CP = cp -av +LEX = flex +LN = ln +MKDIR = mkdir -p +MV = mv +RANLIB = echo +YACC = bison -y diff --git a/scotch-gfortran.patch b/scotch-gfortran.patch new file mode 100644 index 0000000000000000000000000000000000000000..97120f4a85fb3701ca8bea955cda65ab484b5cb3 --- /dev/null +++ b/scotch-gfortran.patch @@ -0,0 +1,12 @@ +diff -rupN --no-dereference scotch-v6.1.2/src/check/Makefile scotch-v6.1.2-new/src/check/Makefile +--- scotch-v6.1.2/src/check/Makefile 2021-11-13 11:07:54.000000000 +0100 ++++ scotch-v6.1.2-new/src/check/Makefile 2021-11-13 21:44:21.161507721 +0100 +@@ -68,7 +68,7 @@ include ../Makefile.inc + $(CC) $(CFLAGS) -I$(SCOTCHINCDIR) -L$(SCOTCHLIBDIR) $(<) -o $(@) $(SCOTCHLIBS) $(LDFLAGS) + + %$(EXE) : %.f90 +- $(FC) $(FFLAGS) -I$(SCOTCHINCDIR) -L$(SCOTCHLIBDIR) $(<) -o $(@) $(SCOTCHLIBS) $(LDFLAGS) ++ gfortran $(FFLAGS) -I$(SCOTCHINCDIR) -L$(SCOTCHLIBDIR) $(<) -o $(@) $(SCOTCHLIBS) $(LDFLAGS) + + ## + ## Project rules. diff --git a/scotch-ldflags.patch b/scotch-ldflags.patch new file mode 100644 index 0000000000000000000000000000000000000000..cf532ea52a86af888a23b3a9bf7083fa3291ecc1 --- /dev/null +++ b/scotch-ldflags.patch @@ -0,0 +1,69 @@ +diff -rupN --no-dereference scotch-v6.1.2/src/esmumps/Makefile scotch-v6.1.2-new/src/esmumps/Makefile +--- scotch-v6.1.2/src/esmumps/Makefile 2021-11-13 11:07:54.000000000 +0100 ++++ scotch-v6.1.2-new/src/esmumps/Makefile 2021-11-13 21:44:21.098507670 +0100 +@@ -196,7 +196,7 @@ symbol_fax_graph$(OBJ) : symbol_fax_gra + fax.h + + libesmumps$(LIB) : $(LIBESMUMPSDEPS) +- $(AR) $(ARFLAGS) $(@) $(?) ++ $(AR) $(ARFLAGS) $(@) $(?) $(LDFLAGS) + -$(RANLIB) $(@) + + main_esmumps$(EXE) : main_esmumps.c \ +diff -rupN --no-dereference scotch-v6.1.2/src/libscotch/Makefile scotch-v6.1.2-new/src/libscotch/Makefile +--- scotch-v6.1.2/src/libscotch/Makefile 2021-11-13 11:07:54.000000000 +0100 ++++ scotch-v6.1.2-new/src/libscotch/Makefile 2021-11-13 21:44:21.098507670 +0100 +@@ -3119,26 +3119,26 @@ ptscotchf.h : ptdummysizes$(EXE) \ + library_pt_f.h + ./ptdummysizes$(EXE) "-s$(SCOTCH_NAME_SUFFIX)" library_pt_f.h ptscotchf.h + +-libscotch$(LIB) : $(LIBSCOTCHDEPS) +- $(AR) $(ARFLAGS) $(@) $(?) ++libscotch$(LIB) : $(LIBSCOTCHDEPS) libscotcherr$(LIB) ++ $(AR) $(ARFLAGS) $(@) $(?) $(LDFLAGS) -L . -lscotcherr + -$(RANLIB) $(@) + + libscotcherr$(LIB) : library_error$(OBJ) +- $(AR) $(ARFLAGS) $(@) $(?) ++ $(AR) $(ARFLAGS) $(@) $(?) $(LDFLAGS) + -$(RANLIB) $(@) + + libscotcherrexit$(LIB) : library_error_exit$(OBJ) +- $(AR) $(ARFLAGS) $(@) $(?) ++ $(AR) $(ARFLAGS) $(@) $(?) $(LDFLAGS) + -$(RANLIB) $(@) + +-libptscotch$(LIB) : $(LIBPTSCOTCHDEPS) +- $(AR) $(ARFLAGS) $(@) $(?) ++libptscotch$(LIB) : $(LIBPTSCOTCHDEPS) libscotch$(LIB) ++ $(AR) $(ARFLAGS) $(@) $(?) $(LDFLAGS) -L . -lscotch + -$(RANLIB) $(@) + + libptscotcherr$(LIB) : library_error_pt$(OBJ) +- $(AR) $(ARFLAGS) $(@) $(?) ++ $(AR) $(ARFLAGS) $(@) $(?) $(LDFLAGS) + -$(RANLIB) $(@) + + libptscotcherrexit$(LIB) : library_error_exit_pt$(OBJ) +- $(AR) $(ARFLAGS) $(@) $(?) ++ $(AR) $(ARFLAGS) $(@) $(?) $(LDFLAGS) + -$(RANLIB) $(@) +diff -rupN --no-dereference scotch-v6.1.2/src/libscotchmetis/Makefile scotch-v6.1.2-new/src/libscotchmetis/Makefile +--- scotch-v6.1.2/src/libscotchmetis/Makefile 2021-11-13 11:07:54.000000000 +0100 ++++ scotch-v6.1.2-new/src/libscotchmetis/Makefile 2021-11-13 21:44:21.099507671 +0100 +@@ -187,7 +187,7 @@ libptscotchparmetis$(LIB) : parmetis_dgr + parmetis_dgraph_order_f$(OBJ) \ + parmetis_dgraph_part$(OBJ) \ + parmetis_dgraph_part_f$(OBJ) +- $(AR) $(ARFLAGS) $(@) $(^) ++ $(AR) $(ARFLAGS) $(@) $(^) $(LDFLAGS) -L ../libscotch -lptscotch + -$(RANLIB) $(@) + + libscotchmetis$(LIB) : metis_graph_dual$(OBJ) \ +@@ -200,5 +200,5 @@ libscotchmetis$(LIB) : metis_graph_dual + metis_graph_part_dual_f$(OBJ) \ + metis_options$(OBJ) \ + metis_options_f$(OBJ) +- $(AR) $(ARFLAGS) $(@) $(^) ++ $(AR) $(ARFLAGS) $(@) $(^) $(LDFLAGS) -L ../libscotch -lscotch + -$(RANLIB) $(@) diff --git a/scotch-v6.1.2.tar.bz2 b/scotch-v6.1.2.tar.bz2 new file mode 100644 index 0000000000000000000000000000000000000000..1605a136552bb0a978dd4e656bba4731d432a755 Binary files /dev/null and b/scotch-v6.1.2.tar.bz2 differ diff --git a/scotch.spec b/scotch.spec new file mode 100644 index 0000000000000000000000000000000000000000..503e5697809eadddc352049ec986955bdb3d4121 --- /dev/null +++ b/scotch.spec @@ -0,0 +1,275 @@ +%global openmpidir %{_builddir}/ptscotch-openmpi-%{version}-%{release} +%global mpichdir %{_builddir}/ptscotch-mpich-%{version}-%{release} + +# Shared library versioning: +# Increment if interface is changed in an incompatible way +%global so_maj 1 +# Increment if interface is extended +%global so_min 3 + +Name: scotch +Summary: Graph, mesh and hypergraph partitioning library +Version: 6.1.2 +Release: 1 + +License: CeCILL-C +URL: https://gitlab.inria.fr/scotch/scotch +Source0: https://gitlab.inria.fr/scotch/scotch/-/archive/v%{version}/scotch-v%{version}.tar.bz2 +Source1: scotch-Makefile.shared.inc.in + +# Make shared libraries link properly with -Wl,--as-needed +Patch0: scotch-ldflags.patch +# Ensure gfortran is used as fortran compiler +Patch1: scotch-gfortran.patch + +BuildRequires: gcc +BuildRequires: gcc-gfortran +BuildRequires: make +BuildRequires: flex +BuildRequires: bison +BuildRequires: zlib-devel +BuildRequires: bzip2-devel +BuildRequires: xz-devel +BuildRequires: environment-modules + +%description +Scotch is a software package for graph and mesh/hypergraph partitioning and +sparse matrix ordering. The parallel scotch libraries are packaged in the +ptscotch sub-packages. + +%package devel +Summary: Development libraries for scotch +Requires: %{name} = %{version}-%{release} + +%description devel +This package contains development libraries for scotch. + + +%package doc +Summary: Documentations and example for scotch and ptscotch +BuildArch: noarch + +%description doc +Contains documentations and example for scotch and ptscotch + +############################################################################### + +%package -n ptscotch-mpich +Summary: PT-Scotch libraries compiled against mpich +BuildRequires: mpich-devel + +%description -n ptscotch-mpich +Scotch is a software package for graph and mesh/hypergraph partitioning and +sparse matrix ordering. This sub-package provides parallelized scotch libraries +compiled with mpich. + + +%package -n ptscotch-mpich-devel +Summary: Development libraries for PT-Scotch (mpich) +Requires: pt%{name}-mpich = %{version}-%{release} + +%description -n ptscotch-mpich-devel +This package contains development libraries for PT-Scotch, compiled against +mpich. + +%package -n ptscotch-mpich-devel-parmetis +Summary: Parmetis compatibility header for scotch +Requires: pt%{name}-mpich-devel = %{version}-%{release} + +%description -n ptscotch-mpich-devel-parmetis +This package contains the parmetis compatibility header for scotch. + + +############################################################################### + +%package -n ptscotch-openmpi +Summary: PT-Scotch libraries compiled against openmpi +BuildRequires: openmpi-devel + +%description -n ptscotch-openmpi +Scotch is a software package for graph and mesh/hypergraph partitioning and +sparse matrix ordering. This sub-package provides parallelized scotch libraries +compiled with openmpi. + + +%package -n ptscotch-openmpi-devel +Summary: Development libraries for PT-Scotch (openmpi) +Requires: pt%{name}-openmpi = %{version}-%{release} + +%description -n ptscotch-openmpi-devel +This package contains development libraries for PT-Scotch, compiled against +openmpi. + + +%package -n ptscotch-openmpi-devel-parmetis +Summary: Parmetis compatibility header for scotch +Requires: pt%{name}-openmpi-devel = %{version}-%{release} + +%description -n ptscotch-openmpi-devel-parmetis +This package contains the parmetis compatibility header for scotch. + +############################################################################### + +%prep +%autosetup -p1 -n %{name}-v%{version} + +cp -a %{SOURCE1} src/Makefile.inc + +# Convert the license files to utf8 +for file in doc/CeCILL-C_V1-en.txt doc/CeCILL-C_V1-fr.txt; do + iconv -f iso8859-1 -t utf-8 $file > $file.conv && mv -f $file.conv $file +done + +cp -a . %{openmpidir} +cp -a . %{mpichdir} + + +%build +pushd src/ +make scotch esmumps CFLAGS="%{optflags}" LDFLAGS="%{?__global_ldflags}" SOMAJ="%{so_maj}" +popd + +%{_mpich_load} +pushd %{mpichdir}/src/ +make ptscotch ptesmumps CFLAGS="%{optflags}" LDFLAGS="%{?__global_ldflags} -L%{_libdir}/mpich/lib -lmpi" SOMAJ="%{so_maj}" +popd +%{_mpich_unload} + +%{_openmpi_load} +pushd %{openmpidir}/src/ +make ptscotch ptesmumps CFLAGS="%{optflags}" LDFLAGS="%{?__global_ldflags} -L%{_libdir}/openmpi/lib -lmpi" SOMAJ="%{so_maj}" +popd +%{_openmpi_unload} + + +%install +%define doinstall() \ +make install prefix=%{buildroot}${MPI_HOME} libdir=%{buildroot}${MPI_LIB} includedir=%{buildroot}${MPI_INCLUDE} mandir=%{buildroot}${MPI_MAN} bindir=%{buildroot}${MPI_BIN} \ +# Fix debuginfo packages not finding sources (See libscotch/Makefile) \ +ln -s parser_ll.c libscotch/lex.yy.c \ +ln -s parser_yy.c libscotch/y.tab.c \ +ln -s parser_ly.h libscotch/y.tab.h \ +\ +pushd %{buildroot}${MPI_LIB}; \ +for lib in *.so; do \ + chmod 755 $lib \ + mv $lib $lib.%{so_maj}.%{so_min} && ln -s $lib.%{so_maj}.%{so_min} $lib && ln -s $lib.%{so_maj}.%{so_min} $lib.%{so_maj} \ +done \ +popd \ +\ +pushd %{buildroot}${MPI_BIN} \ +for prog in *; do \ + mv $prog scotch_${prog} \ + chmod 755 scotch_$prog \ +done \ +popd \ +\ +pushd %{buildroot}${MPI_MAN}/man1/ \ +for man in *; do \ + mv ${man} scotch_${man} \ +done \ +# Cleanup man pages (some pages are only relevant for ptscotch packages, and vice versa) \ +for man in *; do \ + if [ ! -f %{buildroot}${MPI_BIN}/${man/.1/} ]; then \ + rm -f $man \ + fi \ +done \ +popd + +############################################################################### + +export MPI_HOME=%{_prefix} +export MPI_LIB=%{_libdir} +export MPI_INCLUDE=%{_includedir} +export MPI_MAN=%{_mandir} +export MPI_BIN=%{_bindir} +pushd src +%doinstall +popd + +############################################################################### + +%{_mpich_load} +pushd %{mpichdir}/src +%doinstall +install -m644 libscotchmetis/parmetis.h %{buildroot}${MPI_INCLUDE} +popd +%{_mpich_unload} + +############################################################################### + +%{_openmpi_load} +pushd %{openmpidir}/src +%doinstall +install -m644 libscotchmetis/parmetis.h %{buildroot}${MPI_INCLUDE} +popd +%{_openmpi_unload} + +############################################################################### + + +%check +LD_LIBRARY_PATH=%{buildroot}%{_libdir} make -C src/check + + +%ldconfig_scriptlets + +%ldconfig_scriptlets -n ptscotch-mpich + +%ldconfig_scriptlets -n ptscotch-openmpi + + +%{!?_licensedir:%global license %%doc} +%files +%license doc/CeCILL-C_V1-en.txt +%{_bindir}/* +%{_libdir}/libscotch*.so.1* +%{_libdir}/libesmumps*.so.1* +%{_mandir}/man1/* + +%files devel +%{_libdir}/libscotch*.so +%{_libdir}/libesmumps*.so +%{_includedir}/*scotch*.h +%{_includedir}/*esmumps*.h + +%files -n ptscotch-mpich +%license doc/CeCILL-C_V1-en.txt +%{_libdir}/mpich/lib/lib*scotch*.so.1* +%{_libdir}/mpich/lib/lib*esmumps*.so.1* +%{_libdir}/mpich/bin/* +%{_mandir}/mpich*/* + +%files -n ptscotch-mpich-devel +%{_includedir}/mpich*/*scotch*.h +%{_includedir}/mpich*/*esmumps*.h +%{_libdir}/mpich/lib/lib*scotch*.so +%{_libdir}/mpich/lib/lib*esmumps*.so + +%files -n ptscotch-mpich-devel-parmetis +%{_includedir}/mpich*/parmetis.h + +%files -n ptscotch-openmpi +%license doc/CeCILL-C_V1-en.txt +%{_libdir}/openmpi/lib/lib*scotch*.so.1* +%{_libdir}/openmpi/lib/lib*esmumps*.so.1* +%{_libdir}/openmpi/bin/* +%{_mandir}/openmpi*/* + +%files -n ptscotch-openmpi-devel +%{_includedir}/openmpi*/*scotch*.h +%{_includedir}/openmpi*/*esmumps*.h +%{_libdir}/openmpi/lib/lib*scotch*.so +%{_libdir}/openmpi/lib/lib*esmumps*.so + +%files -n ptscotch-openmpi-devel-parmetis +%{_includedir}/openmpi*/parmetis.h + +%files doc +%license doc/CeCILL-C_V1-en.txt +%doc doc/*.pdf +%doc doc/scotch_example.f + +%changelog +* Wed Feb 09 2022 liweigang - 6.1.2-1 +- init package diff --git a/scotch.yaml b/scotch.yaml new file mode 100644 index 0000000000000000000000000000000000000000..97e31959caa0e1547d621daa159b2b2f0d385b2a --- /dev/null +++ b/scotch.yaml @@ -0,0 +1,4 @@ +version_control: gitlab +src_repo: scotch/scotch +tag_prefix: ^v +seperator: .