From 6630f887026dd159759ed49bbed399d7e3b1a869 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Thu, 25 Jun 2015 11:23:42 -0700 Subject: [PATCH 1/5] MPI extensions: build extensions by default * affinity: will build unless disabled. * cr: will build if FT is enabled, unless it is disabled. It will also complain/abort if you --with-mpi-ext=cr, but FT is disabled. * example: will only build if --with-mpi-ext=example (and .ompi_ignore is removed) (cherry picked from commit fca193d3165d3985981d988a49e42c77fcfeb42d) --- config/ompi_ext.m4 | 7 +++++-- ompi/mpiext/affinity/configure.m4 | 10 +++++++--- ompi/mpiext/cr/configure.m4 | 27 ++++++++++++++++++++++----- ompi/mpiext/example/configure.m4 | 12 +++++++++--- 4 files changed, 43 insertions(+), 13 deletions(-) diff --git a/config/ompi_ext.m4 b/config/ompi_ext.m4 index aa798ab3f5..17029a2563 100644 --- a/config/ompi_ext.m4 +++ b/config/ompi_ext.m4 @@ -45,8 +45,11 @@ AC_DEFUN([OMPI_EXT],[ AC_MSG_RESULT([ompi_mpiext_list]) AC_MSG_CHECKING([which MPI extension should be enabled]) - if test "$enable_mpi_ext" = "yes" || test "$enable_mpi_ext" = "all"; then - msg="All Extensions" + if test "$enable_mpi_ext" = "" || \ + test "$enable_mpi_ext" = "yes" || \ + test "$enable_mpi_ext" = "all"; then + enable_mpi_ext=all + msg="All Available Extensions" str="`echo ENABLE_EXT_ALL=1`" eval $str else diff --git a/ompi/mpiext/affinity/configure.m4 b/ompi/mpiext/affinity/configure.m4 index 5192544342..95a4ca7fe9 100644 --- a/ompi/mpiext/affinity/configure.m4 +++ b/ompi/mpiext/affinity/configure.m4 @@ -2,7 +2,7 @@ # # Copyright (c) 2004-2009 The Trustees of Indiana University. # All rights reserved. -# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2012-2015 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -16,6 +16,10 @@ AC_DEFUN([OMPI_MPIEXT_affinity_CONFIG], [ AC_CONFIG_FILES([ompi/mpiext/affinity/Makefile]) AC_CONFIG_FILES([ompi/mpiext/affinity/c/Makefile]) - # This example can always build, so we just execute $1. - $1 + # This example can always build, so we just execute $1 if it was + # requested. + AS_IF([test "$ENABLE_affinity" = "1" || \ + test "$ENABLE_EXT_ALL" = "1"], + [$1], + [$2]) ]) diff --git a/ompi/mpiext/cr/configure.m4 b/ompi/mpiext/cr/configure.m4 index dc228b255d..757118442f 100644 --- a/ompi/mpiext/cr/configure.m4 +++ b/ompi/mpiext/cr/configure.m4 @@ -2,7 +2,7 @@ # # Copyright (c) 2004-2010 The Trustees of Indiana University. # All rights reserved. -# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2012-2015 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -16,8 +16,25 @@ AC_DEFUN([OMPI_MPIEXT_cr_CONFIG],[ AC_CONFIG_FILES([ompi/mpiext/cr/Makefile]) AC_CONFIG_FILES([ompi/mpiext/cr/c/Makefile]) - # If we don't want FT, don't compile this component - AS_IF([test "$opal_want_ft_cr" = "1"], - [$1], - [$2]) + OPAL_VAR_SCOPE_PUSH([ompi_mpi_ext_cr_happy]) + + # If we don't want FT, don't compile this extention + AS_IF([test "$ENABLE_cr" = "1" || \ + test "$ENABLE_EXT_ALL" = "1"], + [ompi_mpi_ext_cr_happy=1], + [ompi_mpi_ext_cr_happy=0]) + + AS_IF([test "$ompi_mpi_ext_cr_happy" = "1" && \ + test "$opal_want_ft_cr" = "1"], + [$1], + [ # Error if the user specifically asked for this extension, + # but we can't build it. + AS_IF([test "$ENABLE_cr" = "1"], + [AC_MSG_WARN([Requested "cr" MPI extension, but cannot build it]) + AC_MSG_WARN([because fault tolerance is not enabled.]) + AC_MSG_WARN([Try again with --enable-ft]) + AC_MSG_ERROR([Cannot continue])]) + $2]) + + OPAL_VAR_SCOPE_POP ]) diff --git a/ompi/mpiext/example/configure.m4 b/ompi/mpiext/example/configure.m4 index 1ae1e9f67c..29c1b42885 100644 --- a/ompi/mpiext/example/configure.m4 +++ b/ompi/mpiext/example/configure.m4 @@ -2,7 +2,7 @@ # # Copyright (c) 2004-2009 The Trustees of Indiana University. # All rights reserved. -# Copyright (c) 2012 Cisco Systems, Inc. All rights reserved. +# Copyright (c) 2012-2015 Cisco Systems, Inc. All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow @@ -20,8 +20,14 @@ AC_DEFUN([OMPI_MPIEXT_example_CONFIG],[ AC_CONFIG_FILES([ompi/mpiext/example/use-mpi/Makefile]) AC_CONFIG_FILES([ompi/mpiext/example/use-mpi-f08/Makefile]) - # This example can always build, so we just execute $1. - $1 + # If your extension can build, run $1. Otherwise, run $2. For + # the purposes of this example, we don't want it to build in most + # cases. So only build if someone specifies an --enable-mpi-ext + # value that contains the token "example". + AS_IF([test "$ENABLE_example" = "1" || \ + test "$ENABLE_EXT_ALL" = "1"], + [$1], + [$2]) ]) # only need to set this if the component needs init/finalize hooks From 5f77fef156cfbbb0c6d99304a5ea2439a83ea2d2 Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Thu, 25 Jun 2015 21:01:17 -0700 Subject: [PATCH 2/5] Remove manpages when doing distclean in the OMPI extensions area (cherry picked from commit open-mpi/ompi@2fa8167383836d617a7f19e6bc2231ce754ff8f9) --- ompi/mpiext/affinity/c/Makefile.am | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ompi/mpiext/affinity/c/Makefile.am b/ompi/mpiext/affinity/c/Makefile.am index c0471d46dd..8d8275d925 100644 --- a/ompi/mpiext/affinity/c/Makefile.am +++ b/ompi/mpiext/affinity/c/Makefile.am @@ -48,3 +48,6 @@ nodist_man_MANS = OMPI_Affinity_str.3 # Man page sources EXTRA_DIST = $(nodist_man_MANS:.3=.3in) example.c + +distclean-local: + rm -f $(nodist_man_MANS) From 8a38b7a57d7672df6ca46552619a4210ab6d54a8 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Mon, 29 Jun 2015 09:54:03 +0900 Subject: [PATCH 3/5] mpiext/affinity: #if OPAL_HAVE_HWLOC most parts of the code that allow this extension to compile if configure'd with --without-hwloc (cherry picked from commit 6994d742fdd6ed9e3407929416dca0ec0b941588) --- ompi/mpiext/affinity/c/mpiext_affinity_str.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/ompi/mpiext/affinity/c/mpiext_affinity_str.c b/ompi/mpiext/affinity/c/mpiext_affinity_str.c index de59be38b7..37f87fe193 100644 --- a/ompi/mpiext/affinity/c/mpiext_affinity_str.c +++ b/ompi/mpiext/affinity/c/mpiext_affinity_str.c @@ -38,12 +38,14 @@ static const char FUNC_NAME[] = "OMPI_Affinity"; static const char ompi_nobind_str[] = "Open MPI did not bind this process"; static const char not_bound_str[] = "Not bound (i.e., bound to all processors)"; +#if OPAL_HAVE_HWLOC static int get_rsrc_ompi_bound(char str[OMPI_AFFINITY_STRING_MAX]); static int get_rsrc_current_binding(char str[OMPI_AFFINITY_STRING_MAX]); static int get_rsrc_exists(char str[OMPI_AFFINITY_STRING_MAX]); static int get_layout_ompi_bound(char str[OMPI_AFFINITY_STRING_MAX]); static int get_layout_current_binding(char str[OMPI_AFFINITY_STRING_MAX]); static int get_layout_exists(char str[OMPI_AFFINITY_STRING_MAX]); +#endif /* OPAL_HAVE_HWLOC */ /*---------------------------------------------------------------------------*/ @@ -52,19 +54,25 @@ int OMPI_Affinity_str(ompi_affinity_fmt_t fmt_type, char current_binding[OMPI_AFFINITY_STRING_MAX], char exists[OMPI_AFFINITY_STRING_MAX]) { +#if OPAL_HAVE_HWLOC int ret; +#endif /* OPAL_HAVE_HWLOC */ memset(ompi_bound, 0, OMPI_AFFINITY_STRING_MAX); memset(current_binding, 0, OMPI_AFFINITY_STRING_MAX); /* If we have no hwloc support, return nothing */ - if (NULL == opal_hwloc_topology) { +#if OPAL_HAVE_HWLOC + if (NULL == opal_hwloc_topology) +#endif /* OPAL_HAVE_HWLOC */ + { strncpy(ompi_bound, "Not supported", OMPI_AFFINITY_STRING_MAX); strncpy(current_binding, "Not supported", OMPI_AFFINITY_STRING_MAX); strncpy(exists, "Not supported", OMPI_AFFINITY_STRING_MAX); return MPI_SUCCESS; } +#if OPAL_HAVE_HWLOC /* Otherwise, return useful information */ switch (fmt_type) { case OMPI_AFFINITY_RSRC_STRING_FMT: @@ -86,8 +94,10 @@ int OMPI_Affinity_str(ompi_affinity_fmt_t fmt_type, } return MPI_SUCCESS; +#endif /* OPAL_HAVE_HWLOC */ } +#if OPAL_HAVE_HWLOC /*---------------------------------------------------------------------------*/ /* @@ -275,7 +285,7 @@ static int get_rsrc_exists(char str[OMPI_AFFINITY_STRING_MAX]) } } } - } + } return OMPI_SUCCESS; } @@ -418,3 +428,4 @@ static int get_layout_exists(char str[OMPI_AFFINITY_STRING_MAX]) return OMPI_SUCCESS; } +#endif /* OPAL_HAVE_HWLOC */ From 64b92141d40b831d7503b64a4d68ad4b62e93e69 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Mon, 29 Jun 2015 09:36:10 -0700 Subject: [PATCH 4/5] mpiext_affinity_str.c: minor stylistic updates No real functional changes: * Reduce #if's a little -- have a single "no hwloc" and "hwloc" section. * Make a common subroutine (no_hwloc_support()) for when we don't have any hwloc support (cherry picked from commit f6882a85bbc1ee0ab347f31a838e5936e025bff9) --- ompi/mpiext/affinity/c/mpiext_affinity_str.c | 58 ++++++++++++++------ 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/ompi/mpiext/affinity/c/mpiext_affinity_str.c b/ompi/mpiext/affinity/c/mpiext_affinity_str.c index 37f87fe193..02983aa40a 100644 --- a/ompi/mpiext/affinity/c/mpiext_affinity_str.c +++ b/ompi/mpiext/affinity/c/mpiext_affinity_str.c @@ -2,7 +2,7 @@ * Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana * University Research and Technology * Corporation. All rights reserved. - * Copyright (c) 2010-2012 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, LLC. All rights * reserved. @@ -38,41 +38,69 @@ static const char FUNC_NAME[] = "OMPI_Affinity"; static const char ompi_nobind_str[] = "Open MPI did not bind this process"; static const char not_bound_str[] = "Not bound (i.e., bound to all processors)"; +/************************************************************************** + * Utility routine + **************************************************************************/ + +static no_hwloc_support(char ompi_bound[OMPI_AFFINITY_STRING_MAX], + char current_binding[OMPI_AFFINITY_STRING_MAX], + char exists[OMPI_AFFINITY_STRING_MAX]) +{ + strncpy(ompi_bound, "Not supported", OMPI_AFFINITY_STRING_MAX); + strncpy(current_binding, "Not supported", OMPI_AFFINITY_STRING_MAX); + strncpy(exists, "Not supported", OMPI_AFFINITY_STRING_MAX); +} + +/************************************************************************** + * If we have no hwloc support compiled in, do almost nothing. + **************************************************************************/ + +#if !OPAL_HAVE_HWLOC +/* + * If hwloc support was not compiled in, then just return "Not + * supported". + */ +int OMPI_Affinity_str(ompi_affinity_fmt_t fmt_type, + char ompi_bound[OMPI_AFFINITY_STRING_MAX], + char current_binding[OMPI_AFFINITY_STRING_MAX], + char exists[OMPI_AFFINITY_STRING_MAX]) +{ + no_hwloc_support(ompi_bound, current_binding, exists); + return MPI_SUCCESS; +} +#endif // !OPAL_HAVE_HWLOC + +/************************************************************************** + * If we have hwloc support compiled in, do the actual work. + **************************************************************************/ + #if OPAL_HAVE_HWLOC + static int get_rsrc_ompi_bound(char str[OMPI_AFFINITY_STRING_MAX]); static int get_rsrc_current_binding(char str[OMPI_AFFINITY_STRING_MAX]); static int get_rsrc_exists(char str[OMPI_AFFINITY_STRING_MAX]); static int get_layout_ompi_bound(char str[OMPI_AFFINITY_STRING_MAX]); static int get_layout_current_binding(char str[OMPI_AFFINITY_STRING_MAX]); static int get_layout_exists(char str[OMPI_AFFINITY_STRING_MAX]); -#endif /* OPAL_HAVE_HWLOC */ -/*---------------------------------------------------------------------------*/ int OMPI_Affinity_str(ompi_affinity_fmt_t fmt_type, - char ompi_bound[OMPI_AFFINITY_STRING_MAX], + char ompi_bound[OMPI_AFFINITY_STRING_MAX], char current_binding[OMPI_AFFINITY_STRING_MAX], char exists[OMPI_AFFINITY_STRING_MAX]) { -#if OPAL_HAVE_HWLOC int ret; -#endif /* OPAL_HAVE_HWLOC */ memset(ompi_bound, 0, OMPI_AFFINITY_STRING_MAX); memset(current_binding, 0, OMPI_AFFINITY_STRING_MAX); /* If we have no hwloc support, return nothing */ -#if OPAL_HAVE_HWLOC - if (NULL == opal_hwloc_topology) -#endif /* OPAL_HAVE_HWLOC */ - { - strncpy(ompi_bound, "Not supported", OMPI_AFFINITY_STRING_MAX); - strncpy(current_binding, "Not supported", OMPI_AFFINITY_STRING_MAX); - strncpy(exists, "Not supported", OMPI_AFFINITY_STRING_MAX); + if (NULL == opal_hwloc_topology) { + no_hwloc_support(ompi_bound, current_binding, exists); + return MPI_SUCCESS; } -#if OPAL_HAVE_HWLOC /* Otherwise, return useful information */ switch (fmt_type) { case OMPI_AFFINITY_RSRC_STRING_FMT: @@ -94,10 +122,8 @@ int OMPI_Affinity_str(ompi_affinity_fmt_t fmt_type, } return MPI_SUCCESS; -#endif /* OPAL_HAVE_HWLOC */ } -#if OPAL_HAVE_HWLOC /*---------------------------------------------------------------------------*/ /* From db1839e74e39f8fa37fa06b77cea14aa8ac1cd64 Mon Sep 17 00:00:00 2001 From: Gilles Gouaillardet Date: Tue, 30 Jun 2015 09:37:00 +0900 Subject: [PATCH 5/5] mpiext/affinity: fix missing function type (cherry picked from commit open-mpi/ompi@a4cc83f4f769f006aa374931befd77a083e13352) --- ompi/mpiext/affinity/c/mpiext_affinity_str.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ompi/mpiext/affinity/c/mpiext_affinity_str.c b/ompi/mpiext/affinity/c/mpiext_affinity_str.c index 02983aa40a..653c91ebb6 100644 --- a/ompi/mpiext/affinity/c/mpiext_affinity_str.c +++ b/ompi/mpiext/affinity/c/mpiext_affinity_str.c @@ -5,11 +5,14 @@ * Copyright (c) 2010-2015 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 Los Alamos National Security, LLC. All rights - * reserved. + * reserved. + * reserved. + * Copyright (c) 2015 Research Organization for Information Science + * and Technology (RIST). All rights reserved. * $COPYRIGHT$ - * + * * Additional copyrights may follow - * + * * $HEADER$ * * Simple routine to expose three things to the MPI process: @@ -42,9 +45,9 @@ static const char not_bound_str[] = "Not bound (i.e., bound to all processors)"; * Utility routine **************************************************************************/ -static no_hwloc_support(char ompi_bound[OMPI_AFFINITY_STRING_MAX], - char current_binding[OMPI_AFFINITY_STRING_MAX], - char exists[OMPI_AFFINITY_STRING_MAX]) +static void no_hwloc_support(char ompi_bound[OMPI_AFFINITY_STRING_MAX], + char current_binding[OMPI_AFFINITY_STRING_MAX], + char exists[OMPI_AFFINITY_STRING_MAX]) { strncpy(ompi_bound, "Not supported", OMPI_AFFINITY_STRING_MAX); strncpy(current_binding, "Not supported", OMPI_AFFINITY_STRING_MAX);