1
1

Per RFC: MPI Interface Extensions Infrastructure

Add infrastructure for MPI Interface Extensions. This allows a developer to create new MPI interfaces that are non-standard.

The following email thread describes the functionality proposed in the RFC:
  http://www.open-mpi.org/community/lists/devel/2009/05/5997.php

The following wiki page describes how to use and enable the extensions:
  https://svn.open-mpi.org/trac/ompi/wiki/MPIExtensions

This commit was SVN r21272.
Этот коммит содержится в:
Josh Hursey 2009-05-26 20:49:35 +00:00
родитель e7ff2368d6
Коммит 3e847c19f0
15 изменённых файлов: 1234 добавлений и 24 удалений

Просмотреть файл

@ -1,6 +1,6 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
dnl Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2004-2005 The University of Tennessee and The University
@ -29,8 +29,20 @@ m4_include(config/ompi_get_version.m4)
#
m4_include(config/mca_no_configure_components.m4)
#
# The config/ext_no_configure_components.m4 file is generated by
# autogen.sh
#
m4_include(config/ext_no_configure_components.m4)
#
# mca_m4_config_include.m4 is generated by autogen.sh. It includes
# the list of all component configure.m4 macros.
#
m4_include(config/mca_m4_config_include.m4)
#
# ext_m4_config_include.m4 is generated by autogen.sh. It includes
# the list of all interface extension component configure.m4 macros.
#
m4_include(config/ext_m4_config_include.m4)

Просмотреть файл

@ -1,6 +1,6 @@
#! /usr/bin/env bash
#
# Copyright (c) 2004-2006 The Trustees of Indiana University and Indiana
# Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
@ -87,6 +87,13 @@ mca_no_config_list_file="mca_no_config_list"
mca_no_config_env_file="mca_no_config_env"
mca_m4_include_file="config/mca_m4_config_include.m4"
mca_m4_config_env_file="mca_m4_config_env"
ext_no_configure_components_file="config/ext_no_configure_components.m4"
ext_no_config_list_file="ext_no_config_list"
ext_no_config_env_file="ext_no_config_env"
ext_m4_include_file="config/ext_m4_config_include.m4"
ext_m4_config_env_file="ext_m4_config_env"
autogen_subdir_file="autogen.subdirs"
topdir_file="opal/include/opal_config_bottom.h"
@ -587,8 +594,13 @@ run_no_configure_component() {
noconf_component="$5"
# Write out to two files (they're merged at the end)
if test $6 = "mca" ; then
noconf_list_file="$noconf_ompi_topdir/$mca_no_config_list_file"
noconf_env_file="$noconf_ompi_topdir/$mca_no_config_env_file"
else
noconf_list_file="$noconf_ompi_topdir/$ext_no_config_list_file"
noconf_env_file="$noconf_ompi_topdir/$ext_no_config_env_file"
fi
cat >> "$noconf_list_file" <<EOF
dnl ----------------------------------------------------------------
@ -637,8 +649,13 @@ run_m4_configure_component() {
m4conf_component="$5"
# Write out to two files (they're merged at the end)
if test $6 = "mca" ; then
m4conf_list_file="$m4conf_ompi_topdir/$mca_no_config_list_file"
m4conf_env_file="$m4conf_ompi_topdir/$mca_m4_config_env_file"
else
m4conf_list_file="$m4conf_ompi_topdir/$ext_no_config_list_file"
m4conf_env_file="$m4conf_ompi_topdir/$ext_m4_config_env_file"
fi
cat >> "$m4conf_list_file" <<EOF
dnl ----------------------------------------------------------------
@ -659,7 +676,11 @@ EOF
# do. By this point, there should already be a header and all
# that. m4_includes are relative to the currently included file,
# so need the .. to get us from config/ to the topsrcdir again.
if test $6 = "mca" ; then
echo "m4_include(${m4conf_project}/mca/${m4conf_framework}/${m4conf_component}/configure.m4)" >> "$m4conf_ompi_topdir/$mca_m4_include_file"
else
echo "m4_include(${m4conf_project}/${m4conf_framework}/${m4conf_component}/configure.m4)" >> "$m4conf_ompi_topdir/$ext_m4_include_file"
fi
cat <<EOF
--> Adding to top-level configure m4-configure subdirs:
@ -878,7 +899,7 @@ EOF
rm -f "configure" "configure.ac*" "acinclude*" "aclocal.m4"
run_m4_configure_component "$pd_dir" "$pd_ompi_topdir" \
"$pd_project" "$pd_framework" "$pd_component"
"$pd_project" "$pd_framework" "$pd_component" "mca"
fi
elif test -f configure.ac -o -f configure.in; then
@ -917,7 +938,198 @@ EOF
EOF
else
run_no_configure_component "$pd_dir" "$pd_ompi_topdir" \
"$pd_project" "$pd_framework" "$pd_component"
"$pd_project" "$pd_framework" "$pd_component" "mca"
fi
else
cat <<EOF
*** Nothing found; directory skipped
*** `pwd`
EOF
fi
# See if there's a file containing additional directories to
# traverse. Shell scripts aren't too good at recursion (no
# local state!), so just have a child autogen.sh do the work.
if test -f $autogen_subdir_file; then
pd_subdir_start_dir="`pwd`"
echo ""
echo "==> Found $autogen_subdir_file -- sub-traversing..."
echo ""
for dir in `cat $autogen_subdir_file`; do
if test -d "$dir"; then
echo "*** Running autogen.sh in $dir"
echo "*** (started in $pd_subdir_start_dir)"
cd "$dir"
$pd_ompi_topdir/autogen.sh -l
if test ! $? -eq 0 ; then
echo "Error running autogen.sh -l in $dir. Aborting."
exit 1
fi
cd "$pd_subdir_start_dir"
echo ""
fi
done
echo "<== Back in $pd_subdir_start_dir"
echo "<== autogen.sh continuing..."
fi
# Go back to the topdir
cd "$pd_cur_dir"
fi
unset PARAM_CONFIG_FILES PARAM_VERSION_FILE
unset pd_dir pd_ompi_topdir pd_cur_dir pd_component_type
}
process_ext_dir() {
pd_dir="$1"
pd_ompi_topdir="$2"
pd_project="$3"
pd_framework="$4"
pd_component="$5"
pd_cur_dir="`pwd`"
# Convert to absolutes
if test -d "$pd_dir"; then
cd "$pd_dir"
pd_abs_dir="`pwd`"
cd "$pd_cur_dir"
fi
if test -d "$pd_ompi_topdir"; then
cd "$pd_ompi_topdir"
pd_ompi_topdir="`pwd`"
cd "$pd_cur_dir"
fi
# clean our environment a bit, since we might evaluate a configure.params
unset PARAM_CONFIG_FILES
PARAM_CONFIG_PRIORITY="0"
if test -d "$pd_dir"; then
cd "$pd_dir"
# See if the package doesn't want us to set it up
if test -f .ompi_no_gnu; then
cat <<EOF
*** Found .ompi_no_gnu file -- skipping GNU setup in:
*** `pwd`
EOF
elif test -f .ompi_ignore -a ! -f .ompi_unignore; then
# Note that if we have an empty (but existant)
# .ompi_unignore, then we ignore the .ompi_ignore file
# (and therefore build the component)
cat <<EOF
*** Found .ompi_ignore file -- skipping entire tree:
*** `pwd`
EOF
# Use && instead of -a here for the test conditions because if
# you use -a, then "test" will execute *all* condition clauses
# (even if the first one is false), meaning that grep will
# fail if there is no .ompi_unignore file. If you use &&,
# then the latter tests will not be executed if a prior one
# fails (i.e., grep won't run if .ompi_unignore does not
# exist).
elif test -f .ompi_ignore && \
test -s .ompi_unignore && \
test -z "`$egrep $USER\$\|$USER@$HOST .ompi_unignore`" ; then
# If we have a non-empty .ompi_unignore and our username
# is in there somewhere, we ignore the .ompi_ignore (and
# therefore build the component). Otherwise, this
# condition is true and we don't configure.
cat <<EOF
*** Found .ompi_ignore file and .ompi_unignore didn't invalidate --
*** skipping entire tree:
*** `pwd`
EOF
elif test "$pd_abs_dir" != "$pd_ompi_topdir" -a -x autogen.sh; then
cat <<EOF
*** Found custom autogen.sh file in:
*** `pwd`
EOF
./autogen.sh
if test ! $? -eq 0 ; then
echo "Error running autogen.sh -l in `pwd`. Aborting."
exit 1
fi
elif test -f configure.params -a -f configure.m4 ; then
cat <<EOF
*** Found configure.params and configure.m4
*** `pwd`
EOF
. ./configure.params
if test -z "$PARAM_CONFIG_FILES"; then
cat <<EOF
*** No PARAM_CONFIG_FILES!
*** Nothing to do -- skipping this directory
EOF
else
# temporary workaround - remove possibly there configure code
rm -f "configure" "configure.ac*" "acinclude*" "aclocal.m4"
run_m4_configure_component "$pd_dir" "$pd_ompi_topdir" \
"$pd_project" "$pd_framework" "$pd_component" "ext"
fi
elif test -f configure.ac -o -f configure.in; then
# If we have configure.ac or configure.in, run the GNU
# tools here
cat <<EOF
*** Found configure.(in|ac)
*** `pwd`
EOF
run_gnu_tools "$pd_ompi_topdir"
elif test -f configure.params -a -f configure.stub; then
cat <<EOF
*** Found configure.params and configure.stub
*** `pwd`
EOF
run_gnu_tools "$pd_ompi_topdir"
elif test -f configure.params; then
cat <<EOF
*** Found configure.params
*** `pwd`
EOF
. ./configure.params
if test -z "$PARAM_CONFIG_FILES"; then
cat <<EOF
*** No PARAM_CONFIG_FILES!
*** Nothing to do -- skipping this directory
EOF
else
run_no_configure_component "$pd_dir" "$pd_ompi_topdir" \
"$pd_project" "$pd_framework" "$pd_component" "ext"
fi
else
cat <<EOF
@ -1037,6 +1249,76 @@ process_framework() {
fi
}
process_ext_framework() {
framework_path="$1"
rg_cwd="$2"
project="$3"
framework="$4"
if test -d "$framework_path" ; then
framework_ext_list="$framework_ext_list $framework"
# Add the framework's configure file into configure,
# if there is one
if test -r "${framework_path}/configure.m4" ; then
echo "m4_include(${framework_path}/configure.m4)" >> "$ext_m4_include_file"
fi
echo "AC_CONFIG_FILES(${framework_path}/Makefile)" >> "$ext_no_config_list_file"
rm -f "$ext_no_config_env_file" "$ext_m4_config_env_file"
touch "$ext_no_config_env_file" "$ext_m4_config_env_file"
for component_path in "$framework_path"/*; do
if test -d "$component_path"; then
if test -f "$component_path/configure.in" -o \
-f "$component_path/configure.params" -o \
-f "$component_path/configure.ac"; then
component=`basename "$component_path"`
process_ext_dir "$component_path" "$rg_cwd" \
"$project" "$framework" "$component"
fi
fi
done
# make list of components that are "no configure".
# Sort the list by priority (stable, so things stay in
# alphabetical order at the same priority), then munge
# it into form we like
component_list=
component_list_sort $ext_no_config_env_file
component_list_define="m4_define([ext_${framework}_no_config_component_list], ["
component_list_define_first="1"
for component in $component_list ; do
if test "$component_list_define_first" = "1"; then
component_list_define="${component_list_define}${component}"
component_list_define_first="0"
else
component_list_define="${component_list_define}, ${component}"
fi
done
component_list_define="${component_list_define}])"
echo "$component_list_define" >> "$ext_no_configure_components_file"
# make list of components that are "m4 configure"
component_list=
component_list_sort $ext_m4_config_env_file
component_list_define="m4_define([ext_${framework}_m4_config_component_list], ["
component_list_define_first="1"
for component in $component_list ; do
if test "$component_list_define_first" = "1"; then
component_list_define="${component_list_define}${component}"
component_list_define_first="0"
else
component_list_define="${component_list_define}, ${component}"
fi
done
component_list_define="${component_list_define}])"
echo "$component_list_define" >> "$ext_no_configure_components_file"
fi
}
process_project() {
project_path="$1"
rg_cwd="$2"
@ -1069,6 +1351,27 @@ process_project() {
process_dir $contrib_path $rg_cwd
done
fi
# Extensions interface only applicable to ompi project
if test $project = "ompi" ; then
# Process interface extensions
framework_ext_list=""
process_ext_framework $project_path/mpiext $rg_cwd $project "mpiext"
# make list of frameworks for this project
framework_ext_list_define="m4_define([ext_${project}_framework_list], ["
framework_ext_list_define_first="1"
for framework in $framework_ext_list ; do
if test "$framework_ext_list_define_first" = "1"; then
framework_ext_list_define="${framework_ext_list_define}${framework}"
framework_ext_list_define_first="0"
else
framework_ext_list_define="${framework_ext_list_define}, ${framework}"
fi
done
framework_ext_list_define="${framework_ext_list_define}])"
echo "$framework_ext_list_define" >> "$ext_no_configure_components_file"
fi
}
@ -1113,6 +1416,34 @@ dnl
dnl This file is automatically created by autogen.sh; it should not
dnl be edited by hand!!
EOF
# [Re-]Create the ext_component_list file
rm -f "$ext_no_configure_components_file" "$ext_no_config_list_file" \
"$ext_no_config_env_file" "$ext_m4_config_env_file" "$ext_m4_include_file"
touch "$ext_no_configure_components_file" "$ext_no_config_list_file" \
"$ext_m4_config_env_file" "$ext_m4_include_file"
# create header for the component m4 include file
cat > "$ext_m4_include_file" <<EOF
dnl
dnl \$HEADER
dnl
dnl This file is automatically created by autogen.sh; it should not
dnl be edited by hand!!
EOF
#create header for the component config file
cat > "$ext_no_configure_components_file" <<EOF
dnl
dnl \$HEADER
dnl
dnl This file is automatically created by autogen.sh; it should not
dnl be edited by hand!!
EOF
# Now run the config in every directory in <location>/mca/*/*
@ -1150,6 +1481,11 @@ EOF
project_list_define="${project_list_define}])"
echo "$project_list_define" >> "$mca_no_configure_components_file"
# create the m4 defines for the list of projects where MPI Extensions
# apply, which is only 'ompi'
project_list_define="m4_define([ext_project_list], [ompi])"
echo "$project_list_define" >> "$ext_no_configure_components_file"
cat >> "$mca_no_configure_components_file" <<EOF
@ -1160,10 +1496,22 @@ AC_DEFUN([MCA_NO_CONFIG_CONFIG_FILES],[
`cat $mca_no_config_list_file`
])dnl
EOF
cat >> "$ext_no_configure_components_file" <<EOF
dnl List all the no-configure components that we found, and AC_DEFINE
dnl their versions
AC_DEFUN([EXT_NO_CONFIG_CONFIG_FILES],[
`cat $ext_no_config_list_file`
])dnl
EOF
# Remove temp files
rm -f $mca_no_config_list_file $mca_no_config_env_file $mca_m4_config_env_file
rm -f $ext_no_config_list_file $ext_no_config_env_file $ext_m4_config_env_file
# Finally, after we found all the no-configure MCA components, run
# the config in the top-level directory

689
config/ompi_ext.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,689 @@
dnl -*- shell-script -*-
dnl
dnl Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
dnl University Research and Technology
dnl Corporation. All rights reserved.
dnl Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
dnl $COPYRIGHT$
dnl
dnl Additional copyrights may follow
dnl
dnl $HEADER$
dnl
######################################################################
#
# OMPI_EXT
#
# configure the Interface Extensions [similar to MCA version]. Works hand in
# hand with Open MPI's autogen.sh, requiring it's specially formatted lists
# of frameworks, components, etc.
#
# USAGE:
# OMPI_EXT()
#
######################################################################
AC_DEFUN([OMPI_EXT],[
dnl for OMPI_CONFIGURE_USER env variable
AC_REQUIRE([OMPI_CONFIGURE_SETUP])
# Note that we do not build DSO's here -- we *only* build convenience
# libraries that get slurped into higher-level libraries
#
# [default -- no option given] = No extensions built
# --enable-mpi-ext=[,]*EXTENSION[,]*
#
AC_ARG_ENABLE(mpi-ext,
AC_HELP_STRING([--enable-mpi-ext[=LIST]],
[Comma-separated list of extensions that should be
built.]))
AC_MSG_CHECKING([which extension components should be enabled])
if test "$enable_mpi_ext" = "yes"; then
msg="All Extensions"
str="`echo ENABLE_EXT_ALL=1`"
eval $str
else
ifs_save="$IFS"
IFS="${IFS}$PATH_SEPARATOR,"
msg=
for item in $enable_mpi_ext; do
type="`echo $item | cut -s -f1 -d-`"
if test -z $type ; then
type=$item
fi
str="`echo ENABLE_${type}=1 | sed s/-/_/g`"
eval $str
msg="$item $msg"
done
IFS="$ifs_save"
fi
AC_MSG_RESULT([$msg])
unset msg
AC_MSG_CHECKING([for projects containing EXT frameworks])
AC_MSG_RESULT([ext_project_list])
# if there isn't a project list, abort
m4_ifdef([ext_project_list], [],
[m4_fatal([Could not find project list - rerun autogen.sh without -l])])
# now configre all the projects, frameworks, and components. Most
# of the hard stuff is in here
EXT_PROJECT_SUBDIRS=
m4_foreach(ext_project, [ext_project_list],
[EXT_PROJECT_SUBDIRS="$EXT_PROJECT_SUBDIRS ext_project"
EXT_CONFIGURE_PROJECT(ext_project) ])
# make all the config output statements for the no configure
# components
EXT_NO_CONFIG_CONFIG_FILES()
AC_SUBST(EXT_C_HEADERS)
AC_SUBST(EXT_CXX_HEADERS)
AC_SUBST(EXT_F77_HEADERS)
AC_SUBST(EXT_F90_HEADERS)
AC_SUBST(EXT_C_LIBS)
AC_SUBST(EXT_CXX_LIBS)
AC_SUBST(EXT_F77_LIBS)
AC_SUBST(EXT_F90_LIBS)
AC_SUBST(EXT_PROJECT_SUBDIRS)
])
######################################################################
#
# EXT_CONFIGURE_PROJECT
#
# Configure all frameworks inside the given project name. Assumes that
# the frameworks are located in [project_name]/[frameworks] and that
# there is an m4_defined list named ext_[project]_framework_list with
# the list of frameworks.
#
# USAGE:
# EXT_CONFIGURE_PROJECT(project_name)
#
######################################################################
AC_DEFUN([EXT_CONFIGURE_PROJECT],[
# can't use a variable rename here because these need to be evaled
# at auto* time.
ompi_show_subtitle "Configuring EXT for $1"
AC_MSG_CHECKING([for frameworks for $1])
AC_MSG_RESULT([ext_$1_framework_list])
# iterate through the list of frameworks. There is something
# funky with m4 foreach if the list is defined, but empty. It
# will call the 3rd argument once with an empty value for the
# first argument. Protect against calling EXT_CONFIGURE_FRAMEWORK
# with an empty second argument. Grrr....
# if there isn't a project list, abort
#
# Also setup two variables for Makefiles:
# EXT_project_FRAMEWORKS - list of frameworks in that project
# EXT_project_FRAMEWORK_LIBS - list of libraries (or variables pointing
# to more libraries) that must be included
# in the project's main library
m4_ifdef([ext_$1_framework_list], [],
[m4_fatal([Could not find ext_$1_framework_list - rerun autogen.sh without -l])])
EXT_$1_FRAMEWORKS=
EXT_$1_FRAMEWORKS_SUBDIRS=
EXT_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS=
EXT_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS=
EXT_$1_FRAMEWORK_LIBS=
m4_foreach(ext_framework, [ext_$1_framework_list],
[m4_ifval(ext_framework,
[
EXT_$1_FRAMEWORKS="$EXT_$1_FRAMEWORKS ext_framework"
EXT_$1_FRAMEWORKS_SUBDIRS="$EXT_$1_FRAMEWORKS_SUBDIRS ext_framework"
EXT_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS="$EXT_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS [\$(EXT_]ext_framework[_ALL_SUBDIRS)]"
EXT_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS="$EXT_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS [\$(EXT_]ext_framework[_STATIC_SUBDIRS)]"
EXT_$1_FRAMEWORK_LIBS="$EXT_$1_FRAMEWORK_LIBS [\$(EXT_]ext_framework[_STATIC_LTLIBS)]"
m4_ifdef([EXT_]ext_framework[_CONFIG],
[EXT_]ext_framework[_CONFIG]($1, ext_framework),
[EXT_CONFIGURE_FRAMEWORK($1, ext_framework, 1)])])])
AC_SUBST(EXT_$1_FRAMEWORKS)
AC_SUBST(EXT_$1_FRAMEWORKS_SUBDIRS)
AC_SUBST(EXT_$1_FRAMEWORK_COMPONENT_ALL_SUBDIRS)
AC_SUBST(EXT_$1_FRAMEWORK_COMPONENT_STATIC_SUBDIRS)
AC_SUBST(EXT_$1_FRAMEWORK_LIBS)
])
######################################################################
#
# EXT_CONFIGURE_FRAMEWORK
#
# Configure the given framework and all components inside the
# framework. Assumes that the framework is located in
# [project_name]/[framework], and that all components are
# available under the framework directory. Will configure all
# no-configure and builtin components, then search for components with
# configure scripts. Assumes that no component is marked as builtin
# AND has a configure script.
#
# USAGE:
# EXT_CONFIGURE_PROJECT(project_name, framework_name, allow_succeed)
#
######################################################################
AC_DEFUN([EXT_CONFIGURE_FRAMEWORK],[
ompi_show_subsubtitle "Configuring EXT framework $2"
OMPI_VAR_SCOPE_PUSH([all_components outfile outfile_real])
# setup for framework
all_components=
static_components=
static_ltlibs=
outdir=$1/include
# remove any previously generated #include files
mpi_ext_h=$outdir/mpi-ext.h
rm -f $mpi_ext_h
# Create the final mpi-ext.h file.
cat > $mpi_ext_h <<EOF
/*
* \$HEADER\$
*/
#ifndef OMPI_MPI_EXT_H
#define OMPI_MPI_EXT_H 1
#if defined(c_plusplus) || defined(__cplusplus)
extern "C" {
#endif
#define OMPI_HAVE_MPI_EXT 1
EOF
#
# XXX: Left todo: Add header files for other languages
#
# print some nice messages about what we're about to do...
AC_MSG_CHECKING([for no configure components in framework $2])
AC_MSG_RESULT([ext_$2_no_config_component_list])
AC_MSG_CHECKING([for m4 configure components in framework $2])
AC_MSG_RESULT([ext_$2_m4_config_component_list])
# configure components that don't have any component-specific
# configuration. See comment in CONFIGURE_PROJECT about the
# m4_ifval in the m4_foreach. If there isn't a component list,
# abort with a reasonable message. If there are components in the
# list, but we're doing one of the "special" selection logics,
# abort with a reasonable message.
m4_ifdef([ext_$2_no_config_component_list], [],
[m4_fatal([Could not find ext_$2_no_config_component_list - rerun autogen.sh without -l])])
# make sure priority stuff set right
m4_if(OMPI_EVAL_ARG([EXT_]ext_framework[_CONFIGURE_MODE]), [STOP_AT_FIRST],
[m4_ifval(ext_$2_no_config_component_list,
[m4_fatal([Framework $2 using STOP_AT_FIRST but at least one component has no configure.m4])])])
m4_if(OMPI_EVAL_ARG([EXT_]ext_framework[_CONFIGURE_MODE]), [STOP_AT_FIRST_PRIORITY],
[m4_ifval(ext_$2_no_config_component_list,
[m4_fatal([Framework $2 using STOP_AT_FIRST_PRIORITY but at least one component has no configure.m4])])])
m4_foreach(ext_component, [ext_$2_no_config_component_list],
[m4_ifval(ext_component,
[EXT_CONFIGURE_NO_CONFIG_COMPONENT($1, $2, ext_component,
[all_components],
[static_components],
[static_ltlibs],
[$3])])])
# configure components that use built-in configuration scripts see
# comment in CONFIGURE_PROJECT about the m4_ifval in the
# m4_foreach. if there isn't a component list, abort
m4_ifdef([ext_$2_m4_config_component_list], [],
[m4_fatal([Could not find ext_$2_m4_config_component_list - rerun autogen.sh without -l])])
best_ext_component_priority=0
components_looking_for_succeed=$3
components_last_result=0
m4_foreach(ext_component, [ext_$2_m4_config_component_list],
[m4_ifval(ext_component,
[m4_if(OMPI_EVAL_ARG([EXT_]ext_framework[_CONFIGURE_MODE]), [STOP_AT_FIRST_PRIORITY],
[ # get the component's priority...
infile="$srcdir/$1/$2/ext_component/configure.params"
ext_component_priority="`$GREP PARAM_CONFIG_PRIORITY= $infile | cut -d= -f2-`"
AS_IF([test -z "$ext_component_priority"], [ext_component_priority=0])
AS_IF([test $best_ext_component_priority -gt $ext_component_priority], [components_looking_for_succeed=0])])
EXT_CONFIGURE_M4_CONFIG_COMPONENT($1, $2, ext_component,
[all_components],
[static_components],
[static_ltlibs],
[$components_looking_for_succeed],
[components_last_result=1],
[components_last_result=0])
m4_if(OMPI_EVAL_ARG([EXT_]ext_framework[_CONFIGURE_MODE]), [STOP_AT_FIRST],
[AS_IF([test $components_last_result -eq 1], [components_looking_for_succeed=0])])
m4_if(OMPI_EVAL_ARG([EXT_]ext_framework[_CONFIGURE_MODE]), [STOP_AT_FIRST_PRIORITY],
[AS_IF([test $components_last_result -eq 1], [best_ext_component_priority=$ext_component_priority])])])])
# configure components that provide their own configure script.
# It would be really hard to run these for "find first that
# works", so we don't :)
m4_if(OMPI_EVAL_ARG([EXT_]ext_framework[_CONFIGURE_MODE]), [STOP_AT_FIRST], [],
[m4_if(OMPI_EVAL_ARG([EXT_]ext_framework[_CONFIGURE_MODE]), [STOP_AT_FIRST_PRIORITY], [],
[AS_IF([test "$3" != "0"],
[EXT_CONFIGURE_ALL_CONFIG_COMPONENTS($1, $2, [all_components],
[static_ltlibs])])])])
EXT_$2_ALL_COMPONENTS="$all_components"
EXT_$2_STATIC_COMPONENTS="$static_components"
EXT_$2_STATIC_LTLIBS="$static_ltlibs"
AC_SUBST(EXT_$2_ALL_COMPONENTS)
AC_SUBST(EXT_$2_STATIC_COMPONENTS)
AC_SUBST(EXT_$2_STATIC_LTLIBS)
# Create the final mpi-ext.h file.
cat >> $mpi_ext_h <<EOF
#if defined(c_plusplus) || defined(__cplusplus)
}
#endif
#endif /* OMPI_MPI_EXT_H */
EOF
#
# XXX: Left todo: Close header files for other languages
#
OMPI_EXT_MAKE_DIR_LIST(EXT_$2_ALL_SUBDIRS, $2, [$all_components])
OMPI_EXT_MAKE_DIR_LIST(EXT_$2_STATIC_SUBDIRS, $2, [$static_components])
OMPI_VAR_SCOPE_POP
])
######################################################################
#
# EXT_CONFIGURE_NO_CONFIG_COMPONENT
#
# Configure the given framework and all components inside the framework.
# Assumes that the framework is located in [project_name]/[framework],
# and that all components are available under the framework directory.
# Will configure all builtin components, then search for components with
# configure scripts. Assumes that no component is marked as builtin
# AND has a configure script.
#
# USAGE:
# EXT_CONFIGURE_NO_CONFIG_COMPONENT(project_name, framework_name, component_name
# all_components_variable,
# static_components_variable,
# static_ltlibs_variable,
# allowed_to_succeed)
#
######################################################################
AC_DEFUN([EXT_CONFIGURE_NO_CONFIG_COMPONENT],[
ompi_show_subsubsubtitle "EXT component $2:$3 (no configuration)"
EXT_COMPONENT_BUILD_CHECK($1, $2, $3,
[should_build=$7], [should_build=0])
EXT_COMPONENT_COMPILE_MODE($1, $2, $3, compile_mode)
if test "$should_build" = "1" ; then
EXT_PROCESS_COMPONENT($1, $2, $3, $4, $6, $compile_mode)
# add component to static component list
$5="$$5 $3"
else
EXT_PROCESS_DEAD_COMPONENT($1, $2, $3)
# add component to all component list
$4="$$4 $3"
fi
unset compile_mode
])
######################################################################
#
# EXT_CONFIGURE_M4_CONFIG_COMPONENT
#
#
# USAGE:
# EXT_CONFIGURE_PROJECT(project_name, framework_name, component_name
# all_components_variable,
# static_components_variable,
# static_ltlibs_variable,
# allowed_to_succeed,
# [eval if should build],
# [eval if should not build])
#
######################################################################
AC_DEFUN([EXT_CONFIGURE_M4_CONFIG_COMPONENT],[
ompi_show_subsubsubtitle "EXT component $2:$3 (m4 configuration macro)"
EXT_COMPONENT_BUILD_CHECK($1, $2, $3, [should_build=$7], [should_build=0])
# Allow the component to override the build mode if it really wants to.
# It is, of course, free to end up calling EXT_COMPONENT_COMPILE_MODE
m4_ifdef([EXT_$2_$3_COMPILE_MODE],
[EXT_$2_$3_COMPILE_MODE($1, $2, $3, compile_mode)],
[EXT_COMPONENT_COMPILE_MODE($1, $2, $3, compile_mode)])
# try to configure the component. pay no attention to
# --enable-dist, since we'll always have makefiles.
AS_IF([test "$should_build" = "1"],
[m4_ifdef([EXT_]$2[_]$3[_CONFIG],
[EXT_$2_$3_CONFIG([should_build=1],
[should_build=0])],
# If they forgot to define an EXT_<fw>_<comp>_CONFIG
# macro, print a friendly warning and abort.
[AC_MSG_WARN([*** The $2:$3 did not define an])
AC_MSG_WARN([*** EXT_$2_$3_CONFIG macro in the])
AC_MSG_WARN([*** $1/$2/$3/configure.m4 file])
AC_MSG_ERROR([Cannot continue])])
])
AS_IF([test "$should_build" = "1"],
[EXT_PROCESS_COMPONENT($1, $2, $3, $4, $6, $compile_mode)
# add component to static component list
$5="$$5 $3" ],
[EXT_PROCESS_DEAD_COMPONENT($1, $2, $3)
# add component to all component list
$4="$$4 $3"])
m4_ifdef([EXT_$2_$3_POST_CONFIG],
[EXT_$2_$3_POST_CONFIG($should_build)])
AS_IF([test "$should_build" = "1"],[$8], [$9])
unset compile_mode
])
######################################################################
#
# EXT_CONFIGURE_ALL_CONFIG_COMPONENTS
#
# configure all components in the given framework that have configure
# scripts and should be configured according to the usual rules...
#
# USAGE:
# EXT_CONFIGURE_ALL_CONFIG_COMPONENTS(project_name,
# framework_name,
# all_components_variable,
# static_ltlibs_variable)
#
######################################################################
AC_DEFUN([EXT_CONFIGURE_ALL_CONFIG_COMPONENTS],[
for component_path in $srcdir/$1/$2/* ; do
component="`basename $component_path`"
if test -d $component_path -a -x $component_path/configure ; then
ompi_show_subsubsubtitle "EXT component $2:$component (need to configure)"
EXT_COMPONENT_BUILD_CHECK($1, $2, $component,
[should_build=1], [should_build=0])
EXT_COMPONENT_COMPILE_MODE($1, $2, $component, compile_mode)
if test "$should_build" = "1" ; then
OMPI_CONFIG_SUBDIR([$1/$2/$component],
[$ompi_subdir_args],
[should_build=1], [should_build=2])
fi
if test "$should_build" = "1" ; then
EXT_PROCESS_COMPONENT($1, $2, $component, $3, $4, $compile_mode)
else
EXT_PROCESS_DEAD_COMPONENT($1, $2, $component)
fi
fi
done
])
######################################################################
#
# EXT_COMPONENT_COMPILE_MODE
#
# set compile_mode_variable to the compile mode for the given component
#
# USAGE:
# EXT_COMPONENT_COMPILE_MODE(project_name,
# framework_name, component_name
# compile_mode_variable)
#
# NOTE: component_name may not be determined until runtime....
#
######################################################################
AC_DEFUN([EXT_COMPONENT_COMPILE_MODE],[
project=$1
framework=$2
component=$3
# Extensions are always static, no need for further checks
$4="static"
#AC_MSG_CHECKING([for EXT component $framework:$component compile mode])
#AC_MSG_RESULT([$$4])
])
######################################################################
#
# EXT_PROCESS_COMPONENT
#
# does all setup work for given component. It should be known before
# calling that this component can build properly (and exists)
#
# USAGE:
# EXT_CONFIGURE_ALL_CONFIG_COMPONENTS(project_name,
# framework_name, component_name
# all_components_variable (4),
# static_ltlibs_variable (5),
# compile_mode_variable (6))
#
# NOTE: component_name may not be determined until runtime....
#
# M4 directive to disable language support in configure.m4
# Need to build a list of .la for each lang. to pull into final library
# List ext_c_headers, ext_c_libs {same for other lang.}
# C: framework_component_c{.h, .la}
# CXX: framework_component_cxx{.h, .la}
# F77: framework_component_f77{.h, .la}
# F90: framework_component_f90{.h, .la} ???
######################################################################
AC_DEFUN([EXT_PROCESS_COMPONENT],[
AC_REQUIRE([AC_PROG_GREP])
project=$1
framework=$2
component=$3
# Output pretty results
AC_MSG_CHECKING([if EXT component $framework:$component can compile])
AC_MSG_RESULT([yes])
# Save the list of headers and convenience libraries that this component will output
# There *must* be C bindings
EXT_C_HEADERS="$EXT_C_HEADERS $framework/$component/${framework}_${component}_c.h"
EXT_C_LIBS="$EXT_C_LIBS $framework/$component/libext_${framework}_${component}.la"
component_header="${framework}_${component}_c.h"
tmp[=]m4_translit([$3],[a-z],[A-Z])
component_define="OMPI_HAVE_MPI_EXT_${tmp}"
cat >> $mpi_ext_h <<EOF
/* Enabled Extension: $component */
#define $component_define 1
#include "openmpi/ompi/mpiext/$component/$component_header"
EOF
#
# XXX: Need to add conditional logic for components that do not supply
# XXX: some or all of the other 3 interfaces [C++, F77, F90]. If they
# XXX: did provide those bindings, then add the header file to the relevant
# XXX: language binding's header file.
#
EXT_CXX_HEADERS="$EXT_CXX_HEADERS $framework/$component/${framework}_${component}_cxx.h"
EXT_CXX_LIBS="$EXT_CXX_LIBS $framework/$component/libext_${framework}_${component}_cxx.la"
EXT_F77_HEADERS="$EXT_F77_HEADERS $framework/$component/${framework}_${component}_f77.h"
EXT_F77_LIBS="$EXT_F77_LIBS $framework/$component/libext_${framework}_${component}_f77.la"
EXT_F90_HEADERS="$EXT_F90_HEADERS $framework/$component/${framework}_${component}_f90.h"
EXT_F90_LIBS="$EXT_F90_LIBS $framework/$component/libext_${framework}_${component}_f90.la"
# See if it dropped an output file for us to pick up some
# shell variables in.
infile="$srcdir/$project/$framework/$component/post_configure.sh"
# Add this subdir to the mast list of all EXT component subdirs
$4="$$4 $component"
$5="$framework/$component/libext_${framework}_${component}.la $$5"
# If there's an output file, add the values to
# scope_EXTRA_flags.
if test -f $infile; then
# First check for the ABORT tag
line="`$GREP ABORT= $infile | cut -d= -f2-`"
if test -n "$line" -a "$line" != "no"; then
AC_MSG_WARN([EXT component configure script told me to abort])
AC_MSG_ERROR([cannot continue])
fi
# Check for flags passed up from the component. If we're
# compiling statically, then take all flags passed up from the
# component.
m4_foreach(flags, [LDFLAGS, LIBS],
[[line="`$GREP WRAPPER_EXTRA_]flags[= $infile | cut -d= -f2-`"]
eval "line=$line"
if test -n "$line"; then
$1[_WRAPPER_EXTRA_]flags[="$]$1[_WRAPPER_EXTRA_]flags[ $line"]
fi
])dnl
fi
# now add the flags that were set in the environment variables
# framework_component_FOO (for example, the flags set by
# m4_configure components)
#
# Check for flags passed up from the component. If we're
# compiling statically, then take all flags passed up from the
# component.
m4_foreach(flags, [LDFLAGS, LIBS],
[[str="line=\$${framework}_${component}_WRAPPER_EXTRA_]flags["]
eval "$str"
if test -n "$line" ; then
$1[_WRAPPER_EXTRA_]flags[="$]$1[_WRAPPER_EXTRA_]flags[ $line"]
fi
])dnl
])
######################################################################
#
# EXT_PROCESS_DEAD_COMPONENT
#
# process a component that can not be built. Do the last minute checks
# to make sure the user isn't doing something stupid.
#
# USAGE:
# EXT_PROCESS_DEAD_COMPONENT(project_name,
# framework_name, component_name)
#
# NOTE: component_name may not be determined until runtime....
#
######################################################################
AC_DEFUN([EXT_PROCESS_DEAD_COMPONENT],[
AC_MSG_CHECKING([if EXT component $2:$3 can compile])
AC_MSG_RESULT([no])
# If this component was requested as the default for this
# type, then abort.
if test "$with_$2" = "$3" ; then
AC_MSG_WARN([EXT component "$3" failed to configure properly])
AC_MSG_WARN([This component was selected as the default])
AC_MSG_ERROR([Cannot continue])
exit 1
fi
])
######################################################################
#
# EXT_COMPONENT_BUILD_CHECK
#
# checks the standard rules of component building to see if the
# given component should be built.
#
# USAGE:
# EXT_COMPONENT_BUILD_CHECK(project, framework, component,
# action-if-build, action-if-not-build)
#
######################################################################
AC_DEFUN([EXT_COMPONENT_BUILD_CHECK],[
AC_REQUIRE([AC_PROG_GREP])
project=$1
framework=$2
component=$3
component_path="$srcdir/$project/$framework/$component"
want_component=0
# build if:
# - the component type is direct and we are that component
# - there is no ompi_ignore file
# - there is an ompi_ignore, but there is an empty ompi_unignore
# - there is an ompi_ignore, but username is in ompi_unignore
if test -d $component_path ; then
# decide if we want the component to be built or not. This
# is spread out because some of the logic is a little complex
# and test's syntax isn't exactly the greatest. We want to
# build the component by default.
want_component=1
if test -f $component_path/.ompi_ignore ; then
# If there is an ompi_ignore file, don't build
# the component. Note that this decision can be
# overridden by the unignore logic below.
want_component=0
fi
if test -f $component_path/.ompi_unignore ; then
# if there is an empty ompi_unignore, that is
# equivalent to having your userid in the unignore file.
# If userid is in the file, unignore the ignore file.
if test ! -s $component_path/.ompi_unignore ; then
want_component=1
elif test ! -z "`$GREP $OMPI_CONFIGURE_USER $component_path/.ompi_unignore`" ; then
want_component=1
fi
fi
fi
# if we asked for everything, then allow it to build if able
str="ENABLED_COMPONENT_CHECK=\$ENABLE_EXT_ALL"
eval $str
if test ! "$ENABLED_COMPONENT_CHECK" = "1" ; then
# if we were explicitly disabled, don't build :)
str="ENABLED_COMPONENT_CHECK=\$ENABLE_${component}"
eval $str
if test ! "$ENABLED_COMPONENT_CHECK" = "1" ; then
want_component=0
fi
fi
AS_IF([test "$want_component" = "1"], [$4], [$5])
])
# OMPI_EXT_MAKE_DIR_LIST(subst'ed variable, framework, shell list)
# -------------------------------------------------------------------------
AC_DEFUN([OMPI_EXT_MAKE_DIR_LIST],[
$1=
for item in $3 ; do
$1="$$1 $2/$item"
done
AC_SUBST($1)
])

Просмотреть файл

@ -1,6 +1,6 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
# Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
@ -1065,6 +1065,20 @@ OMPI_MCA
# checkpoint results
AC_CACHE_SAVE
##################################
# MPI Extended Interfaces
##################################
ompi_show_title "Extended MPI interfaces setup"
OMPI_EXT
AC_DEFINE_UNQUOTED(OMPI_EXT_COMPONENTS, "$EXT_mpiext_ALL_COMPONENTS",
[MPI Extended Interface Components])
# checkpoint results
AC_CACHE_SAVE
##################################
# Visibility
##################################
@ -1072,7 +1086,7 @@ AC_CACHE_SAVE
# Check the visibility declspec at the end to avoid problem with
# the previous tests that are not necessarily prepared for
# the visibility feature.
ompi_show_title "Symbol Visibility Feature"
ompi_show_title "Symbol visibility feature"
OMPI_CHECK_VISIBILITY

Просмотреть файл

@ -1,5 +1,5 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
@ -72,6 +72,8 @@ SUBDIRS = \
debuggers \
etc \
mpi/c \
$(EXT_ompi_FRAMEWORKS_SUBDIRS) \
$(EXT_ompi_FRAMEWORK_COMPONENT_STATIC_SUBDIRS) \
$(MCA_ompi_FRAMEWORKS_SUBDIRS) \
$(MCA_ompi_FRAMEWORK_COMPONENT_STATIC_SUBDIRS) \
. \
@ -90,6 +92,8 @@ DIST_SUBDIRS = \
mpi/cxx \
mpi/f77 \
mpi/f90 \
$(EXT_ompi_FRAMEWORKS_SUBDIRS) \
$(EXT_ompi_FRAMEWORK_COMPONENT_ALL_SUBDIRS) \
$(MCA_ompi_FRAMEWORKS_SUBDIRS) \
$(MCA_ompi_FRAMEWORK_COMPONENT_ALL_SUBDIRS) \
$(OMPI_CONTRIB_DIST_SUBDIRS)
@ -106,6 +110,7 @@ libmpi_la_LIBADD = \
$(c_pmpi_lib) \
$(f77_base_lib) \
$(MCA_ompi_FRAMEWORK_LIBS) \
$(EXT_ompi_FRAMEWORK_LIBS) \
$(OMPI_LIBMPI_EXTRA_LIBS) \
$(top_ompi_builddir)/orte/libopen-rte.la
libmpi_la_DEPENDENCIES = \
@ -116,6 +121,7 @@ libmpi_la_DEPENDENCIES = \
$(c_pmpi_lib) \
$(f77_base_lib) \
$(MCA_ompi_FRAMEWORK_LIBS) \
$(EXT_ompi_FRAMEWORK_LIBS) \
$(top_ompi_builddir)/orte/libopen-rte.la
libmpi_la_LDFLAGS = \
$(OMPI_LIBMPI_EXTRA_LDFLAGS)

Просмотреть файл

@ -1,5 +1,5 @@
#
# Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
# Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# Copyright (c) 2004-2005 The University of Tennessee and The University
@ -30,6 +30,9 @@ nodist_headers = \
# Install these in $(includedir)
include_HEADERS =
# Always install these in $(pkgincludedir)
pkginclude_HEADERS =
if OMPI_WANT_F77_BINDINGS
include_HEADERS += \
mpif-common.h \
@ -41,6 +44,7 @@ endif
# counterparts (which AM automatically ships).
nodist_include_HEADERS = \
mpi.h \
mpi-ext.h \
mpi_portable_platform.h
if OMPI_WANT_F77_BINDINGS

10
ompi/mpiext/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,10 @@
#
# Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#

29
ompi/mpiext/example/Makefile.am Обычный файл
Просмотреть файл

@ -0,0 +1,29 @@
#
# Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
# University Research and Technology
# Corporation. All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
headers = \
mpiext_example_c.h
sources = \
c/progress.c
lib = libext_mpiext_example.la
lib_sources = $(sources)
extcomponentdir = $(pkglibdir)
noinst_LTLIBRARIES = $(lib)
libext_mpiext_example_la_SOURCES = $(lib_sources)
libext_mpiext_example_la_LDFLAGS = -module -avoid-version
ompidir = $(includedir)/openmpi/ompi/mpiext/example
ompi_HEADERS = \
$(headers)

26
ompi/mpiext/example/c/progress.c Обычный файл
Просмотреть файл

@ -0,0 +1,26 @@
/*
* Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
* University Research and Technology
* Corporation. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*/
#include "ompi_config.h"
#include <stdio.h>
#include "ompi/mpi/c/bindings.h"
#include "ompi/mpiext/example/mpiext_example_c.h"
static const char FUNC_NAME[] = "OMPI_Progress";
int OMPI_Progress(char * stmt)
{
printf("%s!!!\n", stmt);
return MPI_SUCCESS;
}

17
ompi/mpiext/example/configure.m4 Обычный файл
Просмотреть файл

@ -0,0 +1,17 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2009 The Trustees of Indiana University.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
# EXT_ompi_example_CONFIG([action-if-found], [action-if-not-found])
# -----------------------------------------------------------
AC_DEFUN([EXT_mpiext_example_CONFIG],[
# Left empty as a stub for copy-paste of new extensions
echo "MPIEXT Example: Inside configure.m4"
])dnl

12
ompi/mpiext/example/configure.params Обычный файл
Просмотреть файл

@ -0,0 +1,12 @@
# -*- shell-script -*-
#
# Copyright (c) 2004-2009 The Trustees of Indiana University.
# All rights reserved.
# $COPYRIGHT$
#
# Additional copyrights may follow
#
# $HEADER$
#
PARAM_CONFIG_FILES="Makefile"

12
ompi/mpiext/example/mpiext_example_c.h Обычный файл
Просмотреть файл

@ -0,0 +1,12 @@
/*
* Copyright (c) 2004-2009 The Trustees of Indiana University.
* All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
*
* $HEADER$
*
*/
OMPI_DECLSPEC int OMPI_Progress(char * stmt);

Просмотреть файл

@ -1,5 +1,5 @@
//
// Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
// Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
// University Research and Technology
// Corporation. All rights reserved.
// Copyright (c) 2004-2005 The University of Tennessee and The University
@ -9,7 +9,7 @@
// University of Stuttgart. All rights reserved.
// Copyright (c) 2004-2005 The Regents of the University of California.
// All rights reserved.
// Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved.
// Copyright (c) 2007-2009 Cisco Systems, Inc. All rights reserved.
// $COPYRIGHT$
//
// Additional copyrights may follow
@ -110,7 +110,9 @@ namespace ompi_info {
int value);
void out(const std::string& pretty_message,
const std::string &plain_message,
const std::string& value);
const std::string& value,
bool strip_leading_whitespace = true,
bool strip_trailing_whitespace = true);
//
// Component-related functions

Просмотреть файл

@ -1,5 +1,5 @@
//
// Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
// Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
// University Research and Technology
// Corporation. All rights reserved.
// Copyright (c) 2004-2006 The University of Tennessee and The University
@ -9,6 +9,7 @@
// University of Stuttgart. All rights reserved.
// Copyright (c) 2004-2005 The Regents of the University of California.
// All rights reserved.
// Copyright (c) 2009 Cisco Systems, Inc. All rights reserved.
// $COPYRIGHT$
//
// Additional copyrights may follow
@ -57,8 +58,11 @@ static int screen_width = 78;
// Prints the passed strings in a pretty or parsable format.
//
void ompi_info::out(const string& pretty_message, const string &plain_message,
const string& value)
const string& value, bool strip_leading_whitespace,
bool strip_trailing_whitespace)
{
string local_value = value;
#ifdef HAVE_ISATTY
// If we have isatty(), if this is not a tty, then disable
// wrapping for grep-friendly behavior
@ -76,10 +80,33 @@ void ompi_info::out(const string& pretty_message, const string &plain_message,
}
#endif
if (strip_leading_whitespace) {
string::size_type i = 0;
while (i < local_value.length() && isspace(local_value[i])) {
++i;
}
if (i > local_value.length()) {
local_value = "";
} else if (i > 0) {
local_value = local_value.substr(i);
}
}
if (strip_trailing_whitespace) {
string::size_type i = local_value.length();
while (i >= 0 && isspace(local_value[i])) {
--i;
}
if (i < 0) {
local_value = "";
} else if (i >= 0) {
local_value = local_value.substr(0, i);
}
}
if (pretty) {
string::size_type pos, max_value_width;
string spaces;
string v = value;
string v = local_value;
string filler;
int num_spaces = (int)(centerpoint - pretty_message.length());
@ -135,9 +162,9 @@ void ompi_info::out(const string& pretty_message, const string &plain_message,
}
} else {
if (!plain_message.empty()) {
cout << plain_message << ":" << value << endl;
cout << plain_message << ":" << local_value << endl;
} else {
cout << value << endl;
cout << local_value << endl;
}
}
}

Просмотреть файл

@ -1,5 +1,5 @@
//
// Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
// Copyright (c) 2004-2009 The Trustees of Indiana University and Indiana
// University Research and Technology
// Corporation. All rights reserved.
// Copyright (c) 2004-2006 The University of Tennessee and The University
@ -9,7 +9,7 @@
// University of Stuttgart. All rights reserved.
// Copyright (c) 2004-2005 The Regents of the University of California.
// All rights reserved.
// Copyright (c) 2007-2008 Cisco Systems, Inc. All rights reserved.
// Copyright (c) 2007-2009 Cisco Systems, Inc. All rights reserved.
// Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
// $COPYRIGHT$
//
@ -781,5 +781,7 @@ void ompi_info::do_config(bool want_all)
out("MPI_WTIME support", "options:mpi-wtime", wtime_support);
out("Symbol visibility support", "options:visibility", symbol_visibility);
out("MPI extensions", "options:mpi_ext", OMPI_EXT_COMPONENTS);
out("FT Checkpoint support", "options:ft_support", ft_support);
}