diff --git a/config/opal_configure_options.m4 b/config/opal_configure_options.m4 index 1e6c82034d..1a1b04316f 100644 --- a/config/opal_configure_options.m4 +++ b/config/opal_configure_options.m4 @@ -492,4 +492,34 @@ else AC_MSG_RESULT([no]) fi + +# +# User level (mpi.h.in) visible maximum lengths of strings. +# These may be required in lower-level libraries to set up matching +# data-structures (e.g. OPAL_MAX_OBJECT_NAME). +# +# Default values (as of OMPI-1.3), and some sane minimum and maximum values +# + +# No lower and upper bound required or enforced +_OPAL_WITH_OPTION_MIN_MAX_VALUE(processor_name, 256, 16, 1024) + +# Min length according to information passed in ompi/errhandler/errcode.c +_OPAL_WITH_OPTION_MIN_MAX_VALUE(error_string, 256, 64, 1024) + +# Min length according to MPI-2.1, p. 236 (information passed in ompi/communicator/comm.c: min only 48) +_OPAL_WITH_OPTION_MIN_MAX_VALUE(object_name, 64, 64, 256) + +# Min and Max length according to MPI-2.1, p. 287 is 32; longest key in ROMIO however 33 +_OPAL_WITH_OPTION_MIN_MAX_VALUE(info_key, 36, 33, 255) + +# No lower and upper bound required or enforced! +_OPAL_WITH_OPTION_MIN_MAX_VALUE(info_val, 256, 32, 1024) + +# Min length according to _POSIX_HOST_NAME_MAX=255 (4*HOST_NAME_MAX) +_OPAL_WITH_OPTION_MIN_MAX_VALUE(port_name, 1024, 255, 2048) + +# Min length accroding to MPI-2.1, p. 418 +_OPAL_WITH_OPTION_MIN_MAX_VALUE(datarep_string, 128, 64, 256) + ])dnl diff --git a/config/opal_functions.m4 b/config/opal_functions.m4 index 2eb7ccc1ad..88dde53fab 100644 --- a/config/opal_functions.m4 +++ b/config/opal_functions.m4 @@ -11,6 +11,8 @@ dnl University of Stuttgart. All rights reserved. dnl Copyright (c) 2004-2005 The Regents of the University of California. dnl All rights reserved. dnl Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. +dnl Copyright (c) 2009 Oak Ridge National Labs. All rights reserved. +dnl dnl $COPYRIGHT$ dnl dnl Additional copyrights may follow @@ -356,3 +358,39 @@ AC_DEFUN([OMPI_VAR_SCOPE_POP],[ unset $ompi_var done ])dnl + + +dnl ####################################################################### +dnl ####################################################################### +dnl ####################################################################### + +# +# _OPAL_WITH_OPTION_MIN_MAX_VALUE(NAME,DEFAULT_VALUE,LOWER_BOUND,UPPER_BOUND) +# Defines a variable OPAL_MAX_xxx, with "xxx" being specified as parameter $1 as "variable_name". +# If not set at configure-time using --with-max-xxx, the default-value ($2) is assumed. +# If set, value is checked against lower (value >= $3) and upper bound (value <= $4) +# +AC_DEFUN([_OPAL_WITH_OPTION_MIN_MAX_VALUE], [ + max_value=[$2] + AC_MSG_CHECKING([maximum length of ]m4_translit($1, [_], [ ])) + AC_ARG_WITH([max-]m4_translit($1, [_], [-]), + AC_HELP_STRING([--with-max-]m4_translit($1, [_], [-])[=VALUE], + [maximum length of ]m4_translit($1, [_], [ ])[s. VALUE argument has to be specified (default: [$2]).])) + if test ! -z "$with_max_[$1]" -a "$with_max_[$1]" != "no" ; then + # Ensure it's a number (hopefully an integer!), and >0 + expr $with_max_[$1] + 1 > /dev/null 2> /dev/null + AS_IF([test "$?" != "0"], [happy=0], + [AS_IF([test $with_max_[$1] -ge $3 -a $with_max_[$1] -le $4], + [happy=1], [happy=0])]) + + # If badness in the above tests, bail + AS_IF([test "$happy" = "0"], + [AC_MSG_RESULT([bad value ($with_max_[$1])]) + AC_MSG_WARN([--with-max-]m4_translit($1, [_], [-])[s value must be >= $3 and <= $4]) + AC_MSG_ERROR([Cannot continue])]) + max_value=$with_max_[$1] + fi + AC_MSG_RESULT([$max_value]) + AC_DEFINE_UNQUOTED([OPAL_MAX_]m4_toupper($1), $max_value, + [Maximum length of ]m4_translit($1, [_], [ ])[s (default is $2)]) +])dnl diff --git a/ompi/debuggers/mpihandles_interface.h b/ompi/debuggers/mpihandles_interface.h index 9f937a66bb..15c7ba9287 100644 --- a/ompi/debuggers/mpihandles_interface.h +++ b/ompi/debuggers/mpihandles_interface.h @@ -20,6 +20,8 @@ #ifndef __MPIDBG_INTERFACE_H__ #define __MPIDBG_INTERFACE_H__ 1 +#include "ompi_config.h" + /* * This file provides interface functions for a debugger to gather * additional information about MPI handles. @@ -37,7 +39,7 @@ **************************************************************************/ enum { - MPIDBG_MAX_OBJECT_NAME = 64 + MPIDBG_MAX_OBJECT_NAME = MPI_MAX_OBJECT_NAME }; enum { MPIDBG_MAX_FILENAME = 1024 diff --git a/ompi/include/mpi.h.in b/ompi/include/mpi.h.in index 531a4d0eb6..e3242b5fdc 100644 --- a/ompi/include/mpi.h.in +++ b/ompi/include/mpi.h.in @@ -65,6 +65,27 @@ /* The size of a `int', as computed by sizeof. */ #undef OPAL_SIZEOF_INT +/* Maximum length of datarep string (default is 128) */ +#undef OPAL_MAX_DATAREP_STRING + +/* Maximum length of error strings (default is 256) */ +#undef OPAL_MAX_ERROR_STRING + +/* Maximum length of info keys (default is 36) */ +#undef OPAL_MAX_INFO_KEY + +/* Maximum length of info vals (default is 256) */ +#undef OPAL_MAX_INFO_VAL + +/* Maximum length of object names (default is 64) */ +#undef OPAL_MAX_OBJECT_NAME + +/* Maximum length of port names (default is 1024) */ +#undef OPAL_MAX_PORT_NAME + +/* Maximum length of processor names (default is 256) */ +#undef OPAL_MAX_PROCESSOR_NAME + /* Whether we have FORTRAN LOGICAL*1 or not */ #undef OMPI_HAVE_FORTRAN_LOGICAL1 @@ -356,37 +377,37 @@ typedef int (MPI_Grequest_cancel_function)(void *, int); /* * Miscellaneous constants */ -#define MPI_ANY_SOURCE -1 /* match any source rank */ -#define MPI_PROC_NULL -2 /* rank of null process */ -#define MPI_ROOT -4 -#define MPI_ANY_TAG -1 /* match any message tag */ -#define MPI_MAX_PROCESSOR_NAME 256 /* max proc. name length */ -#define MPI_MAX_ERROR_STRING 256 /* max error message length */ -#define MPI_MAX_OBJECT_NAME 64 /* max object name length */ -#define MPI_UNDEFINED -32766 /* undefined stuff */ -#define MPI_CART 1 /* cartesian topology */ -#define MPI_GRAPH 2 /* graph topology */ -#define MPI_KEYVAL_INVALID -1 /* invalid key value */ +#define MPI_ANY_SOURCE -1 /* match any source rank */ +#define MPI_PROC_NULL -2 /* rank of null process */ +#define MPI_ROOT -4 /* special value for intercomms */ +#define MPI_ANY_TAG -1 /* match any message tag */ +#define MPI_MAX_PROCESSOR_NAME OPAL_MAX_PROCESSOR_NAME /* max proc. name length */ +#define MPI_MAX_ERROR_STRING OPAL_MAX_ERROR_STRING /* max error message length */ +#define MPI_MAX_OBJECT_NAME OPAL_MAX_OBJECT_NAME /* max object name length */ +#define MPI_UNDEFINED -32766 /* undefined stuff */ +#define MPI_CART 1 /* cartesian topology */ +#define MPI_GRAPH 2 /* graph topology */ +#define MPI_KEYVAL_INVALID -1 /* invalid key value */ /* * More constants */ -#define MPI_BOTTOM ((void *) 0) /* base reference address */ -#define MPI_IN_PLACE ((void *) 1) /* in place buffer */ -#define MPI_BSEND_OVERHEAD 128 /* size of bsend header + ptr */ -#define MPI_MAX_INFO_KEY 36 /* max info key length */ -#define MPI_MAX_INFO_VAL 256 /* max info value length */ -#define MPI_ARGV_NULL ((char **) 0) /* NULL argument vector */ -#define MPI_ARGVS_NULL ((char ***) 0) /* NULL argument vectors */ -#define MPI_ERRCODES_IGNORE ((int *) 0) /* don't return error codes */ -#define MPI_MAX_PORT_NAME 1024 /* max port name length */ -#define MPI_MAX_NAME_LEN MPI_MAX_PORT_NAME /* max port name length */ -#define MPI_ORDER_C 0 /* C row major order */ -#define MPI_ORDER_FORTRAN 1 /* Fortran column major order */ -#define MPI_DISTRIBUTE_BLOCK 0 /* block distribution */ -#define MPI_DISTRIBUTE_CYCLIC 1 /* cyclic distribution */ -#define MPI_DISTRIBUTE_NONE 2 /* not distributed */ -#define MPI_DISTRIBUTE_DFLT_DARG (-1) /* default distribution arg */ +#define MPI_BOTTOM ((void *) 0) /* base reference address */ +#define MPI_IN_PLACE ((void *) 1) /* in place buffer */ +#define MPI_BSEND_OVERHEAD 128 /* size of bsend header + ptr */ +#define MPI_MAX_INFO_KEY OPAL_MAX_INFO_KEY /* max info key length */ +#define MPI_MAX_INFO_VAL OPAL_MAX_INFO_VAL /* max info value length */ +#define MPI_ARGV_NULL ((char **) 0) /* NULL argument vector */ +#define MPI_ARGVS_NULL ((char ***) 0) /* NULL argument vectors */ +#define MPI_ERRCODES_IGNORE ((int *) 0) /* don't return error codes */ +#define MPI_MAX_PORT_NAME OPAL_MAX_PORT_NAME /* max port name length */ +#define MPI_MAX_NAME_LEN MPI_MAX_PORT_NAME /* max port name length, non-std. (LAM < 6.3b1) */ +#define MPI_ORDER_C 0 /* C row major order */ +#define MPI_ORDER_FORTRAN 1 /* Fortran column major order */ +#define MPI_DISTRIBUTE_BLOCK 0 /* block distribution */ +#define MPI_DISTRIBUTE_CYCLIC 1 /* cyclic distribution */ +#define MPI_DISTRIBUTE_NONE 2 /* not distributed */ +#define MPI_DISTRIBUTE_DFLT_DARG (-1) /* default distribution arg */ #if OMPI_PROVIDE_MPI_FILE_INTERFACE /* @@ -406,11 +427,11 @@ typedef int (MPI_Grequest_cancel_function)(void *, int); #define MPI_DISPLACEMENT_CURRENT -54278278 -#define MPI_SEEK_SET 600 -#define MPI_SEEK_CUR 602 -#define MPI_SEEK_END 604 +#define MPI_SEEK_SET 600 +#define MPI_SEEK_CUR 602 +#define MPI_SEEK_END 604 -#define MPI_MAX_DATAREP_STRING 128 +#define MPI_MAX_DATAREP_STRING OPAL_MAX_DATAREP_STRING /* max data representation length */ #endif /* #if OMPI_PROVIDE_MPI_FILE_INTERFACE */ /* diff --git a/ompi/include/mpif-common.h b/ompi/include/mpif-common.h index 81032d5578..2a376f421f 100644 --- a/ompi/include/mpif-common.h +++ b/ompi/include/mpif-common.h @@ -80,9 +80,9 @@ ! Miscellaneous constants ! integer MPI_ANY_SOURCE, MPI_ANY_TAG - integer MPI_PROC_NULL, MPI_MAX_PROCESSOR_NAME + integer MPI_PROC_NULL integer MPI_ROOT - integer MPI_MAX_ERROR_STRING, MPI_UNDEFINED + integer MPI_UNDEFINED integer MPI_CART, MPI_GRAPH, MPI_KEYVAL_INVALID integer MPI_SOURCE, MPI_TAG, MPI_ERROR integer MPI_TAG_UB, MPI_HOST, MPI_IO, MPI_WTIME_IS_GLOBAL @@ -90,8 +90,6 @@ integer IMPI_CLIENT_SIZE, IMPI_CLIENT_COLOR integer IMPI_HOST_SIZE, IMPI_HOST_COLOR integer MPI_BSEND_OVERHEAD - integer MPI_MAX_INFO_KEY, MPI_MAX_INFO_VAL - integer MPI_MAX_PORT_NAME, MPI_MAX_OBJECT_NAME integer MPI_ORDER_C, MPI_ORDER_FORTRAN integer MPI_DISTRIBUTE_BLOCK, MPI_DISTRIBUTE_CYCLIC integer MPI_DISTRIBUTE_NONE, MPI_DISTRIBUTE_DFLT_DARG @@ -106,8 +104,6 @@ parameter (MPI_ANY_TAG=-1) parameter (MPI_PROC_NULL=-2) parameter (MPI_ROOT=-4) - parameter (MPI_MAX_PROCESSOR_NAME=255) - parameter (MPI_MAX_ERROR_STRING=255) parameter (MPI_UNDEFINED=-32766) parameter (MPI_CART=1) parameter (MPI_GRAPH=2) @@ -131,10 +127,6 @@ parameter (IMPI_HOST_COLOR=13) parameter (MPI_BSEND_OVERHEAD=128) - parameter (MPI_MAX_INFO_KEY=35) - parameter (MPI_MAX_INFO_VAL=255) - parameter (MPI_MAX_PORT_NAME=255) - parameter (MPI_MAX_OBJECT_NAME=63) parameter (MPI_ORDER_C=0) parameter (MPI_ORDER_FORTRAN=1) parameter (MPI_DISTRIBUTE_BLOCK=0) diff --git a/ompi/include/mpif-config.h.in b/ompi/include/mpif-config.h.in index 5ad04ca4f6..0e33652e9a 100644 --- a/ompi/include/mpif-config.h.in +++ b/ompi/include/mpif-config.h.in @@ -89,3 +89,20 @@ ! integer MPI_STATUS_SIZE parameter (MPI_STATUS_SIZE=5) +! +! Configurable length constants +! + integer MPI_MAX_PROCESSOR_NAME + integer MPI_MAX_ERROR_STRING + integer MPI_MAX_OBJECT_NAME + integer MPI_MAX_INFO_KEY + integer MPI_MAX_INFO_VAL + integer MPI_MAX_PORT_NAME + integer MPI_MAX_DATAREP_STRING + parameter (MPI_MAX_PROCESSOR_NAME=@OPAL_MAX_PROCESSOR_NAME@-1) + parameter (MPI_MAX_ERROR_STRING=@OPAL_MAX_ERROR_STRING@-1) + parameter (MPI_MAX_OBJECT_NAME=@OPAL_MAX_OBJECT_NAME@-1) + parameter (MPI_MAX_INFO_KEY=@OPAL_MAX_INFO_KEY@-1) + parameter (MPI_MAX_INFO_VAL=@OPAL_MAX_INFO_VAL@-1) + parameter (MPI_MAX_PORT_NAME=@OPAL_MAX_PORT_NAME@-1) + parameter (MPI_MAX_DATAREP_STRING=@OPAL_MAX_DATAREP_STRING@-1) diff --git a/ompi/include/mpif-mpi-io.h b/ompi/include/mpif-mpi-io.h index 7df5499b88..6ffa998607 100644 --- a/ompi/include/mpif-mpi-io.h +++ b/ompi/include/mpif-mpi-io.h @@ -68,7 +68,6 @@ integer MPI_MODE_DELETE_ON_CLOSE, MPI_MODE_UNIQUE_OPEN integer MPI_MODE_EXCL, MPI_MODE_APPEND, MPI_MODE_SEQUENTIAL integer MPI_DISPLACEMENT_CURRENT - integer MPI_MAX_DATAREP_STRING parameter (MPI_FILE_NULL=0) parameter (MPI_SEEK_SET=600) @@ -84,4 +83,3 @@ parameter (MPI_MODE_APPEND=128) parameter (MPI_MODE_SEQUENTIAL=256) parameter (MPI_DISPLACEMENT_CURRENT=-54278278) - parameter (MPI_MAX_DATAREP_STRING=127) diff --git a/ompi/tools/ompi_info/param.cc b/ompi/tools/ompi_info/param.cc index 8fbe946443..1ca5986d68 100644 --- a/ompi/tools/ompi_info/param.cc +++ b/ompi/tools/ompi_info/param.cc @@ -784,4 +784,13 @@ void ompi_info::do_config(bool want_all) out("MPI extensions", "options:mpi_ext", OMPI_EXT_COMPONENTS); out("FT Checkpoint support", "options:ft_support", ft_support); + + out("Parameter OPAL_MAX_PROCESSOR_NAME", "options:max-processor-name", OPAL_MAX_PROCESSOR_NAME); + out("Parameter OPAL_MAX_ERROR_STRING", "options:max-error-string", OPAL_MAX_ERROR_STRING); + out("Parameter OPAL_MAX_OBJECT_NAME", "options:max-object-name", OPAL_MAX_OBJECT_NAME); + out("Parameter OPAL_MAX_INFO_KEY", "options:max-info-key", OPAL_MAX_INFO_KEY); + out("Parameter OPAL_MAX_INFO_VAL", "options:max-info-val", OPAL_MAX_INFO_VAL); + out("Parameter OPAL_MAX_PORT_NAME", "options:max-port-name", OPAL_MAX_PORT_NAME); + out("Parameter OPAL_MAX_DATAREP_STRING", "options:max-datarep-string", OPAL_MAX_DATAREP_STRING); + }