From 7365998b511e001e03a94cea6f6803663e681ab853da217676e85b5133d541e5 Mon Sep 17 00:00:00 2001 From: Nicolas Morey-Chaisemartin Date: Fri, 6 Oct 2017 06:44:19 +0000 Subject: [PATCH 1/3] Accepting request 532074 from science:HPC:EnvMod - Add BuildRequires to libibmad-devel for older release (SLE <= 12.2, Leap <= 42.2) - Add HPC specific build targets using environment modules (FATE#321712). OBS-URL: https://build.opensuse.org/request/show/532074 OBS-URL: https://build.opensuse.org/package/show/science:HPC/mvapich2?expand=0&rev=23 --- _multibuild | 5 + macros.hpc-mvapich2 | 20 +++ mvapich2.changes | 11 ++ mvapich2.spec | 343 ++++++++++++++++++++++++++++++++++++-------- 4 files changed, 318 insertions(+), 61 deletions(-) create mode 100644 macros.hpc-mvapich2 diff --git a/_multibuild b/_multibuild index 9787c35..eef5940 100644 --- a/_multibuild +++ b/_multibuild @@ -1,7 +1,12 @@ + standard testsuite psm psm-testsuite psm2 psm2-testsuite + gnu-hpc + gnu-hpc-psm + gnu-hpc-psm2 + gnu-hpc-testsuite diff --git a/macros.hpc-mvapich2 b/macros.hpc-mvapich2 new file mode 100644 index 0000000..16b85f3 --- /dev/null +++ b/macros.hpc-mvapich2 @@ -0,0 +1,20 @@ +# +# mvapich2 +# + +%hpc_mvapich2_init(V:) \ + %{-V: %define _mf_ver %{-V*}} \ + %{expand: %%global hpc_mvapich2_dep_version %%{?_mf_ver}} \ + %{expand: %%global hpc_mvapich2_dir mvapich2} \ + %global hpc_mvapich2_pack_version %{hpc_mvapich2_dep_version} + +# We may have to add a version here. +%hpc_setup_mvapich2 \ + module load mvapich2 + +%hpc_mvapich2_requires \ +Requires: mvapich2%{hpc_mvapich2_dep_version}-%{compiler_family}%{hpc_cf_pack_version}-hpc + +%hpc_mvapich2_requires_devel \ +Requires: mvapich2%{hpc_mvapich2_dep_version}-%{compiler_family}%{hpc_cf_pack_version}-hpc-devel + diff --git a/mvapich2.changes b/mvapich2.changes index 4d3a34d..71a70b3 100644 --- a/mvapich2.changes +++ b/mvapich2.changes @@ -1,3 +1,14 @@ +------------------------------------------------------------------- +Thu Oct 5 13:30:48 UTC 2017 - nmoreychaisemartin@suse.com + +- Add BuildRequires to libibmad-devel for older release (SLE <= 12.2, Leap <= 42.2) + +------------------------------------------------------------------- +Fri Sep 12 15:38:14 UTC 2017 - eich@suse.com + +- Add HPC specific build targets using environment modules + (FATE#321712). + ------------------------------------------------------------------- Tue Sep 12 09:25:01 UTC 2017 - nmoreychaisemartin@suse.com diff --git a/mvapich2.spec b/mvapich2.spec index 8d71dc4..e7cf4e9 100644 --- a/mvapich2.spec +++ b/mvapich2.spec @@ -16,54 +16,145 @@ # -%global flavor @BUILD_FLAVOR@%nil +%global flavor @BUILD_FLAVOR@%{nil} + +%define pname mvapich2 +%define vers 2.2 +%define _vers 2_2 %if "%{flavor}" == "" +ExclusiveArch: do_not_build +%{bcond_with hpc} +%endif + +%if "%{flavor}" == "standard" %define build_flavor verbs +%{bcond_with hpc} %endif %if "%{flavor}" == "testsuite" %define build_flavor verbs %define testsuite 1 +%{bcond_with hpc} %endif %if "%{flavor}" == "psm" %define build_flavor psm +%{bcond_with hpc} %endif %if "%{flavor}" == "psm-testsuite" %define build_flavor psm %define testsuite 1 +%{bcond_with hpc} %endif %if "%{flavor}" == "psm2" %define build_flavor psm2 +%{bcond_with hpc} %endif %if "%{flavor}" == "psm2-testsuite" %define build_flavor psm2 %define testsuite 1 +%{bcond_with hpc} %endif -%if "%{flavor}" != "" -%define pack_suff -%{flavor} -%else -%define pack_suff %{nil} +%if "%flavor" == "gnu-hpc" +%define compiler_family gnu +%undefine c_f_ver +%define build_flavor verbs +%{bcond_without hpc} +%endif +%if "%flavor" == "gnu-hpc-testsuite" +%define compiler_family gnu +%undefine c_f_ver +%define testsuite 1 +%define build_flavor verbs +%{bcond_without hpc} %endif -%define module_name mvapich2%{pack_suff} -%define _prefix /usr/%_lib/mpi/gcc/%{module_name} -%define _libexecdir %{_prefix}/%{_lib} -%define _benchmarkdir %{_libexecdir}/osu-micro-benchmarks +%if "%flavor" == "gnu-hpc-psm" +%define compiler_family gnu +%undefine c_f_ver +%define build_flavor psm +%{bcond_without hpc} +%endif + +%if "%flavor" == "gnu-hpc-psm2" +%define compiler_family gnu +%undefine c_f_ver +%define build_flavor psm2 +%{bcond_without hpc} +%endif + +%if "%flavor" == "gnu6-hpc" +%define compiler_family gnu +%define c_f_ver 6 +%define build_flavor verbs +%{bcond_without hpc} +%endif +%if "%flavor" == "gnu6-hpc-testsuite" +%define compiler_family gnu +%define c_f_ver 6 +%define testsuite 1 +%define build_flavor verbs +%{bcond_without hpc} +%endif + +%if "%flavor" == "gnu6-hpc-psm" +%define compiler_family gnu +%define c_f_ver 6 +%define build_flavor psm +%{bcond_without hpc} +%endif + +%if "%flavor" == "gnu6-hpc-psm2" +%define compiler_family gnu +%define c_f_ver 6 +%define build_flavor psm2 +%{bcond_without hpc} +%endif + +%if "%{build_flavor}" != "verbs" +%define pack_suff %{?build_flavor:-%{build_flavor}} +%endif + +%if %{without hpc} +%define module_name mvapich2%{?pack_suff} +%define p_prefix /usr/%_lib/mpi/gcc/%{module_name} +%define p_bindir %{p_prefix}/bin +%define p_datadir %{p_prefix}/share +%define p_includedir %{p_prefix}/include +%define p_mandir %{p_datadir}/man +%define p_libdir %{p_prefix}/%{_lib} +%define p_libexecdir %{p_prefix}/%{_lib} %define _moduledir /usr/share/modules/gnu-%{module_name} +%define package_name mvapich2%{?pack_suff} +%else +%{hpc_init -M -c %compiler_family %{?c_f_ver:-v %{c_f_ver}} -m mvapich2 %{?pack_suff:-e %{build_flavor}}} +%define p_prefix %{hpc_prefix} +%define p_bindir %{hpc_bindir} +%define p_datadir %{hpc_datadir} +%define p_includedir %{hpc_includedir} +%define p_mandir %{hpc_mandir} +%define p_libdir %{hpc_libdir} +%define p_libexecdir %{hpc_libexecdir} +%define package_name %{hpc_package_name %{_vers}} -Name: mvapich2%{pack_suff} +%global hpc_mvapich2_dep_version %(VER=%{?m_f_ver}; echo -n ${VER}) +%global hpc_mvapich2_dir mvapich2 +%global hpc_mvapich2_pack_version %{hpc_mvapich2_dep_version} +%endif + +Name: %{package_name} Summary: OSU MVAPICH2 MPI package License: BSD-3-Clause Group: Development/Libraries/Parallel -Version: 2.2 +Version: %{vers} Release: 0 -Source0: http://mvapich.cse.ohio-state.edu/download/mvapich/mv2/mvapich2-%{version}.tar.gz +Source0: mvapich2-%{version}.tar.gz Source1: mpivars.sh Source2: mpivars.csh -Source3: _multibuild +Source3: macros.hpc-mvapich2 +Source100: _multibuild Patch0: mvapich2-s390_get_cycles.patch Patch1: mvapich2-pthread_yield.patch Patch2: mvapich2-arm-support.patch @@ -74,16 +165,22 @@ BuildRequires: autoconf BuildRequires: automake BuildRequires: automake BuildRequires: bison -BuildRequires: gcc-c++ -BuildRequires: gcc-fortran %ifnarch s390 s390x armv7hl BuildRequires: libnuma-devel %endif BuildRequires: libtool BuildRequires: libtool -BuildRequires: mpi-selector BuildRequires: python-devel BuildRequires: sysfsutils +%if %{without hpc} +BuildRequires: gcc-c++ +BuildRequires: gcc-fortran +BuildRequires: mpi-selector +%else +BuildRequires: %{compiler_family}%{?c_f_ver}-compilers-hpc-macros-devel +BuildRequires: lua-lmod +BuildRequires: suse-hpc +%endif %if "%{build_flavor}" == "psm" ExclusiveArch: %ix86 x86_64 BuildRequires: infinipath-psm-devel @@ -97,14 +194,23 @@ BuildRequires: infiniband-diags-devel BuildRequires: libibumad-devel BuildRequires: libibverbs-devel BuildRequires: librdmacm-devel +%if 0%{?sle_version} <= 120200 +BuildRequires: libibmad-devel +%endif %endif +%if %{without hpc} Requires: mpi-selector +%else +Requires: lua-lmod +%endif %description This is an MPI-3 implementation which includes all MPI-1 features. It is based on MPICH2 and MVICH. +%{!?testsuite:%{?with_hpc:%{hpc_master_package -a -L}}} + %if 0%{!?testsuite:1} %package devel @@ -122,12 +228,18 @@ Requires: libibumad-devel Requires: libibverbs-devel Requires: librdmacm-devel %endif +%if %{without hpc} +Requires: gcc-c++ +Requires: gcc-fortran +%else +%hpc_requires_devel +%endif %description devel This is an MPI-2 implementation which includes all MPI-1 features. It is based on MPICH2 and MVICH. - +%{?with_hpc:%{hpc_master_package -a devel}} %package devel-static Summary: OSU MVAPICH2 MPI package - static libraries @@ -138,9 +250,35 @@ Requires: %{name}-devel = %{version} This is an MPI-3 implementation which includes all MPI-1 and MPI-2 features. It is based on MPICH2 and MVICH. This package contains the static libraries +%package doc +Summary: OSU MVAPICH2 MPI package - Documentation +Group: Development/Libraries/Parallel +Requires: lib%{name} = %{version} +BuildArch: noarch + +%description doc +This is an MPI-3 implementation which includes all MPI-1 and MPI-2 features. It +is based on MPICH2 and MVICH. This package contains the static libraries + +%{?with_hpc:%{hpc_master_package doc}} + +%package macros-devel +Summary: OSU MVAPICH2 MPI package - HPC build macros +Group: Development/Libraries/Parallel +Requires: %{name}-devel = %{version} +BuildArch: noarch + +%description macros-devel +This is an MPI-3 implementation which includes all MPI-1 and MPI-2 features. It +is based on MPICH2 and MVICH. This package contains the static libraries + +%{?with_hpc:%{hpc_master_package macros-devel}} + %endif # ! testsuite %prep + +%{?with_hpc:%hpc_debug} %setup -q -n mvapich2-%{version}%{?rc_ver} %patch0 %patch1 @@ -149,7 +287,22 @@ cp /usr/share/automake*/config.* . %build #./autogen.sh +%if %{with hpc} +%{hpc_setup} +%{hpc_configure} \ +%else %configure \ + --prefix=%{p_prefix} \ + --exec-prefix=%{p_prefix} \ + --datadir=%{p_datadir} \ + --bindir=%{p_bindir} \ + --includedir=%{p_includedir} \ + --libdir=%{p_libdir} \ + --libexecdir=%{p_libexecdir} \ + --mandir=%{p_mandir} \ +%endif + --docdir=%{_datadir}/doc/%{name} \ + --disable-wrapper-rpath \ --disable-wrapper-rpath \ %if "%{build_flavor}" == "psm" --with-device=ch3:psm \ @@ -168,21 +321,6 @@ make V=1 check %endif %install -make DESTDIR=%{buildroot} V=1 install -# make and install mpivars files -sed -e 's,prefix,%_prefix,g' -e 's,libdir,%{_libdir},g' %{S:1} > %{buildroot}%{_bindir}/mpivars.sh -sed -e 's,prefix,%_prefix,g' -e 's,libdir,%{_libdir},g' %{S:2} > %{buildroot}%{_bindir}/mpivars.csh -rm -f %{buildroot}%{_libdir}/libfmpich.la \ - %{buildroot}%{_libdir}/libmpich.la \ - %{buildroot}%{_libdir}/libmpichcxx.la \ - %{buildroot}%{_libdir}/libmpichf90.la \ - %{buildroot}%{_libdir}/libmpl.la \ - %{buildroot}%{_libdir}/libopa.la \ - %{buildroot}%{_libdir}/libmpi.la \ - %{buildroot}%{_libdir}/libmpicxx.la \ - %{buildroot}%{_libdir}/libmpifort.la -install -m 0644 COPYRIGHT* %{buildroot}%{_datadir}/doc/mvapich2 -install -m 0644 CHANGE* %{buildroot}%{_datadir}/doc/mvapich2 %if 0%{?testsuite} # Remove everything from testsuite package @@ -190,6 +328,27 @@ install -m 0644 CHANGE* %{buildroot}%{_datadir}/doc/mvapich2 rm -rf %{buildroot}/* %else +make DESTDIR=%{buildroot} V=1 install + +rm -f %{buildroot}%{p_libdir}/libfmpich.la \ + %{buildroot}%{p_libdir}/libmpich.la \ + %{buildroot}%{p_libdir}/libmpichcxx.la \ + %{buildroot}%{p_libdir}/libmpichf90.la \ + %{buildroot}%{p_libdir}/libmpl.la \ + %{buildroot}%{p_libdir}/libopa.la \ + %{buildroot}%{p_libdir}/libmpi.la \ + %{buildroot}%{p_libdir}/libmpicxx.la \ + %{buildroot}%{p_libdir}/libmpifort.la +install -m 0755 -d %{buildroot}%{_datadir}/doc/%{name} +install -m 0644 COPYRIGHT* %{buildroot}%{_datadir}/doc/%{name} +install -m 0644 CHANGE* %{buildroot}%{_datadir}/doc/%{name} + +%if %{without hpc} +# make and install mpivars files +install -m 0755 -d %{buildroot}%{_bindir} +sed -e 's,prefix,%p_prefix,g' -e 's,libdir,%{p_libdir},g' %{S:1} > %{buildroot}%{p_bindir}/mpivars.sh +sed -e 's,prefix,%p_prefix,g' -e 's,libdir,%{p_libdir},g' %{S:2} > %{buildroot}%{p_bindir}/mpivars.csh + mkdir -p %{buildroot}%{_moduledir} cat << EOF > %{buildroot}%{_moduledir}/%{version} @@ -201,11 +360,11 @@ proc ModulesHelp { } { module-whatis "Loads the gnu mvapich2 %{version} Environment." conflict gnu-mvapich2 -prepend-path PATH %{_bindir} -prepend-path INCLUDE %{_includedir} -prepend-path INCLUDE %{_libdir} -prepend-path MANPATH %{_mandir} -prepend-path LD_LIBRARY_PATH %{_libdir} +prepend-path PATH %{%p_bindir} +prepend-path INCLUDE %{p_includedir} +prepend-path INCLUDE %{p_libdir} +prepend-path MANPATH %{p_mandir} +prepend-path LD_LIBRARY_PATH %{p_libdir} EOF @@ -214,52 +373,114 @@ cat << EOF > %{buildroot}%{_moduledir}/.version set ModulesVersion "%{version}" EOF +%else # with hpc + +install -d -m 755 %{buildroot}%{_sysconfdir}/rpm +cp %{S:3} %{buildroot}%{_sysconfdir}/rpm + +%hpc_write_modules_files +#%%Module1.0##################################################################### + +proc ModulesHelp { } { + +puts stderr " " +puts stderr "This module loads the %{pname} library built with the %{compiler_family} toolchain." +puts stderr "\nVersion %{version}\n" + +} +module-whatis "Name: %{pname} built with %{compiler_family} toolchain" +module-whatis "Version: %{version}" +module-whatis "Category: runtime library" +module-whatis "Description: %{summary}" +module-whatis "URL: %{url}" + +set version %{version} + +prepend-path PATH %{hpc_prefix}/bin +prepend-path MANPATH %{hpc_prefix}/man +prepend-path LD_LIBRARY_PATH %{hpc_prefix}/%_lib +prepend-path MODULEPATH %{hpc_modulepath} +prepend-path MPI_DIR %{hpc_prefix} +%{hpc_modulefile_add_pkgconfig_path} + +family "MPI" +EOF +cat < %{buildroot}/%{p_bindir}/mpivars.sh +module load %{hpc_compiler_family}/%{hpc_cf_full_version} %{hpc_mpi_family}%{?pack_suff}/%{version} +EOF +ln -s mpivars.sh %{buildroot}/%{p_bindir}/mpivars.csh + +%endif # with hpc %post /sbin/ldconfig +%if %{without hpc} /usr/bin/mpi-selector \ - --register %{name}%{pack_suff}-%{version} \ - --source-dir %{_bindir} \ + --register %{name}%{?pack_suff}-%{version} \ + --source-dir %{p_bindir} \ --yes +%endif %postun /sbin/ldconfig -/usr/bin/mpi-selector --unregister %{name}%{pack_suff}-%{version} --yes --silent +%if %{without hpc} +/usr/bin/mpi-selector --unregister %{name}%{?pack_suff}-%{version} --yes --silent +%else +%hpc_module_delete_if_default +%endif %files %defattr(-, root, root) -%doc %{_datadir}/doc +%if %{without hpc} %dir /usr/%_lib/mpi %dir /usr/%_lib/mpi/gcc -%dir %{_prefix} -%dir %{_bindir} -%dir %{_datadir} -%dir %{_includedir} %dir /usr/share/modules %dir %{_moduledir} -%dir %{_mandir} -%dir %{_mandir}/man1 -%dir %{_mandir}/man3 -%dir %{_libdir} -%dir %{_libexecdir} -%{_bindir}/* -%{_libexecdir}/osu-micro-benchmarks %{_moduledir} -%{_mandir}/man1/* -%{_libdir}/*.so.* +%else +%hpc_mpi_dirs +%hpc_modules_files +%endif +%doc %{_datadir}/doc/%{name}/COPYRIGHT* +%doc %{_datadir}/doc/%{name}/CHANGE* +%dir %{p_prefix} +%dir %{p_bindir} +%dir %{p_datadir} +%dir %{p_includedir} +%dir %{p_mandir} +%dir %{p_mandir}/man1 +%dir %{p_mandir}/man3 +%dir %{p_libdir} +%dir %{p_libexecdir} +%{p_bindir}/* +%{p_libexecdir}/osu-micro-benchmarks +%{p_mandir}/man1/* +%{p_libdir}/*.so.* + +%files doc +%defattr(-, root, root) +%doc %{_datadir}/doc/%{name} +%exclude /%{_datadir}/doc/%{name}/COPYRIGHT* +%exclude /%{_datadir}/doc/%{name}/CHANGE* %files devel %defattr(-,root,root) -%dir %{_libdir}/pkgconfig -%{_mandir}/man3/* -%{_includedir} -%{_libdir}/*.so -%{_libdir}/pkgconfig/mvapich2.pc -%{_libdir}/pkgconfig/openpa.pc +%dir %{p_libdir}/pkgconfig +%{p_mandir}/man3/* +%{p_includedir} +%{p_libdir}/*.so +%{p_libdir}/pkgconfig/mvapich2.pc +%{p_libdir}/pkgconfig/openpa.pc %files devel-static %defattr(-,root,root) -%{_libdir}/*.a +%{p_libdir}/*.a + +%if %{with hpc} +%files macros-devel +%defattr(-,root,root) +%config %{_sysconfdir}/rpm/macros.hpc-mvapich2 +%endif # with hpc %endif # !testsuite From b2b0b7e1a31457e29b135882dc33b2623a257413369daad0b419a6025c453cd4 Mon Sep 17 00:00:00 2001 From: Nicolas Morey-Chaisemartin Date: Fri, 6 Oct 2017 10:24:47 +0000 Subject: [PATCH 2/3] Fix dependency to libmvapich2 OBS-URL: https://build.opensuse.org/package/show/science:HPC/mvapich2?expand=0&rev=24 --- mvapich2.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mvapich2.spec b/mvapich2.spec index e7cf4e9..15d872a 100644 --- a/mvapich2.spec +++ b/mvapich2.spec @@ -250,10 +250,10 @@ Requires: %{name}-devel = %{version} This is an MPI-3 implementation which includes all MPI-1 and MPI-2 features. It is based on MPICH2 and MVICH. This package contains the static libraries -%package doc +%package doc Summary: OSU MVAPICH2 MPI package - Documentation Group: Development/Libraries/Parallel -Requires: lib%{name} = %{version} +Requires: %{name} = %{version} BuildArch: noarch %description doc @@ -262,7 +262,7 @@ is based on MPICH2 and MVICH. This package contains the static libraries %{?with_hpc:%{hpc_master_package doc}} -%package macros-devel +%package macros-devel Summary: OSU MVAPICH2 MPI package - HPC build macros Group: Development/Libraries/Parallel Requires: %{name}-devel = %{version} From ad3a75b979d8013d4573ac2cf274cc6df519a5fca1e11cf4acb7559b2001d759 Mon Sep 17 00:00:00 2001 From: Nicolas Morey-Chaisemartin Date: Fri, 6 Oct 2017 14:06:55 +0000 Subject: [PATCH 3/3] - Add conflicts between the macros-devel packages OBS-URL: https://build.opensuse.org/package/show/science:HPC/mvapich2?expand=0&rev=25 --- mvapich2.changes | 5 +++++ mvapich2.spec | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/mvapich2.changes b/mvapich2.changes index 71a70b3..83f1aff 100644 --- a/mvapich2.changes +++ b/mvapich2.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Fri Oct 6 14:06:37 UTC 2017 - nmoreychaisemartin@suse.com + +- Add conflicts between the macros-devel packages + ------------------------------------------------------------------- Thu Oct 5 13:30:48 UTC 2017 - nmoreychaisemartin@suse.com diff --git a/mvapich2.spec b/mvapich2.spec index 15d872a..364d5bd 100644 --- a/mvapich2.spec +++ b/mvapich2.spec @@ -254,7 +254,6 @@ is based on MPICH2 and MVICH. This package contains the static libraries Summary: OSU MVAPICH2 MPI package - Documentation Group: Development/Libraries/Parallel Requires: %{name} = %{version} -BuildArch: noarch %description doc This is an MPI-3 implementation which includes all MPI-1 and MPI-2 features. It @@ -266,7 +265,8 @@ is based on MPICH2 and MVICH. This package contains the static libraries Summary: OSU MVAPICH2 MPI package - HPC build macros Group: Development/Libraries/Parallel Requires: %{name}-devel = %{version} -BuildArch: noarch +Provides: %{pname}-hpc-macros-devel = %{version} +Conflicts: otherproviders(%{pname}-hpc-macros-devel) %description macros-devel This is an MPI-3 implementation which includes all MPI-1 and MPI-2 features. It