From b8c2d50f04c020b683d5c4c9396d7527fb4c1775 Mon Sep 17 00:00:00 2001 From: Honggang Li Date: Thu, 18 Feb 2021 09:36:33 +0800 Subject: [PATCH] build mvapich2-2.3.5-2.tar.gz for RHEL9 Resolves: rhbz#1923559 Signed-off-by: Honggang Li --- .gitignore | 1 + gating.yaml | 11 + mvapich2.macros.in | 6 + mvapich2.module.in | 22 ++ mvapich2.spec | 214 ++++++++++++++++++ sources | 1 + tests/run_tests.sh | 10 + tests/sanity.sh | 17 ++ tests/tests.yml | 12 + ...dle-contrib-hwloc-and-osu_benchmarks.patch | 25 ++ 10 files changed, 319 insertions(+) create mode 100644 gating.yaml create mode 100644 mvapich2.macros.in create mode 100644 mvapich2.module.in create mode 100644 mvapich2.spec create mode 100644 sources create mode 100755 tests/run_tests.sh create mode 100755 tests/sanity.sh create mode 100644 tests/tests.yml create mode 100644 unbundle-contrib-hwloc-and-osu_benchmarks.patch diff --git a/.gitignore b/.gitignore index e69de29..4147258 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/mvapich2-2.3.5-2.tar.gz diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..015fe8f --- /dev/null +++ b/gating.yaml @@ -0,0 +1,11 @@ +--- !Policy + +product_versions: + + - rhel-8 + +decision_context: osci_compose_gate + +rules: + + - !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional} diff --git a/mvapich2.macros.in b/mvapich2.macros.in new file mode 100644 index 0000000..a95eadf --- /dev/null +++ b/mvapich2.macros.in @@ -0,0 +1,6 @@ +%_@MACRONAME@_load \ + . /etc/profile.d/modules.sh; \ + module load mpi/@MODULENAME@; +%_@MACRONAME@_unload \ + . /etc/profile.d/modules.sh; \ + module unload mpi/@MODULENAME@; diff --git a/mvapich2.module.in b/mvapich2.module.in new file mode 100644 index 0000000..1002362 --- /dev/null +++ b/mvapich2.module.in @@ -0,0 +1,22 @@ +#%Module 1.0 +# +# OpenMPI module for use with 'environment-modules' package: +# +conflict mpi +prepend-path PATH @LIBDIR@/bin +prepend-path LD_LIBRARY_PATH @LIBDIR@/lib +prepend-path PKG_CONFIG_PATH @LIBDIR@/lib/pkgconfig +prepend-path PYTHONPATH @PYSITEARCH@ +prepend-path MANPATH @MANDIR@ +setenv MPI_BIN @LIBDIR@/bin +setenv MPI_SYSCONFIG @ETCDIR@ +setenv MPI_FORTRAN_MOD_DIR @FMODDIR@ +setenv MPI_INCLUDE @INCDIR@ +setenv MPI_LIB @LIBDIR@/lib +setenv MPI_MAN @MANDIR@ +setenv MPI_PYTHON_SITEARCH @PYSITEARCH@ +setenv MPI_PYTHON2_SITEARCH @PYSITEARCH@ +setenv MPI_PYTHON3_SITEARCH @PYSITEARCH@ +setenv MPI_COMPILER @COMPILER@ +setenv MPI_SUFFIX @SUFFIX@ +setenv MPI_HOME @LIBDIR@ diff --git a/mvapich2.spec b/mvapich2.spec new file mode 100644 index 0000000..c4cca87 --- /dev/null +++ b/mvapich2.spec @@ -0,0 +1,214 @@ +%{!?python3_sitearch: %global python3_sitearch %(%{__python3} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} + +Name: mvapich2 +Version: 2.3.5 +Release: 2%{?dist} +Summary: OSU MVAPICH2 MPI package +Group: Development/Libraries +# Richard Fontana wrote in https://bugzilla.redhat.com/show_bug.cgi?id=1333114: +## The mvapich2 source code is predominantly 3-clause BSD with a smattering of +## 2-clause BSD, MIT and proto-MIT licensed source code. Under the license +## abbreviation system inherited from Fedora that set of licenses is adequately +## described as 'BSD and MIT'. +## There are a couple of source files that indicate they are taken from glibc +## with LGPL license notices, but context strongly suggests that the author of +## that particular code placed it under the MIT license (which is consistent +## with the approach to copyright assignment in glibc in which the author +## receives a broad grant-back license permitting sublicensing under terms +## other than LGPL). +License: BSD and MIT +URL: http://mvapich.cse.ohio-state.edu +Source: http://mvapich.cse.ohio-state.edu/download/mvapich/mv2/%{name}-%{version}-2.tar.gz +Source1: mvapich2.module.in +Source2: mvapich2.macros.in +# We delete bundled stuff in the prep step. The *-unbundle-* patches adjust +# the configure scripts and Makefiles accordingly. +Patch1: unbundle-contrib-hwloc-and-osu_benchmarks.patch + +BuildRequires: gcc-gfortran, gcc-c++ +BuildRequires: libibumad-devel, libibverbs-devel >= 1.1.3, librdmacm-devel +BuildRequires: python3-devel, perl-Digest-MD5, hwloc-devel, rdma-core-devel +BuildRequires: bison, flex +BuildRequires: autoconf, automake, libtool +BuildRequires: rpm-mpi-hooks, rdma-core-devel, infiniband-diags-devel +ExcludeArch: s390 s390x +Provides: mpi +Requires: environment-modules + +%global common_desc MVAPICH2 is a Message Passing Interface (MPI 3.0) implementation based on MPICH\ +and developed by Ohio State University. + +%description +%{common_desc} + +%package devel +Summary: Development files for %{name} +Group: Development/Libraries +Provides: mpi-devel +Requires: librdmacm-devel, libibverbs-devel, libibumad-devel +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: gcc-gfortran + +%description devel +Contains development headers and libraries for %{name}. + +%package doc +Summary: Documentation files for mvapich2 +Group: Documentation +BuildArch: noarch + +%description doc +Additional documentation for mvapich2. + +%prep +%setup -q -n mvapich2-2.3.5-2 +%patch1 -p1 +# bundled hwloc, knem kernel module +rm -r contrib/ +# limic kernel module +rm -r limic2-0.5.6/ +# bundled OSU benchmarks +rm -r osu_benchmarks/ + +# Remove rpath, part 1 +find . -name configure -exec \ + sed -i -r 's/(hardcode_into_libs)=.*$/\1=no/' '{}' ';' + +%build +%set_build_flags +export FFLAGS="$FFLAGS -fallow-argument-mismatch" + +export AR=ar + +%global variant %{name} +%global libname %{variant} +%global namearch %{variant}-%{_arch} + +./configure \ + --prefix=%{_libdir}/%{libname} \ + --exec-prefix=%{_libdir}/%{libname} \ + --bindir=%{_libdir}/%{libname}/bin \ + --sbindir=%{_libdir}/%{libname}/bin \ + --libdir=%{_libdir}/%{libname}/lib \ + --mandir=%{_mandir}/%{namearch} \ + --includedir=%{_includedir}/%{namearch} \ + --sysconfdir=%{_sysconfdir}/%{namearch} \ + --datarootdir=%{_datadir}/%{libname} \ + --docdir=%{_docdir}/%{name} \ + --enable-error-checking=runtime \ + --enable-timing=none \ + --enable-g=mem,dbg,meminit \ + --enable-fast=all \ + --enable-shared \ + --enable-static \ + --enable-fortran=all \ + --enable-cxx \ + --disable-silent-rules \ + --disable-wrapper-rpath \ + --with-hwloc=v2 + +# Remove rpath, part 2 +find . -name libtool -exec \ + sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g; + s|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' '{}' ';' +make %{?_smp_mflags} + + +%install +finish_install() { + local VARIANT="$1" + local LIBNAME="$VARIANT" + local NAMEARCH="$VARIANT-%{_arch}" + + local MODULE_TEMPLATE="$2" + local MACROS_TEMPLATE="$3" + local FORTRAN_SUBDIR_SUFFIX="$4" + + find %{buildroot}%{_libdir}/$LIBNAME/lib -name \*.la -delete + + mkdir -p %{buildroot}%{_mandir}/$NAMEARCH/man{2,4,5,6,7,8,9,n} + mkdir -p %{buildroot}/%{_fmoddir}/$LIBNAME$FORTRAN_SUBDIR_SUFFIX + mkdir -p %{buildroot}/%{python3_sitearch}/$LIBNAME + + # Make the environment-modules file + mkdir -p %{buildroot}%{_sysconfdir}/modulefiles/mpi + sed "s#@LIBDIR@#%{_libdir}/$LIBNAME#g; + s#@ETCDIR@#%{_sysconfdir}/$NAMEARCH#g; + s#@FMODDIR@#%{_fmoddir}/$LIBNAME$FORTRAN_SUBDIR_SUFFIX#g; + s#@INCDIR@#%{_includedir}/$NAMEARCH#g; + s#@MANDIR@#%{_mandir}/$NAMEARCH#g; + s#@PYSITEARCH@#%{python3_sitearch}/$LIBNAME#g; + s#@COMPILER@#$NAMEARCH#g; + s#@SUFFIX@#_$VARIANT#g" \ + < $MODULE_TEMPLATE \ + > %{buildroot}%{_sysconfdir}/modulefiles/mpi/$NAMEARCH + + # make the rpm config file + mkdir -p %{buildroot}%{_sysconfdir}/rpm + # do not expand _arch + sed "s#@MACRONAME@#${LIBNAME//[-.]/_}#g; + s#@MODULENAME@#$NAMEARCH#" \ + < $MACROS_TEMPLATE \ + > %{buildroot}/%{_sysconfdir}/rpm/macros.$NAMEARCH +} + +# 'make install' fails to mkdir docdir by itself before installing index.html +mkdir -p %{buildroot}%{_docdir}/%{name} + +%make_install +finish_install %{name} %SOURCE1 %SOURCE2 "" + +%global variant %{name} +%global libname %{variant} +%global namearch %{variant}-%{_arch} + +%files +%dir %{_libdir}/%{libname} +%dir %{_libdir}/%{libname}/bin +%dir %{_libdir}/%{libname}/lib +%dir %{_mandir}/%{namearch} +%dir %{_mandir}/%{namearch}/man* +%dir %{_fmoddir}/%{libname} +%dir %{python3_sitearch}/%{libname} + +%{_libdir}/%{libname}/bin/hydra_nameserver +%{_libdir}/%{libname}/bin/hydra_persist +%{_libdir}/%{libname}/bin/hydra_pmi_proxy +%{_libdir}/%{libname}/bin/mpichversion +%{_libdir}/%{libname}/bin/mpiexec +%{_libdir}/%{libname}/bin/mpiexec.hydra +%{_libdir}/%{libname}/bin/mpiexec.mpirun_rsh +%{_libdir}/%{libname}/bin/mpiname +%{_libdir}/%{libname}/bin/mpirun +%{_libdir}/%{libname}/bin/mpirun_rsh +%{_libdir}/%{libname}/bin/mpispawn +%{_libdir}/%{libname}/bin/mpivars +%{_libdir}/%{libname}/bin/parkill +%{_libdir}/%{libname}/lib/*.so.* +%{_mandir}/%{namearch}/man1/hydra_* +%{_mandir}/%{namearch}/man1/mpiexec.* +%{_sysconfdir}/modulefiles/mpi/%{namearch} + +%files devel +%dir %{_includedir}/%{namearch} +%{_sysconfdir}/rpm/macros.%{namearch} +%{_includedir}/%{namearch}/* +%{_libdir}/%{libname}/bin/mpic++ +%{_libdir}/%{libname}/bin/mpicc +%{_libdir}/%{libname}/bin/mpicxx +%{_libdir}/%{libname}/bin/mpif77 +%{_libdir}/%{libname}/bin/mpif90 +%{_libdir}/%{libname}/bin/mpifort +%{_libdir}/%{libname}/lib/pkgconfig +%{_libdir}/%{libname}/lib/*.a +%{_libdir}/%{libname}/lib/*.so +%{_mandir}/%{namearch}/man1/mpi[cf]* +%{_mandir}/%{namearch}/man3/* + +%files doc +%{_docdir}/%{name} + +%changelog +* Wed Feb 17 2021 Honggang Li - 2.3.5-2 +- build mvapich2-2.3.5-2.tar.gz for RHEL9 +- Resolves: rhbz#1923559 diff --git a/sources b/sources new file mode 100644 index 0000000..12fdc82 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (mvapich2-2.3.5-2.tar.gz) = 8873dd0b3484c2d63d6f72b0860cfb31454069adc87936986d2e53b990c0a9e93b6786552e981809d627bd8e886310908e05eb62604a4ff3837d527ec58d44e9 diff --git a/tests/run_tests.sh b/tests/run_tests.sh new file mode 100755 index 0000000..11017ab --- /dev/null +++ b/tests/run_tests.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +# when running this in 1minutetip the PATH must be specified to execute +# in the local directory. +echo "Setting path to local directory" +PATH=$PATH:$(pwd) + +# simple sanity test +sanity.sh +exit $? diff --git a/tests/sanity.sh b/tests/sanity.sh new file mode 100755 index 0000000..c7a4900 --- /dev/null +++ b/tests/sanity.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# +# This is a simple sanity test to satisfy the RHEL8.1 onboard gating +# requirement. + +ret=$? +source /etc/profile.d/modules.sh + +module load mpi/mvapich2-x86_64 + +mpichversion +let ret=$ret+$? + +mpirun hostname +let ret=$ret+$? + +exit $ret diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..945c98c --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,12 @@ +- hosts: localhost + roles: + - role: standard-test-basic + tags: + - classic + tests: + - simple: + dir: . # switch to subfolder. This parameter is REQUIRED, use `dir: .` for current folder + run: ./run_tests.sh # this is your test command, its exit code is the outcome of the test + required_packages: + - environment-modules + - mvapich2 diff --git a/unbundle-contrib-hwloc-and-osu_benchmarks.patch b/unbundle-contrib-hwloc-and-osu_benchmarks.patch new file mode 100644 index 0000000..cd74a5b --- /dev/null +++ b/unbundle-contrib-hwloc-and-osu_benchmarks.patch @@ -0,0 +1,25 @@ +diff --git a/Makefile.in b/Makefile.in +index 9e2d9bde248f..789a69723c9e 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -3050,13 +3050,13 @@ bin_PROGRAMS = $(am__EXEEXT_1) src/env/mpichversion$(EXEEXT) \ + @BUILD_F77_BINDING_TRUE@@BUILD_PROFILING_LIB_TRUE@am__append_184 = -DMPICH_MPI_FROM_PMPI -DUSE_ONLY_MPI_NAMES + @BUILD_F77_BINDING_TRUE@@BUILD_FC_BINDING_TRUE@am__append_185 = $(mpi_fc_sources) + @BUILD_CXX_BINDING_TRUE@am__append_186 = lib/lib@MPICXXLIBNAME@.la +-@BUILD_HWLOC_v1_TRUE@@BUILD_OSU_MVAPICH_TRUE@am__append_187 = contrib/hwloc_v1 +-@BUILD_HWLOC_v1_FALSE@@BUILD_OSU_MVAPICH_TRUE@am__append_188 = contrib/hwloc_v2 +-@BUILD_OSU_MVAPICH_TRUE@am__append_189 = src/env/mpiname src/util/mv2_ckpt_rebuild osu_benchmarks +-@BUILD_HWLOC_v1_TRUE@@BUILD_OSU_MVAPICH_TRUE@am__append_190 = -Icontrib/hwloc_v1/include/ -I$(top_srcdir)/contrib/hwloc_v1/include +-@BUILD_HWLOC_v1_TRUE@@BUILD_OSU_MVAPICH_TRUE@am__append_191 = contrib/hwloc_v1/src/libhwloc_embedded.la +-@BUILD_HWLOC_v1_FALSE@@BUILD_OSU_MVAPICH_TRUE@am__append_192 = -Icontrib/hwloc_v2/include/ -I$(top_srcdir)/contrib/hwloc_v2/include +-@BUILD_HWLOC_v1_FALSE@@BUILD_OSU_MVAPICH_TRUE@am__append_193 = contrib/hwloc_v2/hwloc/libhwloc_embedded.la ++@BUILD_HWLOC_v1_TRUE@@BUILD_OSU_MVAPICH_TRUE@am__append_187 = ++@BUILD_HWLOC_v1_FALSE@@BUILD_OSU_MVAPICH_TRUE@am__append_188 = ++@BUILD_OSU_MVAPICH_TRUE@am__append_189 = src/env/mpiname src/util/mv2_ckpt_rebuild ++@BUILD_HWLOC_v1_TRUE@@BUILD_OSU_MVAPICH_TRUE@am__append_190 = ++@BUILD_HWLOC_v1_TRUE@@BUILD_OSU_MVAPICH_TRUE@am__append_191 = -lhwloc ++@BUILD_HWLOC_v1_FALSE@@BUILD_OSU_MVAPICH_TRUE@am__append_192 = ++@BUILD_HWLOC_v1_FALSE@@BUILD_OSU_MVAPICH_TRUE@am__append_193 = -lhwloc + @BUILD_COVERAGE_TRUE@am__append_194 = coverage-clean + subdir = . + ACLOCAL_M4 = $(top_srcdir)/aclocal.m4