One thing to note about this change is that it will break binary compatibility between 1.3/1.4 and the 1.5/1.6 series (since these values are #define's, and therefore are resolved at compile time -- not run-time).

While I agree that reducing the memory footprint is a good thing, do we want to change the default string sizes between 1.3 and 1.5?

Also, fwiw, 16 seems like a pretty short default length for hostnames -- some hostnames will be reported with their domain name by default, which can therefore easily be >16 characters.

Also, the comment mentions that the longest ROMIO key is 33 chars; do we need the max key length to be 34? Or does the code already compensate by using +1 for the actual size of the strings? It's a little confusing because I see "-1"'s in the corresponding fortran code.

Finally, I wouldn't prefix the macro name with "_" -- an "OPAL_" prefix is sufficient.


On May 27, 2009, at 8:54 AM, <rusra...@osl.iu.edu> <rusra...@osl.iu.edu> wrote:

Author: rusraink
Date: 2009-05-27 08:54:40 EDT (Wed, 27 May 2009)
New Revision: 21292
URL: https://svn.open-mpi.org/trac/ompi/changeset/21292

Log:
 - Make the maximum length user strings configurable... Namely
      MPI_MAX_PROCESSOR_NAME
      MPI_MAX_ERROR_STRING
      MPI_MAX_OBJECT_NAME
      MPI_MAX_INFO_KEY
      MPI_MAX_INFO_VAL
      MPI_MAX_PORT_NAME
      MPI_MAX_DATAREP_STRING

Defaults stay as theyr currently are -- and now give an explanation on the
   min/max values being used in a central place...
m4-macro _OPAL_WITH_OPTION_MIN_MAX_VALUE may be benefical in other parts
   of the configure system.

- We need some of these in the lower level OPAL for an upcoming commit!
   All other levels base their values on them.


Text files modified:
   trunk/config/opal_configure_options.m4      |    30 ++++++++++++++
trunk/config/opal_functions.m4 | 38 ++++++++++++++ ++++
   trunk/ompi/debuggers/mpihandles_interface.h |     4 +
trunk/ompi/include/mpi.h.in | 83 ++++++++++++++ +++++++++++--------------
   trunk/ompi/include/mpif-common.h            |    12 ----
   trunk/ompi/include/mpif-config.h.in         |    17 ++++++++
   trunk/ompi/include/mpif-mpi-io.h            |     2
   trunk/ompi/tools/ompi_info/param.cc         |     9 ++++
   8 files changed, 151 insertions(+), 44 deletions(-)

Modified: trunk/config/opal_configure_options.m4
= = = = = = = = ======================================================================
--- trunk/config/opal_configure_options.m4      (original)
+++ trunk/config/opal_configure_options.m4 2009-05-27 08:54:40 EDT (Wed, 27 May 2009)
@@ -492,4 +492,34 @@
     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

Modified: trunk/config/opal_functions.m4
= = = = = = = = ======================================================================
--- trunk/config/opal_functions.m4      (original)
+++ trunk/config/opal_functions.m4 2009-05-27 08:54:40 EDT (Wed, 27 May 2009)
@@ -11,6 +11,8 @@
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 @@
         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

Modified: trunk/ompi/debuggers/mpihandles_interface.h
= = = = = = = = ======================================================================
--- trunk/ompi/debuggers/mpihandles_interface.h (original)
+++ trunk/ompi/debuggers/mpihandles_interface.h 2009-05-27 08:54:40 EDT (Wed, 27 May 2009)
@@ -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

Modified: trunk/ompi/include/mpi.h.in
= = = = = = = = ======================================================================
--- trunk/ompi/include/mpi.h.in (original)
+++ trunk/ompi/include/mpi.h.in 2009-05-27 08:54:40 EDT (Wed, 27 May 2009)
@@ -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 @@
 /*
  * 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 @@

 #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 */

 /*

Modified: trunk/ompi/include/mpif-common.h
= = = = = = = = ======================================================================
--- trunk/ompi/include/mpif-common.h    (original)
+++ trunk/ompi/include/mpif-common.h 2009-05-27 08:54:40 EDT (Wed, 27 May 2009)
@@ -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)

Modified: trunk/ompi/include/mpif-config.h.in
= = = = = = = = ======================================================================
--- trunk/ompi/include/mpif-config.h.in (original)
+++ trunk/ompi/include/mpif-config.h.in 2009-05-27 08:54:40 EDT (Wed, 27 May 2009)
@@ -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)

Modified: trunk/ompi/include/mpif-mpi-io.h
= = = = = = = = ======================================================================
--- trunk/ompi/include/mpif-mpi-io.h    (original)
+++ trunk/ompi/include/mpif-mpi-io.h 2009-05-27 08:54:40 EDT (Wed, 27 May 2009)
@@ -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)

Modified: trunk/ompi/tools/ompi_info/param.cc
= = = = = = = = ======================================================================
--- trunk/ompi/tools/ompi_info/param.cc (original)
+++ trunk/ompi/tools/ompi_info/param.cc 2009-05-27 08:54:40 EDT (Wed, 27 May 2009)
@@ -784,4 +784,13 @@
   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);
+
 }
_______________________________________________
svn-full mailing list
svn-f...@open-mpi.org
http://www.open-mpi.org/mailman/listinfo.cgi/svn-full



--
Jeff Squyres
Cisco Systems

Reply via email to