home *** CD-ROM | disk | FTP | other *** search
/ ftp.parl.clemson.edu / 2015-02-07.ftp.parl.clemson.edu.tar / ftp.parl.clemson.edu / pub / pvfs2 / orangefs-2.8.3-20110323.tar.gz / orangefs-2.8.3-20110323.tar / orangefs / doc / coding / romio-MPICH2-0.96p2-PVFS2-0.51.diff < prev    next >
Text File  |  2004-06-10  |  303KB  |  8,977 lines

  1. Index: romio/Makefile.in
  2. ===================================================================
  3. RCS file: /home/MPI/cvsMaster/romio/Makefile.in,v
  4. retrieving revision 1.34
  5. retrieving revision 1.35
  6. diff -u -w -p -U8 -r1.34 -r1.35
  7. --- romio/Makefile.in    1 Dec 2003 21:52:57 -0000    1.34
  8. +++ romio/Makefile.in    27 Jan 2004 23:27:35 -0000    1.35
  9. @@ -159,8 +159,15 @@
  10.  
  11.  # MPICH2 documentation targets
  12.  mandoc:
  13.      (cd mpi-io && $(MAKE) mandoc )
  14.  htmldoc:
  15.      (cd mpi-io && $(MAKE) htmldoc )
  16.  latexdoc:
  17.      (cd mpi-io && $(MAKE) latexdoc )
  18. +
  19. +
  20. +tags: TAGS
  21. +TAGS:
  22. +    for dir in mpi-io adio/common - ; do \
  23. +        if [ "$$dir" = "-" ] ; then break ; fi ; \
  24. +        (cd $$dir && ${MAKE} TAGS ; ) ; done
  25. Index: romio/README
  26. ===================================================================
  27. RCS file: /home/MPI/cvsMaster/romio/README,v
  28. retrieving revision 1.26
  29. retrieving revision 1.27
  30. --- romio/README    18 Feb 2003 16:31:47 -0000    1.26
  31. +++ romio/README    26 May 2004 17:56:42 -0000    1.27
  32. @@ -253,20 +253,21 @@
  33.  mv, cp, rm, ftp.
  34.  
  35.  
  36.  Using ROMIO on NFS
  37.  ------------------
  38.  
  39.  To use ROMIO on NFS, file locking with fcntl must work correctly on
  40.  the NFS installation. On some installations, fcntl locks don't work.
  41. -To get them to work, you need to use Version 3 of NFS and
  42. -have the system administrator mount the NFS file system with the 
  43. -"noac" option (no attribute caching). Turning off attribute caching 
  44. -may reduce performance, but it is necessary for correct behavior.
  45. +To get them to work, you need to use Version 3 of NFS, ensure that the
  46. +lockd daemon is running on all the machines, and have the system
  47. +administrator mount the NFS file system with the "noac" option (no
  48. +attribute caching). Turning off attribute caching may reduce
  49. +performance, but it is necessary for correct behavior.
  50.  
  51.  The following are some instructions we received from Ian Wells of HP
  52.  for setting the noac option on NFS. We have not tried them
  53.  ourselves. We are including them here because you may find 
  54.  them useful. Note that some of the steps may be specific to HP
  55.  systems, and you may need root permission to execute some of the
  56.  commands. 
  57.     
  58. Index: romio/aclocal.m4
  59. ===================================================================
  60. RCS file: /home/MPI/cvsMaster/romio/aclocal.m4,v
  61. retrieving revision 1.30
  62. retrieving revision 1.31
  63. --- romio/aclocal.m4    6 Oct 2003 16:04:45 -0000    1.30
  64. +++ romio/aclocal.m4    8 Jan 2004 22:41:16 -0000    1.31
  65. @@ -319,17 +319,17 @@
  66.           MPI_Info_create(&info);
  67.           MPI_Finalize(); 
  68.       }
  69.  EOF
  70.    rm -f conftest
  71.    $CC $USER_CFLAGS -I$MPI_INCLUDE_DIR -o conftest mpitest.c $MPI_LIB > /dev/null 2>&1
  72.    if test -x conftest ; then
  73.        AC_MSG_RESULT(yes)
  74. -      AC_DEFINE(HAVE_MPI_INFO,,[Define if MPI_Info available])
  75. +      AC_DEFINE(HAVE_MPI_INFO,1,[Define if MPI_Info available])
  76.        HAVE_MPI_INFO="#define HAVE_MPI_INFO"
  77.        MPI_FINFO1="!"
  78.        MPI_FINFO2="!"
  79.        MPI_FINFO3="!"
  80.        MPI_FINFO4="!"
  81.    else
  82.        AC_MSG_RESULT(no)
  83.        BUILD_MPI_INFO=1
  84. Index: romio/configure.in
  85. ===================================================================
  86. RCS file: /home/MPI/cvsMaster/romio/configure.in,v
  87. retrieving revision 1.98
  88. retrieving revision 1.113
  89. --- romio/configure.in    10 Dec 2003 22:44:11 -0000    1.98
  90. +++ romio/configure.in    8 Jun 2004 19:13:59 -0000    1.113
  91. @@ -76,16 +76,22 @@
  92.  TEST_F77=""
  93.  TRY_WEAK_SYMBOLS=1
  94.  #
  95.  # Error handlers (not used with MPICH2, which provides its own routines)
  96.  MPIO_EXTRA_OBJECTS="get_errh.o set_errh.o"
  97.  MPIO_EXTRA_TMP_POBJECTS="get_errh.p set_errh.p"
  98.  MPIO_EXTRA_REAL_POBJECTS="_get_errh.o _set_errh.o"
  99.  #
  100. +# Completion routines for MPIO_Requests.  MPI Implementations with
  101. +# generalized requests do not need these
  102. +MPIO_REQOBJECTS="iotest.o iotestall.o iotestany.o iotestsome.o iowait.o iowaitall.o iowaitany.o iowaitsome.o ioreq_c2f.o ioreq_f2c.o"
  103. +MPIO_REQ_TMP_POBJECTS="iotest.p iowait.p iowaitall.p iowaitany.p iotestall.p iotestany.p iowaitsome.p iotestsome.p"
  104. +MPIO_REQ_REAL_POBJECTS="_iotest.o _iowait.o _iowaitall.o _iowaitany.o _iotestall.o _iotestany.o _iowaitsome.o _iotestsome.o"
  105. +#
  106.  have_aio=no
  107.  #
  108.  known_filesystems="nfs ufs pfs piofs pvfs pvfs2 testfs xfs hfs sfs"
  109.  known_mpi_impls="mpich_mpi sgi_mpi hp_mpi cray_mpi lam_mpi"
  110.  #
  111.  # Defaults
  112.  AC_ARG_ENABLE(aio,[
  113.  --enable-aio - Request use of asynchronous I/O routines],,enable_aio=notgiven)
  114. @@ -280,17 +286,17 @@
  115.  # --------------------------------------------------------------------------
  116.  # For historical reasons
  117.  if test -z "$FC" ; then 
  118.      FC=$F77
  119.  fi
  120.  #
  121.  C_DEBUG_FLAG="-g"
  122.  F77_DEBUG_FLAG="-g"
  123. -C_OPT_FLAG="-O"
  124. +C_OPT_FLAG=${CFLAGS:-"-O"}
  125.  case $ARCH in 
  126.       sun4)
  127.       CC=${CC:-gcc}
  128.       F77=${FC:-f77}
  129.       ;;
  130.  
  131.       solaris|solaris86)
  132.       CC=${CC:-cc}
  133. @@ -884,16 +890,20 @@
  134.  # If no system selected, turn of AIO
  135.  if test "$have_aio" != yes ; then
  136.      AC_DEFINE(NO_AIO,1,[Define if AIO should not be used])
  137.  fi
  138.  
  139.  
  140.  AC_HAVE_FUNCS(memalign)
  141.  
  142. +#
  143. +# Question: Should ROMIO under MPICH2 ignore the Fortran tests, since 
  144. +# MPICH2 provides all of the Fortran interface routines?
  145. +#
  146.  if test $NOF77 = 0 ; then
  147.      echo "checking Fortran external names"
  148.      PAC_GET_FORTNAMES
  149.      if test -n "$WDEF" ; then
  150.          CFLAGS="$CFLAGS $WDEF"
  151.      fi
  152.      dnl PAC_PROG_F77_NAME_MANGLE
  153.      dnl (need to set the new name format)
  154. @@ -1012,17 +1022,24 @@
  155.     fi
  156.     PAC_TEST_MPI_SGI_type_is_contig
  157.     PAC_TEST_MPI_COMBINERS
  158.     PAC_TEST_MPI_HAVE_OFFSET_KIND
  159.  fi
  160.  #
  161.  # check if darray and subarray constructors are defined in the MPI 
  162.  # implementation 
  163. -if test $WITHIN_KNOWN_MPI_IMPL = no -o $FROM_MPICH2 != no ; then
  164. +if test $WITHIN_KNOWN_MPI_IMPL = no ; then
  165.     PAC_MPI_DARRAY_SUBARRAY
  166. -else
  167. +fi
  168. +if test $FROM_MPICH2 = yes ; then
  169. +   dnl Made this a message instead of a warning because the warning is
  170. +   dnl likely to confuse users.
  171. +   AC_MSG_RESULT("Overriding Array test for MPICH2")
  172. +   dnl unset BUILD_MPI_ARRAY
  173. +   dnl AC_DEFINE(HAVE_MPI_DARRAY_SUBARRAY,1,[Define if Darray is available])
  174. +   dnl HAVE_MPI_DARRAY_SUBARRAY="#define HAVE_MPI_DARRAY_SUBARRAY"
  175.     MPI_FARRAY1="!"
  176.     MPI_FARRAY2="!"
  177.     MPI_FARRAY3="!"
  178.     MPI_FARRAY4="!"
  179.     MPI_FARRAY5="!"
  180.     MPI_FARRAY6="!"
  181. @@ -1041,34 +1058,39 @@
  182.  # Fortran interface for HP already uses one secondary defn. 
  183.  # therefore, do not use this method for profiling interface.
  184.  # build profiling interface explicitly.
  185.     TRY_WEAK_SYMBOLS=0
  186.  fi
  187.  if test $TRY_WEAK_SYMBOLS = 1 ; then
  188.    AC_MSG_CHECKING([for weak symbol support])
  189.    AC_TRY_LINK([
  190. -extern int Foo(int);
  191. +extern int PFoo(int);
  192.  #pragma weak PFoo = Foo
  193. -int Foo(a) { return a; }
  194. +int Foo(int a) { return a; }
  195.  ],[return PFoo(1);],has_pragma_weak=1)
  196.    #
  197.    # Some systems (Linux ia64 and ecc, for example), support weak symbols
  198.    # only within a single object file!  This tests that case.
  199. +  # Note that there is an extern int PFoo declaration before the
  200. +  # pragma.  Some compilers require this in order to make the weak symbol
  201. +  # extenally visible.  
  202.    if test "$has_pragma_weak" = 1 ; then
  203.      AC_MSG_RESULT([pragma weak])
  204.      AC_MSG_CHECKING([that weak symbols are visible to other files])
  205.      rm -f conftest*
  206.      cat >>conftest1.c <<EOF
  207. -extern int Foo(int);
  208. +extern int PFoo(int);
  209.  #pragma weak PFoo = Foo
  210. -int Foo(a) { return a; }
  211. +int Foo(int);
  212. +int Foo(int a) { return a; }
  213.  EOF
  214.      cat >>conftest2.c <<EOF
  215. -int main() {
  216. +extern int PFoo(int);
  217. +int main(int argc, char **argv) {
  218.  return PFoo(0);}
  219.  EOF
  220.      ac_link2='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest1.c conftest2.c $LIBS >conftest.out 2>&1'
  221.      if eval $ac_link2 ; then
  222.          AC_MSG_RESULT(yes)
  223.      else
  224.        echo "$ac_link2" 1>&AC_FD_CC
  225.        echo "Failed program was" 1>&AC_FD_CC
  226. @@ -1080,27 +1102,29 @@
  227.      fi
  228.      rm -f conftest*
  229.    fi
  230.    if test "$has_pragma_weak" = 1 ; then
  231.      HAVE_WEAK_SYMBOLS=1
  232.      AC_DEFINE(HAVE_PRAGMA_WEAK,1,[Define if pragma weak available])
  233.    else
  234.      AC_TRY_LINK([
  235. +extern int PFoo(int);
  236.  #pragma _HP_SECONDARY_DEF Foo PFoo
  237. -int Foo(a) { return a; }
  238. +int Foo(int a) { return a; }
  239.  ],[return PFoo(1);],has_pragma_hp_secondary=1)
  240.      if test "$has_pragma_hp_secondary" = 1 ; then 
  241.          AC_MSG_RESULT([pragma _HP_SECONDARY_DEF])
  242.          HAVE_WEAK_SYMBOLS=1
  243.          AC_DEFINE(HAVE_PRAGMA_HP_SEC_DEF,1,[Define for HP weak pragma])
  244.      else
  245.          AC_TRY_LINK([
  246. +extern int PFoo(int);
  247.  #pragma _CRI duplicate PFoo as Foo
  248. -int Foo(a) { return a; }
  249. +int Foo(int a) { return a; }
  250.  ],[return PFoo(1);],has_pragma_cri_duplicate=1)
  251.          if test "$has_pragma_cri_duplicate" = 1 ; then
  252.          AC_MSG_RESULT([pragma _CRI duplicate x as y])
  253.          HAVE_WEAK_SYMBOLS=1
  254.          AC_DEFINE(HAVE_PRAGMA_CRI_DUP,1,[Define for CRAY weak dup])
  255.          else    
  256.              AC_MSG_RESULT(no)
  257.          fi
  258. @@ -1145,45 +1169,20 @@
  259.          AC_DEFINE(NEEDS_INT_CAST_WITH_FLOCK,1,[Define if l_start and l_len data should be cast as int])
  260.      fi
  261.      # FIXME.  Solaris header files define off_t as a UNION if 64bit file
  262.      # sizes are selected.  Gah!
  263.  fi
  264.  
  265.  if test -n "$file_system_nfs" ; then
  266.     # Check for problems with locks
  267. -   AC_MSG_CHECKING([whether file locks work with NFS])
  268. -   AC_TRY_RUN([
  269. -#include <fcntl.h>
  270. -#include <errno.h>
  271. -#include <unistd.h>
  272. -
  273. -int main()
  274. -{
  275. -    struct flock lock;
  276. -    int fd, err;
  277. -
  278. -    lock.l_type = F_WRLCK;
  279. -    lock.l_start = 0;
  280. -    lock.l_whence = SEEK_SET;
  281. -    lock.l_len = 100;
  282. -
  283. -    fd = open("conftest.dat", O_RDWR | O_CREAT, 0644);
  284. -
  285. -    err = fcntl(fd, F_SETLKW, &lock);
  286. -
  287. -   /* printf("err = %d, errno = %d\n", err, errno); */
  288. -    close(fd);
  289. -    return err;
  290. -}],nfs_locks_work=yes,nfs_locks_work=no,nfs_locks_work=unknown)
  291. -    AC_MSG_RESULT($nfs_locks_work)
  292. -    if test "$nfs_locks_work" != "yes" ; then
  293. -        AC_MSG_WARN([File locks do not work with NFS.  See the Installation and
  294. -users manual for instructions on fixing this])
  295. -    fi
  296. +   # We no longer do this within the configure test.  Instead,
  297. +   # we suggest tha the user run maint/nfslock.c
  298. +   AC_MSG_WARN([File locks may not work with NFS.  See the Installation and
  299. +users manual for instructions on testing and if necessary fixing this])
  300.  fi
  301.  if test -n "$file_system_nfs"; then
  302.      AC_DEFINE(NFS,1,[Define for NFS])
  303.  fi
  304.  if test -n "$file_system_ufs"; then
  305.      AC_DEFINE(UFS,1,[Define for UFS])
  306.  fi
  307.  if test -n "$file_system_hfs"; then
  308. @@ -1222,41 +1221,62 @@
  309.          CFLAGS="$CFLAGS -DXFS_MEMALIGN=$pac_cv_memalignval"
  310.      else
  311.          AC_MSG_RESULT(assuming 128 for memory alignment)
  312.          CFLAGS="$CFLAGS -DXFS_MEMALIGN=128"
  313.      fi
  314.  fi
  315.  
  316.  if test -n "$file_system_pvfs"; then
  317. +    # Check for missing int64_t (intel version 8 compiler and -no-gcc
  318. +    # selected)
  319. +    AC_MSG_CHECKING([that pvfs.h can be compiled])
  320. +    AC_TRY_COMPILE([
  321. +#include <pvfs.h>
  322. +],[],pvfs_header_ok=yes,pvfs_header_ok=no)
  323. +    AC_MSG_RESULT($pvfs_header_ok)
  324. +    if test "$pvfs_header_ok" = no -a "$ac_cv_sizeof_long_long" = 8 ; then
  325. +        AC_MSG_CHECKING([if pvfs.h can be compiled if we define int64_t])
  326. +        # Try again, but with int64_t
  327. +        AC_TRY_COMPILE([
  328. +typedef long long int int64_t;
  329. +#include <pvfs.h>
  330. +],[],pvfs_header_ok="yes with int64 definition")
  331. +        AC_MSG_RESULT($pvfs_header_ok)
  332. +    fi
  333. +    if test "$pvfs_header_ok" = "yes with int64 definition" ; then
  334. +        AC_DEFINE(ROMIO_PVFS_NEEDS_INT64_DEFINITION,1,[Define if int64_t must be defined for PVFS])
  335. +    fi
  336. +    if test "$pvfs_header_ok" != "no" ; then
  337.     # Use ROMIO_PVFS instead of PVFS because FREEBSD defines PVFS.
  338.      AC_DEFINE(ROMIO_PVFS,1,[Define for Romio with PVFS])
  339.  fi
  340. +fi
  341.  if test -n "$file_system_pvfs2"; then
  342.      AC_DEFINE(ROMIO_PVFS2,1,[Define for Romio with PVFS2])
  343.  fi
  344.  if test -n "$file_system_pfs"; then
  345.      AC_DEFINE(PFS,1,[Define for PFS])
  346.  fi
  347.  if test -n "$file_system_testfs"; then
  348.      AC_DEFINE(ROMIO_TESTFS,1,[Define for TESTFS])
  349.  fi
  350.  if test -n "$file_system_piofs"; then
  351.      AC_DEFINE(PIOFS,1,[Define for PIOFS])
  352.      USER_CFLAGS="$USER_CFLAGS -bI:/usr/include/piofs/piofs.exp"
  353.      ROMIO_LFLAGS="$USER_FFLAGS -bI:/usr/include/piofs/piofs.exp"
  354.      USER_FFLAGS="$USER_FFLAGS -bI:/usr/include/piofs/piofs.exp"
  355.  fi
  356.  if test -n "$mpi_mpich"; then
  357. -   if test "$FROM_MPICH2" = no; then
  358. -      AC_DEFINE(NEEDS_MPI_TEST,1,[Define if mpi_test needed])
  359. -      AC_DEFINE(MPICH,1,[Define if using MPICH])
  360.        if test -z "$arch_SX4" ; then
  361.           MPIOF_H_INCLUDED=1
  362.        fi
  363. +   if test "$FROM_MPICH2" = no; then
  364. +      AC_DEFINE(NEEDS_MPI_TEST,1,[Define if mpi_test needed])
  365. +      AC_DEFINE(MPICH,1,[Define if using MPICH])
  366.     fi
  367.  fi
  368.  if test -n "$mpi_sgi"; then
  369.     AC_DEFINE(MPISGI,1,[Define if SGI MPI])
  370.  fi
  371.  if test -n "$mpi_lam"; then
  372.     AC_DEFINE(MPILAM,1,[Define if using LAM/MPI])
  373.  fi
  374. @@ -1274,16 +1294,24 @@
  375.  # package.  This is used only as part of the MPICH2 build, including 
  376.  # the documentation targets mandoc, htmldoc, and latexdoc
  377.  if test -z "$master_top_srcdir" ; then
  378.      if test "$FROM_MPICH2" = yes ; then
  379.          AC_MSG_WARN([Could not determine master_top_srcdir])
  380.      fi
  381.  fi
  382.  AC_SUBST(master_top_srcdir)
  383. +#
  384. +# Get the master builddir (which may be imported from above)
  385. +if test -z "$master_top_builddir" ; then
  386. +    master_top_builddir=`pwd`
  387. +fi
  388. +export master_top_builddir
  389. +AC_SUBST(master_top_builddir)
  390. +
  391.  # The following definitions are needed within adio/common/status_setb.c
  392.  if test "$FROM_MPICH" = yes ; then
  393.     AC_DEFINE(MPICH,1,[Define if compiling within MPICH])
  394.  elif test "$FROM_MPICH2" = yes ; then 
  395.     AC_DEFINE(MPICH2,1,[Define if compiling within MPICH2])
  396.  elif test "$FROM_MPILAM" = yes ; then
  397.     AC_DEFINE(MPILAM,1,[Define if compiling within LAM/MPI])
  398.  fi
  399. @@ -1309,21 +1337,27 @@
  400.      fi
  401.      fi
  402.  fi
  403.  if test "$FROM_MPICH2" != no ; then
  404.      # use the error handlers from MPICH2
  405.      MPIO_EXTRA_OBJECTS=
  406.      MPIO_EXTRA_TMP_POBJECTS=
  407.      MPIO_EXTRA_REAL_POBJECTS=
  408. +    # Use generalized request to get the multiple-completion routines
  409. +    MPIO_REQOBJECTS=
  410. +    MPIO_REQ_TMP_POBJECTS=
  411. +    MPIO_REQ_REAL_POBJECTS=
  412.  fi
  413.  AC_SUBST(MPIO_EXTRA_OBJECTS)
  414.  AC_SUBST(MPIO_EXTRA_TMP_POBJECTS)
  415.  AC_SUBST(MPIO_EXTRA_REAL_POBJECTS)
  416. -
  417. +AC_SUBST(MPIO_REQOBJECTS)
  418. +AC_SUBST(MPIO_REQ_TMP_POBJECTS)
  419. +AC_SUBST(MPIO_REQ_REAL_POBJECTS)
  420.  #
  421.  if test $NOF77 = 1 ; then
  422.     F77=":"
  423.  else
  424.     FORTRAN_TEST="fperf fcoll_test fmisc pfcoll_test" 
  425.  fi
  426.  #
  427.  if test $WITHIN_KNOWN_MPI_IMPL = no ; then
  428. @@ -1355,17 +1389,24 @@
  429.     TEST_LIBNAME=""
  430.     MPIRUN=$MPI_BIN_DIR/mpirun
  431.     if test -n "$arch_SX4" || test -n "$arch_hpux" ; then
  432.        TEST_F77=$MPI_BIN_DIR/mpif90
  433.     else
  434.        TEST_F77=$MPI_BIN_DIR/mpif77
  435.     fi
  436.     CC=$MPI_BIN_DIR/mpicc
  437. -   EXTRA_DIRS="mpi-io/fortran mpi2-other/info mpi2-other/info/fortran mpi2-other/array mpi2-other/array/fortran"
  438. +#   if test $FROM_MPICH2 != yes ; then
  439. +#       BUILD_MPI_ARRAY=1
  440. +#       BUILD_MPI_INFO=1
  441. +#   fi
  442. +   # A later test will insert the mpi2-other/info and array directories based
  443. +   # on the value of BUILD_MPI_xxxx.  This lets MPICH2 turn these off,
  444. +   # since MPICH2 provides these routines elsewhere
  445. +   EXTRA_DIRS="mpi-io/fortran"
  446.     # Some older implementations of the ADI do not include the 
  447.     # MPID_Status_set_bytes routine.   This uses either the 
  448.     # environment variable ADI3_WITHOUT_SET_BYTES or the
  449.     # with arg --without-setbytes
  450.     if test "$ADI2_WITHOUT_SET_BYTES" != yes -a \
  451.             "$with_setbytes" != no ; then
  452.         AC_DEFINE(HAVE_STATUS_SET_BYTES,1,[Define if have MPIR_Status_set_bytes])
  453.     fi
  454. @@ -1386,19 +1427,22 @@
  455.  elif test $FROM_MPICH2 = yes ; then
  456.     # For now, separate the mpich2 from mpich cases
  457.     MPICH_HOME=`dirname $ROMIO_HOME`
  458.     MPICH_HOME=`dirname $MPICH_HOME`
  459.     MPICH_HOME=`dirname $MPICH_HOME`
  460.     if test -z "$MPI_BIN_DIR" ; then MPI_BIN_DIR=$MPICH_HOME/bin ; fi
  461.     # No special compiler script.
  462.     # BUT we need the include paths
  463. -   CC="$CC -I${use_top_srcdir}/src/include -I${top_build_dir}/src/include"
  464. -   TEST_CC="$CC"
  465. -   MPI_LIB="$LIBNAME"
  466. +   # CC="$CC -I${use_top_srcdir}/src/include -I${top_build_dir}/src/include"
  467. +   # TEST_CC="$CC"
  468. +   # MPI_LIB="$LIBNAME"
  469. +   CC=${top_build_dir}/bin/mpicc
  470. +   TEST_CC=${top_build_dir}/bin/mpicc
  471. +   TEST_F77=${top_build_dir}/bin/mpif77
  472.     ROMIO_INCLUDE=""
  473.     USER_CFLAGS=""
  474.     USER_FFLAGS=""
  475.     TEST_LIBNAME=""
  476.     MPIRUN=$MPI_BIN_DIR/mpiexec
  477.     #
  478.     # Turn off the building of the Fortran interface and the Info routines
  479.     EXTRA_DIRS=""
  480. @@ -1446,18 +1490,24 @@
  481.  fi
  482.  AC_SUBST(EXTRA_SRC_DIRS)
  483.  AC_SUBST(FILE_SYS_DIRS)
  484.  
  485.  #
  486.  CFLAGS="$CFLAGS -DHAVE_ROMIOCONF_H"
  487.  #
  488.  
  489. +if test -n "$MPIOF_H_INCLUDED"; then
  490. +   F77MPIOINC=""
  491. +else 
  492. +   F77MPIOINC="include 'mpiof.h'"
  493. +fi
  494. +
  495.  AC_CHECK_HEADERS(unistd.h,
  496. -        AC_MSG_CHECKING(for large file defines)
  497. +        AC_MSG_CHECKING([for large file defines])
  498.          AC_TRY_COMPILE([
  499.                  #include <unistd.h>
  500.                  ], [
  501.                  #ifndef _LFS64_LARGEFILE
  502.                  #error no largefile defines
  503.                  #endif
  504.                  ],
  505.                  CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64"
  506. @@ -1494,16 +1544,17 @@
  507.  AC_SUBST(MAKE)
  508.  AC_SUBST(arch_IRIX)
  509.  AC_SUBST(ROMIO_HOME)
  510.  AC_SUBST(LIBNAME)
  511.  AC_SUBST(TEST_LIBNAME)
  512.  AC_SUBST(LL)
  513.  AC_SUBST(F77GETARG)
  514.  AC_SUBST(F77IARGC)
  515. +AC_SUBST(F77MPIOINC)
  516.  AC_SUBST(FTESTDEFINE)
  517.  AC_SUBST(FORTRAN_MPI_OFFSET)
  518.  AC_SUBST(FROM_MPICH)
  519.  AC_SUBST(FROM_MPICH2)
  520.  AC_SUBST(FROM_LAM)
  521.  AC_SUBST(WITHIN_KNOWN_MPI_IMPL)
  522.  AC_SUBST(NEEDS_MPI_FINT)
  523.  AC_SUBST(HAVE_MPI_INFO)
  524. @@ -1521,16 +1572,17 @@
  525.  AC_SUBST(MPI_FARRAY2)
  526.  AC_SUBST(MPI_FARRAY3)
  527.  AC_SUBST(MPI_FARRAY4)
  528.  AC_SUBST(MPI_FARRAY5)
  529.  AC_SUBST(MPI_FARRAY6)
  530.  AC_SUBST(MPI_FARRAY7)
  531.  AC_SUBST(MPI_OFFSET_KIND1)
  532.  AC_SUBST(MPI_OFFSET_KIND2)
  533. +AC_SUBST(MPIO_REQOBJECTS)
  534.  AC_SUBST(TEST_CC)
  535.  AC_SUBST(TEST_F77)
  536.  AC_SUBST(ROMIO_INCLUDE)
  537.  AC_SUBST(ROMIO_LFLAGS)
  538.  AC_SUBST(ROMIO_LIBLIST)
  539.  AC_SUBST(ROMIO_TCFLAGS)
  540.  AC_SUBST(ROMIO_TCPPFLAGS)
  541.  AC_SUBST(ROMIO_TFFLAGS)
  542. @@ -1541,16 +1593,17 @@
  543.  AC_SUBST(MAKE_DEPEND_C)
  544.  dnl
  545.  dnl Support shared libraries
  546.  if test -z "$ENABLE_SHLIB" ; then
  547.     ENABLE_SHLIB=none
  548.  fi
  549.  AC_SUBST(ENABLE_SHLIB)
  550.  AC_SUBST(CC_SHL)
  551. +AC_SUBST(LIBTOOL)
  552.  # Remove the .a from the library file name (so that we can use .so or
  553.  # other appropriate suffix)
  554.  SHLIBNAME=`echo $LIBNAME | sed 's/\.a//'`
  555.  AC_SUBST(SHLIBNAME)
  556.  dnl
  557.  if test ! -d adio ; then mkdir adio ; fi
  558.  if test ! -d adio/include ; then mkdir adio/include ; fi
  559.  if test ! -d mpi2-other ; then mkdir mpi2-other ; fi
  560. @@ -1584,23 +1637,13 @@
  561.  Please register your copy of ROMIO with us by sending email
  562.  to majordomo@mcs.anl.gov with the message
  563.  subscribe romio-users
  564.  This will enable us to notify you of new releases of ROMIO
  565.  as well as bug fixes.
  566.  
  567.  EOF
  568.  fi
  569. -if test $FROM_MPICH2 = yes -a "$NOF77" = 0 ; then
  570. -      sed 5d test/fcoll_test.f > test/tmp
  571. -      mv test/tmp test/fcoll_test.f
  572. -      sed 5d test/pfcoll_test.f > test/tmp
  573. -      mv test/tmp test/fcoll_test.f
  574. -      sed 5d test/fperf.f > test/tmp
  575. -      mv test/tmp test/fperf.f
  576. -      sed 5d test/fmisc.f > test/tmp
  577. -      mv test/tmp test/fmisc.f
  578. -fi
  579.  if test $FROM_MPICH = no -a $FROM_MPICH2 = no ; then
  580.     AC_MSG_RESULT([Configure done. Now type make])
  581.  fi
  582.  dnl PAC_SUBDIR_CACHE_CLEANUP
  583.  exit 0
  584. Index: romio/configure2.in
  585. ===================================================================
  586. RCS file: romio/configure2.in
  587. --- romio/configure2.in    8 Oct 2003 14:59:50 -0000    1.36
  588. +++ /dev/null    1 Jan 1970 00:00:00 -0000
  589. @@ -1,1471 +0,0 @@
  590. -# build with
  591. -# autoconf -output=configure2 --localdir=../confdb configure2.in
  592. -# (or wherever the confdb is)
  593. -# The following usage message is out-of-date
  594. -# It is retained only to remind us which options were defined.
  595. -
  596. -usage_msg="
  597. -Usage: ${progname} [-file_system=FILE_SYSTEM] [-arch=ARCH_TYPE] [-mpi=MPI_IMPL]
  598. -                [-mpilib=MPI_LIBRARY]
  599. -        [-mpibindir=MPI_BIN_DIR]
  600. -                [-cc=C_COMPILER] [-fc=FORTRAN_COMPILER] [-nof77] 
  601. -                [-cflags=CFLAGS] [-fflags=FFLAGS] [-f90=F90_COMPILER] [-debug] 
  602. -                [-mpiolib=MPIO_LIBRARY] [-ar_nolocal] 
  603. -                [-noranlib] [-ar=AR_COMMAND] [-prefix=INSTALL_DIR]  
  604. -                [-longlongsize=LONGLONGSIZE] [-disable-weak-symbols]
  605. -
  606. -where
  607. -   FILE_SYSTEM  = the file system(s) for which ROMIO is to be configured.
  608. -                  Valid values are pfs, piofs, hfs, xfs, sfs, pvfs, ufs,
  609. -                  and nfs (case-sensitive). They correspond to Intel's PFS, 
  610. -                  IBM's PIOFS, HP/Convex's HFS, SGI's XFS, NEC's SFS, 
  611. -                  Clemson University's PVFS (for Linux clusters), any Unix 
  612. -                  file system, and NFS. 
  613. -                  To configure for multiple file systems, use "+" as a 
  614. -                  separator; e.g., ufs+nfs
  615. -   ARCH_TYPE    = the type of machine for which ROMIO is to be configured.
  616. -                  Not needed on most machines, because ROMIO can usually
  617. -                  find the arch_type on its own. Needed if you are 
  618. -                  cross-compiling for a different architecture.
  619. -                  Valid values are sun4, solaris, solaris86, rs6000,
  620. -                  paragon, hpux, sppux, IRIX, IRIX32, IRIXN32, IRIX64, SX4, 
  621. -                  alpha, freebsd, LINUX, and LINUX_ALPHA.  (case-sensitive)
  622. -   MPI_IMPL     = the MPI implementation with which ROMIO will be used
  623. -                  Valid values are mpich, sgi, hp. (case-sensitive)
  624. -                  Valid implementations are MPICH 1.1.1 or higher,
  625. -                  SGI's MPI 3.1 or higher, HP MPI 1.3 or higher, LAM, 
  626. -                  and Cray MPI.
  627. -   MPI_INCLUDE_DIR = the full path of the directory where mpi.h is located.
  628. -                  Not needed if the directory is in the compiler's 
  629. -                  default include path
  630. -   MPI_LIBRARY  = name of the file containing the MPI library (full path).
  631. -                  Not needed if the library is in the compiler's default
  632. -                  list of libraries
  633. -   MPI_BIN_DIR  = the full path of the directory that contains the MPI
  634. -                  versions of the compilers, such as mpicc and mpif77.
  635. -                  Use only if the ROMIO configure cannot find the
  636. -                  necessary commands
  637. -   C_COMPILER   = the C compiler to use. If not specified, ROMIO uses a 
  638. -                  default compiler depending on the machine.
  639. -   FORTRAN_COMPILER = the Fortran compiler to use. If not specified, ROMIO 
  640. -                  uses a default compiler depending on the machine.
  641. -   CFLAGS       = flags to give to the C compiler
  642. -   FFLAGS       = flags to give to the Fortran compiler
  643. -   F90_COMPILER = the Fortran 90 compiler to use. If not specified, 
  644. -                  ROMIO uses f90.
  645. -   MPIO_LIBRARY = name of the MPI-IO library to be built (full path).
  646. -                  Default is "this_directory"/lib/ARCH_TYPE/libmpio.a.
  647. -   AR_COMMAND   = an alternate archiver (ar) command to use.
  648. -   INSTALL_DIR  = directory where ROMIO is to be installed
  649. -   LONGLONGSIZE = size of long long in bytes.
  650. -The option '-nof77' prevents the compilation of routines that require a
  651. -Fortran compiler.  If you select this option, you cannot use the
  652. -Fortran interface of MPI-IO.
  653. -
  654. -If '-debug' is used, ROMIO will be configured with the '-g' compiler option
  655. -for debugging.
  656. -
  657. -The option '-ar_nolocal' prevents the library archive command from
  658. -attempting to use the local directory for temporary space.  This option
  659. -should be used when (a) there isn't much space (less than 10 MB)
  660. -available in the partition where ROMIO resides and (b) there is enough
  661. -space in /tmp (or wherever ar places temporary files by default).
  662. -
  663. -The option '-noranlib' causes the 'ranlib' step (needed on some systems
  664. -to build an object library) to be skipped.  This is particularly useful
  665. -on systems where 'ranlib' is optional (allowed but not needed; because it
  666. -is allowed, configure chooses to use it just in case) but can fail (some
  667. -'ranlib's are implemented as scripts using 'ar'; if they don't use the
  668. -local directory, they can fail (destroying the library in the process) if
  669. -the temporary directory (usually '/tmp') does not have enough space.
  670. -
  671. -The option -disable-weak-symbols disables the use of weak symbols, even if 
  672. -available, for building the profiling interface.
  673. -"
  674. -#
  675. -AC_INIT(adio/include/romioconf.h.in)
  676. -echo " "
  677. -echo "Configuring ROMIO Version 1.2.6"
  678. -echo " "
  679. -CONFIGURE_ARGS="$*"
  680. -if test -n "$CONFIGURE_ARGS" ; then
  681. -    echo "Configuring with args $CONFIGURE_ARGS"
  682. -fi
  683. -
  684. -print_error() {
  685. -    echo "*# $*" 2>&1 ;
  686. -}
  687. -
  688. -AC_CONFIG_HEADER(adio/include/romioconf.h)
  689. -dnl
  690. -NOF77=0
  691. -ARCH=""
  692. -arch_IRIX=""
  693. -MPI=""
  694. -MPI_INCLUDE_DIR=""
  695. -ROMIO_INCLUDE=""
  696. -MPI_LIB=""
  697. -LIBNAME=""
  698. -TEST_LIBNAME=""
  699. -FILE_SYSTEM=""
  700. -DEBUG=no
  701. -MIPS=0
  702. -BITS=0
  703. -FROM_MPICH=${FROM_MPICH:-0}
  704. -FROM_MPICH2=${FROM_MPICH2:-0}
  705. -CFLAGS=${CFLAGS:-""}
  706. -LL="\%lld"
  707. -AR_LOCAL=l
  708. -HAVE_MPI_INFO=""
  709. -BUILD_MPI_INFO=""
  710. -MPI_FINFO1=""
  711. -MPI_FINFO2=""
  712. -MPI_FINFO3=""
  713. -MPI_FINFO4=""
  714. -MPI_FARRAY1=""
  715. -MPI_FARRAY2=""
  716. -MPI_FARRAY3=""
  717. -MPI_FARRAY4=""
  718. -MPI_FARRAY5=""
  719. -MPI_FARRAY6=""
  720. -MPI_FARRAY7=""
  721. -DEFS=""
  722. -ROMIO_LFLAGS=""
  723. -ROMIO_LIBLIST=""
  724. -ROMIO_TCFLAGS=""
  725. -ROMIO_TCPPFLAGS=""
  726. -ROMIO_TFFLAGS=""
  727. -NOPROFILE=0
  728. -MPIRUN=""
  729. -FORTRAN_TEST=""
  730. -MAKE=${MAKE:-"make"}
  731. -# foll. needed for f77 test programs
  732. -F77GETARG="call getarg(i,str)"
  733. -F77IARGC="iargc()"
  734. -F77MPIOINC=""
  735. -FTESTDEFINE=""
  736. -FORTRAN_MPI_OFFSET=""
  737. -MPIOF_H_INCLUDED=0
  738. -MPI_OFFSET_KIND1="!"
  739. -MPI_OFFSET_KIND2="!"
  740. -F90=""
  741. -TEST_CC=""
  742. -TEST_F77=""
  743. -TRY_WEAK_SYMBOLS=1
  744. -#
  745. -known_filesystems="nfs ufs pfs piofs pvfs pvfs2 testfs xfs hfs sfs"
  746. -known_mpi_impls="mpich_mpi sgi_mpi hp_mpi cray_mpi lam_mpi"
  747. -#
  748. -# Defaults
  749. -AC_ARG_ENABLE(aio,[
  750. ---enable-aio - Request use of asynchronous I/O routines],,enable_aio=notgiven)
  751. -AC_ARG_ENABLE(echo, 
  752. -[--enable-echo  - Turn on strong echoing. The default is enable=no.] ,set -x)
  753. -AC_ARG_ENABLE(f77,
  754. -[--enable-f77 - Turn on support for Fortran 77 (default)],,enable_f77=yes)
  755. -AC_ARG_WITH(file-system,[
  756. ---with-file-system=name - Build with support for the named file systems],,)
  757. -AC_ARG_WITH(mpi,[
  758. ---with-mpi=name - Specify MPI implementation to build ROMIO for],,)
  759. -dnl
  760. -if test "$enable_f77" != "yes" ; then
  761. -   NOF77=1
  762. -fi
  763. -MPI=$with_mpi
  764. -FILE_SYSTEM=$with_file_system
  765. -#
  766. -for arg
  767. -do
  768. -case $arg in
  769. -  -arch=* | --arch=*)
  770. -     ARCH=`echo $arg|sed 's/-*arch=//'`
  771. -     eval "arch_`echo $ARCH`=1"
  772. -     ;;
  773. -
  774. -  -debug | --debug | --enable-g | -enable-g)
  775. -     echo "Configuring for a debugging version"
  776. -     DEBUG=yes
  777. -     ;;
  778. -  -from_mpich | --from_mpich)
  779. -     FROM_MPICH=1
  780. -     ;;
  781. -
  782. -  -noprofile | --noprofile | --disable-profile | -disable-profile )
  783. -     echo "profiling interface will not be built"
  784. -     NOPROFILE=1
  785. -     ;;
  786. -
  787. -  -disable-weak-symbols|--disable-weak-symbols)
  788. -     TRY_WEAK_SYMBOLS=0
  789. -     ;;
  790. -esac
  791. -done
  792. -#
  793. -AC_CONFIG_AUX_DIR(../../../confdb)
  794. -dnl PAC_ARG_CACHING
  795. -
  796. -rm -f config.log
  797. -#
  798. -# Check that an arch was set
  799. -# If it wasn't set, try to guess using "util/tarch"
  800. -#
  801. -if test -z "$ARCH" -a -x $srcdir/util/tarch ; then
  802. -    AC_MSG_CHECKING(for architecture)
  803. -    ARCH=`$srcdir/util/tarch | sed s/-/_/g`
  804. -    if test -z "$ARCH" ; then
  805. -       AC_MSG_RESULT(Unknown!)
  806. -       AC_MSG_ERROR([Error: Couldn't guess target architecture, you must
  807. -set an architecture type with -arch=<value>])
  808. -    fi
  809. -    eval "arch_$ARCH=1"
  810. -    AC_MSG_RESULT($ARCH)
  811. -fi
  812. -#
  813. -# check for valid architecture.  Use __ so that _ALPHA_ does not match
  814. -# LINUX_ALPHA_
  815. -#### WE SHOULD REMOVE THIS SOON
  816. -grep __"$ARCH"_ $srcdir/.config_params > /dev/null 2>&1
  817. -if test $? != 0 ; then
  818. -   AC_MSG_WARN([Unknown architecture $arch... proceeding anyway])
  819. -fi
  820. -#
  821. -#
  822. -#
  823. -# Find the home directory if not specified
  824. -if test "X$srcdir" != "X." -a -s $srcdir/mpi-io/Makefile.in ; then 
  825. -    ROMIO_HOME_TRIAL=$srcdir
  826. -else
  827. -    # Take advantage of autoconf2 features
  828. -    ROMIO_HOME_TRIAL=$ac_srcdir
  829. -    dnl PAC_GETWD(ROMIO_HOME_TRIAL,mpi-io/Makefile.in)
  830. -fi
  831. -echo "ROMIO home directory is $ROMIO_HOME_TRIAL"
  832. -ROMIO_HOME=$ROMIO_HOME_TRIAL
  833. -#
  834. -# Create the "autoconf" style directory names...
  835. -#
  836. -# mandir is the root for the man pages
  837. -if test -z "$mandir" ; then mandir='${prefix}/man' ; fi
  838. -AC_SUBST(mandir)
  839. -if test -z "$docdir" ; then docdir='${prefix}/doc' ; fi
  840. -AC_SUBST(docdir)
  841. -if test -z "$htmldir" ; then htmldir='${prefix}/www' ; fi
  842. -AC_SUBST(htmldir) 
  843. -#
  844. -# check for valid file system
  845. -if test -n "$FILE_SYSTEM" ; then
  846. -   # if multiple filesystems are passed in, they are '+'-delimited
  847. -   # we could set the IFS to tokenize FILE_SYSTEM, but the FILE_SYSTEM env var
  848. -   # is used in multiple places in the build system: get rid of the '+'s so we
  849. -   # can use the 'for x in $FILE_SYSTEM ...' idiom 
  850. -   FILE_SYSTEM=`echo $FILE_SYSTEM|sed -e 's/\+/ /g'`
  851. -   for x in $FILE_SYSTEM
  852. -   do
  853. -      found=no
  854. -      # We could also do test -d "ad_$y" to test for known file systems
  855. -      # based on having access to the adio code.  Then adding a file 
  856. -      # system would not require changing configure to change known_filesystems
  857. -      for y in $known_filesystems ; do 
  858. -          if test $x = $y ; then
  859. -          found=yes
  860. -          eval "file_system_`echo $x`=1"
  861. -          break
  862. -      fi
  863. -      done
  864. -      if test "$found" = "no" ; then
  865. -         AC_MSG_WARN([Unknown file system $x... proceeding anyway])
  866. -      fi
  867. -   done
  868. -fi
  869. -#
  870. -# check for valid MPI implementation
  871. -if test -n "$MPI" ; then
  872. -   found=no
  873. -   for mpi in $known_mpi_impls ; do
  874. -      if test "${MPI}_mpi" = "$mpi" ; then
  875. -          found=yes
  876. -      break
  877. -      fi
  878. -   done
  879. -   if test $found = no ; then
  880. -      AC_MSG_WARN([Unknown MPI implementation $MPI... proceeding anyway])
  881. -   fi
  882. -fi
  883. -#
  884. -# check for valid MPI include directory if specified
  885. -if test $FROM_MPICH = 0 -a $FROM_MPICH2 = 0 ; then
  886. -   if test -n "$MPI_INCLUDE_DIR"; then
  887. -      if test ! -f "$MPI_INCLUDE_DIR/mpi.h" ; then
  888. -         AC_MSG_ERROR([Include file $MPI_INCLUDE_DIR/mpi.h not found])
  889. -      fi
  890. -   else
  891. -#     assume that mpi.h is in the default path
  892. -#     set MPI_INCLUDE_DIR to ".", so that it translates to -I. in the
  893. -#     compile command. Some compilers complain if it's only -I
  894. -      MPI_INCLUDE_DIR=.
  895. -   fi
  896. -else 
  897. -   MPI_INCLUDE_DIR=.
  898. -fi
  899. -#
  900. -# check for valid MPI library if specified
  901. -if test $FROM_MPICH = 0 -a $FROM_MPICH2 = 0 ; then
  902. -   if test -n "$MPI_LIB" ; then
  903. -      if test ! -f "$MPI_LIB" ; then
  904. -         AC_MSG_ERROR([MPI library $MPI_LIB not found])
  905. -      fi
  906. -   fi
  907. -fi
  908. -#
  909. -#
  910. -AR="${AR:-ar} cr$AR_LOCAL"
  911. -if test -z "$RANLIB" ; then
  912. -    AC_PROG_RANLIB
  913. -fi
  914. -MAKE=${MAKE:-make}
  915. -#
  916. -# USER_CFLAGS and USER_FFLAGS are used only in test/Makefile.in
  917. -if test $DEBUG = "yes"; then
  918. -    USER_CFLAGS="$CFLAGS -g"
  919. -    USER_FFLAGS="$FFLAGS -g"
  920. -else
  921. -    USER_CFLAGS="$CFLAGS -O"
  922. -    USER_FFLAGS="$FFLAGS -O"
  923. -fi
  924. -#
  925. -if test -n "$arch_sun4" ; then 
  926. -    CC=${CC:-gcc}
  927. -    F77=${FC:-f77}
  928. -    if test $DEBUG = "yes"; then
  929. -    if test "$CC" = "gcc"; then
  930. -           CFLAGS="$CFLAGS -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes"
  931. -    else
  932. -           CFLAGS="$CFLAGS -g"
  933. -        fi
  934. -    else 
  935. -        CFLAGS="$CFLAGS -O"
  936. -    fi
  937. -    if test "$enable_aio" != "no" ; then
  938. -        # Check for aio
  939. -    AC_SEARCH_LIBS(aiowrite,aio rt)
  940. -    if test "$ac_cv_search_aiowrite" = "no" ; then
  941. -        enable_aio=no
  942. -    elif test "$ac_cv_search_aiowrite" != "none required" ; then
  943. -        ROMIO_LIBLIST="$ROMIO_LIBLIST $ac_cv_search_aiowrite"
  944. -        fi
  945. -    fi
  946. -    if test "$enable_aio" = "no" ; then
  947. -        AC_DEFINE(NO_AIO,,[Define if AIO should not be used])
  948. -    else 
  949. -        AC_DEFINE(AIO_SUN,,[Define for SUN0S 4])
  950. -    fi
  951. -
  952. -    if test -z "$MPI" ; then
  953. -        MPI=mpich
  954. -        mpi_mpich=1
  955. -    fi
  956. -    if test -z "$FILE_SYSTEM" ; then
  957. -        file_system_ufs=1
  958. -        file_system_nfs=1
  959. -        FILE_SYSTEM="ufs nfs"
  960. -        AC_MSG_RESULT([configuring for file systems ufs and nfs])
  961. -    fi
  962. -fi
  963. -#
  964. -if test -n "$arch_solaris" || test -n "$arch_solaris86" ; then
  965. -    CC=${CC:-cc}
  966. -    F77=${FC:-f77}
  967. -    if test $DEBUG = "yes"; then
  968. -        if test "$CC" = "gcc" ; then
  969. -            CFLAGS="$CFLAGS -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes"
  970. -        else 
  971. -            CFLAGS="$CFLAGS -g -v"
  972. -        fi
  973. -    else 
  974. -        CFLAGS="$CFLAGS -O"
  975. -    fi
  976. -    if test "$enable_aio" != "no" ; then
  977. -        # Check for aio
  978. -    AC_SEARCH_LIBS(aiowrite,aio rt)
  979. -    if test "$ac_cv_search_aiowrite" = "no" ; then
  980. -        enable_aio=no
  981. -    elif test "$ac_cv_search_aiowrite" != "none required" ; then
  982. -        ROMIO_LIBLIST="$ROMIO_LIBLIST $ac_cv_search_aiowrite"
  983. -        MPI_LIB="$MPI_LIB -laio"
  984. -        fi
  985. -    fi
  986. -    if test "$enable_aio" = "no" ; then
  987. -        AC_DEFINE(NO_AIO,,[Define if AIO should not be used])
  988. -    else 
  989. -        AC_DEFINE(AIO_SUN,,[Define for SUN0S 4])
  990. -    fi
  991. -
  992. -    if test -z "$MPI" ; then
  993. -        MPI=mpich
  994. -        mpi_mpich=1
  995. -    fi
  996. -    if test -z "$FILE_SYSTEM" ; then
  997. -        file_system_ufs=1
  998. -        file_system_nfs=1
  999. -        FILE_SYSTEM="ufs nfs"
  1000. -        AC_MSG_RESULT([configuring for file systems ufs and nfs])
  1001. -    fi
  1002. -    AC_DEFINE(SOLARIS,,[Define for Solaris])
  1003. -    if test $MPI = "mpich" ; then
  1004. -        TEST_CC=mpicc
  1005. -        TEST_F77=mpif77
  1006. -    else
  1007. -        TEST_CC="$CC"
  1008. -        TEST_F77="$F77"
  1009. -    fi
  1010. -    AR="ar cr"
  1011. -# solaris does not have l option to ar
  1012. -# solaris f90 does not have 8-byte integer type
  1013. -# (it does now!!!! 11/29/01)
  1014. -fi
  1015. -#
  1016. -if test -n "$arch_rs6000"; then
  1017. -    F77=$FC
  1018. -    if test -z "$CC"; then
  1019. -       AC_PROGRAMS_CHECK(CC, mpcc, cc)
  1020. -       echo "Using $CC"
  1021. -    fi
  1022. -    if test $NOF77 = 0 && test -z "$FC"; then 
  1023. -       AC_PROGRAMS_CHECK(F77, mpxlf, f77)
  1024. -       echo "Using $F77"
  1025. -    fi
  1026. -    if test $DEBUG = "yes"; then
  1027. -        CFLAGS="$CFLAGS -g"
  1028. -    else 
  1029. -        CFLAGS="$CFLAGS -O"
  1030. -    fi
  1031. -    # Check that aio is available (many systems appear to have aio
  1032. -    # either installed improperly or turned off).
  1033. -    # The test is the following: if not cross compiling, try to run a 
  1034. -    # program that includes a *reference* to aio_write but does not call it
  1035. -    # If the libraries are not set up correctly, then this will fail.
  1036. -    AC_MSG_CHECKING([whether aio routines can be used])
  1037. -    AC_TRY_RUN([
  1038. -int main( int argc, char **argv )
  1039. -{
  1040. -    if (argc > 10) aio_write();
  1041. -    return 0;
  1042. -}
  1043. -],aio_runs=yes,aio_runs=no,aio_runs=unknown)
  1044. -    AC_MSG_RESULT($aio_runs)                         
  1045. -    if test "$enable_aio" != "no" -a "$aio_runs" = "no" ; then
  1046. -        enable_aio=no
  1047. -    fi
  1048. -    if test "$enable_aio" = "no" ; then
  1049. -        AC_DEFINE(NO_AIO,,[Define if AIO should not be used])
  1050. -    else
  1051. -        AC_DEFINE(NO_FD_IN_AIOCB,,[Define for no fd in the aiocb])
  1052. -        AC_DEFINE(AIO_HANDLE_IN_AIOCB,,[Define for aio handle in aiocb])
  1053. -    fi
  1054. -    if test -z "$MPI" ; then
  1055. -        MPI=mpich
  1056. -        mpi_mpich=1
  1057. -    fi
  1058. -    if test -z "$FILE_SYSTEM" ; then
  1059. -        if test "$CC" = "mpcc" || test "$CC" = "mpCC" ; then
  1060. -            file_system_piofs=1
  1061. -            FILE_SYSTEM="piofs"
  1062. -            AC_MSG_RESULT([configuring for file systems piofs, ufs, and nfs])
  1063. -        else 
  1064. -            AC_MSG_RESULT([configuring for file systems ufs and nfs])
  1065. -        fi
  1066. -        file_system_ufs=1
  1067. -        file_system_nfs=1
  1068. -        FILE_SYSTEM="$FILE_SYSTEM ufs nfs"
  1069. -    fi
  1070. -    AC_DEFINE(AIX,,[Define for AIX])
  1071. -# assume long long exists.
  1072. -    longlongsize=${longlongsize:-8} 
  1073. -    MPI_OFFSET_KIND1="      INTEGER MPI_OFFSET_KIND"
  1074. -    MPI_OFFSET_KIND2="      PARAMETER (MPI_OFFSET_KIND=8)"
  1075. -fi    
  1076. -#
  1077. -if test -n "$arch_paragon"; then
  1078. -    CC=${CC:-icc}
  1079. -    F77=${FC:-if77}
  1080. -    if test $DEBUG = "yes"; then
  1081. -        CFLAGS="$CFLAGS -g"
  1082. -    else 
  1083. -    if test "$CC" = "icc"; then
  1084. -           CFLAGS="$CFLAGS -Knoieee -Mvect -O3"
  1085. -    else
  1086. -           CFLAGS="$CFLAGS -O"
  1087. -        fi
  1088. -    fi
  1089. -    AR="ar860 cr$AR_LOCAL"
  1090. -    MPI_LIB="$MPI_LIB -nx"
  1091. -    if test -z "$MPI" ; then
  1092. -        MPI=mpich
  1093. -        mpi_mpich=1
  1094. -    fi
  1095. -    if test -z "$FILE_SYSTEM" ; then
  1096. -        file_system_pfs=1
  1097. -        file_system_ufs=1
  1098. -        file_system_nfs=1
  1099. -        FILE_SYSTEM="pfs ufs nfs"
  1100. -        AC_MSG_RESULT([configuring for file systems pfs, ufs, and nfs])
  1101. -    fi
  1102. -    AC_DEFINE(PARAGON,,[Define for Intel Paragon])
  1103. -    AC_DEFINE(NO_AIO,,[Define if AIO should not be used])
  1104. -# NO_AIO is if configuring for NFS/UFS. It doesn't affect PFS asynch. I/O.
  1105. -# long long does not exist
  1106. -    longlongsize=${longlongsize:-0} 
  1107. -fi    
  1108. -#
  1109. -if test -n "$arch_tflop" || test -n "$arch_tflops"; then
  1110. -    CC=${CC:-pgcc}
  1111. -    F77=${FC:-pgf77}
  1112. -    TFLOP_FLAGS="-cougar -D__PUMA"
  1113. -    AC_DEFINE(NO_AIO,,[Define if AIO should not be used])
  1114. -    if test $DEBUG = "yes"; then
  1115. -        CFLAGS="$CFLAGS -g $TFLOP_FLAGS"
  1116. -    else
  1117. -       if test "$CC" = "pgcc"; then
  1118. -           CFLAGS="$CFLAGS -Knoieee -Mvect -O3 $TFLOP_FLAGS"
  1119. -       else
  1120. -           CFLAGS="$CFLAGS -O $TFLOP_FLAGS"
  1121. -       fi
  1122. -    fi
  1123. -    AR="xar cr$AR_LOCAL"
  1124. -        RANLIB="xranlib"
  1125. -    MPI_LIB="$MPI_LIB"
  1126. -    if test -z "$MPI" ; then
  1127. -        MPI=mpich
  1128. -        mpi_mpich=1
  1129. -    fi
  1130. -    if test -z "$FILE_SYSTEM" ; then
  1131. -        file_system_ufs=1
  1132. -        FILE_SYSTEM="ufs"
  1133. -        AC_MSG_RESULT([configuring for file system ufs])
  1134. -    fi
  1135. -fi
  1136. -#
  1137. -if test -n "$arch_freebsd" || test -n "$arch_LINUX" || test -n "$arch_LINUX_ALPHA" || test -n "$arch_netbsd" || test -n "$arch_openbsd" ; then
  1138. -    CC=${CC:-gcc}
  1139. -    if test -n "$arch_freebsd" || test -n "$arch_netbsd" || test -n "$arch_openbsd"; then
  1140. -       F77=${FC:-f77}
  1141. -       AC_DEFINE(FREEBSD,,[Define for FreeBSD])
  1142. -       PAC_HAVE_MOUNT_NFS
  1143. -       longlongsize=${longlongsize:-0}
  1144. -# printf doesn't work properly and no integer*8 as far as I can tell
  1145. -    else 
  1146. -       F77=${FC:-g77}
  1147. -       AC_DEFINE(LINUX,,[Define for Linux])
  1148. -    fi
  1149. -    if test $DEBUG = "yes" ; then
  1150. -    if test "$CC" = "gcc" ; then
  1151. -            CFLAGS="$CFLAGS -g -O -Wall -Wstrict-prototypes -Wmissing-prototypes"
  1152. -        else
  1153. -        CFLAGS="$CFLAGS -g"
  1154. -        fi
  1155. -    else 
  1156. -        CFLAGS="$CFLAGS -O"
  1157. -    fi
  1158. -    if test "$enable_aio" != "yes" ; then
  1159. -        AC_DEFINE(NO_AIO,,[Define if AIO should not be used])
  1160. -    else
  1161. -        # Try to find the aio routines
  1162. -    use_aio=no
  1163. -        AC_HEADER_CHECK(aio.h,has_aio_h=yes,has_aio_h=no)
  1164. -    add_lib=""
  1165. -    AC_SEARCH_LIBS(aio_write,aio,add_lib="-laio")
  1166. -    # What function do we want -lrt for?  In recent Linux, aio_write64
  1167. -    # is here, as is lio_listio
  1168. -    AC_SEARCH_LIBS(aio_write64,rt,add_lib="$add_lib -lrt")
  1169. -    AC_SEARCH_LIBS(pthread_create,pthread,[add_lib="$add_lib -lpthread"
  1170. -has_pthread=yes],[has_pthread=no])
  1171. -        AC_FUNC_CHECK(aio_write,has_aio_write=yes,has_aio_write=no)
  1172. -    if test "$has_aio_h" = "yes" -a "$has_aio_write" = "yes" -a \
  1173. -            "$has_pthread" = "yes" ; then
  1174. -        use_aio=yes    
  1175. -    fi    
  1176. -    # Check for aiocb_t as a shorthand for struct aiocb
  1177. -    AC_MSG_CHECKING([for aiocb_t])
  1178. -    AC_TRY_COMPILE([#include <aio.h>],
  1179. -[aiocb_t a;],has_aiocb_t=yes,has_aiocb_t=no)
  1180. -    AC_MSG_RESULT($has_aiocb_t)
  1181. -    if test "$has_aiocb_t" = "no" ; then 
  1182. -        AC_DEFINE(NEEDS_AIOCB_T,,[Define for aiocb_t definition needed])
  1183. -        fi
  1184. -    if test "$use_aio" = "yes" ; then
  1185. -        ROMIO_LIBLIST="$ROMIO_LIBLIST $add_lib"
  1186. -    else
  1187. -            AC_DEFINE(NO_AIO,,[Define if AIO should not be used])
  1188. -    fi
  1189. -    fi
  1190. -    if test -z "$MPI" ; then
  1191. -        MPI=mpich
  1192. -        mpi_mpich=1
  1193. -    fi
  1194. -    if test -z "$FILE_SYSTEM" ; then
  1195. -        file_system_ufs=1
  1196. -        file_system_nfs=1
  1197. -        FILE_SYSTEM="ufs nfs"
  1198. -        AC_MSG_RESULT([configuring for file systems ufs and nfs])
  1199. -    fi
  1200. -fi    
  1201. -#
  1202. -if test -n "$arch_SX4" ; then
  1203. -    CC=${CC:-mpicc}
  1204. -    F77=${FC:-mpif90}
  1205. -    if test $DEBUG = "yes" ; then
  1206. -        CFLAGS="$CFLAGS -g"
  1207. -        FFLAGS="$FFLAGS -g"
  1208. -    else
  1209. -        USER_FFLAGS="$FFLAGS -Chopt"
  1210. -        CFLAGS="$CFLAGS -O"
  1211. -        FFLAGS="$FFLAGS -Chopt"
  1212. -    fi
  1213. -    AC_DEFINE(NO_AIO,,[Define if AIO should not be used])
  1214. -    AC_DEFINE(SX4,,[Define for NEC SX4])
  1215. -    if test -z "$MPI" ; then
  1216. -        MPI=mpich
  1217. -        mpi_mpich=1
  1218. -    fi
  1219. -    if test -z "$FILE_SYSTEM" ; then
  1220. -        file_system_sfs=1
  1221. -        file_system_nfs=1
  1222. -        FILE_SYSTEM="sfs nfs"
  1223. -        AC_MSG_RESULT([configuring for file systems sfs and nfs])
  1224. -    fi
  1225. -    MPI_OFFSET_KIND1="      INTEGER MPI_OFFSET_KIND"
  1226. -    MPI_OFFSET_KIND2="      PARAMETER (MPI_OFFSET_KIND=8)"
  1227. -fi
  1228. -#
  1229. -if test -n "$arch_hpux" || test -n "$arch_sppux" ; then
  1230. -    if test $DEBUG = "yes"; then
  1231. -        CFLAGS="$CFLAGS -g +w1"
  1232. -    else 
  1233. -        CFLAGS="$CFLAGS -O"
  1234. -    fi
  1235. -    AC_DEFINE(NO_AIO,,[Define if AIO should not be used])
  1236. -    RANLIB=":"
  1237. -    if test -z "$MPI"; then
  1238. -        if test -f "/opt/mpi/include/mpi.h" ; then
  1239. -            echo "assuming that you want to use ROMIO with HP MPI"
  1240. -            MPI=hp
  1241. -        else 
  1242. -            echo "assuming that you want to use ROMIO with MPICH"
  1243. -            MPI=mpich
  1244. -        fi            
  1245. -    fi
  1246. -    if test $MPI = "mpich" ; then
  1247. -        mpi_mpich=1
  1248. -        MPI_LIB="$MPI_LIB -lV3"
  1249. -        CC=${CC:-cc -Ae}
  1250. -        F77=${FC:-f77 +U77}
  1251. -    fi
  1252. -    if test $MPI = "hp" ; then
  1253. -        mpi_hp=1
  1254. -        CC=${CC:-mpicc -Ae}
  1255. -        F77=${FC:-mpif77 +U77}
  1256. -    fi
  1257. -    if test $MPI = "lam" && test "$FC" != ""; then
  1258. -        FC="$FC +U77"
  1259. -    fi
  1260. -    FTESTDEFINE="external iargc, getarg"
  1261. -    if test -n "$arch_hpux" ; then
  1262. -        CFLAGS="$CFLAGS -D_LARGEFILE64_SOURCE"
  1263. -        AC_DEFINE(HPUX,,[Define for HPUX])
  1264. -        if test $MPI = "hp" ; then
  1265. -           F77=${FC:-mpif90 +U77}
  1266. -        else
  1267. -           F77=${FC:-f90 +U77}
  1268. -        fi
  1269. -    else
  1270. -        AC_DEFINE(SPPUX,,[Define for SPPUX (Convex)])
  1271. -    fi
  1272. -    if test -z "$FILE_SYSTEM" ; then
  1273. -        if test -n "$arch_hpux" ; then
  1274. -       AC_MSG_CHECKING([for struct flock64])
  1275. -           AC_TRY_COMPILE([#include <fcntl.h>],[
  1276. -struct flock64 fl; int i=F_SETLKW64;],flock64_ok="yes",flock64_ok="no")
  1277. -           AC_MSG_RESULT($flock64_ok)
  1278. -        else
  1279. -            flock64_ok="yes"
  1280. -        fi
  1281. -        if test $flock64_ok = "yes" ; then
  1282. -            file_system_hfs=1
  1283. -            file_system_nfs=1
  1284. -            FILE_SYSTEM="hfs nfs"
  1285. -            AC_MSG_RESULT([configuring for file systems hfs and nfs])
  1286. -        else
  1287. -            file_system_ufs=1
  1288. -            file_system_nfs=1
  1289. -            FILE_SYSTEM="ufs nfs"
  1290. -            AC_MSG_RESULT([no flock64; configuring for file systems ufs and nfs])
  1291. -        fi
  1292. -    fi
  1293. -    MPI_OFFSET_KIND1="      INTEGER MPI_OFFSET_KIND"
  1294. -    MPI_OFFSET_KIND2="      PARAMETER (MPI_OFFSET_KIND=8)"
  1295. -    if test "$CC" != "gcc" ; then
  1296. -        ROMIO_TCFLAGS="-Ae"
  1297. -    fi
  1298. -    if test "$F77" != "g77" ; then
  1299. -        ROMIO_TFFLAGS="+U77"
  1300. -    fi
  1301. -fi
  1302. -#
  1303. -if test -n "$arch_alpha" || test -n "$arch_ALPHA" ; then
  1304. -    CC=${CC:-cc}
  1305. -    F77=${FC:-f77}
  1306. -    if test $DEBUG = "yes"; then
  1307. -        CFLAGS="$CFLAGS -g -std1 -warnprotos -verbose"
  1308. -    else 
  1309. -        CFLAGS="$CFLAGS -O"
  1310. -    fi
  1311. -    AC_DEFINE(AIO_PRIORITY_DEFAULT,,[Define for AIO priority is default])
  1312. -    if test -z "$MPI" ; then
  1313. -        MPI=mpich
  1314. -        mpi_mpich=1
  1315. -    fi
  1316. -    if test -z "$FILE_SYSTEM" ; then
  1317. -        file_system_ufs=1
  1318. -        file_system_nfs=1
  1319. -        FILE_SYSTEM="ufs nfs"
  1320. -        AC_MSG_RESULT([configuring for file systems ufs and nfs])
  1321. -    fi
  1322. -    AC_DEFINE(DEC,,[Define for DEC/Compaq/HP Alpha])
  1323. -    MPI_OFFSET_KIND1="      INTEGER MPI_OFFSET_KIND"
  1324. -    MPI_OFFSET_KIND2="      PARAMETER (MPI_OFFSET_KIND=8)"
  1325. -    ROMIO_LIBLIST="$ROMIO_LIBLIST -laio"
  1326. -fi    
  1327. -#
  1328. -if test -n "$arch_CRAY" ; then
  1329. -    CC=${CC:-cc}
  1330. -    F77=${FC:-f90}
  1331. -    NOF77=1
  1332. -    FTESTDEFINE="integer ilen"
  1333. -    F77GETARG="call pxfgetarg(i, str, ilen, ierr)"
  1334. -    if test $DEBUG = "yes"; then
  1335. -        CFLAGS="$CFLAGS -g"
  1336. -    else 
  1337. -        CFLAGS="$CFLAGS -O"
  1338. -    fi
  1339. -    AC_DEFINE(NO_AIO,,[Define if AIO should not be used])
  1340. -    RANLIB=":"
  1341. -    CFLAGS="$CFLAGS -D_UNICOS"
  1342. -    AC_DEFINE(CRAY,,[Define if Cray])
  1343. -    if test -z "$MPI" || test -n "$mpi_sgi" ; then
  1344. -        MPI=cray
  1345. -        mpi_cray=1
  1346. -        mpi_sgi=""
  1347. -# above is to disable configure tests specific to SGI MPI
  1348. -        AC_DEFINE(MPISGI,,[Define if SGI MPI])
  1349. -        AC_DEFINE(HAVE_MPI_COMBINERS,,[Define if MPI supports datatype combiners])
  1350. -        AC_DEFINE(NO_MPI_SGI_type_is_contig,,[Define if no types show contig])
  1351. -    fi
  1352. -#       MPISGI needed because of error in Cray's and SGI's 
  1353. -#       MPI_Type_get_contents (does not increment reference count).
  1354. -#       Others needed because MPISGI needed.
  1355. -    if test -z "$FILE_SYSTEM" ; then
  1356. -        file_system_ufs=1
  1357. -        file_system_nfs=1
  1358. -        FILE_SYSTEM="ufs nfs"
  1359. -        AC_MSG_RESULT([configuring for file systems ufs and nfs])
  1360. -    fi
  1361. -    MPI_OFFSET_KIND1="      INTEGER MPI_OFFSET_KIND"
  1362. -    MPI_OFFSET_KIND2="      PARAMETER (MPI_OFFSET_KIND=8)"
  1363. -fi
  1364. -#
  1365. -if test -n "$arch_sgi" ; then
  1366. -    arch_IRIX=1
  1367. -    ARCH=IRIX
  1368. -fi
  1369. -if test -n "$arch_IRIX64" ; then
  1370. -    arch_IRIX=1
  1371. -fi
  1372. -if test -n "$arch_IRIX32" ; then
  1373. -    arch_IRIX=1
  1374. -fi
  1375. -if test -n "$arch_IRIXN32" ; then
  1376. -    arch_IRIX=1
  1377. -fi
  1378. -if test -n "$arch_sgi5" ; then
  1379. -    arch_IRIX5=1
  1380. -    ARCH=IRIX
  1381. -fi
  1382. -#
  1383. -PAC_GET_SPECIAL_SYSTEM_INFO
  1384. -#
  1385. -# special case 'sgi5' for use on MESHINE which is much like an SGI running
  1386. -# irix 5 with r4400 chips, but does not have 'hinv', so above code doesn't
  1387. -# work
  1388. -if test -n "$arch_sgi5"; then
  1389. -   osversion=5
  1390. -   cputype=4400
  1391. -   IRIXARCH="$ARCH_$osversion"
  1392. -   IRIXARCH="$IRIXARCH_$cputype"
  1393. -# now set arch_IRIX to 1
  1394. -   arch_IRIX=1
  1395. -   echo "IRIX-specific architecture is $IRIXARCH"
  1396. -   AC_DEFINE(IRIX,,[Define if IRIX])
  1397. -fi
  1398. -#
  1399. -if test -n "$arch_IRIX"; then
  1400. -    CC=${CC:-cc}
  1401. -    F77=${FC:-f77}
  1402. -    if test $DEBUG = "yes"; then
  1403. -        CFLAGS="$CFLAGS -g -fullwarn"
  1404. -    else 
  1405. -        CFLAGS="$CFLAGS -O"
  1406. -    fi
  1407. -   if test $osversion = 4 ; then
  1408. -    RANLIB="ar ts"
  1409. -        if test -n "$mpi_sgi"; then
  1410. -            AC_MSG_ERROR([SGI\'s MPI does not work with IRIX 4.x])
  1411. -        fi
  1412. -   elif test $osversion = 5 ; then
  1413. -        if test -n "$mpi_sgi"; then
  1414. -            AC_MSG_ERROR([SGI\'s MPI does not work with IRIX 5.x])
  1415. -        fi
  1416. -   elif test $osversion = 6 ; then
  1417. -    if test -z "$MPI"; then
  1418. -        if test "$FROM_MPICH2" = "1" ; then
  1419. -            # Building with MPICH2.  Distinguish from MPICH-1
  1420. -        MPI=mpich2
  1421. -        mpi_mpich2=1
  1422. -            elif test -f "/usr/include/mpi.h" ; then
  1423. -                AC_MSG_WARN([assuming that you want to use ROMIO with SGI\'s MPI])
  1424. -                MPI=sgi
  1425. -                mpi_sgi=1
  1426. -            else 
  1427. -            AC_MSG_WARN([assuming that you want to use ROMIO with MPICH])
  1428. -                MPI=mpich
  1429. -                mpi_mpich=1
  1430. -            fi            
  1431. -    fi
  1432. -        RANLIB=":"
  1433. -        AC_DEFINE(AIO_SIGNOTIFY_NONE,,[Define if no signotify])
  1434. -    if test $cputype -ge 5000 ; then
  1435. -            MIPS=4
  1436. -        else 
  1437. -            MIPS=3
  1438. -        fi
  1439. -   fi
  1440. -   if test -n "$mpi_sgi" && test -z "$MPI_LIB" ; then
  1441. -       MPI_LIB="-lmpi"
  1442. -   fi
  1443. -#  check if pread64 is defined
  1444. -   PAC_HAVE_PREAD64
  1445. -#
  1446. -   if test -z "$FILE_SYSTEM" ; then
  1447. -       file_system_nfs=1
  1448. -       FILE_SYSTEM="nfs"
  1449. -       AC_MSG_CHECKING(for xfs)
  1450. -       AC_TRY_COMPILE([
  1451. -#include <aio.h>],
  1452. -[aiocb64_t *t1;],file_system_xfs=1;FILE_SYSTEM="xfs $FILE_SYSTEM";)
  1453. -       if test "$file_system_xfs" = 1 ; then 
  1454. -          AC_MSG_RESULT(yes)
  1455. -       else
  1456. -          AC_MSG_RESULT(no)
  1457. -          file_system_ufs=1
  1458. -          FILE_SYSTEM="ufs $FILE_SYSTEM"
  1459. -       fi
  1460. -       AC_MSG_RESULT([configuring for file systems $FILE_SYSTEM])
  1461. -   fi
  1462. -   AC_DEFINE(IRIX,,[Define if IRIX])
  1463. -   MPI_OFFSET_KIND1="      INTEGER MPI_OFFSET_KIND"
  1464. -   MPI_OFFSET_KIND2="      PARAMETER (MPI_OFFSET_KIND=8)"
  1465. -fi
  1466. -
  1467. -#
  1468. -# If we haven't found an architecture, try for a default
  1469. -if test -z "$CC" ; then
  1470. -    AC_PROG_CC
  1471. -    AC_PROG_F77
  1472. -    if test -z "$FILE_SYSTEM" ; then
  1473. -        FILE_SYSTEM="ufs"
  1474. -    fi
  1475. -    AC_DEFINE(NO_AIO,,[Define if AIO should not be used])
  1476. -fi
  1477. -
  1478. -AC_HAVE_FUNCS(memalign)
  1479. -
  1480. -if test $NOF77 = 0 ; then
  1481. -    echo "checking Fortran external names"
  1482. -    PAC_GET_FORTNAMES
  1483. -    if test -n "$WDEF" ; then
  1484. -        CFLAGS="$CFLAGS $WDEF"
  1485. -    fi
  1486. -    dnl PAC_PROG_F77_NAME_MANGLE
  1487. -    dnl (need to set the new name format)
  1488. -    rm -f test/mpif.h
  1489. -    if test "$MPI_INCLUDE_DIR" != "." && test $FROM_MPICH = 0 && \
  1490. -       test $FROM_MPICH2 = 0 ; then
  1491. -        if test ! -d test ; then mkdir test ; fi
  1492. -        ln -s $MPI_INCLUDE_DIR/mpif.h test
  1493. -    fi
  1494. -else 
  1495. -    F77=":"
  1496. -fi
  1497. -#
  1498. -AC_C_INLINE
  1499. -
  1500. -# Header files
  1501. -AC_CHECK_HEADERS(unistd.h)
  1502. -#
  1503. -CROSS_SIZEOF_INT=${CROSS_SIZEOF_INT:-0}
  1504. -CROSS_SIZEOF_VOID_P=${CROSS_SIZEOF_VOID_P:-0}
  1505. -AC_CHECK_SIZEOF(int,$CROSS_SIZEOF_INT)
  1506. -AC_CHECK_SIZEOF(void*,$CROSS_SIZEOF_VOID_P)
  1507. -AC_CACHE_CHECK([for int large enough for pointers],
  1508. -pac_cv_int_hold_pointer,[
  1509. -if test "$ac_cv_sizeof_int" = "0" -o \
  1510. -    "$ac_cv_sizeof_voidp" = "0" ; then
  1511. -    pac_cv_int_hold_pointer=unknown
  1512. -elif test "$ac_cv_sizeof_int" -lt "$ac_cv_sizeof_voidp" ; then
  1513. -    pac_cv_int_hold_pointer=no
  1514. -else
  1515. -    pac_cv_int_hold_pointer=yes
  1516. -fi
  1517. -])
  1518. -if test "$pac_cv_int_hold_pointer" != yes ; then
  1519. -    AC_DEFINE(INT_LT_POINTER,,[Define if int smaller than pointer])
  1520. -fi
  1521. -#
  1522. -dnl The original ROMIO configure used a set of complex tests here; this
  1523. -dnl is a partial reworking using the autoconf2 sizeof macros, and allowing
  1524. -dnl for the standardized CROSS_xxx varaibles for cross-compilation environments
  1525. -dnl PAC_LONG_LONG_64()
  1526. -CROSS_SIZEOF_LONG_LONG=${CROSS_SIZEOF_LONG_LONG:-0}
  1527. -AC_CHECK_SIZEOF(long long,$CROSS_SIZEOF_LONG_LONG)
  1528. -if test "$ac_sizeof_long_long" != 0 ; then
  1529. -    if test "$ac_sizeof_long_long" = "8" ; then
  1530. -       AC_DEFINE(HAVE_LONG_LONG_64,,[Define if long long is 64 bits])
  1531. -       MPI_OFFSET_TYPE="long long"
  1532. -       DEFINE_MPI_OFFSET="typedef long long MPI_Offset;"
  1533. -       FORTRAN_MPI_OFFSET="integer*8"
  1534. -       LL="\%lld"
  1535. -    elif test "$ac_sizeof_long_long" = "$ac_sizeof_int" ; then
  1536. -       MPI_OFFSET_TYPE="int"
  1537. -       DEFINE_MPI_OFFSET="typedef int MPI_Offset;"
  1538. -       FORTRAN_MPI_OFFSET="integer"
  1539. -       AC_DEFINE(MPI_OFFSET_IS_INT,,[Define if MPI_Offset is int])
  1540. -       LL="\%d"
  1541. -       MPI_OFFSET_KIND1="!"
  1542. -       MPI_OFFSET_KIND2="!"
  1543. -    else
  1544. -       echo "defining MPI_Offset as long in C and integer in Fortran" 
  1545. -       MPI_OFFSET_TYPE="long"
  1546. -       DEFINE_MPI_OFFSET="typedef long MPI_Offset;"
  1547. -       FORTRAN_MPI_OFFSET="integer"
  1548. -       LL="\%ld"
  1549. -       MPI_OFFSET_KIND1="!"
  1550. -       MPI_OFFSET_KIND2="!"
  1551. -    fi
  1552. -else
  1553. -    echo "defining MPI_Offset as long in C and integer in Fortran" 
  1554. -    MPI_OFFSET_TYPE="long"
  1555. -    DEFINE_MPI_OFFSET="typedef long MPI_Offset;"
  1556. -    FORTRAN_MPI_OFFSET="integer"
  1557. -    LL="\%ld"
  1558. -    MPI_OFFSET_KIND1="!"
  1559. -    MPI_OFFSET_KIND2="!"
  1560. -fi
  1561. -
  1562. -
  1563. -#
  1564. -if test -n "$longlongsize"; then
  1565. -   if test $FROM_MPICH = 0 -a $FROM_MPICH2 = 0 ; then
  1566. -       PAC_MPI_LONG_LONG_INT
  1567. -   else
  1568. -       AC_DEFINE(HAVE_MPI_LONG_LONG_INT,,[Define if supports long long int])
  1569. -   fi
  1570. -fi
  1571. -#
  1572. -if test -n "$OFFSET_KIND" -a "A$MPI_OFFSET_KIND1" = "A!" ; then 
  1573. -  MPI_OFFSET_KIND1="        INTEGER MPI_OFFSET_KIND"
  1574. -  MPI_OFFSET_KIND2="        PARAMETER (MPI_OFFSET_KIND=$OFFSET_KIND)"
  1575. -else
  1576. - if test "$FORTRAN_MPI_OFFSET" = "integer*8" && test "A$MPI_OFFSET_KIND2" = "A!" && test $NOF77 = 0 ; then
  1577. -   PAC_MPI_OFFSET_KIND
  1578. - fi
  1579. - #
  1580. -  if test "$FORTRAN_MPI_OFFSET" = "integer" && test "A$MPI_OFFSET_KIND2" = "A!" && test $NOF77 = 0 ; then
  1581. -   PAC_MPI_OFFSET_KIND_4BYTE
  1582. -  fi
  1583. -fi
  1584. -#
  1585. -# check if MPI_Info functions are defined in the MPI implementation
  1586. -if test $FROM_MPICH = 0 -a $FROM_MPICH2 = 0 ; then
  1587. -   PAC_MPI_INFO
  1588. -else
  1589. -   AC_DEFINE(HAVE_MPI_INFO,,[Define if MPI Info is available])
  1590. -   HAVE_MPI_INFO="#define HAVE_MPI_INFO"
  1591. -   MPI_FINFO1="!"
  1592. -   MPI_FINFO2="!"
  1593. -   MPI_FINFO3="!"
  1594. -   MPI_FINFO4="!"
  1595. -fi   
  1596. -#
  1597. -if test -n "$mpi_sgi"; then
  1598. -   if test -z "$HAVE_MPI_INFO" ; then
  1599. -      PAC_CHECK_MPI_SGI_INFO_NULL  # is MPI_INFO_NULL defined in mpi.h?
  1600. -   fi
  1601. -   PAC_TEST_MPI_SGI_type_is_contig
  1602. -   PAC_TEST_MPI_COMBINERS
  1603. -   PAC_TEST_MPI_HAVE_OFFSET_KIND
  1604. -fi
  1605. -#
  1606. -# check if darray and subarray constructors are defined in the MPI implementation
  1607. -if test $FROM_MPICH = 0 ; then
  1608. -   PAC_MPI_DARRAY_SUBARRAY
  1609. -else
  1610. -   AC_DEFINE(HAVE_MPI_DARRAY_SUBARRAY,,[Define if Darray is available])
  1611. -   HAVE_MPI_DARRAY_SUBARRAY="#define HAVE_MPI_DARRAY_SUBARRAY"
  1612. -   MPI_FARRAY1="!"
  1613. -   MPI_FARRAY2="!"
  1614. -   MPI_FARRAY3="!"
  1615. -   MPI_FARRAY4="!"
  1616. -   MPI_FARRAY5="!"
  1617. -   MPI_FARRAY6="!"
  1618. -   MPI_FARRAY7="!"
  1619. -fi   
  1620. -#
  1621. -# Check to see if the compiler accepts prototypes
  1622. -dnl PAC_CHECK_CC_PROTOTYPES(AC_DEFINE(HAVE_PROTOTYPES))
  1623. -#
  1624. -#
  1625. -# Test for weak symbol support...
  1626. -# We can't put # in the message because it causes autoconf to generate
  1627. -# incorrect code
  1628. -HAVE_WEAK_SYMBOLS=0
  1629. -if test -n "$arch_hpux" || test -n "$arch_sppux" ; then
  1630. -# multiple secondary definitions not allowed by HP compilers
  1631. -# Fortran interface for HP already uses one secondary defn. 
  1632. -# therefore, do not use this method for profiling interface.
  1633. -# build profiling interface explicitly.
  1634. -   TRY_WEAK_SYMBOLS=0
  1635. -fi
  1636. -if test $TRY_WEAK_SYMBOLS = 1 ; then
  1637. -  AC_MSG_CHECKING(for weak symbol support)
  1638. -  AC_TRY_LINK([
  1639. -#pragma weak PFoo = Foo
  1640. -int Foo(a) { return a; }
  1641. -],[return PFoo(1);],has_pragma_weak=1)
  1642. -  #
  1643. -  # Some systems (Linux ia64 and ecc, for example), support weak symbols
  1644. -  # only within a single object file!  This tests that case.
  1645. -  if test "$has_pragma_weak" = 1 ; then
  1646. -    AC_MSG_RESULT([pragma weak])
  1647. -    AC_MSG_CHECKING([that weak symbols are visible to other files])
  1648. -    rm -f conftest*
  1649. -    cat >>conftest1.c <<EOF
  1650. -#pragma weak PFoo = Foo
  1651. -int Foo(int);
  1652. -int Foo(a) { return a; }
  1653. -EOF
  1654. -    cat >>conftest2.c <<EOF
  1655. -int main() {
  1656. -return PFoo(0);}
  1657. -EOF
  1658. -    ac_link2='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest1.c conftest2.c $LIBS >conftest.out 2>&1'
  1659. -    if eval $ac_link2 ; then
  1660. -        AC_MSG_RESULT(yes)
  1661. -    else
  1662. -      echo "$ac_link2" >>config.log
  1663. -      echo "Failed program was" >>config.log
  1664. -      cat conftest1.c >>config.log
  1665. -      cat conftest2.c >>config.log
  1666. -      if test -s conftest.out ; then cat conftest.out >> config.log ; fi
  1667. -      AC_MSG_RESULT(no)
  1668. -      has_pragma_weak=0
  1669. -    fi
  1670. -    rm -f conftest*
  1671. -  fi
  1672. -  if test "$has_pragma_weak" = 1 ; then
  1673. -    HAVE_WEAK_SYMBOLS=1
  1674. -    AC_DEFINE(HAVE_WEAK_SYMBOLS,,[Define if weak symbols available])
  1675. -    AC_DEFINE(HAVE_PRAGMA_WEAK,,[Define if pragma weak available])
  1676. -  else
  1677. -    AC_TRY_LINK([
  1678. -#pragma _HP_SECONDARY_DEF Foo PFoo
  1679. -int Foo(a) { return a; }
  1680. -],[return PFoo(1);],has_pragma_hp_secondary=1)
  1681. -    if test "$has_pragma_hp_secondary" = 1 ; then 
  1682. -        AC_MSG_RESULT([pragma _HP_SECONDARY_DEF])
  1683. -        HAVE_WEAK_SYMBOLS=1
  1684. -        AC_DEFINE(HAVE_WEAK_SYMBOLS,,[Define if weak symbols available])
  1685. -        AC_DEFINE(HAVE_PRAGMA_HP_SEC_DEF,,[Define for HP weak pragma])
  1686. -    else
  1687. -        AC_TRY_LINK([
  1688. -#pragma _CRI duplicate PFoo as Foo
  1689. -int Foo(a) { return a; }
  1690. -],[return PFoo(1);],has_pragma_cri_duplicate=1)
  1691. -        if test "$has_pragma_cri_duplicate" = 1 ; then
  1692. -        AC_MSG_RESULT([pragma _CRI duplicate x as y])
  1693. -        HAVE_WEAK_SYMBOLS=1
  1694. -        AC_DEFINE(HAVE_WEAK_SYMBOLS,,[Define if weak symbols available])
  1695. -        AC_DEFINE(HAVE_PRAGMA_CRI_DUP,,[Define for CRAY weak dup])
  1696. -        else    
  1697. -            AC_MSG_RESULT(no)
  1698. -        fi
  1699. -    fi
  1700. -  fi
  1701. -fi
  1702. -AC_SUBST(HAVE_WEAK_SYMBOLS)
  1703. -#
  1704. -# if FILE_SYSTEM is not set above, use ufs and nfs as default
  1705. -#
  1706. -if test -z "$FILE_SYSTEM" ; then
  1707. -    file_system_ufs=1
  1708. -    file_system_nfs=1
  1709. -    FILE_SYSTEM="ufs nfs"
  1710. -    AC_MSG_RESULT([configuring for file systems ufs and nfs])
  1711. -fi
  1712. -#
  1713. -if test -n "$file_system_nfs" ; then
  1714. -   # Check for problems with locks
  1715. -   AC_MSG_CHECKING([whether file locks work with NFS])
  1716. -   AC_TRY_RUN([
  1717. -#include <fcntl.h>
  1718. -#include <errno.h>
  1719. -#include <unistd.h>
  1720. -
  1721. -int main()
  1722. -{
  1723. -    struct flock lock;
  1724. -    int fd, err;
  1725. -
  1726. -    lock.l_type = F_WRLCK;
  1727. -    lock.l_start = 0;
  1728. -    lock.l_whence = SEEK_SET;
  1729. -    lock.l_len = 100;
  1730. -
  1731. -    fd = open("conftest.dat", O_RDWR | O_CREAT, 0644);
  1732. -
  1733. -    err = fcntl(fd, F_SETLKW, &lock);
  1734. -
  1735. -   /* printf("err = %d, errno = %d\n", err, errno); */
  1736. -    close(fd);
  1737. -    return err;
  1738. -}],nfs_locks_work=yes,nfs_locks_work=no,nfs_locks_work=unknown)
  1739. -    AC_MSG_RESULT($nfs_locks_work)
  1740. -    if test "$nfs_locks_work" != "yes" ; then
  1741. -        AC_MSG_WARN([File locks do not work with NFS.  See the Installation and
  1742. -users manual for instructions on fixing this])
  1743. -    fi
  1744. -fi
  1745. -if test -n "$file_system_nfs"; then
  1746. -    AC_DEFINE(NFS,,[Define for NFS])
  1747. -fi
  1748. -if test -n "$file_system_ufs"; then
  1749. -    AC_DEFINE(UFS,,[Define for UFS])
  1750. -fi
  1751. -if test -n "$file_system_hfs"; then
  1752. -    AC_DEFINE(HFS,,[Define for HFS])
  1753. -fi
  1754. -if test -n "$file_system_sfs"; then
  1755. -    AC_DEFINE(SFS,,[Define for SFS])
  1756. -fi
  1757. -if test -n "$file_system_xfs"; then
  1758. -    AC_DEFINE(XFS,,[Define for XFS])
  1759. -    # Check for memalign value (this was P A C_GET_XFS_MEMALIGN,
  1760. -    # switched to autoconf 2)
  1761. -    AC_CACHE_CHECK([for memory alignment needed for direct I/O],
  1762. -pac_cv_memalignval,[
  1763. -/bin/rm -f confmemalignval
  1764. -/bin/rm -f /tmp/romio_tmp.bin
  1765. -AC_TRY_RUN([#include <stdio.h>
  1766. -#include <unistd.h>
  1767. -#include <fcntl.h>
  1768. -#include <stdio.h>
  1769. -main() { 
  1770. -  struct dioattr st;
  1771. -  int fd = open("/tmp/romio_tmp.bin", O_RDWR | O_CREAT, 0644);
  1772. -  FILE *f=fopen("confmemalignval","w");
  1773. -  if (fd == -1) exit(1);
  1774. -  if (!f) exit(1);
  1775. -  fcntl(fd, F_DIOINFO, &st);
  1776. -  fprintf( f, "%u\n", st.d_mem);
  1777. -  exit(0);
  1778. -}],pac_cv_memalignval=`cat confmemalignval`,pac_cv_memalignval="unknown",pac_cv_memalignval="unknown")
  1779. -    /bin/rm -f confmemalignval
  1780. -    /bin/rm -f /tmp/romio_tmp.bin
  1781. -])
  1782. -    if test -n "$pac_cv_memalignval" -a "$pac_cv_memalignval" != 0 -a \
  1783. -    "$pac_cv_memalignval" != "unknown" ; then
  1784. -        CFLAGS="$CFLAGS -DXFS_MEMALIGN=$pac_cv_memalignval"
  1785. -    else
  1786. -        AC_MSG_RESULT(assuming 128 for memory alignment)
  1787. -        CFLAGS="$CFLAGS -DXFS_MEMALIGN=128"
  1788. -    fi
  1789. -fi
  1790. -
  1791. -if test -n "$file_system_pvfs"; then
  1792. -   # Use ROMIO_PVFS instead of PVFS because FREEBSD defines PVFS.
  1793. -    AC_DEFINE(ROMIO_PVFS,,[Define for Romio with PVFS])
  1794. -fi
  1795. -if test -n "$file_system_pvfs2"; then
  1796. -    AC_DEFINE(ROMIO_PVFS2,,[Define for Romio with PVFS2])
  1797. -fi
  1798. -if test -n "$file_system_pfs"; then
  1799. -    AC_DEFINE(PFS,,[Define for PFS])
  1800. -fi
  1801. -if test -n "$file_system_testfs"; then
  1802. -    AC_DEFINE(ROMIO_TESTFS,,[Define for TESTFS])
  1803. -fi
  1804. -if test -n "$file_system_piofs"; then
  1805. -    AC_DEFINE(PIOFS,,[Define for PIOFS])
  1806. -    USER_CFLAGS="$USER_CFLAGS -bI:/usr/include/piofs/piofs.exp"
  1807. -    ROMIO_LFLAGS="$USER_FFLAGS -bI:/usr/include/piofs/piofs.exp"
  1808. -    USER_FFLAGS="$USER_FFLAGS -bI:/usr/include/piofs/piofs.exp"
  1809. -fi
  1810. -if test -n "$mpi_mpich"; then
  1811. -   if test "$FROM_MPICH2" = 0; then
  1812. -      AC_DEFINE(NEEDS_MPI_TEST,,[Define if mpi_test needed])
  1813. -      AC_DEFINE(MPICH,,[Define if using MPICH])
  1814. -      if test -z "$arch_SX4" ; then
  1815. -         MPIOF_H_INCLUDED=1
  1816. -      fi
  1817. -   fi
  1818. -fi
  1819. -if test -n "$mpi_sgi"; then
  1820. -   AC_DEFINE(MPISGI,,[Define if SGI MPI])
  1821. -fi
  1822. -if test -n "$mpi_lam"; then
  1823. -   AC_DEFINE(MPILAM,,[Define if using LAM/MPI])
  1824. -fi
  1825. -if test -n "$mpi_hp"; then
  1826. -   AC_DEFINE(MPIHP,,[Define if using HP MPI])
  1827. -   if test "$NOF77" = 0; then
  1828. -      PAC_CHECK_MPIOF_H
  1829. -   fi
  1830. -fi
  1831. -#
  1832. -PAC_FUNC_STRERROR
  1833. -if test -z "$srcdir" -o "$srcdir" = "." ; then srcdir="$ROMIO_HOME" ; fi
  1834. -AC_SUBST(srcdir)
  1835. -if test "$FROM_MPICH2" = 0 ; then 
  1836. -    if test -z "$LIBNAME"; then
  1837. -        LIBNAME="$ROMIO_HOME/lib/$ARCH/libmpio.a"
  1838. -    fi
  1839. -    #
  1840. -    if test ! -d $ROMIO_HOME/lib ; then 
  1841. -        mkdir $ROMIO_HOME/lib
  1842. -    fi
  1843. -    if test ! -d $ROMIO_HOME/lib/$ARCH ; then 
  1844. -        mkdir $ROMIO_HOME/lib/$ARCH
  1845. -    fi
  1846. -else
  1847. -    MPILIBNAME=${MPILIBNAME:-mpich}
  1848. -    if test -n "$top_build_dir" -a -d "$top_build_dir/lib" ; then
  1849. -        LIBNAME=$top_build_dir/lib/lib${MPILIBNAME}.a
  1850. -    else
  1851. -        LIBNAME="$ROMIO_HOME/lib${MPILIBNAME}.a"
  1852. -    fi
  1853. -fi
  1854. -#
  1855. -if test $NOF77 = 1 ; then
  1856. -   F77=":"
  1857. -else
  1858. -   FORTRAN_TEST="fperf fcoll_test fmisc pfcoll_test" 
  1859. -fi
  1860. -#
  1861. -if test $FROM_MPICH = 0 -a $FROM_MPICH2 = 0 ; then
  1862. -   PAC_TEST_MPI
  1863. -   PAC_NEEDS_FINT
  1864. -else
  1865. -   NEEDS_MPI_FINT=""
  1866. -fi
  1867. -#
  1868. -if test "$MPI_INCLUDE_DIR" = "." ; then
  1869. -   ROMIO_INCLUDE="-I../include"
  1870. -else 
  1871. -   ROMIO_INCLUDE="-I../include -I$MPI_INCLUDE_DIR"
  1872. -fi
  1873. -#
  1874. -TEST_LIBNAME=$LIBNAME
  1875. -MPIRUN=mpirun
  1876. -#
  1877. -# if MPICH, use mpicc in test programs
  1878. -#
  1879. -if test $FROM_MPICH = 1 ; then
  1880. -   MPICH_HOME=`dirname $ROMIO_HOME`
  1881. -   if test -z "$MPI_BIN_DIR" ; then MPI_BIN_DIR=$MPICH_HOME/bin ; fi
  1882. -   TEST_CC=$MPI_BIN_DIR/mpicc
  1883. -   MPI_LIB=""
  1884. -   ROMIO_INCLUDE=""
  1885. -   USER_CFLAGS=""
  1886. -   USER_FFLAGS=""
  1887. -   TEST_LIBNAME=""
  1888. -   MPIRUN=$MPI_BIN_DIR/mpirun
  1889. -   if test -n "$arch_SX4" || test -n "$arch_hpux" ; then
  1890. -      TEST_F77=$MPI_BIN_DIR/mpif90
  1891. -   else
  1892. -      TEST_F77=$MPI_BIN_DIR/mpif77
  1893. -   fi
  1894. -   CC=$MPI_BIN_DIR/mpicc
  1895. -   AC_DEFINE(HAVE_STATUS_SET_BYTES,,[Define if status_set_bytes available])
  1896. -fi
  1897. -# For now, separate the mpich2 from mpich cases
  1898. -if test $FROM_MPICH2 = 1 ; then
  1899. -   MPICH_HOME=`dirname $ROMIO_HOME`
  1900. -   MPICH_HOME=`dirname $MPICH_HOME`
  1901. -   MPICH_HOME=`dirname $MPICH_HOME`
  1902. -   if test -z "$MPI_BIN_DIR" ; then MPI_BIN_DIR=$MPICH_HOME/bin ; fi
  1903. -   # No special compiler script.
  1904. -   # BUT we need the include paths
  1905. -   CC="$CC -I${use_top_srcdir}/src/include -I${top_build_dir}/src/include"
  1906. -   TEST_CC="$CC"
  1907. -   MPI_LIB="$LIBNAME"
  1908. -   ROMIO_INCLUDE=""
  1909. -   USER_CFLAGS=""
  1910. -   USER_FFLAGS=""
  1911. -   TEST_LIBNAME=""
  1912. -   MPIRUN=$MPI_BIN_DIR/mpiexec
  1913. -   AC_DEFINE(HAVE_STATUS_SET_BYTES,,[Define if status_set_bytes available])
  1914. -   AC_DEFINE(HAVE_MPI_GREQUEST,,[Define if generalized requests avaliable])
  1915. -fi
  1916. -#
  1917. -#
  1918. -# feature tests:  we can't test features if building as part of MPICH because
  1919. -# we don't yet have an implementation against which we can test
  1920. -#
  1921. -if test "$FROM_MPICH2" = 0 -a "$FROM_MPICH" = 0 ; then
  1922. -   PAC_TEST_MPIR_STATUS_SET_BYTES
  1923. -   PAC_TEST_MPI_GREQUEST
  1924. -   AC_DEFINE(PRINT_ERR_MSG,,[Define for printing error messages])
  1925. -fi
  1926. -#
  1927. -if test -z "$TEST_CC" ; then
  1928. -   TEST_CC="$CC"
  1929. -fi
  1930. -if test -z "$TEST_F77" ; then
  1931. -   TEST_F77="$F77"
  1932. -fi
  1933. -#
  1934. -CFLAGS="$CFLAGS -DHAVE_ROMIOCONF_H"
  1935. -#
  1936. -echo "setting CC to $CC"
  1937. -echo "setting F77 to $F77"
  1938. -echo "setting TEST_CC to $TEST_CC"
  1939. -echo "setting TEST_F77 to $TEST_F77"
  1940. -echo "setting CFLAGS to $CFLAGS"
  1941. -echo "setting USER_CFLAGS to $USER_CFLAGS"
  1942. -echo "setting USER_FFLAGS to $USER_FFLAGS"
  1943. -#
  1944. -VPATH='VPATH = .:${srcdir}'
  1945. -AC_SUBST(VPATH)
  1946. -AC_SUBST(ARCH)
  1947. -AC_SUBST(FILE_SYSTEM)
  1948. -AC_SUBST(CC)
  1949. -AC_SUBST(CFLAGS)
  1950. -AC_SUBST(USER_CFLAGS)
  1951. -AC_SUBST(USER_FFLAGS)
  1952. -AC_SUBST(MIPS)
  1953. -AC_SUBST(BITS)
  1954. -AC_SUBST(MPI)
  1955. -AC_SUBST(AR)
  1956. -AC_SUBST(RANLIB)
  1957. -AC_SUBST(MPI_INCLUDE_DIR)
  1958. -AC_SUBST(MPI_LIB)
  1959. -AC_SUBST(F77)
  1960. -AC_SUBST(NOF77)
  1961. -AC_SUBST(NOPROFILE)
  1962. -AC_SUBST(MAKE)
  1963. -AC_SUBST(arch_IRIX)
  1964. -AC_SUBST(ROMIO_HOME)
  1965. -AC_SUBST(LIBNAME)
  1966. -AC_SUBST(TEST_LIBNAME)
  1967. -AC_SUBST(LL)
  1968. -AC_SUBST(F77GETARG)
  1969. -AC_SUBST(F77IARGC)
  1970. -AC_SUBST(FTESTDEFINE)
  1971. -AC_SUBST(FORTRAN_MPI_OFFSET)
  1972. -AC_SUBST(FROM_MPICH)
  1973. -AC_SUBST(FROM_MPICH2)
  1974. -AC_SUBST(NEEDS_MPI_FINT)
  1975. -AC_SUBST(HAVE_MPI_INFO)
  1976. -AC_SUBST(BUILD_MPI_INFO)
  1977. -AC_SUBST(HAVE_MPI_DARRAY_SUBARRAY)
  1978. -AC_SUBST(BUILD_MPI_ARRAY)
  1979. -AC_SUBST(DEFINE_MPI_OFFSET)
  1980. -AC_SUBST(MPI_OFFSET_TYPE)
  1981. -AC_SUBST(MPI_FINFO1)
  1982. -AC_SUBST(MPI_FINFO2)
  1983. -AC_SUBST(MPI_FINFO3)
  1984. -AC_SUBST(MPI_FINFO4)
  1985. -AC_SUBST(MPI_FARRAY1)
  1986. -AC_SUBST(MPI_FARRAY2)
  1987. -AC_SUBST(MPI_FARRAY3)
  1988. -AC_SUBST(MPI_FARRAY4)
  1989. -AC_SUBST(MPI_FARRAY5)
  1990. -AC_SUBST(MPI_FARRAY6)
  1991. -AC_SUBST(MPI_FARRAY7)
  1992. -AC_SUBST(MPI_OFFSET_KIND1)
  1993. -AC_SUBST(MPI_OFFSET_KIND2)
  1994. -AC_SUBST(TEST_CC)
  1995. -AC_SUBST(TEST_F77)
  1996. -AC_SUBST(ROMIO_INCLUDE)
  1997. -AC_SUBST(ROMIO_LFLAGS)
  1998. -AC_SUBST(ROMIO_LIBLIST)
  1999. -AC_SUBST(ROMIO_TCFLAGS)
  2000. -AC_SUBST(ROMIO_TCPPFLAGS)
  2001. -AC_SUBST(ROMIO_TFFLAGS)
  2002. -AC_SUBST(MPIRUN)
  2003. -AC_SUBST(FORTRAN_TEST)
  2004. -dnl
  2005. -dnl Dependency handling
  2006. -AC_SUBST(MAKE_DEPEND_C)
  2007. -if test ! -d adio ; then mkdir adio ; fi
  2008. -if test ! -d adio/include ; then mkdir adio/include ; fi
  2009. -if test ! -d mpi2-other ; then mkdir mpi2-other ; fi
  2010. -# 
  2011. -# Make sure we remove any configuration file incase there is out-of-date data.
  2012. -# We remove the version in include in case this is a vpath build
  2013. -rm -f adio/include/romioconf.h ${use_top_srcdir}/src/mpi/romio/adio/include/romioconf.h ${use_top_srcdir}/adio/include/romioconf.h
  2014. -#
  2015. -# Create makefiles for all of the adio devices.  Only the ones that 
  2016. -# are active will be called by the top level ROMIO make
  2017. -AC_OUTPUT_COMMANDS([chmod 755 util/romioinstall test/runtests])
  2018. -AC_OUTPUT(Makefile localdefs mpi-io/Makefile mpi2-other/info/Makefile \
  2019. -           mpi2-other/array/Makefile adio/common/Makefile \
  2020. -           test/Makefile test/misc.c test/large_file.c \
  2021. -           test/runtests util/romioinstall include/mpio.h \
  2022. -           include/mpiof.h \
  2023. -           adio/ad_nfs/Makefile adio/ad_ufs/Makefile \
  2024. -           adio/ad_xfs/Makefile adio/ad_hfs/Makefile \
  2025. -           adio/ad_sfs/Makefile adio/ad_pfs/Makefile \
  2026. -           adio/ad_testfs/Makefile adio/ad_pvfs/Makefile \
  2027. -           adio/ad_pvfs2/Makefile adio/ad_piofs/Makefile \
  2028. -                   mpi-io/fortran/Makefile mpi2-other/info/fortran/Makefile \
  2029. -                   mpi2-other/array/fortran/Makefile test/fmisc.f \
  2030. -                   test/fcoll_test.f test/pfcoll_test.f test/fperf.f )
  2031. -#
  2032. -rm -f *.o
  2033. -if test "$ROMIO_NO_BANNER" != "yes" -a "$FROM_MPICH" = 0 -a \
  2034. -         $FROM_MPICH2 = 0 ; then
  2035. -cat <<EOF
  2036. -
  2037. -Please register your copy of ROMIO with us by sending email
  2038. -to majordomo@mcs.anl.gov with the message
  2039. -subscribe romio-users
  2040. -This will enable us to notify you of new releases of ROMIO
  2041. -as well as bug fixes.
  2042. -
  2043. -EOF
  2044. -fi
  2045. -if test $FROM_MPICH2 = 1 -a "$NOF77" = 0 ; then
  2046. -      sed 5d test/fcoll_test.f > test/tmp
  2047. -      mv test/tmp test/fcoll_test.f
  2048. -      sed 5d test/pfcoll_test.f > test/tmp
  2049. -      mv test/tmp test/fcoll_test.f
  2050. -      sed 5d test/fperf.f > test/tmp
  2051. -      mv test/tmp test/fperf.f
  2052. -      sed 5d test/fmisc.f > test/tmp
  2053. -      mv test/tmp test/fmisc.f
  2054. -fi
  2055. -if test $FROM_MPICH = 0 -a $FROM_MPICH2 = 0 ; then
  2056. -   AC_MSG_RESULT([Configure done. Now type make])
  2057. -fi
  2058. -dnl PAC_SUBDIR_CACHE_CLEANUP
  2059. -exit 0
  2060. Index: romio/adio/ad_hfs/.cvsignore
  2061. ===================================================================
  2062. RCS file: /home/MPI/cvsMaster/romio/adio/ad_hfs/.cvsignore,v
  2063. retrieving revision 1.2
  2064. retrieving revision 1.3
  2065. --- romio/adio/ad_hfs/.cvsignore    1 Aug 2003 13:30:17 -0000    1.2
  2066. +++ romio/adio/ad_hfs/.cvsignore    19 Jan 2004 14:49:35 -0000    1.3
  2067. @@ -1,2 +1,4 @@
  2068.  Makefile
  2069.  .deps
  2070. +*.bb
  2071. +*.bbg
  2072. Index: romio/adio/ad_nfs/.cvsignore
  2073. ===================================================================
  2074. RCS file: /home/MPI/cvsMaster/romio/adio/ad_nfs/.cvsignore,v
  2075. retrieving revision 1.2
  2076. retrieving revision 1.3
  2077. --- romio/adio/ad_nfs/.cvsignore    1 Aug 2003 13:30:17 -0000    1.2
  2078. +++ romio/adio/ad_nfs/.cvsignore    19 Jan 2004 14:49:35 -0000    1.3
  2079. @@ -1,2 +1,4 @@
  2080.  Makefile
  2081.  .deps
  2082. +*.bb
  2083. +*.bbg
  2084. Index: romio/adio/ad_ntfs/.cvsignore
  2085. ===================================================================
  2086. RCS file: /home/MPI/cvsMaster/romio/adio/ad_ntfs/.cvsignore,v
  2087. retrieving revision 1.2
  2088. retrieving revision 1.3
  2089. --- romio/adio/ad_ntfs/.cvsignore    1 Aug 2003 13:30:17 -0000    1.2
  2090. +++ romio/adio/ad_ntfs/.cvsignore    19 Jan 2004 14:49:35 -0000    1.3
  2091. @@ -1,2 +1,4 @@
  2092.  Makefile
  2093.  .deps
  2094. +*.bb
  2095. +*.bbg
  2096. Index: romio/adio/ad_pfs/.cvsignore
  2097. ===================================================================
  2098. RCS file: /home/MPI/cvsMaster/romio/adio/ad_pfs/.cvsignore,v
  2099. retrieving revision 1.2
  2100. retrieving revision 1.3
  2101. --- romio/adio/ad_pfs/.cvsignore    1 Aug 2003 13:30:17 -0000    1.2
  2102. +++ romio/adio/ad_pfs/.cvsignore    19 Jan 2004 14:49:35 -0000    1.3
  2103. @@ -1,2 +1,4 @@
  2104.  Makefile
  2105.  .deps
  2106. +*.bb
  2107. +*.bbg
  2108. Index: romio/adio/ad_piofs/.cvsignore
  2109. ===================================================================
  2110. RCS file: /home/MPI/cvsMaster/romio/adio/ad_piofs/.cvsignore,v
  2111. retrieving revision 1.2
  2112. retrieving revision 1.3
  2113. --- romio/adio/ad_piofs/.cvsignore    1 Aug 2003 13:30:18 -0000    1.2
  2114. +++ romio/adio/ad_piofs/.cvsignore    19 Jan 2004 14:49:36 -0000    1.3
  2115. @@ -1,2 +1,4 @@
  2116.  Makefile
  2117.  .deps
  2118. +*.bb
  2119. +*.bbg
  2120. Index: romio/adio/ad_pvfs/.cvsignore
  2121. ===================================================================
  2122. RCS file: /home/MPI/cvsMaster/romio/adio/ad_pvfs/.cvsignore,v
  2123. retrieving revision 1.2
  2124. retrieving revision 1.3
  2125. --- romio/adio/ad_pvfs/.cvsignore    1 Aug 2003 13:30:18 -0000    1.2
  2126. +++ romio/adio/ad_pvfs/.cvsignore    19 Jan 2004 14:49:36 -0000    1.3
  2127. @@ -1,2 +1,4 @@
  2128.  Makefile
  2129.  .deps
  2130. +*.bb
  2131. +*.bbg
  2132. Index: romio/adio/ad_pvfs/ad_pvfs.h
  2133. ===================================================================
  2134. RCS file: /home/MPI/cvsMaster/romio/adio/ad_pvfs/ad_pvfs.h,v
  2135. retrieving revision 1.3
  2136. retrieving revision 1.5
  2137. --- romio/adio/ad_pvfs/ad_pvfs.h    24 Oct 2002 17:00:57 -0000    1.3
  2138. +++ romio/adio/ad_pvfs/ad_pvfs.h    7 Jun 2004 19:26:28 -0000    1.5
  2139. @@ -1,19 +1,27 @@
  2140.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  2141.  /* 
  2142. - *   $Id: ad_pvfs.h,v 1.3 2002/10/24 17:00:57 gropp Exp $    
  2143. + *   $Id: ad_pvfs.h,v 1.5 2004/06/07 19:26:28 gropp Exp $    
  2144.   *
  2145.   *   Copyright (C) 1997 University of Chicago. 
  2146.   *   See COPYRIGHT notice in top-level directory.
  2147.   */
  2148.  
  2149.  #ifndef AD_PVFS_INCLUDE
  2150.  #define AD_PVFS_INCLUDE
  2151.  
  2152. +#ifndef ROMIOCONF_H_INCLUDED
  2153. +#include "romioconf.h"
  2154. +#define ROMIOCONG_H_INCLUDED
  2155. +#endif
  2156. +#ifdef ROMIO_PVFS_NEEDS_INT64_DEFINITION
  2157. +typedef long long int int64_t;
  2158. +#endif
  2159. +
  2160.  #include <unistd.h>
  2161.  #include <sys/types.h>
  2162.  #include <sys/uio.h>
  2163.  #include <fcntl.h>
  2164.  #include <pvfs.h>
  2165.  #include "adio.h"
  2166.  #include "pvfs_proto.h"
  2167.  
  2168. Index: romio/adio/ad_pvfs/ad_pvfs_flush.c
  2169. ===================================================================
  2170. RCS file: /home/MPI/cvsMaster/romio/adio/ad_pvfs/ad_pvfs_flush.c,v
  2171. retrieving revision 1.11
  2172. retrieving revision 1.12
  2173. --- romio/adio/ad_pvfs/ad_pvfs_flush.c    18 Apr 2003 20:15:01 -0000    1.11
  2174. +++ romio/adio/ad_pvfs/ad_pvfs_flush.c    20 May 2004 19:05:17 -0000    1.12
  2175. @@ -1,26 +1,38 @@
  2176.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  2177.  /* 
  2178. - *   $Id: ad_pvfs_flush.c,v 1.11 2003/04/18 20:15:01 David Exp $    
  2179. + *   $Id: ad_pvfs_flush.c,v 1.12 2004/05/20 19:05:17 robl Exp $    
  2180.   *
  2181.   *   Copyright (C) 1997 University of Chicago. 
  2182.   *   See COPYRIGHT notice in top-level directory.
  2183.   */
  2184.  
  2185.  #include "ad_pvfs.h"
  2186.  
  2187.  void ADIOI_PVFS_Flush(ADIO_File fd, int *error_code)
  2188.  {
  2189. -    int err;
  2190. +    int err, rank, dummy=0, dummy_in=0;
  2191.  #ifndef PRINT_ERR_MSG
  2192.      static char myname[] = "ADIOI_PVFS_FLUSH";
  2193.  #endif
  2194.  
  2195. +    /* a collective routine: because we do not cache data in PVFS1, one process
  2196. +     * can initiate the fsync operation and broadcast the result to the others.
  2197. +     * One catch: MPI_File_sync has special meaning with respect to file system
  2198. +     * consistency.  Ensure no clients have outstanding write operations.
  2199. +     */
  2200. +
  2201. +    MPI_Comm_rank(fd->comm, &rank);
  2202. +    MPI_Reduce(&dummy_in, &dummy, 1, MPI_INT, MPI_SUM, 
  2203. +            fd->hints->ranklist[0], fd->comm);
  2204. +    if (rank == fd->hints->ranklist[0]) {
  2205.      err = pvfs_fsync(fd->fd_sys);
  2206. +    }
  2207. +    MPI_Bcast(&err, 1, MPI_INT, 0, fd->comm);
  2208.  
  2209.      if (err == -1) {
  2210.  #ifdef MPICH2
  2211.      *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
  2212.          "**io %s", strerror(errno));
  2213.  #elif defined(PRINT_ERR_MSG)
  2214.      *error_code = MPI_ERR_UNKNOWN;
  2215.  #else /* MPICH-1 */
  2216. Index: romio/adio/ad_pvfs/ad_pvfs_resize.c
  2217. ===================================================================
  2218. RCS file: /home/MPI/cvsMaster/romio/adio/ad_pvfs/ad_pvfs_resize.c,v
  2219. retrieving revision 1.11
  2220. retrieving revision 1.13
  2221. --- romio/adio/ad_pvfs/ad_pvfs_resize.c    18 Apr 2003 20:15:01 -0000    1.11
  2222. +++ romio/adio/ad_pvfs/ad_pvfs_resize.c    7 Jun 2004 16:42:26 -0000    1.13
  2223. @@ -1,26 +1,35 @@
  2224.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  2225.  /* 
  2226. - *   $Id: ad_pvfs_resize.c,v 1.11 2003/04/18 20:15:01 David Exp $    
  2227. + *   $Id: ad_pvfs_resize.c,v 1.13 2004/06/07 16:42:26 gropp Exp $    
  2228.   *
  2229.   *   Copyright (C) 1997 University of Chicago. 
  2230.   *   See COPYRIGHT notice in top-level directory.
  2231.   */
  2232.  
  2233.  #include "ad_pvfs.h"
  2234.  
  2235.  void ADIOI_PVFS_Resize(ADIO_File fd, ADIO_Offset size, int *error_code)
  2236.  {
  2237.      int err;
  2238. +    int ret, rank;
  2239.  #ifndef PRINT_ERR_MSG
  2240.      static char myname[] = "ADIOI_PVFS_RESIZE";
  2241.  #endif
  2242.      
  2243. +    /* because MPI_File_set_size is a collective operation, and PVFS1 clients
  2244. +     * do not cache metadata locally, one client can resize and broadcast the
  2245. +     * result to the others */
  2246. +    MPI_Comm_rank(fd->comm, &rank);
  2247. +    if (rank == fd->hints->ranklist[0]) {
  2248.      err = pvfs_ftruncate64(fd->fd_sys, size);
  2249. +    }
  2250. +    MPI_Bcast(&err, 1, MPI_INT, 0, fd->comm);
  2251. +
  2252.      if (err == -1) {
  2253.  #ifdef MPICH2
  2254.      *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**io",
  2255.          "**io %s", strerror(errno));
  2256.  #elif defined(PRINT_ERR_MSG)
  2257.      *error_code = MPI_ERR_UNKNOWN;
  2258.  #else /* MPICH-1 */
  2259.      *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR,
  2260. Index: romio/adio/ad_pvfs2/.cvsignore
  2261. ===================================================================
  2262. RCS file: /home/MPI/cvsMaster/romio/adio/ad_pvfs2/.cvsignore,v
  2263. retrieving revision 1.2
  2264. retrieving revision 1.3
  2265. --- romio/adio/ad_pvfs2/.cvsignore    1 Aug 2003 13:30:18 -0000    1.2
  2266. +++ romio/adio/ad_pvfs2/.cvsignore    19 Jan 2004 14:49:36 -0000    1.3
  2267. @@ -1,2 +1,5 @@
  2268.  Makefile
  2269.  .deps
  2270. +*.bb
  2271. +*.bbg
  2272. +
  2273. Index: romio/adio/ad_pvfs2/ad_pvfs2_close.c
  2274. ===================================================================
  2275. RCS file: /home/MPI/cvsMaster/romio/adio/ad_pvfs2/ad_pvfs2_close.c,v
  2276. retrieving revision 1.2
  2277. retrieving revision 1.3
  2278. --- romio/adio/ad_pvfs2/ad_pvfs2_close.c    27 Jun 2003 23:23:16 -0000    1.2
  2279. +++ romio/adio/ad_pvfs2/ad_pvfs2_close.c    20 May 2004 19:13:57 -0000    1.3
  2280. @@ -1,19 +1,22 @@
  2281.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  2282.  /* 
  2283. - *   $Id: ad_pvfs2_close.c,v 1.2 2003/06/27 23:23:16 robl Exp $
  2284. + *   $Id: ad_pvfs2_close.c,v 1.3 2004/05/20 19:13:57 robl Exp $
  2285.   *
  2286.   *   Copyright (C) 1997 University of Chicago. 
  2287.   *   See COPYRIGHT notice in top-level directory.
  2288.   */
  2289.  
  2290.  #include "ad_pvfs2.h"
  2291.  
  2292.  void ADIOI_PVFS2_Close(ADIO_File fd, int *error_code)
  2293.  {
  2294.      ADIOI_Free(fd->fs_ptr);
  2295. -    /* pvfs2 doesn't have a 'close' */
  2296. +    /* pvfs2 doesn't have a 'close', but MPI-IO semantics dictate that we
  2297. +     * ensure all data has been flushed  */
  2298. +    /* XXX: reduce and sync? sync on all? */
  2299. +
  2300.      *error_code = MPI_SUCCESS;
  2301.  }
  2302.  /* 
  2303.   * vim: ts=8 sts=4 sw=4 noexpandtab 
  2304.   */
  2305. Index: romio/adio/ad_pvfs2/ad_pvfs2_common.c
  2306. ===================================================================
  2307. RCS file: /home/MPI/cvsMaster/romio/adio/ad_pvfs2/ad_pvfs2_common.c,v
  2308. retrieving revision 1.7
  2309. retrieving revision 1.9
  2310. --- romio/adio/ad_pvfs2/ad_pvfs2_common.c    5 Sep 2003 20:43:58 -0000    1.7
  2311. +++ romio/adio/ad_pvfs2/ad_pvfs2_common.c    25 Mar 2004 22:17:45 -0000    1.9
  2312. @@ -1,75 +1,63 @@
  2313.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  2314.  /* 
  2315. - *   $Id: ad_pvfs2_common.c,v 1.7 2003/09/05 20:43:58 robl Exp $
  2316. + *   $Id: ad_pvfs2_common.c,v 1.9 2004/03/25 22:17:45 robl Exp $
  2317.   *
  2318.   *   Copyright (C) 2003 University of Chicago. 
  2319.   *   See COPYRIGHT notice in top-level directory.
  2320.   */
  2321.  
  2322.  #include "ad_pvfs2.h"
  2323.  #include "ad_pvfs2_common.h"
  2324.  #include <unistd.h>
  2325.  #include <sys/types.h>
  2326.  
  2327.  /* maybe give romio access to the globalconfig struct */
  2328.  /* keyval hack to both tell us if we've already initialized pvfs2 and also
  2329.   * close it down when mpi exits */
  2330.  int ADIOI_PVFS2_Initialized = MPI_KEYVAL_INVALID;
  2331.  
  2332. -PVFS_fs_id * ADIOI_PVFS2_fs_id_list;
  2333. -pvfs_mntlist ADIOI_PVFS2_mntlist;
  2334. -
  2335.  void ADIOI_PVFS2_End(int *error_code)
  2336.  {
  2337.      int ret;
  2338.      ret = PVFS_sys_finalize();
  2339.      if (ret < 0 ) {
  2340. -    *error_code = MPI_UNDEFINED;
  2341. +    ADIOI_PVFS2_pvfs_error_convert(ret, error_code);
  2342.      } else {
  2343.      *error_code = MPI_SUCCESS;
  2344.      }
  2345.  }
  2346.  
  2347.  int ADIOI_PVFS2_End_call(MPI_Comm comm, int keyval, 
  2348.      void *attribute_val, void *extra_state)
  2349.  {
  2350.      int error_code;
  2351.      ADIOI_PVFS2_End(&error_code);
  2352.      return error_code;
  2353.  }
  2354.  
  2355.  void ADIOI_PVFS2_Init(int *error_code )
  2356.  {
  2357. -    PVFS_sysresp_init resp_init;
  2358.      int ret;
  2359.  
  2360.      /* do nothing if we've already fired up the pvfs2 interface */
  2361.      if (ADIOI_PVFS2_Initialized != MPI_KEYVAL_INVALID) {
  2362.          *error_code = MPI_SUCCESS;
  2363.          return;
  2364.      }
  2365.  
  2366. -    ret = PVFS_util_parse_pvfstab(&ADIOI_PVFS2_mntlist);
  2367. -    if (ret < 0) {
  2368. -        /* XXX: better error handling */
  2369. -        fprintf(stderr, "error parsing pvfstab\n");
  2370. -        *error_code = MPI_UNDEFINED;
  2371. -        return;
  2372. -    }
  2373. -    ret = PVFS_sys_initialize(ADIOI_PVFS2_mntlist, ADIOI_PVFS2_DEBUG_MASK, 
  2374. -        &resp_init);
  2375. +    ret = PVFS_util_init_defaults();
  2376.      if (ret < 0 ) {
  2377.          /* XXX: better error handling */
  2378. -        fprintf(stderr, "error initializing pvfs\n");
  2379. -        *error_code = MPI_UNDEFINED;
  2380. +        PVFS_perror("PVFS_util_init_defaults", ret);
  2381. +        ADIOI_PVFS2_pvfs_error_convert(ret, error_code);
  2382.          return;
  2383.      }
  2384. -    ADIOI_PVFS2_fs_id_list = resp_init.fsid_list;
  2385. +
  2386.      MPI_Keyval_create(MPI_NULL_COPY_FN, ADIOI_PVFS2_End_call,
  2387.          &ADIOI_PVFS2_Initialized, (void *)0); 
  2388.      /* just like romio does, we make a dummy attribute so we 
  2389.       * get cleaned up */
  2390.      MPI_Attr_put(MPI_COMM_WORLD, ADIOI_PVFS2_Initialized, (void *)0);
  2391.  }
  2392.  
  2393.  void ADIOI_PVFS2_makeattribs(PVFS_sys_attr * attribs)
  2394. @@ -82,18 +70,17 @@
  2395.      attribs->mask =  PVFS_ATTR_SYS_ALL_SETABLE;
  2396.  }
  2397.  
  2398.  
  2399.  void ADIOI_PVFS2_makecredentials(PVFS_credentials * credentials)
  2400.  {
  2401.      memset(credentials, 0, sizeof(PVFS_credentials));
  2402.  
  2403. -    credentials->uid = geteuid();
  2404. -    credentials->gid = getegid();
  2405. +    PVFS_util_gen_credentials(credentials);
  2406.  }
  2407.  
  2408.  /* pvfs_error_convert: given a pvfs error code, make it into the appropriate
  2409.   * mpi error code */ 
  2410.  int ADIOI_PVFS2_pvfs_error_convert(int pvfs_error, int *mpi_error)
  2411.  {
  2412.      *mpi_error = MPI_UNDEFINED;
  2413.      return 0;
  2414. Index: romio/adio/ad_pvfs2/ad_pvfs2_common.h
  2415. ===================================================================
  2416. RCS file: /home/MPI/cvsMaster/romio/adio/ad_pvfs2/ad_pvfs2_common.h,v
  2417. retrieving revision 1.8
  2418. retrieving revision 1.10
  2419. --- romio/adio/ad_pvfs2/ad_pvfs2_common.h    18 Sep 2003 23:13:18 -0000    1.8
  2420. +++ romio/adio/ad_pvfs2/ad_pvfs2_common.h    25 Mar 2004 22:22:34 -0000    1.10
  2421. @@ -1,11 +1,11 @@
  2422.  /* -*- Mode: C; c-basic-offset:4 ; -*-
  2423.   * vim: ts=8 sts=4 sw=4 noexpandtab
  2424. - *   $Id: ad_pvfs2_common.h,v 1.8 2003/09/18 23:13:18 robl Exp $    
  2425. + *   $Id: ad_pvfs2_common.h,v 1.10 2004/03/25 22:22:34 robl Exp $    
  2426.   *
  2427.   *   Copyright (C) 1997 University of Chicago. 
  2428.   *   See COPYRIGHT notice in top-level directory.
  2429.   */
  2430.  
  2431.  #ifndef _AD_PVFS2_h
  2432.  #define _AD_PVFS2_H
  2433.  #include "ad_pvfs2.h"
  2434. @@ -13,24 +13,22 @@
  2435.  /* useful values:
  2436.   *  0:            no debugging
  2437.   *  CLIENT_DEBUG:   debug client state machines
  2438.   */
  2439.  #define ADIOI_PVFS2_DEBUG_MASK 0
  2440.  
  2441.  
  2442.  struct ADIOI_PVFS2_fs_s {
  2443. -    PVFS_pinode_reference pinode_refn;
  2444. +    PVFS_object_ref object_ref;
  2445.      PVFS_credentials credentials;
  2446.  } ADIOI_PVFS2_fs_s;
  2447.  
  2448.  typedef struct ADIOI_PVFS2_fs_s ADIOI_PVFS2_fs;
  2449.  
  2450. -extern PVFS_fs_id * ADIOI_PVFS2_fs_id_list;
  2451. -extern pvfs_mntlist ADIOI_PVFS2_mntlist;
  2452.  
  2453.  void ADIOI_PVFS2_Init(int *error_code );
  2454.  void ADIOI_PVFS2_makeattribs(PVFS_sys_attr * attribs);
  2455.  void ADIOI_PVFS2_makecredentials(PVFS_credentials * credentials);
  2456.  void ADIOI_PVFS2_End(int *error_code);
  2457.  int ADIOI_PVFS2_End_call(MPI_Comm comm, int keyval, 
  2458.      void *attribute_val, void *extra_state);
  2459.  int ADIOI_PVFS2_pvfs_error_convert(int pvfs_error, int *mpi_error);
  2460. Index: romio/adio/ad_pvfs2/ad_pvfs2_delete.c
  2461. ===================================================================
  2462. RCS file: /home/MPI/cvsMaster/romio/adio/ad_pvfs2/ad_pvfs2_delete.c,v
  2463. retrieving revision 1.5
  2464. retrieving revision 1.8
  2465. --- romio/adio/ad_pvfs2/ad_pvfs2_delete.c    5 Sep 2003 20:43:58 -0000    1.5
  2466. +++ romio/adio/ad_pvfs2/ad_pvfs2_delete.c    20 May 2004 20:31:05 -0000    1.8
  2467. @@ -1,62 +1,52 @@
  2468.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  2469.  /* 
  2470. - *   $Id: ad_pvfs2_delete.c,v 1.5 2003/09/05 20:43:58 robl Exp $    
  2471. + *   $Id: ad_pvfs2_delete.c,v 1.8 2004/05/20 20:31:05 robl Exp $    
  2472.   *
  2473.   *   Copyright (C) 2003 University of Chicago. 
  2474.   *   See COPYRIGHT notice in top-level directory.
  2475.   */
  2476.  
  2477.  #include "ad_pvfs2.h"
  2478.  #include "adio.h"
  2479.  
  2480.  #include "ad_pvfs2_common.h"
  2481.  
  2482.  void ADIOI_PVFS2_Delete(char *filename, int *error_code)
  2483.  {
  2484.      PVFS_credentials credentials;
  2485.      PVFS_sysresp_getparent resp_getparent;
  2486. -    int ret, i, mnt_index;
  2487. +    int ret;
  2488. +    PVFS_fs_id cur_fs;
  2489.      char pvfs_path[PVFS_NAME_MAX] = {0};
  2490.  
  2491.      ADIOI_PVFS2_Init(error_code);
  2492.      if (*error_code != MPI_SUCCESS) 
  2493.      {
  2494.      ADIOI_PVFS2_pvfs_error_convert(0, error_code);
  2495.      return;
  2496.      }
  2497.  
  2498.      /* in most cases we'll store the credentials in the fs struct, but we don't
  2499.       * have one of those in Delete  */
  2500.      ADIOI_PVFS2_makecredentials(&credentials);
  2501.  
  2502.      /* given the filename, figure out which pvfs filesystem it is on */
  2503. -    for (i=0; i<ADIOI_PVFS2_mntlist.ptab_count; i++) {
  2504. -    ret = PVFS_util_remove_dir_prefix(filename, 
  2505. -        ADIOI_PVFS2_mntlist.ptab_array[i].mnt_dir, 
  2506. -        pvfs_path, PVFS_NAME_MAX);
  2507. -    if (ret == 0) {
  2508. -        mnt_index = i;
  2509. -        break;
  2510. -    }
  2511. -    }
  2512. -    if (mnt_index == -1) {
  2513. -    fprintf(stderr, "Error: could not find filesystem for %s in pvfstab",
  2514. -        filename);
  2515. +    ret = PVFS_util_resolve(filename, &cur_fs, pvfs_path, PVFS_NAME_MAX);
  2516. +    if (ret < 0) {
  2517. +    PVFS_perror("PVFS_util_resolve", ret);
  2518.      /* TODO: pick a good error for this */
  2519.      ret = -1;
  2520.      goto resolve_error;
  2521.      }
  2522. -
  2523. -    ret = PVFS_sys_getparent(ADIOI_PVFS2_fs_id_list[mnt_index], pvfs_path,
  2524. -        credentials, &resp_getparent);
  2525. +    ret = PVFS_sys_getparent(cur_fs, pvfs_path, &credentials, &resp_getparent);
  2526.  
  2527.      ret = PVFS_sys_remove(resp_getparent.basename, 
  2528. -        resp_getparent.parent_refn, credentials);
  2529. +        resp_getparent.parent_ref, &credentials);
  2530.      if (ret < 0) {
  2531.      /* XXX: better error handling */
  2532.      ADIOI_PVFS2_pvfs_error_convert(ret, error_code);
  2533.      return;
  2534.      }
  2535.      *error_code = MPI_SUCCESS;
  2536.      return;
  2537.  
  2538. Index: romio/adio/ad_pvfs2/ad_pvfs2_fcntl.c
  2539. ===================================================================
  2540. RCS file: /home/MPI/cvsMaster/romio/adio/ad_pvfs2/ad_pvfs2_fcntl.c,v
  2541. retrieving revision 1.3
  2542. retrieving revision 1.5
  2543. --- romio/adio/ad_pvfs2/ad_pvfs2_fcntl.c    5 Aug 2003 22:59:20 -0000    1.3
  2544. +++ romio/adio/ad_pvfs2/ad_pvfs2_fcntl.c    20 May 2004 20:31:05 -0000    1.5
  2545. @@ -1,11 +1,11 @@
  2546.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  2547.  /* 
  2548. - *   $Id: ad_pvfs2_fcntl.c,v 1.3 2003/08/05 22:59:20 robl Exp $    
  2549. + *   $Id: ad_pvfs2_fcntl.c,v 1.5 2004/05/20 20:31:05 robl Exp $    
  2550.   *
  2551.   *   Copyright (C) 1997 University of Chicago. 
  2552.   *   See COPYRIGHT notice in top-level directory.
  2553.   */
  2554.  
  2555.  #include "ad_pvfs2.h"
  2556.  #include "adio_extern.h"
  2557.  #include "ad_pvfs2_common.h"
  2558. @@ -16,18 +16,18 @@
  2559.      ADIOI_PVFS2_fs *pvfs_fs;
  2560.      PVFS_sysresp_getattr resp_getattr;
  2561.  
  2562.      pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr;
  2563.  
  2564.      switch(flag) {
  2565.  
  2566.      case ADIO_FCNTL_GET_FSIZE:
  2567. -    ret = PVFS_sys_getattr(pvfs_fs->pinode_refn, PVFS_ATTR_SYS_SIZE, 
  2568. -        pvfs_fs->credentials, &resp_getattr);
  2569. +    ret = PVFS_sys_getattr(pvfs_fs->object_ref, PVFS_ATTR_SYS_SIZE, 
  2570. +        &(pvfs_fs->credentials), &resp_getattr);
  2571.      if (ret < 0 ) {
  2572.          ADIOI_PVFS2_pvfs_error_convert(ret, error_code);
  2573.      } else {
  2574.          *error_code = MPI_SUCCESS;
  2575.      }
  2576.      fcntl_struct->fsize = resp_getattr.attr.size;
  2577.      return;
  2578.  
  2579. Index: romio/adio/ad_pvfs2/ad_pvfs2_flush.c
  2580. ===================================================================
  2581. RCS file: /home/MPI/cvsMaster/romio/adio/ad_pvfs2/ad_pvfs2_flush.c,v
  2582. retrieving revision 1.3
  2583. retrieving revision 1.9
  2584. --- romio/adio/ad_pvfs2/ad_pvfs2_flush.c    30 Oct 2003 18:53:40 -0000    1.3
  2585. +++ romio/adio/ad_pvfs2/ad_pvfs2_flush.c    20 May 2004 20:31:05 -0000    1.9
  2586. @@ -1,41 +1,49 @@
  2587.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  2588.  /* 
  2589. - *   $Id: ad_pvfs2_flush.c,v 1.3 2003/10/30 18:53:40 robl Exp $    
  2590. + *   $Id: ad_pvfs2_flush.c,v 1.9 2004/05/20 20:31:05 robl Exp $    
  2591.   *
  2592.   *   Copyright (C) 1997 University of Chicago. 
  2593.   *   See COPYRIGHT notice in top-level directory.
  2594.   */
  2595.  
  2596.  #include "ad_pvfs2.h"
  2597.  #include "ad_pvfs2_common.h"
  2598.  
  2599. -/* we want to be a bit clever here:  at scale, every client sending a flush
  2600. - * will stress the server unnecessarily.  One process should wait for everyone
  2601. - * to catch up, do the sync, then broadcast the result.
  2602. +/* we want to be a bit clever here:  at scale, if every client sends a
  2603. + * flush request, it will stress the PVFS2 servers with redundant
  2604. + * PVFS_sys_flush requests.  Instead, one process should wait for
  2605. + * everyone to catch up, do the sync, then broadcast the result.  We can
  2606. + * get away with this thanks to PVFS2's stateless design 
  2607.   */
  2608. +
  2609.  void ADIOI_PVFS2_Flush(ADIO_File fd, int *error_code)
  2610.  {
  2611. -    int ret, rank, tmprank, dummy1, dummy2;
  2612. +    int ret, rank, dummy=0, dummy_in=0; 
  2613.      ADIOI_PVFS2_fs *pvfs_fs;
  2614.  
  2615.      *error_code = MPI_SUCCESS;
  2616.  
  2617.      pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr;
  2618.  
  2619.      MPI_Comm_rank(fd->comm, &rank);
  2620.  
  2621. -    /* the cheapest way we know to let one process know everyone is here */
  2622. -    MPI_Gather(&dummy1, 1, MPI_INT, &dummy2, 1, MPI_INT, 0, fd->comm);
  2623.  
  2624. -    if (rank == 0) {
  2625. -    ret = PVFS_sys_flush(pvfs_fs->pinode_refn, pvfs_fs->credentials);
  2626. +    /* unlike ADIOI_PVFS2_Resize, MPI_File_sync() does not perform any
  2627. +     * syncronization */
  2628. +    MPI_Reduce(&dummy_in, &dummy, 1, MPI_INT, MPI_SUM, 
  2629. +        fd->hints->ranklist[0], fd->comm);
  2630. +
  2631. +    /* io_worker computed in ADIO_Open */
  2632. +    if (rank == fd->hints->ranklist[0]) {
  2633. +    ret = PVFS_sys_flush(pvfs_fs->object_ref, &(pvfs_fs->credentials));
  2634.      MPI_Bcast(&ret, 1, MPI_INT, 0, fd->comm);
  2635. -    }
  2636. +    } else {
  2637.      MPI_Bcast(&ret, 1, MPI_INT, 0, fd->comm);
  2638. +    }
  2639.      if (ret < 0)
  2640.      ADIOI_PVFS2_pvfs_error_convert(ret, error_code);
  2641.  }
  2642.  
  2643.  /* 
  2644.   * vim: ts=8 sts=4 sw=4 noexpandtab 
  2645.   */
  2646. Index: romio/adio/ad_pvfs2/ad_pvfs2_open.c
  2647. ===================================================================
  2648. RCS file: /home/MPI/cvsMaster/romio/adio/ad_pvfs2/ad_pvfs2_open.c,v
  2649. retrieving revision 1.11
  2650. retrieving revision 1.14
  2651. --- romio/adio/ad_pvfs2/ad_pvfs2_open.c    2 Nov 2003 15:55:18 -0000    1.11
  2652. +++ romio/adio/ad_pvfs2/ad_pvfs2_open.c    20 May 2004 20:31:05 -0000    1.14
  2653. @@ -1,22 +1,22 @@
  2654.  /* -*- Mode: C; c-basic-offset:4 ; -*-
  2655.   * vim: ts=8 sts=4 sw=4 noexpandtab
  2656. - *   $Id: ad_pvfs2_open.c,v 1.11 2003/11/02 15:55:18 rross Exp $
  2657. + *   $Id: ad_pvfs2_open.c,v 1.14 2004/05/20 20:31:05 robl Exp $
  2658.   *
  2659.   *   Copyright (C) 1997 University of Chicago. 
  2660.   *   See COPYRIGHT notice in top-level directory.
  2661.   */
  2662.  
  2663.  #include "ad_pvfs2.h"
  2664.  #include "ad_pvfs2_common.h"
  2665.  
  2666.  struct open_status_s {
  2667.      int error;
  2668. -    PVFS_pinode_reference pinode_refn;
  2669. +    PVFS_object_ref object_ref;
  2670.  };
  2671.  typedef struct open_status_s open_status;
  2672.      
  2673.      /* steps for getting a handle:  (it gets a little convoluted, but at least
  2674.       * it's deterministic) 
  2675.       * . lookup the file.  
  2676.       * . if lookup succeeds, but we were passed MPI_MODE_EXCL, that's an error
  2677.       * . if lookup fails, the file might not exist. 
  2678. @@ -39,128 +39,123 @@
  2679.  
  2680.      ADIOI_PVFS2_makeattribs(&attribs);
  2681.  
  2682.      memset(&resp_lookup, 0, sizeof(resp_lookup));
  2683.      memset(&resp_getparent, 0, sizeof(resp_getparent));
  2684.      memset(&resp_create, 0, sizeof(resp_create));
  2685.  
  2686.      ret = PVFS_sys_lookup(fs_id, pvfs_name,
  2687. -        pvfs2_fs->credentials, &resp_lookup, PVFS2_LOOKUP_LINK_FOLLOW);
  2688. +        &(pvfs2_fs->credentials), &resp_lookup, PVFS2_LOOKUP_LINK_FOLLOW);
  2689.      if ( (ret < 0) ) { /* XXX: check what the error was */
  2690.      if (access_mode & MPI_MODE_CREATE)  {
  2691.          ret = PVFS_sys_getparent(fs_id, pvfs_name,
  2692. -            pvfs2_fs->credentials, &resp_getparent); 
  2693. +            &(pvfs2_fs->credentials), &resp_getparent); 
  2694.          if (ret < 0) {
  2695.          fprintf(stderr, "pvfs_sys_getparent returns with %d\n", ret);
  2696.          o_status->error = ret;
  2697.          return;
  2698.          } 
  2699.          ret = PVFS_sys_create(resp_getparent.basename, 
  2700. -            resp_getparent.parent_refn, attribs, 
  2701. -            pvfs2_fs->credentials, &resp_create); 
  2702. +            resp_getparent.parent_ref, attribs, 
  2703. +            &(pvfs2_fs->credentials), NULL, &resp_create); 
  2704.  
  2705.          if (ret < 0) { /* XXX: should only do this for EEXISTS */
  2706.          ret = PVFS_sys_lookup(fs_id, pvfs_name,
  2707. -            pvfs2_fs->credentials, &resp_lookup, 
  2708. +            &(pvfs2_fs->credentials), &resp_lookup, 
  2709.              PVFS2_LOOKUP_LINK_FOLLOW);
  2710.          if ( ret < 0 ) {
  2711.              o_status->error = ret;
  2712.              return;
  2713.          }
  2714.          o_status->error = ret;
  2715. -        o_status->pinode_refn = resp_lookup.pinode_refn;
  2716. +        o_status->object_ref = resp_lookup.ref;
  2717.          return;
  2718.          }
  2719. -        o_status->pinode_refn = resp_create.pinode_refn;
  2720. +        o_status->object_ref = resp_create.ref;
  2721.      } else {
  2722.          fprintf(stderr, "cannot create file without MPI_MODE_CREATE\n");
  2723.          o_status->error = ret;
  2724.          return;
  2725.      }
  2726.      } else if (access_mode & MPI_MODE_EXCL) {
  2727.      /* lookup should not succeed if opened with EXCL */
  2728.      o_status->error = -1; /* XXX: what should it be? */
  2729.      return;
  2730.      } else {
  2731. -    o_status->pinode_refn = resp_lookup.pinode_refn;
  2732. +    o_status->object_ref = resp_lookup.ref;
  2733.      }
  2734.      o_status->error = ret;
  2735.      return;
  2736.  
  2737.  }
  2738.  
  2739.  
  2740.  /* if MPI_File_open was called with MPI_MODE_CREATE|MPI_MODE_EXCL, then we have
  2741.   * a little problem: our usual open-and-broadcast test will not work because
  2742.   * only one person (the first aggregator) will perform the open w/ CREATE|EXCL
  2743.   */
  2744.  void ADIOI_PVFS2_Open(ADIO_File fd, int *error_code)
  2745.  {
  2746. -    int rank, ret, i, mnt_index=-1;
  2747. +    int rank, ret;
  2748. +    PVFS_fs_id cur_fs;
  2749.      char pvfs_path[PVFS_NAME_MAX] = {0};
  2750.  
  2751.      ADIOI_PVFS2_fs *pvfs2_fs;
  2752.  
  2753.      /* since one process is doing the open, that means one process is also
  2754. -     * doing the error checking.  define a struct for both the pinode and the
  2755. -     * error code to broadcast to all the processors */
  2756. +     * doing the error checking.  define a struct for both the object reference
  2757. +     * and the error code to broadcast to all the processors */
  2758.  
  2759.      open_status o_status;
  2760.      MPI_Datatype open_status_type;
  2761.      MPI_Datatype types[2] = {MPI_INT, MPI_BYTE};
  2762. -    int lens[2] = {1, sizeof(PVFS_pinode_reference)};
  2763. +    int lens[2] = {1, sizeof(PVFS_object_ref)};
  2764.      MPI_Aint offsets[2];
  2765.      
  2766.      pvfs2_fs = (ADIOI_PVFS2_fs *)ADIOI_Malloc(sizeof(ADIOI_PVFS2_fs));
  2767.      if (pvfs2_fs == NULL) {
  2768.      /* graceful way to handle out of memory? */
  2769.      ADIOI_PVFS2_pvfs_error_convert(0, error_code);
  2770.      return;
  2771.      }
  2772.  
  2773.      MPI_Comm_rank(fd->comm, &rank);
  2774.  
  2775.      MPI_Address(&o_status.error, &offsets[0]);
  2776. -    MPI_Address(&o_status.pinode_refn, &offsets[1]);
  2777. +    MPI_Address(&o_status.object_ref, &offsets[1]);
  2778.  
  2779.      MPI_Type_struct(2, lens, offsets, types, &open_status_type);
  2780.      MPI_Type_commit(&open_status_type);
  2781.  
  2782.      ADIOI_PVFS2_Init(error_code);
  2783.      if (*error_code != MPI_SUCCESS)
  2784.      {
  2785. -    /* XXX: handle errors */
  2786. +    ADIOI_PVFS2_pvfs_error_convert(0, error_code);
  2787.      return;
  2788.      }
  2789.  
  2790.      ADIOI_PVFS2_makecredentials(&(pvfs2_fs->credentials));
  2791.  
  2792.      /* we only have to do this on one node. we'll broadcast the handle to
  2793.       * everyone else in the communicator */
  2794.  
  2795.      if (rank == fd->hints->ranklist[0]) {
  2796.      /* given the filename, figure out which pvfs filesystem it is on */
  2797. -    for(i=0; i<ADIOI_PVFS2_mntlist.ptab_count; i++) {
  2798. -        ret = PVFS_util_remove_dir_prefix(fd->filename, 
  2799. -            ADIOI_PVFS2_mntlist.ptab_array[i].mnt_dir, 
  2800. +    ret = PVFS_util_resolve(fd->filename, &cur_fs, 
  2801.              pvfs_path, PVFS_NAME_MAX);
  2802. -        if (ret == 0) {
  2803. -        mnt_index = i;
  2804. -        break;
  2805. -        }
  2806. -    }
  2807. -    if (mnt_index == -1) {
  2808. -        fprintf(stderr, "Error: could not find filesystem for %s in pvfstab", fd->filename);
  2809. +    if (ret < 0 ) {
  2810. +        PVFS_perror("PVFS_util_resolve", ret);
  2811.          /* TODO: pick a good error for this */
  2812.          o_status.error = -1;
  2813. -    } else 
  2814. -        fake_an_open(ADIOI_PVFS2_fs_id_list[mnt_index], pvfs_path,
  2815. +    } else  {
  2816. +        fake_an_open(cur_fs, pvfs_path,
  2817.              fd->access_mode, pvfs2_fs, &o_status);
  2818.      }
  2819. +    }
  2820.  
  2821.      /* NOTE: if MPI_MODE_EXCL was set, ADIO_Open will call
  2822.       * ADIOI_PVFS2_Open from just one processor.  This really confuses MPI when
  2823.       * one procesor on a communicator broadcasts to no listners.  
  2824.       *
  2825.       * Since ADIO_Open will close the file and call ADIOI_PVFS2_Open again (but
  2826.       * w/o EXCL), we can bail out right here and return early */
  2827.      if ( (fd->access_mode & MPI_MODE_EXCL)  ) {
  2828. @@ -170,25 +165,25 @@
  2829.      } else {
  2830.          ADIOI_Free(pvfs2_fs);
  2831.          ADIOI_PVFS2_pvfs_error_convert(o_status.error, error_code);
  2832.      } 
  2833.      MPI_Type_free(&open_status_type);
  2834.      return;
  2835.      } 
  2836.  
  2837. -    /* broadcast status and (if successful) valid pinode refn */
  2838. +    /* broadcast status and (if successful) valid object reference */
  2839.      MPI_Bcast(MPI_BOTTOM, 1, open_status_type, 0, fd->comm);
  2840.  
  2841.      if (o_status.error != 0 ) { 
  2842.      ADIOI_Free(pvfs2_fs);
  2843.      ADIOI_PVFS2_pvfs_error_convert(o_status.error, error_code);
  2844.      return;
  2845.      }
  2846.  
  2847. -    pvfs2_fs->pinode_refn = o_status.pinode_refn;
  2848. +    pvfs2_fs->object_ref = o_status.object_ref;
  2849.      fd->fs_ptr = pvfs2_fs;
  2850.  
  2851.      MPI_Type_free(&open_status_type);
  2852.  
  2853.      *error_code = MPI_SUCCESS;
  2854.      return;
  2855.  }
  2856. Index: romio/adio/ad_pvfs2/ad_pvfs2_read.c
  2857. ===================================================================
  2858. RCS file: /home/MPI/cvsMaster/romio/adio/ad_pvfs2/ad_pvfs2_read.c,v
  2859. retrieving revision 1.7
  2860. retrieving revision 1.10
  2861. --- romio/adio/ad_pvfs2/ad_pvfs2_read.c    7 Aug 2003 23:34:31 -0000    1.7
  2862. +++ romio/adio/ad_pvfs2/ad_pvfs2_read.c    7 Jun 2004 20:48:15 -0000    1.10
  2863. @@ -1,11 +1,11 @@
  2864.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  2865.  /* 
  2866. - *   $Id: ad_pvfs2_read.c,v 1.7 2003/08/07 23:34:31 robl Exp $
  2867. + *   $Id: ad_pvfs2_read.c,v 1.10 2004/06/07 20:48:15 robl Exp $
  2868.   *
  2869.   *   Copyright (C) 1997 University of Chicago. 
  2870.   *   See COPYRIGHT notice in top-level directory.
  2871.   */
  2872.  
  2873.  #include "adio.h"
  2874.  #include "adio_extern.h"
  2875.  #include "ad_pvfs2.h"
  2876. @@ -34,26 +34,26 @@
  2877.  
  2878.      ret = PVFS_Request_contiguous(len, PVFS_BYTE, &file_req);
  2879.      if (ret < 0) {
  2880.      fprintf(stderr, "pvfs_request_contig returns with %d\n", ret);
  2881.      goto error_request;
  2882.      }
  2883.  
  2884.      if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {
  2885. -    ret = PVFS_sys_read(pvfs_fs->pinode_refn, file_req, offset, buf, 
  2886. -        mem_req, pvfs_fs->credentials, &resp_io);
  2887. +    ret = PVFS_sys_read(pvfs_fs->object_ref, file_req, offset, buf, 
  2888. +        mem_req, &(pvfs_fs->credentials), &resp_io);
  2889.      if (ret < 0 ) {
  2890.          fprintf(stderr, "pvfs_sys_read returns with %d\n", ret);
  2891.          goto error_read;
  2892.      }
  2893.      fd->fp_sys_posn = offset + (int)resp_io.total_completed;
  2894.      } else { 
  2895. -    ret = PVFS_sys_read(pvfs_fs->pinode_refn, file_req, fd->fp_ind, buf, 
  2896. -        mem_req, pvfs_fs->credentials, &resp_io);
  2897. +    ret = PVFS_sys_read(pvfs_fs->object_ref, file_req, fd->fp_ind, buf, 
  2898. +        mem_req, &(pvfs_fs->credentials), &resp_io);
  2899.      if (ret < 0) {
  2900.          fprintf(stderr, "pvfs_sys_read returns with %d\n", ret);
  2901.          goto error_read;
  2902.      }
  2903.      fd->fp_ind += (int)resp_io.total_completed;
  2904.      fd->fp_sys_posn = fd->fp_ind;
  2905.      }
  2906.  #ifdef HAVE_STATUS_SET_BYTES
  2907. @@ -69,17 +69,719 @@
  2908.  }
  2909.  
  2910.  
  2911.  void ADIOI_PVFS2_ReadStrided(ADIO_File fd, void *buf, int count,
  2912.                         MPI_Datatype datatype, int file_ptr_type,
  2913.                         ADIO_Offset offset, ADIO_Status *status, int
  2914.                         *error_code)
  2915.  {
  2916. -    /* for now, defer to the generic operations. pvfs2 should have a lot of
  2917. -     * ogood ways to express strided io, however... */
  2918. -    ADIOI_GEN_ReadStrided(fd, buf, count, datatype, 
  2919. -        file_ptr_type, offset, status, error_code);
  2920. +    /* offset is in units of etype relative to the filetype. */
  2921. +    ADIOI_Flatlist_node *flat_buf, *flat_file;
  2922. +    int i, j, k,  brd_size, frd_size=0, st_index=0;
  2923. +    int bufsize, sum, n_etypes_in_filetype, size_in_filetype;
  2924. +    int n_filetypes, etype_in_filetype;
  2925. +    ADIO_Offset abs_off_in_filetype=0;
  2926. +    int filetype_size, etype_size, buftype_size;
  2927. +    MPI_Aint filetype_extent, buftype_extent; 
  2928. +    int buf_count, buftype_is_contig, filetype_is_contig;
  2929. +    ADIO_Offset off, disp, start_off;
  2930. +    int flag, st_frd_size, st_n_filetypes;
  2931. +
  2932. +    int mem_list_count, file_list_count;
  2933. +    PVFS_size *mem_offsets;
  2934. +    int64_t *file_offsets;
  2935. +    int *mem_lengths;
  2936. +    int32_t *file_lengths;
  2937. +    int total_blks_to_read;
  2938. +
  2939. +    int max_mem_list, max_file_list;
  2940. +
  2941. +    int b_blks_read;
  2942. +    int f_data_read;
  2943. +    int size_read=0, n_read_lists, extra_blks;
  2944. +
  2945. +    int end_brd_size, end_frd_size;
  2946. +    int start_k, start_j, new_file_read, new_buffer_read;
  2947. +    int start_mem_offset;
  2948. +    PVFS_Request mem_req, file_req;
  2949. +    ADIOI_PVFS2_fs * pvfs_fs;
  2950. +    PVFS_sysresp_io resp_io;
  2951. +    int err_flag=0;
  2952. +
  2953. +#define MAX_ARRAY_SIZE 64
  2954. +
  2955. +#ifndef PRINT_ERR_MESG
  2956. +  static char myname[] = "ADIOI_PVFS2_ReadStrided";
  2957. +#endif
  2958. +
  2959. +    *error_code = MPI_SUCCESS;  /* changed below if error */
  2960. +
  2961. +    ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
  2962. +    ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
  2963. +    MPI_Type_size(fd->filetype, &filetype_size);
  2964. +    if ( ! filetype_size ) {
  2965. +    *error_code = MPI_SUCCESS; 
  2966. +    return;
  2967. +    }
  2968. +
  2969. +    MPI_Type_extent(fd->filetype, &filetype_extent);
  2970. +    MPI_Type_size(datatype, &buftype_size);
  2971. +    MPI_Type_extent(datatype, &buftype_extent);
  2972. +    etype_size = fd->etype_size;
  2973. +
  2974. +    bufsize = buftype_size * count;
  2975. +    
  2976. +    pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr;
  2977. +
  2978. +    if (!buftype_is_contig && filetype_is_contig) {
  2979. +
  2980. +/* noncontiguous in memory, contiguous in file. */
  2981. +        int64_t file_offsets;
  2982. +    int32_t file_lengths;
  2983. +
  2984. +    ADIOI_Flatten_datatype(datatype);
  2985. +    flat_buf = ADIOI_Flatlist;
  2986. +    while (flat_buf->type != datatype) flat_buf = flat_buf->next;
  2987. +
  2988. +    off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : 
  2989. +        fd->disp + etype_size * offset;
  2990. +
  2991. +    file_list_count = 1;
  2992. +    file_offsets = off;
  2993. +    file_lengths = 0;
  2994. +    total_blks_to_read = count*flat_buf->count;
  2995. +    b_blks_read = 0;
  2996. +
  2997. +    /* allocate arrays according to max usage */
  2998. +    if (total_blks_to_read > MAX_ARRAY_SIZE)
  2999. +        mem_list_count = MAX_ARRAY_SIZE;
  3000. +    else mem_list_count = total_blks_to_read;
  3001. +    mem_offsets = (PVFS_size*)ADIOI_Malloc(mem_list_count*sizeof(PVFS_size));
  3002. +    mem_lengths = (int*)ADIOI_Malloc(mem_list_count*sizeof(int));
  3003. +
  3004. +    j = 0;
  3005. +    /* step through each block in memory, filling memory arrays */
  3006. +    while (b_blks_read < total_blks_to_read) {
  3007. +        for (i=0; i<flat_buf->count; i++) {
  3008. +        mem_offsets[b_blks_read % MAX_ARRAY_SIZE] = 
  3009. +            /* TODO: fix this compiler warning */
  3010. +            ((PVFS_size)buf + j*buftype_extent + flat_buf->indices[i]);
  3011. +        mem_lengths[b_blks_read % MAX_ARRAY_SIZE] = 
  3012. +            flat_buf->blocklens[i];
  3013. +        file_lengths += flat_buf->blocklens[i];
  3014. +        b_blks_read++;
  3015. +        if (!(b_blks_read % MAX_ARRAY_SIZE) ||
  3016. +            (b_blks_read == total_blks_to_read)) {
  3017. +
  3018. +            /* in the case of the last read list call,
  3019. +               adjust mem_list_count */
  3020. +            if (b_blks_read == total_blks_to_read) {
  3021. +                mem_list_count = total_blks_to_read % MAX_ARRAY_SIZE;
  3022. +            /* in case last read list call fills max arrays */
  3023. +            if (!mem_list_count) mem_list_count = MAX_ARRAY_SIZE;
  3024. +            }
  3025. +            err_flag = PVFS_Request_hindexed(mem_list_count, 
  3026. +                mem_lengths, mem_offsets, PVFS_BYTE, &mem_req);
  3027. +            if (err_flag < 0) break;
  3028. +            err_flag = PVFS_Request_contiguous(file_lengths, 
  3029. +                PVFS_BYTE, &file_req);
  3030. +            if (err_flag < 0) break;
  3031. +            err_flag = PVFS_sys_read(pvfs_fs->object_ref, file_req, 
  3032. +                file_offsets, PVFS_BOTTOM, mem_req, 
  3033. +                &(pvfs_fs->credentials), &resp_io);
  3034. +          
  3035. +            /* in the case of error or the last read list call, 
  3036. +             * leave here */
  3037. +            if (err_flag || b_blks_read == total_blks_to_read) break;
  3038. +
  3039. +            file_offsets += file_lengths;
  3040. +            file_lengths = 0;
  3041. +        } 
  3042. +        } /* for (i=0; i<flat_buf->count; i++) */
  3043. +        j++;
  3044. +    } /* while (b_blks_read < total_blks_to_read) */
  3045. +    ADIOI_Free(mem_offsets);
  3046. +    ADIOI_Free(mem_lengths);
  3047. +
  3048. +        if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off;
  3049. +
  3050. +    fd->fp_sys_posn = -1;  /* set it to null. */
  3051. +
  3052. +#ifdef HAVE_STATUS_SET_BYTES
  3053. +    MPIR_Status_set_bytes(status, datatype, bufsize);
  3054. +    /* This isa temporary way of filling in status.  The right way is to
  3055. +       keep tracke of how much data was actually read adn placed in buf
  3056. +       by ADIOI_BUFFERED_READ. */
  3057. +#endif
  3058. +    ADIOI_Delete_flattened(datatype);
  3059. +
  3060. +    return;
  3061. +    } /* if (!buftype_is_contig && filetype_is_contig) */
  3062. +
  3063. +    /* know file is noncontiguous from above */
  3064. +    /* noncontiguous in file */
  3065. +
  3066. +    /* filetype already flattened in ADIO_Open */
  3067. +    flat_file = ADIOI_Flatlist;
  3068. +    while (flat_file->type != fd->filetype) flat_file = flat_file->next;
  3069. +
  3070. +    disp = fd->disp;
  3071. +
  3072. +    /* for each case - ADIO_Individual pointer or explicit, find the file
  3073. +       offset in bytes (offset), n_filetypes (how many filetypes into
  3074. +       file to start), frd_size (remaining amount of data in present
  3075. +       file block), and st_index (start point in terms of blocks in
  3076. +       starting filetype) */
  3077. +    if (file_ptr_type == ADIO_INDIVIDUAL) {
  3078. +        offset = fd->fp_ind; /* in bytes */
  3079. +    n_filetypes = -1;
  3080. +    flag = 0;
  3081. +    while (!flag) {
  3082. +        n_filetypes++;
  3083. +        for (i=0; i<flat_file->count; i++) {
  3084. +            if (disp + flat_file->indices[i] + 
  3085. +            (ADIO_Offset) n_filetypes*filetype_extent +
  3086. +            flat_file->blocklens[i]  >= offset) {
  3087. +            st_index = i;
  3088. +            frd_size = (int) (disp + flat_file->indices[i] + 
  3089. +                      (ADIO_Offset) n_filetypes*filetype_extent
  3090. +                      + flat_file->blocklens[i] - offset);
  3091. +            flag = 1;
  3092. +            break;
  3093. +        }
  3094. +        }
  3095. +    } /* while (!flag) */
  3096. +    } /* if (file_ptr_type == ADIOI_INDIVIDUAL) */
  3097. +    else {
  3098. +        n_etypes_in_filetype = filetype_size/etype_size;
  3099. +    n_filetypes = (int) (offset / n_etypes_in_filetype);
  3100. +    etype_in_filetype = (int) (offset % n_etypes_in_filetype);
  3101. +    size_in_filetype = etype_in_filetype * etype_size;
  3102. +    
  3103. +    sum = 0;
  3104. +    for (i=0; i<flat_file->count; i++) {
  3105. +        sum += flat_file->blocklens[i];
  3106. +        if (sum > size_in_filetype) {
  3107. +            st_index = i;
  3108. +        frd_size = sum - size_in_filetype;
  3109. +        abs_off_in_filetype = flat_file->indices[i] +
  3110. +            size_in_filetype - (sum - flat_file->blocklens[i]);
  3111. +        break;
  3112. +        }
  3113. +    }
  3114. +    
  3115. +    /* abs. offset in bytes in the file */
  3116. +    offset = disp + (ADIO_Offset) n_filetypes*filetype_extent + 
  3117. +        abs_off_in_filetype;
  3118. +    } /* else [file_ptr_type != ADIOI_INDIVIDUAL] */
  3119. +
  3120. +    start_off = offset;
  3121. +    st_frd_size = frd_size;
  3122. +    st_n_filetypes = n_filetypes;
  3123. +    
  3124. +    if (buftype_is_contig && !filetype_is_contig) {
  3125. +
  3126. +/* contiguous in memory, noncontiguous in file. should be the most
  3127. +   common case. */
  3128. +
  3129. +        int mem_lengths;
  3130. +    char *mem_offsets;
  3131. +    
  3132. +    i = 0;
  3133. +    j = st_index;
  3134. +    n_filetypes = st_n_filetypes;
  3135. +    
  3136. +    mem_list_count = 1;
  3137. +    
  3138. +    /* determine how many blocks in file to read */
  3139. +    f_data_read = ADIOI_MIN(st_frd_size, bufsize);
  3140. +    total_blks_to_read = 1;
  3141. +    j++;
  3142. +    while (f_data_read < bufsize) {
  3143. +        f_data_read += flat_file->blocklens[j];
  3144. +        total_blks_to_read++;
  3145. +        if (j<(flat_file->count-1)) j++;
  3146. +        else j = 0;    
  3147. +    }
  3148. +      
  3149. +    j = st_index;
  3150. +    n_filetypes = st_n_filetypes;
  3151. +    n_read_lists = total_blks_to_read/MAX_ARRAY_SIZE;
  3152. +    extra_blks = total_blks_to_read%MAX_ARRAY_SIZE;
  3153. +    
  3154. +    mem_offsets = buf;
  3155. +    mem_lengths = 0;
  3156. +    
  3157. +    /* if at least one full readlist, allocate file arrays
  3158. +       at max array size and don't free until very end */
  3159. +    if (n_read_lists) {
  3160. +        file_offsets = (int64_t*)ADIOI_Malloc(MAX_ARRAY_SIZE*
  3161. +                          sizeof(int64_t));
  3162. +        file_lengths = (int32_t*)ADIOI_Malloc(MAX_ARRAY_SIZE*
  3163. +                          sizeof(int32_t));
  3164. +    }
  3165. +    /* if there's no full readlist allocate file arrays according
  3166. +       to needed size (extra_blks) */
  3167. +    else {
  3168. +        file_offsets = (int64_t*)ADIOI_Malloc(extra_blks*
  3169. +                          sizeof(int64_t));
  3170. +        file_lengths = (int32_t*)ADIOI_Malloc(extra_blks*
  3171. +                          sizeof(int32_t));
  3172. +    }
  3173. +    
  3174. +    /* for file arrays that are of MAX_ARRAY_SIZE, build arrays */
  3175. +    for (i=0; i<n_read_lists; i++) {
  3176. +        file_list_count = MAX_ARRAY_SIZE;
  3177. +        if(!i) {
  3178. +            file_offsets[0] = offset;
  3179. +        file_lengths[0] = st_frd_size;
  3180. +        mem_lengths = st_frd_size;
  3181. +        }
  3182. +        for (k=0; k<MAX_ARRAY_SIZE; k++) {
  3183. +            if (i || k) {
  3184. +            file_offsets[k] = disp + n_filetypes*filetype_extent
  3185. +              + flat_file->indices[j];
  3186. +            file_lengths[k] = flat_file->blocklens[j];
  3187. +            mem_lengths += file_lengths[k];
  3188. +        }
  3189. +        if (j<(flat_file->count - 1)) j++;
  3190. +        else {
  3191. +            j = 0;
  3192. +            n_filetypes++;
  3193. +        }
  3194. +        } /* for (k=0; k<MAX_ARRAY_SIZE; k++) */
  3195. +        err_flag = PVFS_Request_contiguous(mem_lengths, 
  3196. +            PVFS_BYTE, &mem_req);
  3197. +        if (err_flag < 0) 
  3198. +        goto error_state;
  3199. +        err_flag = PVFS_Request_hindexed(file_list_count, file_lengths, 
  3200. +            file_offsets, PVFS_BYTE, &file_req);
  3201. +        if (err_flag < 0)
  3202. +        goto error_state;
  3203. +        /* PVFS_Request_hindexed already expresses the offsets into the
  3204. +         * file, so we should not pass in an offset if we are using
  3205. +         * hindexed for the file type */
  3206. +        err_flag = PVFS_sys_write(pvfs_fs->object_ref, file_req, 0, 
  3207. +            mem_offsets, mem_req, &(pvfs_fs->credentials), &resp_io);
  3208. +        if (err_flag < 0)
  3209. +        goto error_state;
  3210. +        mem_offsets += mem_lengths;
  3211. +        mem_lengths = 0;
  3212. +    } /* for (i=0; i<n_read_lists; i++) */
  3213. +
  3214. +    /* for file arrays smaller than MAX_ARRAY_SIZE (last read_list call) */
  3215. +    if (extra_blks) {
  3216. +        file_list_count = extra_blks;
  3217. +        if(!i) {
  3218. +            file_offsets[0] = offset;
  3219. +        file_lengths[0] = st_frd_size;
  3220. +        }
  3221. +        for (k=0; k<extra_blks; k++) {
  3222. +            if(i || k) {
  3223. +            file_offsets[k] = disp + n_filetypes*filetype_extent +
  3224. +              flat_file->indices[j];
  3225. +            if (k == (extra_blks - 1)) {
  3226. +                file_lengths[k] = bufsize - (int32_t) mem_lengths
  3227. +              - (int32_t) mem_offsets + (int32_t)  buf;
  3228. +            }
  3229. +            else file_lengths[k] = flat_file->blocklens[j];
  3230. +        } /* if(i || k) */
  3231. +        mem_lengths += file_lengths[k];
  3232. +        if (j<(flat_file->count - 1)) j++;
  3233. +        else {
  3234. +            j = 0;
  3235. +            n_filetypes++;
  3236. +        }
  3237. +        } /* for (k=0; k<extra_blks; k++) */
  3238. +        err_flag = PVFS_Request_contiguous(mem_lengths, 
  3239. +            PVFS_BYTE, &mem_req);
  3240. +        if (err_flag < 0)
  3241. +        goto error_state;
  3242. +        err_flag = PVFS_Request_hindexed(file_list_count, file_lengths, 
  3243. +            file_offsets, PVFS_BYTE, &file_req);
  3244. +        if (err_flag < 0)
  3245. +        goto error_state;
  3246. +        /* as above, use 0 for 'offset' when using hindexed file type*/
  3247. +        err_flag = PVFS_sys_write(pvfs_fs->object_ref, file_req, 0, 
  3248. +            mem_offsets, mem_req, &(pvfs_fs->credentials), &resp_io);
  3249. +        if (err_flag < 0)
  3250. +        goto error_state;
  3251. +    }
  3252. +    }
  3253. +    else {
  3254. +/* noncontiguous in memory as well as in file */
  3255. +      
  3256. +        ADIOI_Flatten_datatype(datatype);
  3257. +    flat_buf = ADIOI_Flatlist;
  3258. +    while (flat_buf->type != datatype) flat_buf = flat_buf->next;
  3259. +
  3260. +    size_read = 0;
  3261. +    n_filetypes = st_n_filetypes;
  3262. +    frd_size = st_frd_size;
  3263. +    brd_size = flat_buf->blocklens[0];
  3264. +    buf_count = 0;
  3265. +    start_mem_offset = 0;
  3266. +    start_k = k = 0;
  3267. +    start_j = st_index;
  3268. +    max_mem_list = 0;
  3269. +    max_file_list = 0;
  3270. +
  3271. +    /* run through and file max_file_list and max_mem_list so that you 
  3272. +       can allocate the file and memory arrays less than MAX_ARRAY_SIZE
  3273. +       if possible */
  3274. +
  3275. +    while (size_read < bufsize) {
  3276. +        k = start_k;
  3277. +        new_buffer_read = 0;
  3278. +        mem_list_count = 0;
  3279. +        while ((mem_list_count < MAX_ARRAY_SIZE) && 
  3280. +           (new_buffer_read < bufsize-size_read)) {
  3281. +            /* find mem_list_count and file_list_count such that both are
  3282. +           less than MAX_ARRAY_SIZE, the sum of their lengths are
  3283. +           equal, and the sum of all the data read and data to be
  3284. +           read in the next immediate read list is less than
  3285. +           bufsize */
  3286. +            if(mem_list_count) {
  3287. +            if((new_buffer_read + flat_buf->blocklens[k] + 
  3288. +            size_read) > bufsize) {
  3289. +                end_brd_size = new_buffer_read + 
  3290. +                flat_buf->blocklens[k] - (bufsize - size_read);
  3291. +            new_buffer_read = bufsize - size_read;
  3292. +            }
  3293. +            else {
  3294. +                new_buffer_read += flat_buf->blocklens[k];
  3295. +            end_brd_size = flat_buf->blocklens[k];
  3296. +            }
  3297. +        }
  3298. +        else {
  3299. +            if (brd_size > (bufsize - size_read)) {
  3300. +                new_buffer_read = bufsize - size_read;
  3301. +            brd_size = new_buffer_read;
  3302. +            }
  3303. +            else new_buffer_read = brd_size;
  3304. +        }
  3305. +        mem_list_count++;
  3306. +        k = (k + 1)%flat_buf->count;
  3307. +         } /* while ((mem_list_count < MAX_ARRAY_SIZE) && 
  3308. +           (new_buffer_read < bufsize-size_read)) */
  3309. +        j = start_j;
  3310. +        new_file_read = 0;
  3311. +        file_list_count = 0;
  3312. +        while ((file_list_count < MAX_ARRAY_SIZE) && 
  3313. +           (new_file_read < new_buffer_read)) {
  3314. +            if(file_list_count) {
  3315. +            if((new_file_read + flat_file->blocklens[j]) > 
  3316. +               new_buffer_read) {
  3317. +                end_frd_size = new_buffer_read - new_file_read;
  3318. +            new_file_read = new_buffer_read;
  3319. +            j--;
  3320. +            }
  3321. +            else {
  3322. +                new_file_read += flat_file->blocklens[j];
  3323. +            end_frd_size = flat_file->blocklens[j];
  3324. +            }
  3325. +        }
  3326. +        else {
  3327. +            if (frd_size > new_buffer_read) {
  3328. +                new_file_read = new_buffer_read;
  3329. +            frd_size = new_file_read;
  3330. +            }
  3331. +            else new_file_read = frd_size;
  3332. +        }
  3333. +        file_list_count++;
  3334. +        if (j < (flat_file->count - 1)) j++;
  3335. +        else j = 0;
  3336. +        
  3337. +        k = start_k;
  3338. +        if ((new_file_read < new_buffer_read) && 
  3339. +            (file_list_count == MAX_ARRAY_SIZE)) {
  3340. +            new_buffer_read = 0;
  3341. +            mem_list_count = 0;
  3342. +            while (new_buffer_read < new_file_read) {
  3343. +                if(mem_list_count) {
  3344. +                if((new_buffer_read + flat_buf->blocklens[k]) >
  3345. +                   new_file_read) {
  3346. +                    end_brd_size = new_file_read - new_buffer_read;
  3347. +                new_buffer_read = new_file_read;
  3348. +                k--;
  3349. +                }
  3350. +                else {
  3351. +                    new_buffer_read += flat_buf->blocklens[k];
  3352. +                end_brd_size = flat_buf->blocklens[k];
  3353. +                }
  3354. +            }
  3355. +            else {
  3356. +                new_buffer_read = brd_size;
  3357. +                if (brd_size > (bufsize - size_read)) {
  3358. +                    new_buffer_read = bufsize - size_read;
  3359. +                brd_size = new_buffer_read;
  3360. +                }
  3361. +            }
  3362. +            mem_list_count++;
  3363. +            k = (k + 1)%flat_buf->count;
  3364. +            } /* while (new_buffer_read < new_file_read) */
  3365. +        } /* if ((new_file_read < new_buffer_read) && (file_list_count
  3366. +             == MAX_ARRAY_SIZE)) */
  3367. +        } /* while ((mem_list_count < MAX_ARRAY_SIZE) && 
  3368. +         (new_buffer_read < bufsize-size_read)) */
  3369. +
  3370. +        /*  fakes filling the readlist arrays of lengths found above  */
  3371. +        k = start_k;
  3372. +        j = start_j;
  3373. +        for (i=0; i<mem_list_count; i++) {         
  3374. +        if(i) {
  3375. +            if (i == (mem_list_count - 1)) {
  3376. +            if (flat_buf->blocklens[k] == end_brd_size)
  3377. +                brd_size = flat_buf->blocklens[(k+1)%
  3378. +                              flat_buf->count];
  3379. +            else {
  3380. +                brd_size = flat_buf->blocklens[k] - end_brd_size;
  3381. +                k--;
  3382. +                buf_count--;
  3383. +            }
  3384. +            }
  3385. +        }
  3386. +        buf_count++;
  3387. +        k = (k + 1)%flat_buf->count;
  3388. +        } /* for (i=0; i<mem_list_count; i++) */
  3389. +        for (i=0; i<file_list_count; i++) {
  3390. +        if (i) {
  3391. +            if (i == (file_list_count - 1)) {
  3392. +            if (flat_file->blocklens[j] == end_frd_size)
  3393. +                frd_size = flat_file->blocklens[(j+1)%
  3394. +                              flat_file->count];   
  3395. +            else {
  3396. +                frd_size = flat_file->blocklens[j] - end_frd_size;
  3397. +                j--;
  3398. +            }
  3399. +            }
  3400. +        }
  3401. +        if (j < flat_file->count - 1) j++;
  3402. +        else {
  3403. +            j = 0;
  3404. +            n_filetypes++;
  3405. +        }
  3406. +        } /* for (i=0; i<file_list_count; i++) */
  3407. +        size_read += new_buffer_read;
  3408. +        start_k = k;
  3409. +        start_j = j;
  3410. +        if (max_mem_list < mem_list_count)
  3411. +            max_mem_list = mem_list_count;
  3412. +        if (max_file_list < file_list_count)
  3413. +            max_file_list = file_list_count;
  3414. +        if (max_mem_list == max_mem_list == MAX_ARRAY_SIZE)
  3415. +            break;
  3416. +    } /* while (size_read < bufsize) */
  3417. +
  3418. +    mem_offsets = (PVFS_size*)ADIOI_Malloc(max_mem_list*sizeof(PVFS_size*));
  3419. +    mem_lengths = (int *)ADIOI_Malloc(max_mem_list*sizeof(int));
  3420. +    file_offsets = (int64_t *)ADIOI_Malloc(max_file_list*sizeof(int64_t));
  3421. +    file_lengths = (int32_t *)ADIOI_Malloc(max_file_list*sizeof(int32_t));
  3422. +        
  3423. +    size_read = 0;
  3424. +    n_filetypes = st_n_filetypes;
  3425. +    frd_size = st_frd_size;
  3426. +    brd_size = flat_buf->blocklens[0];
  3427. +    buf_count = 0;
  3428. +    start_mem_offset = 0;
  3429. +    start_k = k = 0;
  3430. +    start_j = st_index;
  3431. +
  3432. +    /*  this section calculates mem_list_count and file_list_count
  3433. +        and also finds the possibly odd sized last array elements
  3434. +        in new_frd_size and new_brd_size  */
  3435. +    
  3436. +    while (size_read < bufsize) {
  3437. +        k = start_k;
  3438. +        new_buffer_read = 0;
  3439. +        mem_list_count = 0;
  3440. +        while ((mem_list_count < MAX_ARRAY_SIZE) && 
  3441. +           (new_buffer_read < bufsize-size_read)) {
  3442. +            /* find mem_list_count and file_list_count such that both are
  3443. +           less than MAX_ARRAY_SIZE, the sum of their lengths are
  3444. +           equal, and the sum of all the data read and data to be
  3445. +           read in the next immediate read list is less than
  3446. +           bufsize */
  3447. +            if(mem_list_count) {
  3448. +            if((new_buffer_read + flat_buf->blocklens[k] + 
  3449. +            size_read) > bufsize) {
  3450. +                end_brd_size = new_buffer_read + 
  3451. +                flat_buf->blocklens[k] - (bufsize - size_read);
  3452. +            new_buffer_read = bufsize - size_read;
  3453. +            }
  3454. +            else {
  3455. +                new_buffer_read += flat_buf->blocklens[k];
  3456. +            end_brd_size = flat_buf->blocklens[k];
  3457. +            }
  3458. +        }
  3459. +        else {
  3460. +            if (brd_size > (bufsize - size_read)) {
  3461. +                new_buffer_read = bufsize - size_read;
  3462. +            brd_size = new_buffer_read;
  3463. +            }
  3464. +            else new_buffer_read = brd_size;
  3465. +        }
  3466. +        mem_list_count++;
  3467. +        k = (k + 1)%flat_buf->count;
  3468. +         } /* while ((mem_list_count < MAX_ARRAY_SIZE) && 
  3469. +           (new_buffer_read < bufsize-size_read)) */
  3470. +        j = start_j;
  3471. +        new_file_read = 0;
  3472. +        file_list_count = 0;
  3473. +        while ((file_list_count < MAX_ARRAY_SIZE) && 
  3474. +           (new_file_read < new_buffer_read)) {
  3475. +            if(file_list_count) {
  3476. +            if((new_file_read + flat_file->blocklens[j]) > 
  3477. +               new_buffer_read) {
  3478. +                end_frd_size = new_buffer_read - new_file_read;
  3479. +            new_file_read = new_buffer_read;
  3480. +            j--;
  3481. +            }
  3482. +            else {
  3483. +                new_file_read += flat_file->blocklens[j];
  3484. +            end_frd_size = flat_file->blocklens[j];
  3485. +            }
  3486. +        }
  3487. +        else {
  3488. +            if (frd_size > new_buffer_read) {
  3489. +                new_file_read = new_buffer_read;
  3490. +            frd_size = new_file_read;
  3491. +            }
  3492. +            else new_file_read = frd_size;
  3493. +        }
  3494. +        file_list_count++;
  3495. +        if (j < (flat_file->count - 1)) j++;
  3496. +        else j = 0;
  3497. +        
  3498. +        k = start_k;
  3499. +        if ((new_file_read < new_buffer_read) && 
  3500. +            (file_list_count == MAX_ARRAY_SIZE)) {
  3501. +            new_buffer_read = 0;
  3502. +            mem_list_count = 0;
  3503. +            while (new_buffer_read < new_file_read) {
  3504. +                if(mem_list_count) {
  3505. +                if((new_buffer_read + flat_buf->blocklens[k]) >
  3506. +                   new_file_read) {
  3507. +                    end_brd_size = new_file_read - new_buffer_read;
  3508. +                new_buffer_read = new_file_read;
  3509. +                k--;
  3510. +                }
  3511. +                else {
  3512. +                    new_buffer_read += flat_buf->blocklens[k];
  3513. +                end_brd_size = flat_buf->blocklens[k];
  3514. +                }
  3515. +            }
  3516. +            else {
  3517. +                new_buffer_read = brd_size;
  3518. +                if (brd_size > (bufsize - size_read)) {
  3519. +                    new_buffer_read = bufsize - size_read;
  3520. +                brd_size = new_buffer_read;
  3521. +                }
  3522. +            }
  3523. +            mem_list_count++;
  3524. +            k = (k + 1)%flat_buf->count;
  3525. +            } /* while (new_buffer_read < new_file_read) */
  3526. +        } /* if ((new_file_read < new_buffer_read) && (file_list_count
  3527. +             == MAX_ARRAY_SIZE)) */
  3528. +        } /* while ((mem_list_count < MAX_ARRAY_SIZE) && 
  3529. +         (new_buffer_read < bufsize-size_read)) */
  3530. +
  3531. +        /*  fills the allocated readlist arrays  */
  3532. +        k = start_k;
  3533. +        j = start_j;
  3534. +        for (i=0; i<mem_list_count; i++) {         
  3535. +            mem_offsets[i] = ((PVFS_size)buf + buftype_extent*
  3536. +                     (buf_count/flat_buf->count) +
  3537. +                     (int)flat_buf->indices[k]);
  3538. +        if(!i) {
  3539. +            mem_lengths[0] = brd_size;
  3540. +            mem_offsets[0] += flat_buf->blocklens[k] - brd_size;
  3541. +        }
  3542. +        else {
  3543. +            if (i == (mem_list_count - 1)) {
  3544. +                mem_lengths[i] = end_brd_size;
  3545. +            if (flat_buf->blocklens[k] == end_brd_size)
  3546. +                brd_size = flat_buf->blocklens[(k+1)%
  3547. +                              flat_buf->count];
  3548. +            else {
  3549. +                brd_size = flat_buf->blocklens[k] - end_brd_size;
  3550. +                k--;
  3551. +                buf_count--;
  3552. +            }
  3553. +            }
  3554. +            else {
  3555. +                mem_lengths[i] = flat_buf->blocklens[k];
  3556. +            }
  3557. +        }
  3558. +        buf_count++;
  3559. +        k = (k + 1)%flat_buf->count;
  3560. +        } /* for (i=0; i<mem_list_count; i++) */
  3561. +        for (i=0; i<file_list_count; i++) {
  3562. +            file_offsets[i] = disp + flat_file->indices[j] + n_filetypes *
  3563. +            filetype_extent;
  3564. +            if (!i) {
  3565. +            file_lengths[0] = frd_size;
  3566. +            file_offsets[0] += flat_file->blocklens[j] - frd_size;
  3567. +        }
  3568. +        else {
  3569. +            if (i == (file_list_count - 1)) {
  3570. +                file_lengths[i] = end_frd_size;
  3571. +            if (flat_file->blocklens[j] == end_frd_size)
  3572. +                frd_size = flat_file->blocklens[(j+1)%
  3573. +                              flat_file->count];   
  3574. +            else {
  3575. +                frd_size = flat_file->blocklens[j] - end_frd_size;
  3576. +                j--;
  3577. +            }
  3578. +            }
  3579. +            else file_lengths[i] = flat_file->blocklens[j];
  3580. +        }
  3581. +        if (j < flat_file->count - 1) j++;
  3582. +        else {
  3583. +            j = 0;
  3584. +            n_filetypes++;
  3585. +        }
  3586. +        } /* for (i=0; i<file_list_count; i++) */
  3587. +        err_flag = PVFS_Request_hindexed(mem_list_count, mem_lengths, 
  3588. +            mem_offsets, PVFS_BYTE, &mem_req);
  3589. +        if (err_flag < 0 ) 
  3590. +        goto error_state;
  3591. +        err_flag = PVFS_Request_hindexed(file_list_count, file_lengths, 
  3592. +            file_offsets, PVFS_BYTE, &file_req);
  3593. +        if (err_flag < 0)
  3594. +        goto error_state;
  3595. +        /* offset will be expressed in memory and file datatypes */
  3596. +        err_flag = PVFS_sys_read(pvfs_fs->object_ref, file_req, 0, 
  3597. +            PVFS_BOTTOM, mem_req, &(pvfs_fs->credentials), &resp_io);
  3598. +        size_read += new_buffer_read;
  3599. +        start_k = k;
  3600. +        start_j = j;
  3601. +    } /* while (size_read < bufsize) */
  3602. +    ADIOI_Free(mem_offsets);
  3603. +    ADIOI_Free(mem_lengths);
  3604. +    }
  3605. +    ADIOI_Free(file_offsets);
  3606. +    ADIOI_Free(file_lengths);
  3607. +    
  3608. +    if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off;
  3609. +
  3610. +error_state:
  3611. +    if (err_flag) {
  3612. +    ADIOI_PVFS2_pvfs_error_convert(err_flag, error_code);
  3613. +    }
  3614. +    else *error_code = MPI_SUCCESS;
  3615. +    
  3616. +    fd->fp_sys_posn = -1;   /* set it to null. */
  3617. +
  3618. +#ifdef HAVE_STATUS_SET_BYTES
  3619. +    MPIR_Status_set_bytes(status, datatype, bufsize);
  3620. +    /* This is a temporary way of filling in status. The right way is to 
  3621. +       keep track of how much data was actually read and placed in buf 
  3622. +       by ADIOI_BUFFERED_READ. */
  3623. +#endif
  3624. +    
  3625. +    if (!buftype_is_contig) ADIOI_Delete_flattened(datatype);
  3626.  }
  3627.  
  3628.  /*
  3629.   * vim: ts=8 sts=4 sw=4 noexpandtab 
  3630.   */
  3631. Index: romio/adio/ad_pvfs2/ad_pvfs2_resize.c
  3632. ===================================================================
  3633. RCS file: /home/MPI/cvsMaster/romio/adio/ad_pvfs2/ad_pvfs2_resize.c,v
  3634. retrieving revision 1.4
  3635. retrieving revision 1.10
  3636. --- romio/adio/ad_pvfs2/ad_pvfs2_resize.c    4 Sep 2003 23:20:09 -0000    1.4
  3637. +++ romio/adio/ad_pvfs2/ad_pvfs2_resize.c    20 May 2004 20:31:05 -0000    1.10
  3638. @@ -1,29 +1,46 @@
  3639.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  3640.  /* 
  3641. - *   $Id: ad_pvfs2_resize.c,v 1.4 2003/09/04 23:20:09 robl Exp $
  3642. + *   $Id: ad_pvfs2_resize.c,v 1.10 2004/05/20 20:31:05 robl Exp $
  3643.   *
  3644.   *   Copyright (C) 1997 University of Chicago. 
  3645.   *   See COPYRIGHT notice in top-level directory.
  3646.   */
  3647.  
  3648.  #include "ad_pvfs2.h"
  3649.  #include "ad_pvfs2_common.h"
  3650.  
  3651. +/* as with ADIOI_PVFS2_Flush, implement the resize operation in a scalable
  3652. + * manner. one process does the work, then broadcasts the result to everyone
  3653. + * else.  fortunately, this operation is defined to be collective */
  3654.  void ADIOI_PVFS2_Resize(ADIO_File fd, ADIO_Offset size, int *error_code)
  3655.  {
  3656. -    int ret;
  3657. +    int ret, rank;
  3658.      ADIOI_PVFS2_fs *pvfs_fs;
  3659.  
  3660. +    *error_code = MPI_SUCCESS;
  3661. +
  3662.      pvfs_fs = (ADIOI_PVFS2_fs*)fd->fs_ptr;
  3663.  
  3664. -    ret = PVFS_sys_truncate(pvfs_fs->pinode_refn, size, pvfs_fs->credentials);
  3665. -    if (ret < 0 ) {
  3666. -    ADIOI_PVFS2_pvfs_error_convert(ret, error_code);
  3667. +    MPI_Comm_rank(fd->comm, &rank);
  3668. +
  3669. +    /* We desginate one node in the communicator to be an 'io_worker' in 
  3670. +     * ADIO_Open.  This node can perform operations on files and then 
  3671. +     * inform the other nodes of the result */
  3672. +
  3673. +    /* we know all processes have reached this point because we did an
  3674. +     * MPI_Barrier in MPI_File_set_size() */
  3675. +
  3676. +    if (rank == fd->hints->ranklist[0]) {
  3677. +    ret = PVFS_sys_truncate(pvfs_fs->object_ref, 
  3678. +        size, &(pvfs_fs->credentials));
  3679. +    MPI_Bcast(&ret, 1, MPI_INT, 0, fd->comm);
  3680.      } else {
  3681. -    *error_code = MPI_SUCCESS;
  3682. +    MPI_Bcast(&ret, 1, MPI_INT, 0, fd->comm);
  3683.      }
  3684. +    if (ret < 0 ) 
  3685. +    ADIOI_PVFS2_pvfs_error_convert(ret, error_code);
  3686.  }
  3687.  
  3688.  /*
  3689.   * vim: ts=8 sts=4 sw=4 noexpandtab 
  3690.   */
  3691. Index: romio/adio/ad_pvfs2/ad_pvfs2_write.c
  3692. ===================================================================
  3693. RCS file: /home/MPI/cvsMaster/romio/adio/ad_pvfs2/ad_pvfs2_write.c,v
  3694. retrieving revision 1.11
  3695. retrieving revision 1.13
  3696. --- romio/adio/ad_pvfs2/ad_pvfs2_write.c    5 Sep 2003 20:47:47 -0000    1.11
  3697. +++ romio/adio/ad_pvfs2/ad_pvfs2_write.c    20 May 2004 20:31:05 -0000    1.13
  3698. @@ -1,11 +1,11 @@
  3699.  /* -*- Mode: C; c-basic-offset:4 ; -*- 
  3700.   *   vim: ts=8 sts=4 sw=4 noexpandtab
  3701. - *   $Id: ad_pvfs2_write.c,v 1.11 2003/09/05 20:47:47 robl Exp $
  3702. + *   $Id: ad_pvfs2_write.c,v 1.13 2004/05/20 20:31:05 robl Exp $
  3703.   *
  3704.   *   Copyright (C) 1997 University of Chicago. 
  3705.   *   See COPYRIGHT notice in top-level directory.
  3706.   */
  3707.  
  3708.  #include "ad_pvfs2.h"
  3709.  #include "adio_extern.h"
  3710.  
  3711. @@ -33,26 +33,26 @@
  3712.  
  3713.      ret = PVFS_Request_contiguous(len, PVFS_BYTE, &file_req);
  3714.      if (ret < 0) {
  3715.      fprintf(stderr, "pvfs_request_contig returns with %d\n", ret);
  3716.      goto error_request;
  3717.      }
  3718.  
  3719.      if (file_ptr_type == ADIO_EXPLICIT_OFFSET) {
  3720. -    ret = PVFS_sys_write(pvfs_fs->pinode_refn, file_req, offset,  buf, 
  3721. -        mem_req, pvfs_fs->credentials, &resp_io);
  3722. +    ret = PVFS_sys_write(pvfs_fs->object_ref, file_req, offset,  buf, 
  3723. +        mem_req, &(pvfs_fs->credentials), &resp_io);
  3724.      if (ret < 0 ) {
  3725.          fprintf(stderr, "pvfs_sys_write returns with %d\n", ret);
  3726.          goto error_write;
  3727.      }
  3728.      fd->fp_sys_posn = offset + (int) resp_io.total_completed;
  3729.      } else {
  3730. -    ret = PVFS_sys_write(pvfs_fs->pinode_refn, file_req, fd->fp_ind, buf, 
  3731. -        mem_req, pvfs_fs->credentials, &resp_io);
  3732. +    ret = PVFS_sys_write(pvfs_fs->object_ref, file_req, fd->fp_ind, buf, 
  3733. +        mem_req, &(pvfs_fs->credentials), &resp_io);
  3734.      if (ret < 0) {
  3735.          fprintf(stderr, "pvfs_sys_write returns with %d\n", ret);
  3736.          goto error_write;
  3737.      }
  3738.      fd->fp_ind += (int)resp_io.total_completed;
  3739.      fd->fp_sys_posn = fd->fp_ind;
  3740.      }
  3741.  #ifdef HAVE_STATUS_SET_BYTES
  3742. @@ -200,19 +200,19 @@
  3743.              }
  3744.  
  3745.              err_flag = PVFS_Request_hindexed(mem_list_count, 
  3746.                  mem_lengths, mem_offsets, PVFS_BYTE, &mem_req);
  3747.              if (err_flag < 0) break;
  3748.              err_flag = PVFS_Request_contiguous(file_lengths, 
  3749.                  PVFS_BYTE, &file_req);
  3750.              if (err_flag < 0) break;
  3751. -            err_flag = PVFS_sys_write(pvfs_fs->pinode_refn, file_req, 
  3752. +            err_flag = PVFS_sys_write(pvfs_fs->object_ref, file_req, 
  3753.                  file_offsets, PVFS_BOTTOM, mem_req, 
  3754. -                pvfs_fs->credentials, &resp_io);
  3755. +                &(pvfs_fs->credentials), &resp_io);
  3756.            
  3757.              /* in the case of error or the last read list call, 
  3758.               * leave here */
  3759.              if (err_flag || b_blks_wrote == total_blks_to_write) break;
  3760.  
  3761.              file_offsets += file_lengths;
  3762.              file_lengths = 0;
  3763.          } 
  3764. @@ -380,18 +380,18 @@
  3765.          goto error_state;
  3766.          err_flag = PVFS_Request_hindexed(file_list_count, file_lengths, 
  3767.              file_offsets, PVFS_BYTE, &file_req);
  3768.          if (err_flag < 0)
  3769.          goto error_state;
  3770.          /* PVFS_Request_hindexed already expresses the offsets into the
  3771.           * file, so we should not pass in an offset if we are using
  3772.           * hindexed for the file type */
  3773. -        err_flag = PVFS_sys_write(pvfs_fs->pinode_refn, file_req, 0, 
  3774. -            mem_offsets, mem_req, pvfs_fs->credentials, &resp_io);
  3775. +        err_flag = PVFS_sys_write(pvfs_fs->object_ref, file_req, 0, 
  3776. +            mem_offsets, mem_req, &(pvfs_fs->credentials), &resp_io);
  3777.          if (err_flag < 0)
  3778.          goto error_state;
  3779.  
  3780.              mem_offsets += mem_lengths;
  3781.              mem_lengths = 0;
  3782.          } /* for (i=0; i<n_write_lists; i++) */
  3783.  
  3784.          /* for file arrays smaller than MAX_ARRAY_SIZE (last read_list call) */
  3785. @@ -422,18 +422,18 @@
  3786.              PVFS_BYTE, &mem_req);
  3787.          if (err_flag < 0)
  3788.          goto error_state;
  3789.          err_flag = PVFS_Request_hindexed(file_list_count, file_lengths, 
  3790.              file_offsets, PVFS_BYTE, &file_req);
  3791.          if (err_flag < 0)
  3792.          goto error_state;
  3793.          /* as above, use 0 for 'offset' when using hindexed file type*/
  3794. -        err_flag = PVFS_sys_write(pvfs_fs->pinode_refn, file_req, 0, 
  3795. -            mem_offsets, mem_req, pvfs_fs->credentials, &resp_io);
  3796. +        err_flag = PVFS_sys_write(pvfs_fs->object_ref, file_req, 0, 
  3797. +            mem_offsets, mem_req, &(pvfs_fs->credentials), &resp_io);
  3798.          if (err_flag < 0)
  3799.          goto error_state;
  3800.          }
  3801.      } 
  3802.      else {
  3803.          /* noncontiguous in memory as well as in file */
  3804.  
  3805.          ADIOI_Flatten_datatype(datatype);
  3806. @@ -776,18 +776,18 @@
  3807.              mem_offsets, PVFS_BYTE, &mem_req);
  3808.          if (err_flag < 0 ) 
  3809.          goto error_state;
  3810.          err_flag = PVFS_Request_hindexed(file_list_count, file_lengths, 
  3811.              file_offsets, PVFS_BYTE, &file_req);
  3812.          if (err_flag < 0)
  3813.          goto error_state;
  3814.          /* offset will be expressed in memory and file datatypes */
  3815. -        err_flag = PVFS_sys_write(pvfs_fs->pinode_refn, file_req, 0, 
  3816. -            PVFS_BOTTOM, mem_req, pvfs_fs->credentials, &resp_io);
  3817. +        err_flag = PVFS_sys_write(pvfs_fs->object_ref, file_req, 0, 
  3818. +            PVFS_BOTTOM, mem_req, &(pvfs_fs->credentials), &resp_io);
  3819.          size_wrote += new_buffer_write;
  3820.          start_k = k;
  3821.          start_j = j;
  3822.      } /* while (size_wrote < bufsize) */
  3823.      ADIOI_Free(mem_offsets);
  3824.      ADIOI_Free(mem_lengths);
  3825.      }
  3826.      ADIOI_Free(file_offsets);
  3827. Index: romio/adio/ad_sfs/.cvsignore
  3828. ===================================================================
  3829. RCS file: /home/MPI/cvsMaster/romio/adio/ad_sfs/.cvsignore,v
  3830. retrieving revision 1.2
  3831. retrieving revision 1.3
  3832. --- romio/adio/ad_sfs/.cvsignore    1 Aug 2003 13:30:18 -0000    1.2
  3833. +++ romio/adio/ad_sfs/.cvsignore    19 Jan 2004 14:49:36 -0000    1.3
  3834. @@ -1,2 +1,4 @@
  3835.  Makefile
  3836.  .deps
  3837. +*.bb
  3838. +*.bbg
  3839. Index: romio/adio/ad_testfs/.cvsignore
  3840. ===================================================================
  3841. RCS file: /home/MPI/cvsMaster/romio/adio/ad_testfs/.cvsignore,v
  3842. retrieving revision 1.2
  3843. retrieving revision 1.3
  3844. --- romio/adio/ad_testfs/.cvsignore    1 Aug 2003 13:30:19 -0000    1.2
  3845. +++ romio/adio/ad_testfs/.cvsignore    19 Jan 2004 14:49:36 -0000    1.3
  3846. @@ -1,2 +1,4 @@
  3847.  Makefile
  3848.  .deps
  3849. +*.bb
  3850. +*.bbg
  3851. Index: romio/adio/ad_ufs/.cvsignore
  3852. ===================================================================
  3853. RCS file: /home/MPI/cvsMaster/romio/adio/ad_ufs/.cvsignore,v
  3854. retrieving revision 1.2
  3855. retrieving revision 1.3
  3856. --- romio/adio/ad_ufs/.cvsignore    1 Aug 2003 13:30:19 -0000    1.2
  3857. +++ romio/adio/ad_ufs/.cvsignore    19 Jan 2004 14:49:37 -0000    1.3
  3858. @@ -1,2 +1,4 @@
  3859.  Makefile
  3860.  .deps
  3861. +*.bb
  3862. +*.bbg
  3863. Index: romio/adio/ad_xfs/.cvsignore
  3864. ===================================================================
  3865. RCS file: /home/MPI/cvsMaster/romio/adio/ad_xfs/.cvsignore,v
  3866. retrieving revision 1.3
  3867. retrieving revision 1.4
  3868. --- romio/adio/ad_xfs/.cvsignore    1 Aug 2003 13:30:19 -0000    1.3
  3869. +++ romio/adio/ad_xfs/.cvsignore    19 Jan 2004 14:49:37 -0000    1.4
  3870. @@ -1,4 +1,5 @@
  3871.  Makefile
  3872.  *.safe
  3873. -
  3874.  .deps
  3875. +*.bb
  3876. +*.bbg
  3877. Index: romio/adio/common/.cvsignore
  3878. ===================================================================
  3879. RCS file: /home/MPI/cvsMaster/romio/adio/common/.cvsignore,v
  3880. retrieving revision 1.3
  3881. retrieving revision 1.4
  3882. --- romio/adio/common/.cvsignore    1 Aug 2003 13:30:19 -0000    1.3
  3883. +++ romio/adio/common/.cvsignore    19 Jan 2004 14:49:37 -0000    1.4
  3884. @@ -1,5 +1,6 @@
  3885.  Makefile
  3886.  Debug*
  3887.  Release*
  3888. -
  3889.  .deps
  3890. +*.bb
  3891. +*.bbg
  3892. Index: romio/adio/common/Makefile.in
  3893. ===================================================================
  3894. RCS file: /home/MPI/cvsMaster/romio/adio/common/Makefile.in,v
  3895. retrieving revision 1.12
  3896. retrieving revision 1.15
  3897. --- romio/adio/common/Makefile.in    7 Oct 2003 22:12:29 -0000    1.12
  3898. +++ romio/adio/common/Makefile.in    6 Feb 2004 15:57:24 -0000    1.15
  3899. @@ -14,17 +14,18 @@
  3900.  @VPATH@
  3901.  
  3902.  AD_OBJECTS = ad_close.o ad_init.o ad_end.o ad_open.o setfn.o flatten.o \
  3903.        async_list.o req_malloc.o malloc.o ad_read_coll.o eof_offset.o \
  3904.        ad_write_coll.o lock.o ad_read_str.o ad_write_str.o iscontig.o \
  3905.        get_fp_posn.o ad_seek.o ad_delete.o ad_flush.o ad_hints.o error.o \
  3906.        ad_fstype.o ad_get_sh_fp.o ad_set_sh_fp.o shfp_fname.o byte_offset.o \
  3907.        status_setb.o ad_aggregate.o cb_config_list.o \
  3908. -      ad_read_str_naive.o gencheck.o ad_set_view.o ad_iopen.o
  3909. +      ad_read_str_naive.o gencheck.o ad_set_view.o ad_iopen.o \
  3910. +      ad_write_str_naive.o
  3911.  
  3912.  all: $(LIBNAME)
  3913.      @if [ "@ENABLE_SHLIB@" != "none" ] ; then \
  3914.          $(MAKE) $(SHLIBNAME).la ;\
  3915.      fi
  3916.  
  3917.  .SUFFIXES: $(SUFFIXES) .p .lo
  3918.  
  3919. @@ -39,8 +40,14 @@
  3920.  
  3921.  AD_LOOBJECTS = $(AD_OBJECTS:.o=.lo)
  3922.  
  3923.  $(SHLIBNAME).la: $(AD_LOOBJECTS)
  3924.      $(AR) $(SHLIBNAME).la $(AD_LOOBJECTS)
  3925.  
  3926.  clean:
  3927.      @rm -f *.o *.lo
  3928. +
  3929. +tags: TAGS
  3930. +SOURCES = ${AD_OBJECTS:.o=.c}
  3931. +HEADERS = 
  3932. +TAGS:${HEADERS} ${SOURCES}
  3933. +    here=`cd ../../../../.. && pwd` ; cd ${srcdir} && etags -o $$here/TAGS --append ${HEADERS} ${SOURCES}
  3934. Index: romio/adio/common/ad_open.c
  3935. ===================================================================
  3936. RCS file: /home/MPI/cvsMaster/romio/adio/common/ad_open.c,v
  3937. retrieving revision 1.23
  3938. retrieving revision 1.27
  3939. --- romio/adio/common/ad_open.c    5 Sep 2003 22:35:49 -0000    1.23
  3940. +++ romio/adio/common/ad_open.c    20 May 2004 07:43:36 -0000    1.27
  3941. @@ -1,11 +1,11 @@
  3942.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  3943.  /* 
  3944. - *   $Id: ad_open.c,v 1.23 2003/09/05 22:35:49 gropp Exp $    
  3945. + *   $Id: ad_open.c,v 1.27 2004/05/20 07:43:36 David Exp $    
  3946.   *
  3947.   *   Copyright (C) 1997 University of Chicago. 
  3948.   *   See COPYRIGHT notice in top-level directory.
  3949.   */
  3950.  
  3951.  #include "adio.h"
  3952.  #include "adio_extern.h"
  3953.  #include "adio_cb_config_list.h"
  3954. @@ -24,17 +24,17 @@
  3955.      ADIO_File fd;
  3956.      ADIO_cb_name_array array;
  3957.      int orig_amode_excl, orig_amode_wronly, err, rank, procs, agg_rank;
  3958.      char *value;
  3959.  #if defined(MPICH2) || !defined(PRINT_ERR_MSG)
  3960.      static char myname[] = "ADIO_OPEN";
  3961.  #endif
  3962.  
  3963. -    int rank_ct;
  3964. +    int rank_ct, max_error_code;
  3965.      int *tmp_ranklist;
  3966.      MPI_Comm aggregator_comm = MPI_COMM_NULL; /* just for deferred opens */
  3967.  
  3968.      *error_code = MPI_SUCCESS;
  3969.  
  3970.      fd = (ADIO_File) ADIOI_Malloc(sizeof(struct ADIOI_FileD));
  3971.      if (fd == NULL) {
  3972.      /* NEED TO HANDLE ENOMEM ERRORS */
  3973. @@ -121,17 +121,17 @@
  3974.      *error_code = MPI_ERR_UNKNOWN;
  3975.  #else
  3976.      *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR, myname,
  3977.                        "Open Error", "%s", 
  3978.                        "No aggregators match");
  3979.      ADIOI_Error(MPI_FILE_NULL, *error_code, myname);
  3980.  #endif
  3981.      fd = ADIO_FILE_NULL;
  3982. -    return fd;
  3983. +        goto fn_exit;
  3984.      }
  3985.  
  3986.      /* deferred open: 
  3987.       * we can only do this if 'fd->hints->deferred_open' is set (which means
  3988.       * the user hinted 'no_indep_rw' and collective buffering).  Furthermore,
  3989.       * we only do this if our collective read/write routines use our generic
  3990.       * function, and not an fs-specific routine (we can defer opens only if we
  3991.       * use our aggreagation code). 
  3992. @@ -148,24 +148,28 @@
  3993.          /* MPI_Comm_split will create a communication group of aggregators.
  3994.           * for non-aggregators it will return MPI_COMM_NULL .  we rely on
  3995.           * fd->agg_comm == MPI_COMM_NULL for non-aggregators in several
  3996.           * tests in the code  */
  3997.          if (is_aggregator(rank, fd)) {
  3998.              MPI_Comm_split(fd->comm, 1, 0, &aggregator_comm);
  3999.              fd->agg_comm = aggregator_comm;
  4000.              MPI_Comm_rank(fd->agg_comm, &agg_rank);
  4001. -            if (agg_rank == 0) fd->io_worker = 1;
  4002. +            if (agg_rank == 0) {
  4003. +                fd->io_worker = 1;
  4004. +            }
  4005.          } else {
  4006.              MPI_Comm_split(fd->comm, MPI_UNDEFINED, 0, &aggregator_comm);
  4007.              fd->agg_comm = aggregator_comm;
  4008.          }
  4009.  
  4010.      } else {
  4011. -        if (rank == 0) fd->io_worker = 1;
  4012. +        if (rank == 0) {
  4013. +            fd->io_worker = 1;
  4014. +        }
  4015.      }
  4016.  
  4017.      orig_amode_excl = access_mode;
  4018.  
  4019.      /* we used to do this EXCL|CREAT workaround in MPI_File_open, but if we are
  4020.       * doing deferred open, we more easily know who the aggregators are in
  4021.       * ADIO_Open */
  4022.      if ((access_mode & MPI_MODE_CREATE) && (access_mode & MPI_MODE_EXCL)) {
  4023. @@ -179,24 +183,17 @@
  4024.          MPI_Bcast(error_code, 1, MPI_INT, 0, fd->comm);
  4025.          /* if no error, close the file and reopen normally below */
  4026.          if (*error_code == MPI_SUCCESS) 
  4027.              (*(fd->fns->ADIOI_xxx_Close))(fd, error_code);
  4028.         }
  4029.         else MPI_Bcast(error_code, 1, MPI_INT, 0, fd->comm);
  4030.  
  4031.         if (*error_code != MPI_SUCCESS) {
  4032. -           /* copied from below */
  4033. -           ADIOI_Free(fd->fns);
  4034. -           MPI_Comm_free(&(fd->comm));
  4035. -           free(fd->filename);
  4036. -           MPI_Info_free(&(fd->info));
  4037. -           ADIOI_Free(fd);
  4038. -           fd = ADIO_FILE_NULL;
  4039. -           return fd;
  4040. +           goto fn_exit;
  4041.         } 
  4042.         else {
  4043.             /* turn off EXCL for real open */
  4044.             access_mode = access_mode ^ MPI_MODE_EXCL; 
  4045.         }
  4046.      }
  4047.  
  4048.      /* if we are doing deferred open, non-aggregators should return now */
  4049. @@ -204,17 +201,17 @@
  4050.              ADIOI_Uses_generic_read(fd) &&
  4051.              ADIOI_Uses_generic_write(fd) ) {
  4052.          if (fd->agg_comm == MPI_COMM_NULL) {
  4053.              /* we might have turned off EXCL for the aggregators.
  4054.               * restore access_mode that non-aggregators get the right
  4055.               * value from get_amode */
  4056.              fd->access_mode = orig_amode_excl;
  4057.              *error_code = MPI_SUCCESS;
  4058. -            return fd;
  4059. +            goto fn_exit;
  4060.          }
  4061.      }
  4062.  
  4063.  /* For writing with data sieving, a read-modify-write is needed. If 
  4064.     the file is opened for write_only, the read will fail. Therefore,
  4065.     if write_only, open the file as read_write, but record it as write_only
  4066.     in fd, so that get_amode returns the right answer. */
  4067.  
  4068. @@ -235,24 +232,55 @@
  4069.  
  4070.      /* if we turned off EXCL earlier, then we should turn it back on */
  4071.      if (fd->access_mode != orig_amode_excl) fd->access_mode = orig_amode_excl;
  4072.  
  4073.      /* for deferred open: this process has opened the file (because if we are
  4074.       * not an aggregaor and we are doing deferred open, we returned earlier)*/
  4075.      fd->is_open = 1;
  4076.  
  4077. -    /* if error, free and set fd to NULL */
  4078. -    if (*error_code != MPI_SUCCESS) {
  4079. -    ADIOI_Free(fd->fns);
  4080. -    MPI_Comm_free(&(fd->comm));
  4081. -    free(fd->filename);
  4082. -    MPI_Info_free(&(fd->info));
  4083. + fn_exit:
  4084. +    MPI_Allreduce(error_code, &max_error_code, 1, MPI_INT, MPI_MAX, comm);
  4085. +    if (max_error_code != MPI_SUCCESS) {
  4086. +
  4087. +        /* If the file was successfully opened, close it */
  4088. +        if (*error_code == MPI_SUCCESS) {
  4089. +        
  4090. +            /* in the deferred open case, only those who have actually
  4091. +               opened the file should close it */
  4092. +            if (fd->hints->deferred_open && 
  4093. +                ADIOI_Uses_generic_read(fd) &&
  4094. +                ADIOI_Uses_generic_write(fd) ) {
  4095. +                if (fd->agg_comm != MPI_COMM_NULL) {
  4096. +                    (*(fd->fns->ADIOI_xxx_Close))(fd, error_code);
  4097. +                }
  4098. +            }
  4099. +            else {
  4100. +                (*(fd->fns->ADIOI_xxx_Close))(fd, error_code);
  4101. +            }
  4102. +        }
  4103. +
  4104. +    if (fd->fns) ADIOI_Free(fd->fns);
  4105. +    if (fd->filename) free(fd->filename);
  4106. +    if (fd->info != MPI_INFO_NULL) MPI_Info_free(&(fd->info));
  4107.      ADIOI_Free(fd);
  4108.      fd = ADIO_FILE_NULL;
  4109. +    if (*error_code == MPI_SUCCESS)
  4110. +    {
  4111. +#ifdef MPICH2
  4112. +        *error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**oremote_fail", 0);
  4113. +#elif defined(PRINT_ERR_MSG)
  4114. +        *error_code = MPI_ERR_UNKNOWN;
  4115. +#else
  4116. +        *error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ADIO_ERROR, myname,
  4117. +        "Open Error", "%s", 
  4118. +        "Open failed on a remote node");
  4119. +        ADIOI_Error(MPI_FILE_NULL, *error_code, myname);
  4120. +#endif
  4121. +    }
  4122.      }
  4123.  
  4124.      return fd;
  4125.  }
  4126.  
  4127.  /* a simple linear search. possible enancement: add a my_cb_nodes_index member
  4128.   * ( index into cb_nodes, else -1 if not aggregator ) for faster lookups 
  4129.   *
  4130. @@ -265,10 +293,8 @@
  4131.          int i;
  4132.          
  4133.          for (i=0; i< fd->hints->cb_nodes; i++ ) {
  4134.                  if ( rank == fd->hints->ranklist[i] )
  4135.                          return 1;
  4136.          }
  4137.          return 0;
  4138.  }
  4139. -
  4140. -
  4141. Index: romio/adio/common/ad_write_str.c
  4142. ===================================================================
  4143. RCS file: /home/MPI/cvsMaster/romio/adio/common/ad_write_str.c,v
  4144. retrieving revision 1.11
  4145. retrieving revision 1.12
  4146. --- romio/adio/common/ad_write_str.c    26 Jul 2003 23:16:57 -0000    1.11
  4147. +++ romio/adio/common/ad_write_str.c    16 Dec 2003 21:51:22 -0000    1.12
  4148. @@ -1,11 +1,11 @@
  4149.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  4150.  /* 
  4151. - *   $Id: ad_write_str.c,v 1.11 2003/07/26 23:16:57 David Exp $    
  4152. + *   $Id: ad_write_str.c,v 1.12 2003/12/16 21:51:22 robl Exp $    
  4153.   *
  4154.   *   Copyright (C) 1997 University of Chicago. 
  4155.   *   See COPYRIGHT notice in top-level directory.
  4156.   */
  4157.  
  4158.  #include "adio.h"
  4159.  #include "adio_extern.h"
  4160.  
  4161. @@ -96,16 +96,31 @@
  4162.      int buf_count, buftype_is_contig, filetype_is_contig;
  4163.      ADIO_Offset userbuf_off;
  4164.      ADIO_Offset off, req_off, disp, end_offset=0, writebuf_off, start_off;
  4165.      char *writebuf;
  4166.      int flag, st_fwr_size, st_n_filetypes, writebuf_len, write_sz;
  4167.      ADIO_Status status1;
  4168.      int new_bwr_size, new_fwr_size, max_bufsize;
  4169.  
  4170. +    if (fd->hints->ds_write == ADIOI_HINT_DISABLE) {
  4171. +        /* if user has disabled data sieving on reads, use naive
  4172. +     * approach instead.
  4173. +     */
  4174. +    ADIOI_GEN_WriteStrided_naive(fd, 
  4175. +                    buf,
  4176. +                    count,
  4177. +                    datatype,
  4178. +                    file_ptr_type,
  4179. +                    offset,
  4180. +                    status,
  4181. +                    error_code);
  4182. +        return;
  4183. +    }
  4184. +
  4185.      *error_code = MPI_SUCCESS;  /* changed below if error */
  4186.  
  4187.      ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
  4188.      ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
  4189.  
  4190.      MPI_Type_size(fd->filetype, &filetype_size);
  4191.      if ( ! filetype_size ) {
  4192.      *error_code = MPI_SUCCESS; 
  4193. Index: romio/adio/common/ad_write_str_naive.c
  4194. ===================================================================
  4195. RCS file: romio/adio/common/ad_write_str_naive.c
  4196. --- /dev/null    1 Jan 1970 00:00:00 -0000
  4197. +++ romio/adio/common/ad_write_str_naive.c    16 Dec 2003 21:51:23 -0000    1.1
  4198. @@ -0,0 +1,375 @@
  4199. +/* -*- Mode: C; c-basic-offset:4 ; -*- */
  4200. +/* 
  4201. + *   $Id: ad_write_str_naive.c,v 1.1 2003/12/16 21:51:23 robl Exp $
  4202. + *
  4203. + *   Copyright (C) 2001 University of Chicago. 
  4204. + *   See COPYRIGHT notice in top-level directory.
  4205. + */
  4206. +
  4207. +#include "adio.h"
  4208. +#include "adio_extern.h"
  4209. +
  4210. +void ADIOI_GEN_WriteStrided_naive(ADIO_File fd, void *buf, int count,
  4211. +                       MPI_Datatype buftype, int file_ptr_type,
  4212. +                       ADIO_Offset offset, ADIO_Status *status, int
  4213. +                       *error_code)
  4214. +{
  4215. +    /* offset is in units of etype relative to the filetype. */
  4216. +
  4217. +    ADIOI_Flatlist_node *flat_buf, *flat_file;
  4218. +    /* bwr == buffer write; fwr == file write */
  4219. +    int bwr_size, fwr_size=0, b_index;
  4220. +    int bufsize, size, sum, n_etypes_in_filetype, size_in_filetype;
  4221. +    int n_filetypes, etype_in_filetype;
  4222. +    ADIO_Offset abs_off_in_filetype=0;
  4223. +    int filetype_size, etype_size, buftype_size, req_len;
  4224. +    MPI_Aint filetype_extent, buftype_extent; 
  4225. +    int buf_count, buftype_is_contig, filetype_is_contig;
  4226. +    ADIO_Offset userbuf_off;
  4227. +    ADIO_Offset off, req_off, disp, end_offset=0, start_off;
  4228. +    ADIO_Status status1;
  4229. +
  4230. +    *error_code = MPI_SUCCESS;  /* changed below if error */
  4231. +
  4232. +    ADIOI_Datatype_iscontig(buftype, &buftype_is_contig);
  4233. +    ADIOI_Datatype_iscontig(fd->filetype, &filetype_is_contig);
  4234. +
  4235. +    MPI_Type_size(fd->filetype, &filetype_size);
  4236. +    if ( ! filetype_size ) {
  4237. +    *error_code = MPI_SUCCESS; 
  4238. +    return;
  4239. +    }
  4240. +
  4241. +    MPI_Type_extent(fd->filetype, &filetype_extent);
  4242. +    MPI_Type_size(buftype, &buftype_size);
  4243. +    MPI_Type_extent(buftype, &buftype_extent);
  4244. +    etype_size = fd->etype_size;
  4245. +
  4246. +    bufsize = buftype_size * count;
  4247. +
  4248. +    /* contiguous in buftype and filetype is handled elsewhere */
  4249. +
  4250. +    if (!buftype_is_contig && filetype_is_contig) {
  4251. +        int b_count;
  4252. +    /* noncontiguous in memory, contiguous in file. */
  4253. +
  4254. +    ADIOI_Flatten_datatype(buftype);
  4255. +    flat_buf = ADIOI_Flatlist;
  4256. +    while (flat_buf->type != buftype) flat_buf = flat_buf->next;
  4257. +
  4258. +        off = (file_ptr_type == ADIO_INDIVIDUAL) ? fd->fp_ind : 
  4259. +              fd->disp + etype_size * offset;
  4260. +
  4261. +    start_off = off;
  4262. +    end_offset = off + bufsize - 1;
  4263. +
  4264. +    /* if atomicity is true, lock (exclusive) the region to be accessed */
  4265. +        if ((fd->atomicity) && (fd->file_system != ADIO_PIOFS) && 
  4266. +       (fd->file_system != ADIO_PVFS))
  4267. +    {
  4268. +            ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1);
  4269. +    }
  4270. +
  4271. +    /* for each region in the buffer, grab the data and put it in
  4272. +     * place
  4273. +     */
  4274. +        for (b_count=0; b_count < count; b_count++) {
  4275. +            for (b_index=0; b_index < flat_buf->count; b_index++) {
  4276. +                userbuf_off = b_count*buftype_extent + 
  4277. +                      flat_buf->indices[b_index];
  4278. +        req_off = off;
  4279. +        req_len = flat_buf->blocklens[b_index];
  4280. +
  4281. +        ADIO_WriteContig(fd, 
  4282. +                (char *) buf + userbuf_off,
  4283. +                req_len, 
  4284. +                MPI_BYTE, 
  4285. +                    ADIO_EXPLICIT_OFFSET,
  4286. +                req_off,
  4287. +                &status1,
  4288. +                error_code);
  4289. +        if (*error_code != MPI_SUCCESS) return;
  4290. +
  4291. +        /* off is (potentially) used to save the final offset later */
  4292. +                off += flat_buf->blocklens[b_index];
  4293. +            }
  4294. +    }
  4295. +
  4296. +        if ((fd->atomicity) && (fd->file_system != ADIO_PIOFS) && 
  4297. +       (fd->file_system != ADIO_PVFS))
  4298. +    {
  4299. +            ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1);
  4300. +    }
  4301. +
  4302. +        if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off;
  4303. +
  4304. +    }
  4305. +
  4306. +    else {  /* noncontiguous in file */
  4307. +        int f_index, st_fwr_size, st_index = 0, st_n_filetypes;
  4308. +    int flag;
  4309. +
  4310. +        /* First we're going to calculate a set of values for use in all
  4311. +     * the noncontiguous in file cases:
  4312. +     * start_off - starting byte position of data in file
  4313. +     * end_offset - last byte offset to be acessed in the file
  4314. +     * st_n_filetypes - how far into the file we start in terms of
  4315. +     *                  whole filetypes
  4316. +     * st_index - index of block in first filetype that we will be
  4317. +     *            starting in (?)
  4318. +     * st_fwr_size - size of the data in the first filetype block
  4319. +     *               that we will write (accounts for being part-way
  4320. +     *               into writing this block of the filetype
  4321. +     *
  4322. +     */
  4323. +
  4324. +    /* filetype already flattened in ADIO_Open */
  4325. +    flat_file = ADIOI_Flatlist;
  4326. +    while (flat_file->type != fd->filetype) flat_file = flat_file->next;
  4327. +    disp = fd->disp;
  4328. +
  4329. +    if (file_ptr_type == ADIO_INDIVIDUAL) {
  4330. +        start_off = fd->fp_ind; /* in bytes */
  4331. +        n_filetypes = -1;
  4332. +        flag = 0;
  4333. +        while (!flag) {
  4334. +                n_filetypes++;
  4335. +        for (f_index=0; f_index < flat_file->count; f_index++) {
  4336. +            if (disp + flat_file->indices[f_index] + 
  4337. +                       (ADIO_Offset) n_filetypes*filetype_extent + 
  4338. +               flat_file->blocklens[f_index] >= start_off) 
  4339. +            {
  4340. +                /* this block contains our starting position */
  4341. +
  4342. +            st_index = f_index;
  4343. +            fwr_size = (int) (disp + flat_file->indices[f_index] + 
  4344. +                        (ADIO_Offset) n_filetypes*filetype_extent + 
  4345. +                   flat_file->blocklens[f_index] - start_off);
  4346. +            flag = 1;
  4347. +            break;
  4348. +            }
  4349. +        }
  4350. +        }
  4351. +    }
  4352. +    else {
  4353. +        n_etypes_in_filetype = filetype_size/etype_size;
  4354. +        n_filetypes = (int) (offset / n_etypes_in_filetype);
  4355. +        etype_in_filetype = (int) (offset % n_etypes_in_filetype);
  4356. +        size_in_filetype = etype_in_filetype * etype_size;
  4357. +        sum = 0;
  4358. +        for (f_index=0; f_index < flat_file->count; f_index++) {
  4359. +        sum += flat_file->blocklens[f_index];
  4360. +        if (sum > size_in_filetype) {
  4361. +            st_index = f_index;
  4362. +            fwr_size = sum - size_in_filetype;
  4363. +            abs_off_in_filetype = flat_file->indices[f_index] +
  4364. +                              size_in_filetype - 
  4365. +                              (sum - flat_file->blocklens[f_index]);
  4366. +            break;
  4367. +        }
  4368. +        }
  4369. +
  4370. +        /* abs. offset in bytes in the file */
  4371. +        start_off = disp + (ADIO_Offset) n_filetypes*filetype_extent + 
  4372. +                    abs_off_in_filetype;
  4373. +    }
  4374. +
  4375. +    st_fwr_size = fwr_size;
  4376. +    st_n_filetypes = n_filetypes;
  4377. +
  4378. +    /* start_off, st_n_filetypes, st_index, and st_fwr_size are 
  4379. +     * all calculated at this point
  4380. +     */
  4381. +
  4382. +        /* Calculate end_offset, the last byte-offset that will be accessed.
  4383. +         * e.g., if start_off=0 and 100 bytes to be written, end_offset=99
  4384. +     */
  4385. +    userbuf_off = 0;
  4386. +    f_index = st_index;
  4387. +    off = start_off;
  4388. +    fwr_size = ADIOI_MIN(st_fwr_size, bufsize);
  4389. +    while (userbuf_off < bufsize) {
  4390. +        userbuf_off += fwr_size;
  4391. +        end_offset = off + fwr_size - 1;
  4392. +
  4393. +        if (f_index < (flat_file->count - 1)) f_index++;
  4394. +        else {
  4395. +        f_index = 0;
  4396. +        n_filetypes++;
  4397. +        }
  4398. +
  4399. +        off = disp + flat_file->indices[f_index] + 
  4400. +              (ADIO_Offset) n_filetypes*filetype_extent;
  4401. +        fwr_size = ADIOI_MIN(flat_file->blocklens[f_index], 
  4402. +                             bufsize-(int)userbuf_off);
  4403. +    }
  4404. +
  4405. +    /* End of calculations.  At this point the following values have
  4406. +     * been calculated and are ready for use:
  4407. +     * - start_off
  4408. +     * - end_offset
  4409. +     * - st_n_filetypes
  4410. +     * - st_index
  4411. +     * - st_fwr_size
  4412. +     */
  4413. +
  4414. +    /* if atomicity is true, lock (exclusive) the region to be accessed */
  4415. +        if ((fd->atomicity) && (fd->file_system != ADIO_PIOFS) && 
  4416. +       (fd->file_system != ADIO_PVFS))
  4417. +    {
  4418. +            ADIOI_WRITE_LOCK(fd, start_off, SEEK_SET, end_offset-start_off+1);
  4419. +    }
  4420. +
  4421. +    if (buftype_is_contig && !filetype_is_contig) {
  4422. +        /* contiguous in memory, noncontiguous in file. should be the
  4423. +         * most common case.
  4424. +         */
  4425. +
  4426. +        userbuf_off = 0;
  4427. +        f_index = st_index;
  4428. +        off = start_off;
  4429. +        n_filetypes = st_n_filetypes;
  4430. +        fwr_size = ADIOI_MIN(st_fwr_size, bufsize);
  4431. +
  4432. +        /* while there is still space in the buffer, write more data */
  4433. +        while (userbuf_off < bufsize) {
  4434. +                if (fwr_size) { 
  4435. +                    /* TYPE_UB and TYPE_LB can result in 
  4436. +                       fwr_size = 0. save system call in such cases */ 
  4437. +            req_off = off;
  4438. +            req_len = fwr_size;
  4439. +
  4440. +            ADIO_WriteContig(fd, 
  4441. +                    (char *) buf + userbuf_off,
  4442. +                    req_len, 
  4443. +                    MPI_BYTE, 
  4444. +                    ADIO_EXPLICIT_OFFSET,
  4445. +                    req_off,
  4446. +                    &status1,
  4447. +                    error_code);
  4448. +            if (*error_code != MPI_SUCCESS) return;
  4449. +        }
  4450. +        userbuf_off += fwr_size;
  4451. +
  4452. +                if (off + fwr_size < disp + flat_file->indices[f_index] +
  4453. +                   flat_file->blocklens[f_index] + 
  4454. +           (ADIO_Offset) n_filetypes*filetype_extent)
  4455. +        {
  4456. +            /* important that this value be correct, as it is
  4457. +             * used to set the offset in the fd near the end of
  4458. +             * this function.
  4459. +             */
  4460. +                    off += fwr_size;
  4461. +        }
  4462. +                /* did not reach end of contiguous block in filetype.
  4463. +                 * no more I/O needed. off is incremented by fwr_size.
  4464. +         */
  4465. +                else {
  4466. +            if (f_index < (flat_file->count - 1)) f_index++;
  4467. +            else {
  4468. +            f_index = 0;
  4469. +            n_filetypes++;
  4470. +            }
  4471. +            off = disp + flat_file->indices[f_index] + 
  4472. +                          (ADIO_Offset) n_filetypes*filetype_extent;
  4473. +            fwr_size = ADIOI_MIN(flat_file->blocklens[f_index], 
  4474. +                                 bufsize-(int)userbuf_off);
  4475. +        }
  4476. +        }
  4477. +    }
  4478. +    else {
  4479. +        int i, tmp_bufsize = 0;
  4480. +        /* noncontiguous in memory as well as in file */
  4481. +
  4482. +        ADIOI_Flatten_datatype(buftype);
  4483. +        flat_buf = ADIOI_Flatlist;
  4484. +        while (flat_buf->type != buftype) flat_buf = flat_buf->next;
  4485. +
  4486. +        b_index = buf_count = 0;
  4487. +        i = (int) (flat_buf->indices[0]);
  4488. +        f_index = st_index;
  4489. +        off = start_off;
  4490. +        n_filetypes = st_n_filetypes;
  4491. +        fwr_size = st_fwr_size;
  4492. +        bwr_size = flat_buf->blocklens[0];
  4493. +
  4494. +        /* while we haven't read size * count bytes, keep going */
  4495. +        while (tmp_bufsize < bufsize) {
  4496. +            int new_bwr_size = bwr_size, new_fwr_size = fwr_size;
  4497. +
  4498. +        size = ADIOI_MIN(fwr_size, bwr_size);
  4499. +        if (size) {
  4500. +            req_off = off;
  4501. +            req_len = size;
  4502. +            userbuf_off = i;
  4503. +
  4504. +            ADIO_WriteContig(fd, 
  4505. +                    (char *) buf + userbuf_off,
  4506. +                    req_len, 
  4507. +                    MPI_BYTE, 
  4508. +                    ADIO_EXPLICIT_OFFSET,
  4509. +                    req_off,
  4510. +                    &status1,
  4511. +                    error_code);
  4512. +            if (*error_code != MPI_SUCCESS) return;
  4513. +        }
  4514. +
  4515. +        if (size == fwr_size) {
  4516. +            /* reached end of contiguous block in file */
  4517. +            if (f_index < (flat_file->count - 1)) f_index++;
  4518. +            else {
  4519. +            f_index = 0;
  4520. +            n_filetypes++;
  4521. +            }
  4522. +
  4523. +            off = disp + flat_file->indices[f_index] + 
  4524. +                          (ADIO_Offset) n_filetypes*filetype_extent;
  4525. +
  4526. +            new_fwr_size = flat_file->blocklens[f_index];
  4527. +            if (size != bwr_size) {
  4528. +            i += size;
  4529. +            new_bwr_size -= size;
  4530. +            }
  4531. +        }
  4532. +
  4533. +        if (size == bwr_size) {
  4534. +            /* reached end of contiguous block in memory */
  4535. +
  4536. +            b_index = (b_index + 1)%flat_buf->count;
  4537. +            buf_count++;
  4538. +            i = (int) (buftype_extent*(buf_count/flat_buf->count) +
  4539. +            flat_buf->indices[b_index]);
  4540. +            new_bwr_size = flat_buf->blocklens[b_index];
  4541. +            if (size != fwr_size) {
  4542. +            off += size;
  4543. +            new_fwr_size -= size;
  4544. +            }
  4545. +        }
  4546. +        tmp_bufsize += size;
  4547. +        fwr_size = new_fwr_size;
  4548. +                bwr_size = new_bwr_size;
  4549. +        }
  4550. +    }
  4551. +
  4552. +    /* unlock the file region if we locked it */
  4553. +        if ((fd->atomicity) && (fd->file_system != ADIO_PIOFS) && 
  4554. +       (fd->file_system != ADIO_PVFS))
  4555. +    {
  4556. +            ADIOI_UNLOCK(fd, start_off, SEEK_SET, end_offset-start_off+1);
  4557. +    }
  4558. +
  4559. +    if (file_ptr_type == ADIO_INDIVIDUAL) fd->fp_ind = off;
  4560. +    } /* end of (else noncontiguous in file) */
  4561. +
  4562. +    fd->fp_sys_posn = -1;   /* mark it as invalid. */
  4563. +
  4564. +#ifdef HAVE_STATUS_SET_BYTES
  4565. +    MPIR_Status_set_bytes(status, buftype, bufsize);
  4566. +    /* This is a temporary way of filling in status. The right way is to 
  4567. +     * keep track of how much data was actually written and placed in buf 
  4568. +     */
  4569. +#endif
  4570. +
  4571. +    if (!buftype_is_contig) ADIOI_Delete_flattened(buftype);
  4572. +}
  4573. Index: romio/adio/common/flatten.c
  4574. ===================================================================
  4575. RCS file: /home/MPI/cvsMaster/romio/adio/common/flatten.c,v
  4576. retrieving revision 1.12
  4577. retrieving revision 1.14
  4578. --- romio/adio/common/flatten.c    4 Sep 2003 21:35:29 -0000    1.12
  4579. +++ romio/adio/common/flatten.c    19 Feb 2004 16:24:02 -0000    1.14
  4580. @@ -1,46 +1,72 @@
  4581.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  4582.  /* 
  4583. - *   $Id: flatten.c,v 1.12 2003/09/04 21:35:29 rross Exp $    
  4584. + *   $Id: flatten.c,v 1.14 2004/02/19 16:24:02 robl Exp $    
  4585.   *
  4586.   *   Copyright (C) 1997 University of Chicago. 
  4587.   *   See COPYRIGHT notice in top-level directory.
  4588.   */
  4589.  
  4590.  #include "adio.h"
  4591.  #include "adio_extern.h"
  4592.  #ifdef MPISGI
  4593.  #include "mpisgi2.h"
  4594.  #endif
  4595.  
  4596. -#if 0
  4597. -#define HAVE_MPIR_TYPE_FLATTEN 1
  4598. -#define HAVE_MPIR_TYPE_GET_CONTIG_BLOCKS 1
  4599. -#endif
  4600. -
  4601. -#undef HAVE_MPI_COMBINER_DUP
  4602. -#undef HAVE_MPI_COMBINER_SUBARRAY
  4603. -
  4604.  void ADIOI_Optimize_flattened(ADIOI_Flatlist_node *flat_type);
  4605.  void ADIOI_Flatten_subarray(int ndims,
  4606.                  int *array_of_sizes,
  4607.                  int *array_of_subsizes,
  4608.                  int *array_of_starts,
  4609.                  int order,
  4610.                  MPI_Datatype oldtype,
  4611.                  ADIOI_Flatlist_node *flat,
  4612.                  ADIO_Offset start_offset,
  4613.                  int *inout_index_p);
  4614. +void ADIOI_Flatten_darray(int size,
  4615. +              int rank,
  4616. +              int ndims,
  4617. +              int array_of_gsizes[],
  4618. +              int array_of_distribs[],
  4619. +              int array_of_dargs[],
  4620. +              int array_of_psizes[],
  4621. +              int order,
  4622. +              MPI_Datatype oldtype,
  4623. +              ADIOI_Flatlist_node *flat,
  4624. +              ADIO_Offset start_offset,
  4625. +              int *inout_index_p);
  4626.  void ADIOI_Flatten_copy_type(ADIOI_Flatlist_node *flat,
  4627.                   int old_type_start,
  4628.                   int old_type_end,
  4629.                   int new_type_start,
  4630.                   ADIO_Offset offset_adjustment);
  4631.  
  4632. +/* darray helper functions */
  4633. +#ifdef MPIIMPL_HAVE_MPI_COMBINER_DARRAY
  4634. +static int index_of_type(int type_nr,
  4635. +             int dim_size,
  4636. +             int dim_rank,
  4637. +             int dim_ranks,
  4638. +             int k);
  4639. +static int get_cyclic_k(int dim_size,
  4640. +            int dim_ranks,
  4641. +            int dist,
  4642. +            int d_arg);
  4643. +static void get_darray_position(int rank,
  4644. +                int ranks,
  4645. +                int ndims,
  4646. +                int array_of_psizes[],
  4647. +                int r[]);
  4648. +static int local_types_in_dim(int dim_size,
  4649. +                  int dim_rank,
  4650. +                  int dim_ranks,
  4651. +                  int k);
  4652. +#endif
  4653. +
  4654.  /* flatten datatype and add it to Flatlist */
  4655.  void ADIOI_Flatten_datatype(MPI_Datatype datatype)
  4656.  {
  4657.  #ifdef HAVE_MPIR_TYPE_FLATTEN
  4658.      MPI_Aint flatten_idx;
  4659.  #endif
  4660.      int curr_index=0, is_contig;
  4661.      ADIOI_Flatlist_node *flat, *prev=0;
  4662. @@ -99,17 +125,17 @@
  4663.      {
  4664.      int i;
  4665.      FPRINTF(stderr, "blens: ");
  4666.      for (i=0; i<flat->count; i++) 
  4667.          FPRINTF(stderr, "%d ", flat->blocklens[i]);
  4668.      FPRINTF(stderr, "\n\n");
  4669.      FPRINTF(stderr, "indices: ");
  4670.      for (i=0; i<flat->count; i++) 
  4671. -        FPRINTF(stderr, "%ld ", flat->indices[i]);
  4672. +        FPRINTF(stderr, "%ld ", (long) flat->indices[i]);
  4673.      FPRINTF(stderr, "\n\n");
  4674.      }
  4675.  #endif
  4676.  
  4677.  }
  4678.  
  4679.  /* ADIOI_Flatten()
  4680.   *
  4681. @@ -128,42 +154,61 @@
  4682.  
  4683.      MPI_Type_get_envelope(datatype, &nints, &nadds, &ntypes, &combiner);
  4684.      ints = (int *) ADIOI_Malloc((nints+1)*sizeof(int));
  4685.      adds = (MPI_Aint *) ADIOI_Malloc((nadds+1)*sizeof(MPI_Aint));
  4686.      types = (MPI_Datatype *) ADIOI_Malloc((ntypes+1)*sizeof(MPI_Datatype));
  4687.      MPI_Type_get_contents(datatype, nints, nadds, ntypes, ints, adds, types);
  4688.  
  4689.      switch (combiner) {
  4690. -#ifdef HAVE_MPI_COMBINER_DUP
  4691. +#ifdef MPIIMPL_HAVE_MPI_COMBINER_DUP
  4692.      case MPI_COMBINER_DUP:
  4693.          MPI_Type_get_envelope(types[0], &old_nints, &old_nadds,
  4694.                    &old_ntypes, &old_combiner); 
  4695.          ADIOI_Datatype_iscontig(types[0], &old_is_contig);
  4696.      if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig))
  4697.              ADIOI_Flatten(types[0], flat, st_offset, curr_index);
  4698.          break;
  4699.  #endif
  4700. -#ifdef HAVE_MPI_COMBINER_SUBARRAY
  4701. +#ifdef MPIIMPL_HAVE_MPI_COMBINER_SUBARRAY
  4702.      case MPI_COMBINER_SUBARRAY:
  4703.      {
  4704.          int dims = ints[0];
  4705.          ADIOI_Flatten_subarray(dims,
  4706.                     &ints[1],        /* sizes */
  4707.                     &ints[dims+1],   /* subsizes */
  4708.                     &ints[2*dims+1], /* starts */
  4709.                     ints[3*dims+1],  /* order */
  4710.                     types[0],        /* type */
  4711.                     flat,
  4712.                     st_offset,
  4713.                     curr_index);
  4714.                     
  4715.      }
  4716.      break;
  4717.  #endif
  4718. +#ifdef MPIIMPL_HAVE_MPI_COMBINER_DARRAY
  4719. +    case MPI_COMBINER_DARRAY:
  4720. +    {
  4721. +        int dims = ints[2];
  4722. +        ADIOI_Flatten_darray(ints[0],         /* size */
  4723. +                 ints[1],         /* rank */
  4724. +                 dims,
  4725. +                 &ints[3],        /* gsizes */
  4726. +                 &ints[dims+3],   /* distribs */
  4727. +                 &ints[2*dims+3], /* dargs */
  4728. +                 &ints[3*dims+3], /* psizes */
  4729. +                 ints[4*dims+3],  /* order */
  4730. +                 types[0],
  4731. +                 flat,
  4732. +                 st_offset,
  4733. +                 curr_index);
  4734. +    }
  4735. +    break;
  4736. +#endif
  4737.      case MPI_COMBINER_CONTIGUOUS:
  4738.      top_count = ints[0];
  4739.          MPI_Type_get_envelope(types[0], &old_nints, &old_nadds,
  4740.                    &old_ntypes, &old_combiner); 
  4741.          ADIOI_Datatype_iscontig(types[0], &old_is_contig);
  4742.  
  4743.      prev_index = *curr_index;
  4744.      if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig))
  4745. @@ -480,21 +525,18 @@
  4746.  #endif
  4747.  
  4748.      ADIOI_Free(ints);
  4749.      ADIOI_Free(adds);
  4750.      ADIOI_Free(types);
  4751.  
  4752.  }
  4753.  
  4754. -
  4755.  /********************************************************/
  4756.  
  4757. -
  4758. -
  4759.  /* ADIOI_Count_contiguous_blocks
  4760.   *
  4761.   * Returns number of contiguous blocks in type, and also saves this value in
  4762.   * curr_index.
  4763.   *
  4764.   * ASSUMES THAT TYPE IS NOT A BASIC!!!
  4765.   */
  4766.  int ADIOI_Count_contiguous_blocks(MPI_Datatype datatype, int *curr_index)
  4767. @@ -515,27 +557,27 @@
  4768.  
  4769.      MPI_Type_get_envelope(datatype, &nints, &nadds, &ntypes, &combiner);
  4770.      ints = (int *) ADIOI_Malloc((nints+1)*sizeof(int));
  4771.      adds = (MPI_Aint *) ADIOI_Malloc((nadds+1)*sizeof(MPI_Aint));
  4772.      types = (MPI_Datatype *) ADIOI_Malloc((ntypes+1)*sizeof(MPI_Datatype));
  4773.      MPI_Type_get_contents(datatype, nints, nadds, ntypes, ints, adds, types);
  4774.  
  4775.      switch (combiner) {
  4776. -#ifdef HAVE_MPI_COMBINER_DUP
  4777. +#ifdef MPIIMPL_HAVE_MPI_COMBINER_DUP
  4778.      case MPI_COMBINER_DUP:
  4779.          MPI_Type_get_envelope(types[0], &old_nints, &old_nadds,
  4780.                                &old_ntypes, &old_combiner); 
  4781.      ADIOI_Datatype_iscontig(types[0], &old_is_contig);
  4782.      if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig))
  4783.          count = ADIOI_Count_contiguous_blocks(types[0], curr_index);
  4784.      else count = 1;
  4785.          break;
  4786.  #endif
  4787. -#ifdef HAVE_MPI_COMBINER_SUBARRAY
  4788. +#ifdef MPIIMPL_HAVE_MPI_COMBINER_SUBARRAY
  4789.      case MPI_COMBINER_SUBARRAY:
  4790.      /* first get an upper bound (since we're not optimizing) on the
  4791.       * number of blocks in the child type.
  4792.       */
  4793.      MPI_Type_get_envelope(types[0], &old_nints, &old_nadds,
  4794.                    &old_ntypes, &old_combiner);
  4795.      ADIOI_Datatype_iscontig(types[0], &old_is_contig);
  4796.      if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig))
  4797. @@ -553,16 +595,53 @@
  4798.       */
  4799.      n = 1; /* going to tally up # of types in here */
  4800.      for (i=0; i < ints[0]; i++) {
  4801.          n *= ints[ints[0]+1+i];
  4802.      }
  4803.      count *= n;
  4804.      break;        
  4805.  #endif
  4806. +#ifdef MPIIMPL_HAVE_MPI_COMBINER_DARRAY
  4807. +    case MPI_COMBINER_DARRAY:
  4808. +    {
  4809. +        int dims, k, *ranks;
  4810. +
  4811. +        MPI_Type_get_envelope(types[0], &old_nints, &old_nadds,
  4812. +                  &old_ntypes, &old_combiner);
  4813. +        ADIOI_Datatype_iscontig(types[0], &old_is_contig);
  4814. +        if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig))
  4815. +        count = ADIOI_Count_contiguous_blocks(types[0], curr_index);
  4816. +        else count = 1;
  4817. +        
  4818. +        n = 1;
  4819. +        dims = ints[2];
  4820. +        ranks = ADIOI_Malloc(sizeof(int) * dims);
  4821. +        get_darray_position(ints[1],         /* rank */
  4822. +                ints[0],         /* size */
  4823. +                dims,
  4824. +                &ints[3*dims+3], /* psizes */
  4825. +                ranks);
  4826. +
  4827. +        for (i=0; i < dims; i++) {
  4828. +        k = get_cyclic_k(ints[3+i],         /* gsize */
  4829. +                 ints[3*dims+3+i],  /* psize */
  4830. +                 ints[dims+3+i],    /* distrib */
  4831. +                 ints[2*dims+3+i]); /* darg */
  4832. +
  4833. +        n *= local_types_in_dim(ints[3+i],        /* gsize */
  4834. +                    ranks[i],         /* dim rank */
  4835. +                    ints[3*dims+3+i], /* psize */
  4836. +                    k);
  4837. +        }
  4838. +        ADIOI_Free(ranks);
  4839. +        count *= n;
  4840. +    }
  4841. +    break;
  4842. +#endif
  4843.      case MPI_COMBINER_CONTIGUOUS:
  4844.          top_count = ints[0];
  4845.          MPI_Type_get_envelope(types[0], &old_nints, &old_nadds,
  4846.                                &old_ntypes, &old_combiner); 
  4847.      ADIOI_Datatype_iscontig(types[0], &old_is_contig);
  4848.  
  4849.      prev_index = *curr_index;
  4850.      if ((old_combiner != MPI_COMBINER_NAMED) && (!old_is_contig))
  4851. @@ -767,17 +846,17 @@
  4852.      if (flat->blocklens) ADIOI_Free(flat->blocklens);
  4853.      if (flat->indices) ADIOI_Free(flat->indices);
  4854.      ADIOI_Free(flat);
  4855.      }
  4856.  }
  4857.  
  4858.  /****************************************************************/
  4859.  
  4860. -#ifdef HAVE_MPI_COMBINER_SUBARRAY
  4861. +#ifdef MPIIMPL_HAVE_MPI_COMBINER_SUBARRAY
  4862.  /* ADIOI_Flatten_subarray()
  4863.   *
  4864.   * ndims - number of dimensions in the array
  4865.   * array_of_sizes - dimensions of the array (one value per dim)
  4866.   * array_of_subsizes - dimensions of the subarray (one value per dim)
  4867.   * array_of_starts - starting offsets of the subarray (one value per dim)
  4868.   * order - MPI_ORDER_FORTRAN or MPI_ORDER_C
  4869.   * oldtype - type on which this subarray as built
  4870. @@ -792,20 +871,21 @@
  4871.                  int *array_of_subsizes,
  4872.                  int *array_of_starts,
  4873.                  int order,
  4874.                  MPI_Datatype oldtype,
  4875.                  ADIOI_Flatlist_node *flat,
  4876.                  ADIO_Offset start_offset,
  4877.                  int *inout_index_p)
  4878.  {
  4879. -    int i, j, oldtype_extent, total_types, *dim_sz, flatten_start_offset,
  4880. +    int i, j, total_types, *dim_sz, flatten_start_offset,
  4881.      flatten_end_offset;
  4882.      int old_nints, old_nadds, old_ntypes, old_combiner;
  4883.      ADIO_Offset subarray_start_offset, type_offset, *dim_skipbytes;
  4884. +    MPI_Aint oldtype_extent;
  4885.  
  4886.      MPI_Type_extent(oldtype, &oldtype_extent);
  4887.  
  4888.      /* TODO: optimization for 1-dimensional types -- treat like a contig */
  4889.  
  4890.      /* general case - make lots of copies of the offsets, adjusting 
  4891.       * the indices as necessary.
  4892.       */
  4893. @@ -955,8 +1035,324 @@
  4894.      int i, out_index = new_type_start;
  4895.  
  4896.      for (i=old_type_start; i < old_type_end; i++) {
  4897.      flat->indices[out_index]   = flat->indices[i] + offset_adjustment;
  4898.      flat->blocklens[out_index] = flat->blocklens[i];
  4899.      out_index++;
  4900.      }
  4901.  }
  4902. +
  4903. +/****************************************************************/
  4904. +
  4905. +#ifdef MPIIMPL_HAVE_MPI_COMBINER_DARRAY
  4906. +/* ADIOI_Flatten_darray()
  4907. + *
  4908. + * size - number of processes across which darray is defined
  4909. + * rank - our rank in the group of processes
  4910. + * ndims - number of dimensions of darray type
  4911. + * gsizes - dimensions of the array in types (order varies)
  4912. + * distribs - type of dist. for each dimension (order varies)
  4913. + * dargs - argument to dist. for each dimension (order varies)
  4914. + * psizes - number of processes across which each dimension
  4915. + *          is split (always C order)
  4916. + * order - order of parameters (c or fortran)
  4917. + * oldtype - type on which this darray is built
  4918. + * flat - ...
  4919. + * start_offset - offset of this type to begin with
  4920. + * inout_index_p - count of indices already used on input, updated
  4921. + *                 for output
  4922. + *
  4923. + * The general approach is to convert everything into cyclic-k and process
  4924. + * it from there.
  4925. + */
  4926. +void ADIOI_Flatten_darray(int size,
  4927. +              int rank,
  4928. +              int ndims,
  4929. +              int array_of_gsizes[],
  4930. +              int array_of_distribs[],
  4931. +              int array_of_dargs[],
  4932. +              int array_of_psizes[],
  4933. +              int order,
  4934. +              MPI_Datatype oldtype,
  4935. +              ADIOI_Flatlist_node *flat,
  4936. +              ADIO_Offset start_offset,
  4937. +              int *inout_index_p)
  4938. +{
  4939. +    int i, j, total_types, flatten_start_offset,
  4940. +    flatten_end_offset, oldtype_nints, oldtype_nadds, oldtype_ntypes,
  4941. +    oldtype_combiner, *dim_ranks, *dim_ks, *dim_localtypes;
  4942. +    ADIO_Offset darray_start_offset, first_darray_offset;
  4943. +    MPI_Aint oldtype_extent, *dim_skipbytes;
  4944. +
  4945. +    MPI_Type_extent(oldtype, &oldtype_extent);
  4946. +
  4947. +    dim_localtypes = ADIOI_Malloc(sizeof(int) * ndims);
  4948. +    dim_skipbytes = ADIOI_Malloc(sizeof(MPI_Aint) * ndims);
  4949. +    dim_ranks = (int *) ADIOI_Malloc(sizeof(int) * ndims);
  4950. +    dim_ks = (int *) ADIOI_Malloc(sizeof(int) * ndims);
  4951. +
  4952. +    /* fill in dim_ranks, C order (just like psizes) */
  4953. +    get_darray_position(rank, size, ndims, array_of_psizes, dim_ranks);
  4954. +
  4955. +    /* calculate all k values; store in same order as arrays */
  4956. +    for (i=0; i < ndims; i++) {
  4957. +    dim_ks[i] = get_cyclic_k(array_of_gsizes[i],
  4958. +                 array_of_psizes[i],
  4959. +                 array_of_distribs[i],
  4960. +                 array_of_dargs[i]);
  4961. +    }
  4962. +
  4963. +    /* calculate total number of oldtypes in this type */
  4964. +    total_types = 1;
  4965. +    for (i=0; i < ndims; i++) {
  4966. +    total_types *= local_types_in_dim(array_of_gsizes[i],
  4967. +                      dim_ranks[i],
  4968. +                      array_of_psizes[i],
  4969. +                      dim_ks[i]);
  4970. +    }
  4971. +
  4972. +    /* fill in temporary values; these are just cached so we aren't
  4973. +     * calculating them for every type instance.
  4974. +     *
  4975. +     * dim_localtypes holds the # of types this process has in the given
  4976. +     * dimension.
  4977. +     *
  4978. +     * dim_skipbytes (in this function) is going to hold the distance
  4979. +     * to skip to move from one type to the next in that dimension, in
  4980. +     * bytes, in terms of the darray as a whole.  sort of like the stride
  4981. +     * for a vector.
  4982. +     * 
  4983. +     * we keep this stuff in row-major (C) order -- least-frequently changing
  4984. +     * first.
  4985. +     */
  4986. +    for (i=0; i < ndims; i++) {
  4987. +    int idx = (order == MPI_ORDER_C) ? i : ndims-1-i;
  4988. +
  4989. +    dim_localtypes[i] = local_types_in_dim(array_of_gsizes[idx],
  4990. +                           dim_ranks[idx],
  4991. +                           array_of_psizes[idx],
  4992. +                           dim_ks[idx]);
  4993. +    }
  4994. +
  4995. +    dim_skipbytes[ndims-1] = oldtype_extent;
  4996. +    for (i=ndims-2; i >= 0; i--) {
  4997. +    int idx = (order == MPI_ORDER_C) ? i+1 : ndims-2-i;
  4998. +
  4999. +    dim_skipbytes[i] = array_of_gsizes[idx] * dim_skipbytes[i+1];
  5000. +    }
  5001. +
  5002. +#if 0
  5003. +    for (i=0; i < ndims; i++) {
  5004. +    MPIU_dbg_printf("dim_skipbytes[%d] = %d, dim_localtypes[%d] = %d\n",
  5005. +            i, (int) dim_skipbytes[i], i, dim_localtypes[i]);
  5006. +    }
  5007. +#endif
  5008. +
  5009. +
  5010. +    /* determine starting offset */
  5011. +    darray_start_offset = start_offset;
  5012. +    first_darray_offset = 0;
  5013. +    for (i=0; i < ndims; i++) {
  5014. +    ADIO_Offset this_dim_off;
  5015. +    int idx = (order == MPI_ORDER_C) ? i : ndims-1-i;
  5016. +
  5017. +    this_dim_off = index_of_type(0,
  5018. +                     array_of_gsizes[idx],
  5019. +                     dim_ranks[i],
  5020. +                     array_of_psizes[i],
  5021. +                     dim_ks[idx]);
  5022. +
  5023. +    this_dim_off *= (ADIO_Offset) dim_skipbytes[i];
  5024. +    darray_start_offset += this_dim_off;
  5025. +    first_darray_offset += this_dim_off;
  5026. +    }
  5027. +    
  5028. +    /* flatten one of the type to get the offsets that we need;
  5029. +     * we need an accurate starting offset to do this in-place.
  5030. +     *
  5031. +     * we save the starting offset so we can adjust when copying
  5032. +     * later on.
  5033. +     */
  5034. +    flatten_start_offset = *inout_index_p;
  5035. +    MPI_Type_get_envelope(oldtype,
  5036. +              &oldtype_nints,
  5037. +              &oldtype_nadds,
  5038. +              &oldtype_ntypes,
  5039. +              &oldtype_combiner);
  5040. +    if (oldtype_combiner != MPI_COMBINER_NAMED) {
  5041. +    ADIOI_Flatten(oldtype, flat, darray_start_offset, inout_index_p);
  5042. +    }
  5043. +    else {
  5044. +    int oldtype_size;
  5045. +
  5046. +    MPI_Type_size(oldtype, &oldtype_size);
  5047. +
  5048. +    flat->indices[flatten_start_offset]   = darray_start_offset;
  5049. +    flat->blocklens[flatten_start_offset] = oldtype_size;
  5050. +    (*inout_index_p)++;
  5051. +    }
  5052. +    flatten_end_offset = *inout_index_p;
  5053. +
  5054. +    /* now run through all the types, calculating the effective
  5055. +     * offset and then making a copy of the flattened regions for the
  5056. +     * type (and adjusting the offsets of them appropriately)
  5057. +     */
  5058. +    for (i=0; i < total_types; i++) {
  5059. +    int block_nr = i;
  5060. +    ADIO_Offset type_offset = 0;
  5061. +
  5062. +    for (j=ndims-1; j >= 0; j--) {
  5063. +        ADIO_Offset dim_off;
  5064. +        int idx = (order == MPI_ORDER_C) ? j : ndims-1-j;
  5065. +        int dim_index = block_nr % dim_localtypes[j];
  5066. +
  5067. +        dim_off = index_of_type(dim_index,
  5068. +                    array_of_gsizes[idx],
  5069. +                    dim_ranks[j],
  5070. +                    array_of_psizes[j],
  5071. +                    dim_ks[idx]);
  5072. +
  5073. +
  5074. +        if (dim_off) type_offset += (ADIO_Offset) dim_off *
  5075. +                 (ADIO_Offset) dim_skipbytes[j];
  5076. +#if 0
  5077. +        {
  5078. +        char s1[] = " ", s2[] = "  ", s3[] = "   ";
  5079. +        MPIU_dbg_printf("%sindex of type %d (pass %d,%d) is %d; new offset = %d\n",
  5080. +                (j == 0) ? s1 : ((j == 1) ? s2 : s3),
  5081. +                dim_index, i, j, (int) dim_off, (int) type_offset);
  5082. +        }
  5083. +#endif
  5084. +        block_nr /= dim_localtypes[j];
  5085. +    }
  5086. +
  5087. +    /* perform copy; noting in this case that the type offsets that
  5088. +     * we are calculating here are relative to the beginning of the
  5089. +     * darray as a whole, not relative to the first of our elements.
  5090. +     *
  5091. +     * because of that we have to subtract off the first_darray_offset
  5092. +     * in order to get the right offset adjustment.
  5093. +     */
  5094. +    ADIOI_Flatten_copy_type(flat,
  5095. +                flatten_start_offset,
  5096. +                flatten_end_offset,
  5097. +                flatten_start_offset + i * (flatten_end_offset - flatten_start_offset),
  5098. +                type_offset - first_darray_offset);
  5099. +    }
  5100. +    
  5101. +    /* free temp space */
  5102. +    ADIOI_Free(dim_skipbytes);
  5103. +    ADIOI_Free(dim_localtypes);
  5104. +    ADIOI_Free(dim_ranks);
  5105. +    ADIOI_Free(dim_ks);
  5106. +
  5107. +    *inout_index_p = flatten_start_offset + total_types *
  5108. +    (flatten_end_offset - flatten_start_offset);
  5109. +}
  5110. +
  5111. +/* darray processing helper functions */
  5112. +static int index_of_type(int type_nr,
  5113. +             int dim_size,
  5114. +             int dim_rank,
  5115. +             int dim_ranks,
  5116. +             int k)
  5117. +{
  5118. +    int cycle, leftover, index;
  5119. +
  5120. +    /* handle MPI_DISTRIBUTE_NONE case */
  5121. +    if (k == 0) return type_nr;
  5122. +
  5123. +    cycle = type_nr / k;
  5124. +    leftover = type_nr % k;
  5125. +
  5126. +    index = (dim_rank * k) + (dim_ranks * k * cycle) + leftover;
  5127. +
  5128. +    return index;
  5129. +}
  5130. +
  5131. +static int get_cyclic_k(int dim_size,
  5132. +            int dim_ranks,
  5133. +            int dist,
  5134. +            int d_arg)
  5135. +{
  5136. +    int k;
  5137. +
  5138. +    /* calculate correct "k" if DFLT_DARG passed in */
  5139. +    if (dist == MPI_DISTRIBUTE_NONE) return 0; /* indicates NONE */
  5140. +    else if (d_arg == MPI_DISTRIBUTE_DFLT_DARG) {
  5141. +    if (dist == MPI_DISTRIBUTE_BLOCK) {
  5142. +        k = (dim_size + dim_ranks - 1) / dim_ranks;
  5143. +    }
  5144. +    else {
  5145. +        k = 1;
  5146. +    }
  5147. +    }
  5148. +    else {
  5149. +    k = d_arg;
  5150. +    }
  5151. +
  5152. +    return k;
  5153. +}
  5154. +
  5155. +static int local_types_in_dim(int dim_size,
  5156. +                  int dim_rank,
  5157. +                  int dim_ranks,
  5158. +                  int k)
  5159. +{
  5160. +    int count, n_blocks, n_types, leftover;
  5161. +
  5162. +    if (k == 0) {
  5163. +    /* indicates MPI_DISTRIBUTE_NONE */
  5164. +    return dim_size;
  5165. +    }
  5166. +
  5167. +    /* blocks are regions of (up to k) types; this count
  5168. +     * includes partials
  5169. +     */
  5170. +    n_blocks = (dim_size + k - 1) / k;
  5171. +
  5172. +    /* count gets us a total # of blocks that the particular
  5173. +     * rank gets, including possibly a partial block
  5174. +     */
  5175. +    count = n_blocks / dim_ranks;
  5176. +    leftover = n_blocks - (count * dim_ranks);
  5177. +    if (dim_rank < leftover) count++;
  5178. +
  5179. +    n_types = count * k;
  5180. +
  5181. +    /* subtract off the types that are missing from the final
  5182. +     * partial block, if there is a partial and this rank is
  5183. +     * the one that has it.
  5184. +     */
  5185. +    if ((dim_rank == leftover - 1) && (dim_size % k != 0)) {
  5186. +    n_types -= k - (dim_size - ((dim_size / k) * k));
  5187. +    }
  5188. +
  5189. +    return n_types;
  5190. +}
  5191. +
  5192. +/* get_darray_position(rank, ranks, ndims, array_of_psizes, r[])
  5193. + *
  5194. + * Calculates the position of this process in the darray
  5195. + * given the rank of the process passed to the darray create
  5196. + * and the total number of processes also passed to the darray
  5197. + * create.
  5198. + *
  5199. + * Assumes that the array (r[]) has already been allocated.
  5200. + */
  5201. +static void get_darray_position(int rank,
  5202. +                int ranks,
  5203. +                int ndims,
  5204. +                int array_of_psizes[],
  5205. +                int r[])
  5206. +{
  5207. +    int i;
  5208. +    int t_rank = rank;
  5209. +    int t_size = ranks;
  5210. +
  5211. +    for (i = 0; i < ndims; i++) {
  5212. +    t_size = t_size / array_of_psizes[i];
  5213. +    r[i] = t_rank / t_size;
  5214. +    t_rank = t_rank % t_size;
  5215. +    }
  5216. +} 
  5217. +#endif
  5218. Index: romio/adio/common/lock.c
  5219. ===================================================================
  5220. RCS file: /home/MPI/cvsMaster/romio/adio/common/lock.c,v
  5221. retrieving revision 1.10
  5222. retrieving revision 1.11
  5223. --- romio/adio/common/lock.c    10 Dec 2003 22:44:12 -0000    1.10
  5224. +++ romio/adio/common/lock.c    26 May 2004 17:56:55 -0000    1.11
  5225. @@ -1,11 +1,11 @@
  5226.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  5227.  /* 
  5228. - *   $Id: lock.c,v 1.10 2003/12/10 22:44:12 gropp Exp $    
  5229. + *   $Id: lock.c,v 1.11 2004/05/26 17:56:55 thakur Exp $    
  5230.   *
  5231.   *   Copyright (C) 1997 University of Chicago. 
  5232.   *   See COPYRIGHT notice in top-level directory.
  5233.   */
  5234.  
  5235.  #include "adio.h"
  5236.  
  5237.  #ifdef ROMIO_NTFS
  5238. @@ -78,17 +78,17 @@
  5239.  
  5240.      do {
  5241.      err = fcntl(fd, cmd, &lock);
  5242.      } while (err && (errno == EINTR));
  5243.  
  5244.      if (err && (errno != EBADF)) {
  5245.      /* FIXME: This should use the error message system, 
  5246.         especially for MPICH2 */
  5247. -    FPRINTF(stderr, "File locking failed in ADIOI_Set_lock. If the file system is NFS, you need to use NFS version 3 and mount the directory with the 'noac' option (no attribute caching).\n");
  5248. +    FPRINTF(stderr, "File locking failed in ADIOI_Set_lock. If the file system is NFS, you need to use NFS version 3, ensure that the lockd daemon is running on all the machines, and mount the directory with the 'noac' option (no attribute caching).\n");
  5249.      MPI_Abort(MPI_COMM_WORLD, 1);
  5250.      }
  5251.  
  5252.      error_code = (err == 0) ? MPI_SUCCESS : MPI_ERR_UNKNOWN;
  5253.      return error_code;
  5254.  }
  5255.  #endif
  5256.  
  5257. Index: romio/adio/include/adio.h
  5258. ===================================================================
  5259. RCS file: /home/MPI/cvsMaster/romio/adio/include/adio.h,v
  5260. retrieving revision 1.30
  5261. retrieving revision 1.35
  5262. --- romio/adio/include/adio.h    8 Sep 2003 13:35:43 -0000    1.30
  5263. +++ romio/adio/include/adio.h    7 Jun 2004 17:59:57 -0000    1.35
  5264. @@ -1,11 +1,11 @@
  5265.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  5266.  /* 
  5267. - *   $Id: adio.h,v 1.30 2003/09/08 13:35:43 gropp Exp $    
  5268. + *   $Id: adio.h,v 1.35 2004/06/07 17:59:57 gropp Exp $    
  5269.   *
  5270.   *   Copyright (C) 1997 University of Chicago. 
  5271.   *   See COPYRIGHT notice in top-level directory.
  5272.   */
  5273.  
  5274.  /* main include file for ADIO.
  5275.     contains general definitions, declarations, and macros independent 
  5276.     of the underlying file system */
  5277. @@ -52,17 +52,22 @@
  5278.  #  define FORTRAN_API __declspec(dllexport)
  5279.  # else
  5280.  #  define FORTRAN_API __declspec(dllimport)
  5281.  # endif
  5282.  #else
  5283.  # define FORTRAN_API
  5284.  #endif
  5285.  
  5286. +/* Include romioconf.h if we haven't already (some include files may
  5287. +   need to include romioconf before some system includes) */
  5288. +#ifndef ROMIOCONF_H_INCLUDED
  5289.  #include "romioconf.h"
  5290. +#define ROMIOCONG_H_INCLUDED
  5291. +#endif
  5292.  
  5293.  #include "mpi.h"
  5294.  #include <fcntl.h>
  5295.  #include <sys/types.h>
  5296.  #include <sys/stat.h>
  5297.  #include <string.h>
  5298.  #include <stdio.h>
  5299.  #include <stdlib.h>
  5300. @@ -175,17 +180,17 @@
  5301.      unsigned d_maxiosz;      /* max xfer size */
  5302.  #endif
  5303.      ADIO_Offset fp_ind;      /* individual file pointer in MPI-IO (in bytes)*/
  5304.      ADIO_Offset fp_sys_posn; /* current location of the system file-pointer
  5305.                                  in bytes */
  5306.      ADIOI_Fns *fns;          /* struct of I/O functions to use */
  5307.      MPI_Comm comm;           /* communicator indicating who called open */
  5308.      MPI_Comm agg_comm;      /* deferred open: aggregators who called open */
  5309. -    int io_worker;        /* if one proc should do io, should it be me? */
  5310. +    int io_worker;        /* bool: if one proc should do io, is it me? */
  5311.      int is_open;        /* deferred open: 0: not open yet 1: is open */
  5312.      char *filename;          
  5313.      int file_system;         /* type of file system */
  5314.      int access_mode;         /* Access mode (sequential, append, etc.) */
  5315.      ADIO_Offset disp;        /* reqd. for MPI-IO */
  5316.      MPI_Datatype etype;      /* reqd. for MPI-IO */
  5317.      MPI_Datatype filetype;   /* reqd. for MPI-IO */
  5318.      int etype_size;          /* in bytes */
  5319. @@ -387,13 +392,14 @@
  5320.  /* Copied from mpiimpl.h because mpiimpl.h cannot be included from romio. */
  5321.  /* Remove these prototypes when mpiimpl.h is broken up and a specific error */
  5322.  /* handling header file can be included. */
  5323.  #define MPIR_ERR_FATAL 1
  5324.  #define MPIR_ERR_RECOVERABLE 0
  5325.  int MPIR_Err_return_file( MPI_File file_ptr, const char fcname[], int errcode );
  5326.  int MPIR_Err_create_code( int, int, const char [], int, int, const char [], const char [], ... );
  5327.  int MPIR_Err_is_fatal(int);
  5328. -void MPIR_Err_get_string(int, char *);
  5329. +typedef int (* MPIR_Err_get_class_string_func_t)(int error, char *str, int length);
  5330. +void MPIR_Err_get_string(int, char *, int, MPIR_Err_get_class_string_func_t );
  5331.  void MPIR_Err_print_stack(FILE *, int);
  5332.  extern int MPIR_Err_print_stack_flag;
  5333.  
  5334.  #endif
  5335. Index: romio/adio/include/adioi.h
  5336. ===================================================================
  5337. RCS file: /home/MPI/cvsMaster/romio/adio/include/adioi.h,v
  5338. retrieving revision 1.21
  5339. retrieving revision 1.22
  5340. --- romio/adio/include/adioi.h    4 Dec 2003 22:20:06 -0000    1.21
  5341. +++ romio/adio/include/adioi.h    17 Dec 2003 16:49:52 -0000    1.22
  5342. @@ -1,11 +1,11 @@
  5343.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  5344.  /* 
  5345. - *   $Id: adioi.h,v 1.21 2003/12/04 22:20:06 robl Exp $    
  5346. + *   $Id: adioi.h,v 1.22 2003/12/17 16:49:52 robl Exp $    
  5347.   *
  5348.   *   Copyright (C) 1997 University of Chicago. 
  5349.   *   See COPYRIGHT notice in top-level directory.
  5350.   */
  5351.  
  5352.  
  5353.  /* contains general definitions, declarations, and macros internal to
  5354.     the ADIO implementation, though independent of the underlying file
  5355. @@ -299,16 +299,20 @@
  5356.  void ADIOI_GEN_ReadStrided_naive(ADIO_File fd, void *buf, int count,
  5357.                         MPI_Datatype buftype, int file_ptr_type,
  5358.                         ADIO_Offset offset, ADIO_Status *status, int
  5359.                         *error_code);
  5360.  void ADIOI_GEN_WriteStrided(ADIO_File fd, void *buf, int count,
  5361.                         MPI_Datatype datatype, int file_ptr_type,
  5362.                         ADIO_Offset offset, ADIO_Status *status, int
  5363.                         *error_code);
  5364. +void ADIOI_GEN_WriteStrided_naive(ADIO_File fd, void *buf, int count,
  5365. +                       MPI_Datatype datatype, int file_ptr_type,
  5366. +                       ADIO_Offset offset, ADIO_Status *status, int
  5367. +                       *error_code);
  5368.  void ADIOI_GEN_ReadStridedColl(ADIO_File fd, void *buf, int count,
  5369.                         MPI_Datatype datatype, int file_ptr_type,
  5370.                         ADIO_Offset offset, ADIO_Status *status, int
  5371.                         *error_code);
  5372.  void ADIOI_GEN_WriteStridedColl(ADIO_File fd, void *buf, int count,
  5373.                         MPI_Datatype datatype, int file_ptr_type,
  5374.                         ADIO_Offset offset, ADIO_Status *status, int
  5375.                         *error_code);
  5376. Index: romio/adio/include/mpipr.h
  5377. ===================================================================
  5378. RCS file: /home/MPI/cvsMaster/romio/adio/include/mpipr.h,v
  5379. retrieving revision 1.8
  5380. retrieving revision 1.9
  5381. --- romio/adio/include/mpipr.h    8 Sep 2003 13:36:43 -0000    1.8
  5382. +++ romio/adio/include/mpipr.h    8 Jan 2004 22:41:54 -0000    1.9
  5383. @@ -1,10 +1,10 @@
  5384.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  5385. -/*  $Id: mpipr.h,v 1.8 2003/09/08 13:36:43 gropp Exp $
  5386. +/*  $Id: mpipr.h,v 1.9 2004/01/08 22:41:54 gropp Exp $
  5387.   *
  5388.   *  (C) 2001 by Argonne National Laboratory.
  5389.   *      See COPYRIGHT in top-level directory.
  5390.   */
  5391.  /* This file replaces all MPI function names with their PMPI equivalents.
  5392.     PMPI versions are used by default so that the user can profile 
  5393.     application code without interference from MPI functions used by 
  5394.     MPI-IO. */
  5395. @@ -144,16 +144,17 @@
  5396.  #undef MPI_Group_size
  5397.  #define MPI_Group_size PMPI_Group_size
  5398.  #undef MPI_Group_translate_ranks
  5399.  #define MPI_Group_translate_ranks PMPI_Group_translate_ranks
  5400.  #undef MPI_Group_union
  5401.  #define MPI_Group_union PMPI_Group_union
  5402.  #undef MPI_Ibsend
  5403.  #define MPI_Ibsend PMPI_Ibsend
  5404. +#if 0
  5405.  #undef MPI_Info_create
  5406.  #define MPI_Info_create PMPI_Info_create
  5407.  #undef MPI_Info_delete
  5408.  #define MPI_Info_delete PMPI_Info_delete
  5409.  #undef MPI_Info_dup
  5410.  #define MPI_Info_dup PMPI_Info_dup
  5411.  #undef MPI_Info_free
  5412.  #define MPI_Info_free PMPI_Info_free
  5413. @@ -162,16 +163,17 @@
  5414.  #undef MPI_Info_get_nkeys
  5415.  #define MPI_Info_get_nkeys PMPI_Info_get_nkeys
  5416.  #undef MPI_Info_get_nthkey
  5417.  #define MPI_Info_get_nthkey PMPI_Info_get_nthkey
  5418.  #undef MPI_Info_get_valuelen
  5419.  #define MPI_Info_get_valuelen PMPI_Info_get_valuelen
  5420.  #undef MPI_Info_set
  5421.  #define MPI_Info_set PMPI_Info_set
  5422. +#endif /* only conditionally set the info */
  5423.  #undef MPI_Init
  5424.  #define MPI_Init PMPI_Init
  5425.  #undef MPI_Initialized
  5426.  #define MPI_Initialized PMPI_Initialized
  5427.  #undef MPI_Intercomm_create
  5428.  #define MPI_Intercomm_create PMPI_Intercomm_create
  5429.  #undef MPI_Intercomm_merge
  5430.  #define MPI_Intercomm_merge PMPI_Intercomm_merge
  5431. Index: romio/doc/Makefile
  5432. ===================================================================
  5433. RCS file: /home/MPI/cvsMaster/romio/doc/Makefile,v
  5434. retrieving revision 1.1
  5435. retrieving revision 1.2
  5436. --- romio/doc/Makefile    18 Jan 2002 16:41:58 -0000    1.1
  5437. +++ romio/doc/Makefile    26 May 2004 17:57:02 -0000    1.2
  5438. @@ -9,9 +9,9 @@
  5439.      latex users-guide.tex
  5440.      bibtex users-guide
  5441.      latex users-guide.tex
  5442.      latex users-guide.tex
  5443.      dvips -o users-guide.ps users-guide.dvi
  5444.  
  5445.  clean:
  5446.      -rm -f users-guide.toc users-guide.log users-guide.dvi \
  5447. -           users-guide.aux
  5448. +           users-guide.aux users-guide.bbl
  5449. Index: romio/doc/users-guide.ps.gz
  5450. ===================================================================
  5451. RCS file: /home/MPI/cvsMaster/romio/doc/users-guide.ps.gz,v
  5452. retrieving revision 1.19
  5453. retrieving revision 1.20
  5454. diff -u -w -p -U8 -r1.19 -r1.20
  5455. Binary files /tmp/cvsy3X7o5 and /tmp/cvsdA5Zly differ
  5456. Index: romio/doc/users-guide.tex
  5457. ===================================================================
  5458. RCS file: /home/MPI/cvsMaster/romio/doc/users-guide.tex,v
  5459. retrieving revision 1.11
  5460. retrieving revision 1.12
  5461. --- romio/doc/users-guide.tex    9 Jul 2003 00:20:25 -0000    1.11
  5462. +++ romio/doc/users-guide.tex    26 May 2004 17:57:03 -0000    1.12
  5463. @@ -31,17 +31,17 @@
  5464.  Mathematics and Computer Science Division
  5465.  
  5466.  \bigskip
  5467.  
  5468.  Technical Memorandum No.\ 234
  5469.  
  5470.  
  5471.  \vspace{1.4in}
  5472. -Revised May 2002
  5473. +Revised May 2004
  5474.  
  5475.  \end{center}
  5476.  
  5477.  \vfill
  5478.  
  5479.  {\small
  5480.  \noindent
  5481.  This work was supported by the Mathematical, Information, and
  5482. @@ -400,24 +400,23 @@
  5483.  Default is \texttt{disable}.
  5484.  \end{itemize}
  5485.  
  5486.  If ROMIO doesn't understand a hint, or if the value is invalid, the hint
  5487.  will be ignored. The values of hints being used by ROMIO for a file
  5488.  can be obtained at any time via {\tt MPI\_File\_get\_info}.
  5489.  
  5490.  \subsection{Using ROMIO on NFS}
  5491. -To use ROMIO on NFS, file locking with {\tt fcntl} must work correctly on
  5492. -the NFS installation. On some installations, fcntl locks don't work.
  5493. -To get them to work, you need to use Version~3 of NFS and 
  5494. -have the system administrator mount the NFS file system with the 
  5495. -``{\tt noac}'' option (no attribute caching). Turning off attribute caching 
  5496. -may reduce performance, but it is necessary for correct behavior.  
  5497. -Some NFS server implementations also need the lockd and rpc.statd servers
  5498. -running. 
  5499. +To use ROMIO on NFS, file locking with {\tt fcntl} must work correctly
  5500. +on the NFS installation. On some installations, fcntl locks don't
  5501. +work.  To get them to work, you need to use Version~3 of NFS, ensure
  5502. +that the lockd daemon is running on all the machines, and have the system
  5503. +administrator mount the NFS file system with the ``{\tt noac}'' option
  5504. +(no attribute caching). Turning off attribute caching may reduce
  5505. +performance, but it is necessary for correct behavior.
  5506.  
  5507.  The following are some instructions we received from Ian Wells of HP
  5508.  for setting the {\tt noac} option on NFS. We have not tried them
  5509.  ourselves. We are including them here because you may find 
  5510.  them useful. Note that some of the steps may be specific to HP
  5511.  systems, and you may need root permission to execute some of the
  5512.  commands. 
  5513.  
  5514. Index: romio/include/mpio.h.in
  5515. ===================================================================
  5516. RCS file: /home/MPI/cvsMaster/romio/include/mpio.h.in,v
  5517. retrieving revision 1.20
  5518. retrieving revision 1.25
  5519. --- romio/include/mpio.h.in    7 Nov 2003 00:14:54 -0000    1.20
  5520. +++ romio/include/mpio.h.in    1 Jun 2004 19:21:16 -0000    1.25
  5521. @@ -1,40 +1,46 @@
  5522.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  5523.  /* 
  5524. - *   $Id: mpio.h.in,v 1.20 2003/11/07 00:14:54 robl Exp $    
  5525. + *   $Id: mpio.h.in,v 1.25 2004/06/01 19:21:16 thakur Exp $    
  5526.   *
  5527.   *   Copyright (C) 1997 University of Chicago. 
  5528.   *   See COPYRIGHT notice in top-level directory.
  5529.   */
  5530.  
  5531.  /* user include file for MPI-IO programs */
  5532.  
  5533.  #ifndef MPIO_INCLUDE
  5534.  #define MPIO_INCLUDE
  5535.  
  5536.  #include "mpi.h"
  5537.  
  5538.  #if defined(__cplusplus)
  5539.  extern "C" {
  5540.  #endif
  5541.  
  5542. -#define ROMIO_VERSION 124 /* version 1.2.4 */
  5543. +#define ROMIO_VERSION 126 /* version 1.2.6 */
  5544.  
  5545.  /* define MPI-IO datatypes and constants */
  5546.  
  5547.  #ifndef MPI_FILE_DEFINED
  5548.  typedef struct ADIOI_FileD *MPI_File;
  5549.  #endif
  5550.  
  5551.  @DEFINE_HAVE_MPI_GREQUEST@
  5552.  #ifndef HAVE_MPI_GREQUEST
  5553.  typedef struct ADIOI_RequestD *MPIO_Request;  
  5554.  #else
  5555.  #define MPIO_Request MPI_Request
  5556. +#define MPIO_USES_MPI_REQUEST
  5557. +/* Also rename the MPIO routines to get the MPI versions */
  5558. +#define MPIO_Wait MPI_Wait
  5559. +#define MPIO_Test MPI_Test
  5560. +#define PMPIO_Wait PMPI_Wait
  5561. +#define PMPIO_Test PMPI_Test
  5562.  #endif
  5563.  #define MPIO_REQUEST_DEFINED
  5564.  
  5565.  #ifndef HAVE_MPI_OFFSET
  5566.  @DEFINE_MPI_OFFSET@
  5567.  #endif
  5568.  
  5569.  #ifndef NEEDS_MPI_FINT
  5570. @@ -61,17 +67,22 @@
  5571.  #define MPI_MODE_EXCL               64  /* ADIO_EXCL */
  5572.  #define MPI_MODE_DELETE_ON_CLOSE    16  /* ADIO_DELETE_ON_CLOSE */
  5573.  #define MPI_MODE_UNIQUE_OPEN        32  /* ADIO_UNIQUE_OPEN */
  5574.  #define MPI_MODE_APPEND            128  /* ADIO_APPEND */
  5575.  #define MPI_MODE_SEQUENTIAL        256  /* ADIO_SEQUENTIAL */
  5576.  
  5577.  #define MPI_DISPLACEMENT_CURRENT   -54278278
  5578.  
  5579. +#ifndef MPI_FILE_NULL
  5580. +
  5581. +
  5582. +
  5583.  #define MPI_FILE_NULL           ((MPI_File) 0)
  5584. +#endif
  5585.  #define MPIO_REQUEST_NULL       ((MPIO_Request) 0)
  5586.  
  5587.  #define MPI_SEEK_SET            600
  5588.  #define MPI_SEEK_CUR            602
  5589.  #define MPI_SEEK_END            604
  5590.  
  5591.  #define MPI_MAX_DATAREP_STRING  128
  5592.  
  5593. @@ -199,18 +210,21 @@
  5594.                                       MPI_Aint *extent);
  5595.  
  5596.  /* Section 9.6.1 */
  5597.  int MPI_File_set_atomicity(MPI_File fh, int flag);
  5598.  int MPI_File_get_atomicity(MPI_File fh, int *flag);
  5599.  int MPI_File_sync(MPI_File fh);
  5600.  
  5601.  /* Section 4.13.3 */
  5602. +#ifndef MPICH2
  5603. +/* MPICH2 provides these definitions */
  5604.  int MPI_File_set_errhandler( MPI_File, MPI_Errhandler );
  5605.  int MPI_File_get_errhandler( MPI_File, MPI_Errhandler * );
  5606. +#endif
  5607.  /* End Prototypes */
  5608.  
  5609.  #ifndef HAVE_MPI_DARRAY_SUBARRAY
  5610.  /* Section 4.14.4 */
  5611.  int MPI_Type_create_subarray(int ndims, int *array_of_sizes, int
  5612.                        *array_of_subsizes, int *array_of_starts, int order, 
  5613.                        MPI_Datatype oldtype, MPI_Datatype *newtype);
  5614.  
  5615. @@ -394,18 +408,21 @@
  5616.                                        MPI_Aint *extent);
  5617.  
  5618.  /* Section 9.6.1 */
  5619.  int PMPI_File_set_atomicity(MPI_File fh, int flag);
  5620.  int PMPI_File_get_atomicity(MPI_File fh, int *flag);
  5621.  int PMPI_File_sync(MPI_File fh);
  5622.  
  5623.  /* Section 4.13.3 */
  5624. +#ifndef MPICH2
  5625. +/* MPICH2 provides these definitions */
  5626.  int PMPI_File_set_errhandler( MPI_File, MPI_Errhandler );
  5627.  int PMPI_File_get_errhandler( MPI_File, MPI_Errhandler * );
  5628. +#endif
  5629.  
  5630.  #ifndef HAVE_MPI_DARRAY_SUBARRAY
  5631.  /* Section 4.14.4 */
  5632.  int PMPI_Type_create_subarray(int ndims, int *array_of_sizes, int
  5633.                        *array_of_subsizes, int *array_of_starts, int order, 
  5634.                        MPI_Datatype oldtype, MPI_Datatype *newtype);
  5635.  
  5636.  /* Section 4.14.5 */
  5637. Index: romio/mpi-io/.cvsignore
  5638. ===================================================================
  5639. RCS file: /home/MPI/cvsMaster/romio/mpi-io/.cvsignore,v
  5640. retrieving revision 1.2
  5641. retrieving revision 1.3
  5642. --- romio/mpi-io/.cvsignore    1 Aug 2003 13:30:20 -0000    1.2
  5643. +++ romio/mpi-io/.cvsignore    19 Jan 2004 14:49:37 -0000    1.3
  5644. @@ -1,2 +1,5 @@
  5645.  Makefile
  5646.  .deps
  5647. +*.o
  5648. +*.bb
  5649. +*.bbg
  5650. Index: romio/mpi-io/Makefile.in
  5651. ===================================================================
  5652. RCS file: /home/MPI/cvsMaster/romio/mpi-io/Makefile.in,v
  5653. retrieving revision 1.19
  5654. retrieving revision 1.21
  5655. --- romio/mpi-io/Makefile.in    1 Dec 2003 21:52:58 -0000    1.19
  5656. +++ romio/mpi-io/Makefile.in    27 Jan 2004 23:27:39 -0000    1.21
  5657. @@ -29,82 +29,77 @@
  5658.        rd_atallb.c rd_atalle.c read_allb.c read_alle.c wr_atallb.c \
  5659.        wr_atalle.c write_allb.c write_alle.c \
  5660.        get_posn_sh.c iread_sh.c read_sh.c write_sh.c \
  5661.        iwrite_sh.c seek_sh.c read_ord.c read_orde.c write_ordb.c \
  5662.        read_ordb.c write_ord.c write_orde.c mpiu_greq.c 
  5663.  
  5664.  # EXTRA objects are ones that need to be included for all but MPICH2
  5665.  MPIO_OBJECTS = close.o read.o open.o write.o set_view.o \
  5666. -      iread.o iwrite.o iotest.o iowait.o \
  5667. -    iowaitall.o iowaitany.o \
  5668. -    iotestall.o iotestany.o \
  5669. -    iowaitsome.o iotestsome.o \
  5670. +      iread.o iwrite.o \
  5671.        seek.o get_posn.o \
  5672.        delete.o read_all.o read_at.o \
  5673.        read_atall.o iread_at.o iwrite_at.o write_all.o get_bytoff.o \
  5674.        write_at.o write_atall.o get_view.o get_group.o get_amode.o \
  5675.        get_extent.o fsync.o get_atom.o set_atom.o \
  5676.        set_size.o get_size.o prealloc.o file_f2c.o file_c2f.o \
  5677.        ioreq_f2c.o ioreq_c2f.o set_info.o get_info.o \
  5678.        rd_atallb.o rd_atalle.o read_allb.o read_alle.o wr_atallb.o \
  5679.        wr_atalle.o write_allb.o write_alle.o \
  5680.        get_posn_sh.o iread_sh.o read_sh.o write_sh.o \
  5681.        iwrite_sh.o seek_sh.o read_ord.o read_orde.o write_ordb.o \
  5682.        read_ordb.o write_ord.o write_orde.o mpiu_greq.o mpich2_fileutil.o
  5683. +# MPIO_REQOBJECTS are the routines that provide the MPIO_Wait etc.
  5684. +# routines (iotest.o, iowait.o iowaitall.o iowaitany.o iotestall.o
  5685. +# iotestany.o iowaitsome.o and iotestsome.o)
  5686. +MPIO_REQOBJECTS = @MPIO_REQOBJECTS@
  5687.  
  5688.  # Either get_errh.o set_errh.o or empty 
  5689. -MPIO_EXTRA_OBJECTS = @MPIO_EXTRA_OBJECTS@
  5690. +MPIO_EXTRA_OBJECTS = @MPIO_EXTRA_OBJECTS@ @MPIO_REQOBJECTS@
  5691.  
  5692.  # mpich2_fileutil.p is not included because it does not include any
  5693.  # name-shifted functions
  5694.  MPIO_TMP_POBJECTS = close.p read.p open.p write.p get_extent.p \
  5695. -      iread.p iwrite.p iotest.p iowait.p \
  5696. -    iowaitall.p iowaitany.p \
  5697. -    iotestall.p iotestany.p \
  5698. -    iowaitsome.p iotestsome.p \
  5699. +      iread.p iwrite.p \
  5700.        seek.p \
  5701.        delete.p read_all.p read_at.p \
  5702.        read_atall.p iread_at.p iwrite_at.p get_posn.p \
  5703.        write_all.p write_at.p write_atall.p get_bytoff.p \
  5704.        set_view.p get_view.p get_group.p get_amode.p \
  5705.        fsync.p get_atom.p set_atom.p set_size.p get_size.p prealloc.p \
  5706.        file_f2c.p file_c2f.p ioreq_f2c.p ioreq_c2f.p set_info.p get_info.p \
  5707.        rd_atallb.p rd_atalle.p read_allb.p read_alle.p wr_atallb.p \
  5708.        wr_atalle.p write_allb.p write_alle.p \
  5709.        get_posn_sh.p iread_sh.p read_sh.p write_sh.p \
  5710.        iwrite_sh.p seek_sh.p read_ord.p read_orde.p write_ordb.p \
  5711.        read_ordb.p write_ord.p write_orde.p 
  5712.  
  5713.  # Either get_errh.p set_errh.p or empty 
  5714. -MPIO_EXTRA_TMP_POBJECTS = @MPIO_EXTRA_TMP_POBJECTS@
  5715. +MPIO_EXTRA_TMP_POBJECTS = @MPIO_EXTRA_TMP_POBJECTS@ @MPIO_REQ_TMP_POBJECTS@
  5716.  
  5717.  # _mpich2_fileutil.o is not included because it does not include any 
  5718.  # name-shifted functions
  5719.  MPIO_REAL_POBJECTS = _close.o _read.o _open.o _get_extent.o \
  5720.        _write.o _set_view.o _seek.o _read_at.o _prealloc.o \
  5721. -      _iread.o _iwrite.o _iotest.o _iowait.o \
  5722. -    _iowaitall.o _iowaitany.o \
  5723. -    _iotestall.o _iotestany.o \
  5724. -    _iowaitsome.o _iotestsome.o \
  5725. +      _iread.o _iwrite.o \
  5726.      _get_posn.o \
  5727.        _delete.o _read_all.o _get_bytoff.o \
  5728.        _read_atall.o _iread_at.o _iwrite_at.o _get_group.o _get_amode.o \
  5729.        _write_all.o _write_at.o _write_atall.o _get_view.o \
  5730.        _fsync.o _get_atom.o _set_atom.o _set_size.o _get_size.o \
  5731.        _file_f2c.o _file_c2f.o _ioreq_f2c.o _ioreq_c2f.o \
  5732.        _set_info.o _get_info.o \
  5733.        _rd_atallb.o _rd_atalle.o _read_allb.o _read_alle.o _wr_atallb.o \
  5734.        _wr_atalle.o _write_allb.o _write_alle.o \
  5735.        _get_posn_sh.o _iread_sh.o _read_sh.o _write_sh.o \
  5736.        _iwrite_sh.o _seek_sh.o _read_ord.o _read_orde.o _write_ordb.o \
  5737.        _read_ordb.o _write_ord.o _write_orde.o 
  5738.  
  5739.  # Either _get_errh.o _set_errh.o or empty 
  5740. -MPIO_EXTRA_REAL_POBJECTS = @MPIO_EXTRA_REAL_POBJECTS@
  5741. +MPIO_EXTRA_REAL_POBJECTS = @MPIO_EXTRA_REAL_POBJECTS@ @MPIO_REQ_REAL_POBJECTS@
  5742.  
  5743.  all: $(LIBNAME)
  5744.      @if [ "@ENABLE_SHLIB@" != "none" ] ; then \
  5745.          $(MAKE) $(SHLIBNAME).la ;\
  5746.      fi
  5747.  
  5748.  .SUFFIXES: $(SUFFIXES) .p .lo
  5749.  
  5750. @@ -148,8 +143,14 @@
  5751.      doctext -latex -mpath ../../../../doc/refman  -heading MPI \
  5752.          -quotefmt ${master_top_srcdir}/maint/docnotes $<
  5753.  .c.html:
  5754.      doctext -html -mpath ../../../../www/www3  -heading MPI \
  5755.          -quotefmt ${master_top_srcdir}/maint/docnotes $<
  5756.  mandoc: ${mpi_sources:.c=.man}
  5757.  latexdoc: ${mpi_sources:.c=.latex}
  5758.  htmldoc: ${mpi_sources:.c=.html}
  5759. +
  5760. +tags: TAGS
  5761. +SOURCES = ${mpi_sources}
  5762. +HEADERS = 
  5763. +TAGS:${HEADERS} ${SOURCES}
  5764. +    here=`cd ../../../.. && pwd` ; cd ${srcdir} && etags -o $$here/TAGS --append ${HEADERS} ${SOURCES}
  5765. Index: romio/mpi-io/close.c
  5766. ===================================================================
  5767. RCS file: /home/MPI/cvsMaster/romio/mpi-io/close.c,v
  5768. retrieving revision 1.11
  5769. retrieving revision 1.12
  5770. --- romio/mpi-io/close.c    1 Jul 2003 19:12:39 -0000    1.11
  5771. +++ romio/mpi-io/close.c    6 Apr 2004 18:46:31 -0000    1.12
  5772. @@ -1,11 +1,11 @@
  5773.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  5774.  /* 
  5775. - *   $Id: close.c,v 1.11 2003/07/01 19:12:39 robl Exp $    
  5776. + *   $Id: close.c,v 1.12 2004/04/06 18:46:31 thakur Exp $    
  5777.   *
  5778.   *   Copyright (C) 1997 University of Chicago. 
  5779.   *   See COPYRIGHT notice in top-level directory.
  5780.   */
  5781.  
  5782.  #include "mpioimpl.h"
  5783.  
  5784.  #ifdef HAVE_WEAK_SYMBOLS
  5785. @@ -50,16 +50,20 @@
  5786.      MPI_Abort(MPI_COMM_WORLD, 1);
  5787.      }
  5788.  #else
  5789.      ADIOI_TEST_FILE_HANDLE(*fh, myname);
  5790.  #endif
  5791.  
  5792.      if (((*fh)->file_system != ADIO_PIOFS) && ((*fh)->file_system != ADIO_PVFS) && ((*fh)->file_system != ADIO_PVFS2)) {
  5793.      ADIOI_Free((*fh)->shared_fp_fname);
  5794. +        /* need a barrier because the file containing the shared file
  5795. +        pointer is opened with COMM_SELF. We don't want it to be
  5796. +    deleted while others are still accessing it. */ 
  5797. +        MPI_Barrier((*fh)->comm);
  5798.      if ((*fh)->shared_fp_fd != ADIO_FILE_NULL)
  5799.          ADIO_Close((*fh)->shared_fp_fd, &error_code);
  5800.      }
  5801.  
  5802.      ADIO_Close(*fh, &error_code);
  5803.  
  5804.      *fh = MPI_FILE_NULL;
  5805.  #ifdef MPI_hpux
  5806. Index: romio/mpi-io/delete.c
  5807. ===================================================================
  5808. RCS file: /home/MPI/cvsMaster/romio/mpi-io/delete.c,v
  5809. retrieving revision 1.18
  5810. retrieving revision 1.19
  5811. --- romio/mpi-io/delete.c    15 Sep 2003 13:33:30 -0000    1.18
  5812. +++ romio/mpi-io/delete.c    12 Feb 2004 06:08:22 -0000    1.19
  5813. @@ -1,11 +1,11 @@
  5814.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  5815.  /* 
  5816. - *   $Id: delete.c,v 1.18 2003/09/15 13:33:30 gropp Exp $    
  5817. + *   $Id: delete.c,v 1.19 2004/02/12 06:08:22 David Exp $    
  5818.   *
  5819.   *   Copyright (C) 1997 University of Chicago. 
  5820.   *   See COPYRIGHT notice in top-level directory.
  5821.   */
  5822.  
  5823.  #include "mpioimpl.h"
  5824.  
  5825.  #ifdef HAVE_WEAK_SYMBOLS
  5826. @@ -51,26 +51,29 @@
  5827.  #endif /* MPI_hpux */
  5828.  
  5829.      /* first check if ADIO has been initialized. If not, initialize it */
  5830.      if (ADIO_Init_keyval == MPI_KEYVAL_INVALID) {
  5831.  
  5832.     /* check if MPI itself has been initialized. If not, flag an error.
  5833.     Can't initialize it here, because don't know argc, argv */
  5834.          MPI_Initialized(&flag);
  5835. -        if (!flag) {
  5836. +    /* --BEGIN ERROR HANDLING-- */
  5837. +        if (!flag)
  5838. +    {
  5839.  #ifdef MPICH2
  5840.          error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_INTERN, 
  5841.                        "**initialized", 0);
  5842.          return MPIR_Err_return_file(MPI_FILE_NULL, myname, error_code);
  5843.  #else
  5844.              FPRINTF(stderr, "Error: MPI_Init() must be called before using MPI-IO\n");
  5845.              MPI_Abort(MPI_COMM_WORLD, 1);
  5846.  #endif
  5847.          }
  5848. +    /* --END ERROR HANDLING-- */
  5849.  
  5850.          MPI_Keyval_create(MPI_NULL_COPY_FN, ADIOI_End_call, &ADIO_Init_keyval,
  5851.                            (void *) 0);  
  5852.  
  5853.     /* put a dummy attribute on MPI_COMM_WORLD, because we want the delete
  5854.     function to be called when MPI_COMM_WORLD is freed. Hopefully the
  5855.     MPI library frees MPI_COMM_WORLD when MPI_Finalize is called,
  5856.     though the standard does not mandate this. */
  5857. @@ -81,30 +84,33 @@
  5858.  
  5859.          ADIO_Init( (int *)0, (char ***)0, &error_code);
  5860.      }
  5861.  
  5862.  
  5863.      /* resolve file system type from file name; this is a collective call */
  5864.      ADIO_ResolveFileType(MPI_COMM_SELF, filename, &file_system, &fsops, 
  5865.               &error_code);
  5866. -    if (error_code != MPI_SUCCESS) {
  5867. +    /* --BEGIN ERROR HANDLING-- */
  5868. +    if (error_code != MPI_SUCCESS)
  5869. +    {
  5870.      /* ADIO_ResolveFileType() will print as informative a message as it
  5871.       * possibly can or call MPIR_Err_setmsg.  We just need to propagate 
  5872.       * the error up.  In the PRINT_ERR_MSG case MPI_Abort has already
  5873.       * been called as well, so we probably didn't even make it this far.
  5874.       */
  5875.  #ifdef MPICH2
  5876.      return MPIR_Err_return_file(MPI_FILE_NULL, myname, error_code);
  5877.  #elif defined(PRINT_ERR_MSG)
  5878.      MPI_Abort(MPI_COMM_WORLD, 1); /* this is mostly here for clarity */
  5879.  #else /* MPICH-1 */
  5880.      return ADIOI_Error(MPI_FILE_NULL, error_code, myname);
  5881.  #endif
  5882.      }
  5883. +    /* --END ERROR HANDLING-- */
  5884.  
  5885.      /* skip prefix on filename if there is one */
  5886.      tmp = strchr(filename, ':');
  5887.      /* Only skip prefixes greater than length one to allow for windows drive specification (c:\...)*/
  5888.      /*if (tmp) filename = tmp + 1;*/
  5889.      if (tmp > filename + 1)
  5890.      filename = tmp + 1;
  5891.  
  5892. Index: romio/mpi-io/get_posn_sh.c
  5893. ===================================================================
  5894. RCS file: /home/MPI/cvsMaster/romio/mpi-io/get_posn_sh.c,v
  5895. retrieving revision 1.17
  5896. retrieving revision 1.18
  5897. --- romio/mpi-io/get_posn_sh.c    1 Jul 2003 19:12:39 -0000    1.17
  5898. +++ romio/mpi-io/get_posn_sh.c    12 Feb 2004 06:08:24 -0000    1.18
  5899. @@ -1,11 +1,11 @@
  5900.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  5901.  /* 
  5902. - *   $Id: get_posn_sh.c,v 1.17 2003/07/01 19:12:39 robl Exp $    
  5903. + *   $Id: get_posn_sh.c,v 1.18 2004/02/12 06:08:24 David Exp $    
  5904.   *
  5905.   *   Copyright (C) 1997 University of Chicago. 
  5906.   *   See COPYRIGHT notice in top-level directory.
  5907.   */
  5908.  
  5909.  #include "mpioimpl.h"
  5910.  
  5911.  #ifdef HAVE_WEAK_SYMBOLS
  5912. @@ -47,42 +47,46 @@
  5913.      if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {
  5914.      FPRINTF(stderr, "MPI_File_get_position_shared: Invalid file handle\n");
  5915.      MPI_Abort(MPI_COMM_WORLD, 1);
  5916.      }
  5917.  #else
  5918.      ADIOI_TEST_FILE_HANDLE(fh, myname);
  5919.  #endif
  5920.  
  5921. -    if (fh->access_mode & MPI_MODE_SEQUENTIAL) {
  5922. +    /* --BEGIN ERROR HANDLING-- */
  5923. +    if (fh->access_mode & MPI_MODE_SEQUENTIAL)
  5924. +    {
  5925.  #ifdef MPICH2
  5926.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_UNSUPPORTED_OPERATION, 
  5927.          "**ioamodeseq", 0);
  5928.      return MPIR_Err_return_file(fh, myname, error_code);
  5929.  #elif defined(PRINT_ERR_MSG)
  5930.          FPRINTF(stderr, "MPI_File_get_position_shared: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n");
  5931.          MPI_Abort(MPI_COMM_WORLD, 1);
  5932.  #else /* MPICH-1 */
  5933.      error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, MPIR_ERR_AMODE_SEQ,
  5934.                       myname, (char *) 0, (char *) 0);
  5935.      return ADIOI_Error(fh, error_code, myname);
  5936.  #endif
  5937.      }
  5938.  
  5939. -    if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS) || (fh->file_system == ADIO_PVFS2)) {
  5940. +    if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS) || (fh->file_system == ADIO_PVFS2))
  5941. +    {
  5942.  #ifdef MPICH2
  5943.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_UNSUPPORTED_OPERATION, "**iosharedunsupported", 0);
  5944.      return MPIR_Err_return_file(fh, myname, error_code);
  5945.  #elif defined(PRINT_ERR_MSG)
  5946.      FPRINTF(stderr, "MPI_File_get_position_shared: Shared file pointer not supported on PIOFS and PVFS\n");
  5947.      MPI_Abort(MPI_COMM_WORLD, 1);
  5948.  #else /* MPICH-1 */
  5949.      error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, 
  5950.                      MPIR_ERR_NO_SHARED_FP, myname, (char *) 0, (char *) 0);
  5951.      return ADIOI_Error(fh, error_code, myname);
  5952.  #endif
  5953.      }
  5954. +    /* --END ERROR HANDLING-- */
  5955.  
  5956.      ADIOI_TEST_DEFERRED(fh, "MPI_File_get_position_shared", &error_code);
  5957.  
  5958.      ADIO_Get_shared_fp(fh, 0, offset, &error_code);
  5959.      return error_code;
  5960.  }
  5961. Index: romio/mpi-io/get_view.c
  5962. ===================================================================
  5963. RCS file: /home/MPI/cvsMaster/romio/mpi-io/get_view.c,v
  5964. retrieving revision 1.15
  5965. retrieving revision 1.16
  5966. --- romio/mpi-io/get_view.c    18 Apr 2003 20:15:08 -0000    1.15
  5967. +++ romio/mpi-io/get_view.c    12 Feb 2004 06:08:26 -0000    1.16
  5968. @@ -1,11 +1,11 @@
  5969.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  5970.  /* 
  5971. - *   $Id: get_view.c,v 1.15 2003/04/18 20:15:08 David Exp $    
  5972. + *   $Id: get_view.c,v 1.16 2004/02/12 06:08:26 David Exp $    
  5973.   *
  5974.   *   Copyright (C) 1997 University of Chicago. 
  5975.   *   See COPYRIGHT notice in top-level directory.
  5976.   */
  5977.  
  5978.  #include "mpioimpl.h"
  5979.  
  5980.  #ifdef HAVE_WEAK_SYMBOLS
  5981. @@ -55,30 +55,33 @@
  5982.      if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {
  5983.      FPRINTF(stderr, "MPI_File_get_view: Invalid file handle\n");
  5984.      MPI_Abort(MPI_COMM_WORLD, 1);
  5985.      }
  5986.  #else
  5987.      ADIOI_TEST_FILE_HANDLE(fh, myname);
  5988.  #endif
  5989.  
  5990. -    if (datarep <= (char *) 0) {
  5991. +    /* --BEGIN ERROR HANDLING-- */
  5992. +    if (datarep <= (char *) 0)
  5993. +    {
  5994.  #ifdef MPICH2
  5995.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ARG, 
  5996.          "**iodatarepnomem", 0);
  5997.      return MPIR_Err_return_file(fh, myname, error_code);
  5998.  #elif defined(PRINT_ERR_MSG)
  5999.      FPRINTF(stderr, "MPI_File_get_view: The user must allocate memory for datarep\n");
  6000.      MPI_Abort(MPI_COMM_WORLD, 1);
  6001.  #else /* MPICH-1 */
  6002.      error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_DATAREP_ARG,
  6003.                       myname, (char *) 0, (char *) 0);
  6004.      return ADIOI_Error(fh, error_code, myname);
  6005.  #endif
  6006.      }
  6007. +    /* --END ERROR HANDLING-- */
  6008.  
  6009.      *disp = fh->disp;
  6010.      strcpy(datarep, "native");
  6011.  
  6012.      MPI_Type_get_envelope(fh->etype, &i, &j, &k, &combiner);
  6013.      if (combiner == MPI_COMBINER_NAMED) *etype = fh->etype;
  6014.      else {
  6015.          MPI_Type_contiguous(1, fh->etype, ©_etype);
  6016. Index: romio/mpi-io/ioreq_f2c.c
  6017. ===================================================================
  6018. RCS file: /home/MPI/cvsMaster/romio/mpi-io/ioreq_f2c.c,v
  6019. retrieving revision 1.10
  6020. retrieving revision 1.11
  6021. --- romio/mpi-io/ioreq_f2c.c    24 Feb 2003 23:52:08 -0000    1.10
  6022. +++ romio/mpi-io/ioreq_f2c.c    12 Feb 2004 06:08:27 -0000    1.11
  6023. @@ -1,11 +1,11 @@
  6024.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  6025.  /* 
  6026. - *   $Id: ioreq_f2c.c,v 1.10 2003/02/24 23:52:08 robl Exp $    
  6027. + *   $Id: ioreq_f2c.c,v 1.11 2004/02/12 06:08:27 David Exp $    
  6028.   *
  6029.   *   Copyright (C) 1997 University of Chicago. 
  6030.   *   See COPYRIGHT notice in top-level directory.
  6031.   */
  6032.  
  6033.  #include "mpioimpl.h"
  6034.  
  6035.  #ifdef HAVE_WEAK_SYMBOLS
  6036. @@ -39,17 +39,19 @@
  6037.  MPIO_Request MPIO_Request_f2c(MPI_Fint request) {return((MPIO_Request)request);}
  6038.  #else
  6039.  MPIO_Request MPIO_Request_f2c(MPI_Fint request)
  6040.  {
  6041.  
  6042.  #ifndef INT_LT_POINTER
  6043.      return (MPIO_Request) request;
  6044.  #else
  6045. +    /* --BEGIN ERROR HANDLING-- */
  6046.      if (!request) return MPIO_REQUEST_NULL;
  6047.      if ((request < 0) || (request > ADIOI_Reqtable_ptr)) {
  6048.      FPRINTF(stderr, "MPIO_Request_f2c: Invalid request\n");
  6049.      MPI_Abort(MPI_COMM_WORLD, 1);
  6050.      }
  6051. +    /* --END ERROR HANDLING-- */
  6052.      return ADIOI_Reqtable[request];
  6053.  #endif
  6054.  }
  6055.  #endif
  6056. Index: romio/mpi-io/iread_sh.c
  6057. ===================================================================
  6058. RCS file: /home/MPI/cvsMaster/romio/mpi-io/iread_sh.c,v
  6059. retrieving revision 1.20
  6060. retrieving revision 1.21
  6061. --- romio/mpi-io/iread_sh.c    1 Jul 2003 19:12:40 -0000    1.20
  6062. +++ romio/mpi-io/iread_sh.c    12 Feb 2004 06:08:29 -0000    1.21
  6063. @@ -1,11 +1,11 @@
  6064.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  6065.  /* 
  6066. - *   $Id: iread_sh.c,v 1.20 2003/07/01 19:12:40 robl Exp $    
  6067. + *   $Id: iread_sh.c,v 1.21 2004/02/12 06:08:29 David Exp $    
  6068.   *
  6069.   *   Copyright (C) 1997 University of Chicago. 
  6070.   *   See COPYRIGHT notice in top-level directory.
  6071.   */
  6072.  
  6073.  #include "mpioimpl.h"
  6074.  
  6075.  #ifdef HAVE_WEAK_SYMBOLS
  6076. @@ -71,129 +71,152 @@
  6077.      int error_code, bufsize, buftype_is_contig, filetype_is_contig;
  6078.  #if defined(MPICH2) || !defined(PRINT_ERR_MSG)
  6079.      static char myname[] = "MPI_FILE_IREAD_SHARED";
  6080.  #endif
  6081.      int datatype_size, incr;
  6082.      ADIO_Status status;
  6083.      ADIO_Offset off, shared_fp;
  6084.  
  6085. +    /* --BEGIN ERROR HANDLING-- */
  6086.  #ifdef PRINT_ERR_MSG
  6087. -    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {
  6088. +    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE))
  6089. +    {
  6090.      FPRINTF(stderr, "MPI_File_iread_shared: Invalid file handle\n");
  6091.      MPI_Abort(MPI_COMM_WORLD, 1);
  6092.      }
  6093.  #else
  6094.      ADIOI_TEST_FILE_HANDLE(fh, myname);
  6095.  #endif
  6096.  
  6097. -    if (count < 0) {
  6098. +    if (count < 0)
  6099. +    {
  6100.  #ifdef MPICH2
  6101.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ARG, "**iobadcount", 0);
  6102.      return MPIR_Err_return_file(fh, myname, error_code);
  6103.  #elif defined(PRINT_ERR_MSG)
  6104.      FPRINTF(stderr, "MPI_File_iread_shared: Invalid count argument\n");
  6105.      MPI_Abort(MPI_COMM_WORLD, 1);
  6106.  #else /* MPICH-1 */
  6107.      error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG,
  6108.                       myname, (char *) 0, (char *) 0);
  6109.      return ADIOI_Error(fh, error_code, myname);
  6110.  #endif
  6111.      }
  6112.  
  6113. -    if (datatype == MPI_DATATYPE_NULL) {
  6114. +    if (datatype == MPI_DATATYPE_NULL)
  6115. +    {
  6116.  #ifdef MPICH2
  6117.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_TYPE, 
  6118.          "**dtypenull", 0);
  6119.      return MPIR_Err_return_file(fh, myname, error_code);
  6120.  #elif defined(PRINT_ERR_MSG)
  6121.          FPRINTF(stderr, "MPI_File_iread_shared: Invalid datatype\n");
  6122.          MPI_Abort(MPI_COMM_WORLD, 1);
  6123.  #else /* MPICH-1 */
  6124.      error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL,
  6125.                       myname, (char *) 0, (char *) 0);
  6126.      return ADIOI_Error(fh, error_code, myname);        
  6127.  #endif
  6128.      }
  6129. +    /* --END ERROR HANDLING-- */
  6130.  
  6131.      MPI_Type_size(datatype, &datatype_size);
  6132.  
  6133. -    if ((count*datatype_size) % fh->etype_size != 0) {
  6134. +    /* --BEGIN ERROR HANDLING-- */
  6135. +    if ((count*datatype_size) % fh->etype_size != 0)
  6136. +    {
  6137.  #ifdef MPICH2
  6138.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, 
  6139.          "**ioetype", 0);
  6140.      return MPIR_Err_return_file(fh, myname, error_code);
  6141.  #elif defined(PRINT_ERR_MSG)
  6142.          FPRINTF(stderr, "MPI_File_iread_shared: Only an integral number of etypes can be accessed\n");
  6143.          MPI_Abort(MPI_COMM_WORLD, 1);
  6144.  #else /* MPICH-1 */
  6145.      error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL,
  6146.                       myname, (char *) 0, (char *) 0);
  6147.      return ADIOI_Error(fh, error_code, myname);        
  6148.  #endif
  6149.      }
  6150.  
  6151. -    if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS) || (fh->file_system == ADIO_PVFS2)) {
  6152. +    if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS) || (fh->file_system == ADIO_PVFS2))
  6153. +    {
  6154.  #ifdef MPICH2
  6155.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_UNSUPPORTED_OPERATION, 
  6156.          "**iosharedunsupported", 0);
  6157.      return MPIR_Err_return_file(fh, myname, error_code);
  6158.  #elif defined(PRINT_ERR_MSG)
  6159.      FPRINTF(stderr, "MPI_File_iread_shared: Shared file pointer not supported on PIOFS and PVFS\n");
  6160.      MPI_Abort(MPI_COMM_WORLD, 1);
  6161.  #else /* MPICH-1 */
  6162.      error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, 
  6163.                      MPIR_ERR_NO_SHARED_FP, myname, (char *) 0, (char *) 0);
  6164.      return ADIOI_Error(fh, error_code, myname);
  6165.  #endif
  6166.      }
  6167. +    /* --END ERROR HANDLING-- */
  6168.  
  6169.      ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
  6170.      ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig);
  6171.  
  6172.      ADIOI_TEST_DEFERRED(fh, "MPI_File_iread_sh", &error_code);
  6173.  
  6174.      incr = (count*datatype_size)/fh->etype_size;
  6175.      ADIO_Get_shared_fp(fh, incr, &shared_fp, &error_code);
  6176. -    if (error_code != MPI_SUCCESS) {
  6177. +    /* --BEGIN ERROR HANDLING-- */
  6178. +    if (error_code != MPI_SUCCESS)
  6179. +    {
  6180.      FPRINTF(stderr, "MPI_File_iread_shared: Error! Could not access shared file pointer.\n");
  6181.      MPI_Abort(MPI_COMM_WORLD, 1);
  6182.      }
  6183. +    /* --END ERROR HANDLING-- */
  6184.  
  6185.      /* contiguous or strided? */
  6186. -    if (buftype_is_contig && filetype_is_contig) {
  6187. +    if (buftype_is_contig && filetype_is_contig)
  6188. +    {
  6189.      /* convert count and shared_fp to bytes */
  6190.      bufsize = datatype_size * count;
  6191.      off = fh->disp + fh->etype_size * shared_fp;
  6192.          if (!(fh->atomicity))
  6193. +    {
  6194.          ADIO_IreadContig(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
  6195.              off, request, &error_code); 
  6196. -        else {
  6197. +    }
  6198. +        else
  6199. +    {
  6200.              /* to maintain strict atomicity semantics with other concurrent
  6201.                operations, lock (exclusive) and call blocking routine */
  6202.  
  6203.              *request = ADIOI_Malloc_request();
  6204.              (*request)->optype = ADIOI_READ;
  6205.              (*request)->fd = fh;
  6206.              (*request)->datatype = datatype;
  6207.              (*request)->queued = 0;
  6208.          (*request)->handle = 0;
  6209.  
  6210.              if (fh->file_system != ADIO_NFS)
  6211. +        {
  6212.                  ADIOI_WRITE_LOCK(fh, off, SEEK_SET, bufsize);
  6213. +        }
  6214.  
  6215.              ADIO_ReadContig(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET, off, 
  6216.                      &status, &error_code);  
  6217.  
  6218.              if (fh->file_system != ADIO_NFS)
  6219. +        {
  6220.                  ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize);
  6221. +        }
  6222.  
  6223.              fh->async_count++;
  6224.              /* status info. must be linked to the request structure, so that it
  6225.                 can be accessed later from a wait */
  6226.          }
  6227.      }
  6228. -    else ADIO_IreadStrided(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
  6229. +    else
  6230. +    {
  6231. +    ADIO_IreadStrided(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
  6232.                 shared_fp, request, &error_code); 
  6233. +    }
  6234.  
  6235.      return error_code;
  6236.  }
  6237.  #endif
  6238. Index: romio/mpi-io/mpich2_fileutil.c
  6239. ===================================================================
  6240. RCS file: /home/MPI/cvsMaster/romio/mpi-io/mpich2_fileutil.c,v
  6241. retrieving revision 1.12
  6242. retrieving revision 1.15
  6243. --- romio/mpi-io/mpich2_fileutil.c    3 Nov 2003 13:49:38 -0000    1.12
  6244. +++ romio/mpi-io/mpich2_fileutil.c    7 Jun 2004 14:55:17 -0000    1.15
  6245. @@ -12,22 +12,26 @@
  6246.     in a ROMIO File structure.  FIXME: These should be imported from a common
  6247.     header file that is also used in errhan/file_set_errhandler.c
  6248.   */
  6249.  int MPIR_ROMIO_Get_file_errhand( MPI_File, MPI_Errhandler * );
  6250.  int MPIR_ROMIO_Set_file_errhand( MPI_File, MPI_Errhandler );
  6251.  void MPIR_Get_file_error_routine( MPI_Errhandler, 
  6252.                    void (**)(MPI_File *, int *, ...), 
  6253.                    int * );
  6254. +struct MPID_Comm;
  6255. +int MPID_Abort( struct MPID_Comm *comm, int mpi_errno, int exit_code, char *error_msg );
  6256.  
  6257.  int MPIR_Err_return_file( MPI_File file_ptr, const char fcname[], int errcode )
  6258.  {
  6259.      MPI_Errhandler e;
  6260.      void (*c_errhandler)(MPI_File *, int *, ... );
  6261.      int  kind;   /* Error handler kind (see below) */
  6262. +    char error_msg[4096];
  6263. +    int len;
  6264.  
  6265.      /* First, check the nesting level */
  6266.      /*if (MPIR_Nest_value()) return errcode;*/ /* Is there any recursion in the MPI_File_... interface? */
  6267.  
  6268.      /* If the file pointer is not valid, we use the handler on
  6269.         MPI_FILE_NULL (MPI-2, section 9.7).  For now, this code assumes that 
  6270.         MPI_FILE_NULL has the default handler (return).  FIXME.  See
  6271.         below - the set error handler uses ADIOI_DFLT_ERR_HANDLER; 
  6272. @@ -53,35 +57,22 @@
  6273.      }
  6274.      else {
  6275.      MPIR_Get_file_error_routine( e, &c_errhandler, &kind );
  6276.      }
  6277.  
  6278.      /* --BEGIN ERROR HANDLING-- */
  6279.      if (MPIR_Err_is_fatal(errcode) || kind == 0) 
  6280.      {
  6281. -    if (MPIR_Err_print_stack_flag)
  6282. -    {
  6283. -        fprintf( stderr, "Fatal error (code 0x%08x) in %s():\n", errcode, fcname);
  6284. -        MPIR_Err_print_stack(stderr, errcode);
  6285. -    }
  6286. -    else
  6287. -    {
  6288. -        /* The default handler should try the following: Provide the rank 
  6289. -           in comm_world.  If the process is not in comm world,
  6290. -           use something else.  If the communicator exists and has a name, 
  6291. -           provide that name */
  6292. -        char msg[MPI_MAX_ERROR_STRING];
  6293. -
  6294. -        MPIR_Err_get_string( errcode, msg );
  6295. -        fprintf( stderr, "Fatal error (code 0x%08x) in %s(): %s\n", 
  6296. -             errcode, fcname, msg);
  6297. -    }
  6298. -
  6299. -    MPID_Abort( 0, errcode, errcode); 
  6300. +    /* This file does not get the correct definitions for MPIU_Snprintf because it cannot include mpiimpl.h */
  6301. +    /* MPIU_Snprintf(error_msg, 4096, "Fatal error in %s: ", fcname); */
  6302. +    sprintf(error_msg, "Fatal error in %s: ", fcname);
  6303. +    len = (int)strlen(error_msg);
  6304. +    MPIR_Err_get_string(errcode, &error_msg[len], 4096-len, NULL);
  6305. +    MPID_Abort(NULL, MPI_SUCCESS, errcode, error_msg);
  6306.      }
  6307.      /* --END ERROR HANDLING-- */
  6308.      else if (kind == 2) {
  6309.      (*c_errhandler)( &file_ptr, &errcode, 0 );
  6310.      }
  6311.      /* if kind == 1, just return */
  6312.  
  6313.      return errcode;
  6314. Index: romio/mpi-io/mpioprof.h
  6315. ===================================================================
  6316. RCS file: /home/MPI/cvsMaster/romio/mpi-io/mpioprof.h,v
  6317. retrieving revision 1.9
  6318. retrieving revision 1.10
  6319. --- romio/mpi-io/mpioprof.h    8 Sep 2003 13:32:48 -0000    1.9
  6320. +++ romio/mpi-io/mpioprof.h    28 May 2004 23:05:41 -0000    1.10
  6321. @@ -1,11 +1,11 @@
  6322.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  6323.  /* 
  6324. - *   $Id: mpioprof.h,v 1.9 2003/09/08 13:32:48 gropp Exp $    
  6325. + *   $Id: mpioprof.h,v 1.10 2004/05/28 23:05:41 David Exp $    
  6326.   *
  6327.   *   Copyright (C) 1997 University of Chicago. 
  6328.   *   See COPYRIGHT notice in top-level directory.
  6329.   */
  6330.  
  6331.  /* 
  6332.     This header file converts all MPI_ names into PMPI_ names, for 
  6333.     building the profiling interface
  6334. @@ -135,18 +135,20 @@
  6335.  #if !defined(MPI_File_f2c) || defined(MPICH_RENAMING_MPI_FUNCS)
  6336.  #undef MPI_File_f2c
  6337.  #define MPI_File_f2c PMPI_File_f2c
  6338.  #undef MPI_File_c2f
  6339.  #define MPI_File_c2f PMPI_File_c2f
  6340.  #endif
  6341.  
  6342.  #undef MPIO_Test
  6343. +#undef PMPIO_Test
  6344.  #define MPIO_Test PMPIO_Test
  6345.  #undef MPIO_Wait
  6346. +#undef PMPIO_Wait
  6347.  #define MPIO_Wait PMPIO_Wait
  6348.  #undef MPIO_Testall
  6349.  #define MPIO_Testall PMPIO_Testall
  6350.  #undef MPIO_Waitall
  6351.  #define MPIO_Waitall PMPIO_Waitall
  6352.  #undef MPIO_Testany
  6353.  #define MPIO_Testany PMPIO_Testany
  6354.  #undef MPIO_Waitany
  6355. @@ -182,9 +184,16 @@
  6356.  #define MPI_Info_free PMPI_Info_free
  6357.  #undef MPI_Info_c2f
  6358.  #define MPI_Info_c2f PMPI_Info_c2f
  6359.  #undef MPI_Info_f2c
  6360.  #define MPI_Info_f2c PMPI_Info_f2c
  6361.  
  6362.  #endif
  6363.  
  6364. +#undef MPI_Grequest_start
  6365. +#define MPI_Grequest_start PMPI_Grequest_start
  6366. +#undef MPI_Grequest_complete
  6367. +#define MPI_Grequest_complete PMPI_Grequest_complete
  6368. +#undef MPI_Status_set_cancelled
  6369. +#define MPI_Status_set_cancelled PMPI_Status_set_cancelled
  6370. +
  6371.  #endif
  6372. Index: romio/mpi-io/mpiu_greq.c
  6373. ===================================================================
  6374. RCS file: /home/MPI/cvsMaster/romio/mpi-io/mpiu_greq.c,v
  6375. retrieving revision 1.2
  6376. retrieving revision 1.3
  6377. --- romio/mpi-io/mpiu_greq.c    18 Mar 2003 17:19:17 -0000    1.2
  6378. +++ romio/mpi-io/mpiu_greq.c    28 May 2004 23:05:41 -0000    1.3
  6379. @@ -2,16 +2,22 @@
  6380.  /*
  6381.   *  (C) 2003 by Argonne National Laboratory.
  6382.   *      See COPYRIGHT in top-level directory.
  6383.   */
  6384.  #include <string.h>
  6385.  #include "mpioimpl.h"
  6386.  #include "mpiu_greq.h"
  6387.  
  6388. +#ifdef HAVE_WEAK_SYMBOLS
  6389. +/* Include mapping from MPI->PMPI */
  6390. +#define MPIO_BUILD_PROFILING
  6391. +#include "mpioprof.h"
  6392. +#endif
  6393. +
  6394.  int MPIU_Greq_query_fn(void *extra_state, MPI_Status *status)
  6395.  {
  6396.      int foo;
  6397.  
  6398.      /* can't touch user's MPI_ERROR, so hold it for a moment */
  6399.      foo = status->MPI_ERROR;
  6400.  
  6401.      /* get the status from the blocking operation */
  6402. Index: romio/mpi-io/open.c
  6403. ===================================================================
  6404. RCS file: /home/MPI/cvsMaster/romio/mpi-io/open.c,v
  6405. retrieving revision 1.32
  6406. retrieving revision 1.34
  6407. --- romio/mpi-io/open.c    22 Sep 2003 21:23:23 -0000    1.32
  6408. +++ romio/mpi-io/open.c    19 May 2004 23:55:09 -0000    1.34
  6409. @@ -1,11 +1,11 @@
  6410.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  6411.  /* 
  6412. - *   $Id: open.c,v 1.32 2003/09/22 21:23:23 gropp Exp $    
  6413. + *   $Id: open.c,v 1.34 2004/05/19 23:55:09 thakur Exp $    
  6414.   *
  6415.   *   Copyright (C) 1997 University of Chicago. 
  6416.   *   See COPYRIGHT notice in top-level directory.
  6417.   */
  6418.  
  6419.  #include "mpioimpl.h"
  6420.  
  6421.  #ifdef HAVE_WEAK_SYMBOLS
  6422. @@ -52,108 +52,118 @@
  6423.      ADIOI_Fns *fsops;
  6424.  
  6425.  #ifdef MPI_hpux
  6426.      int fl_xmpi;
  6427.  
  6428.      HPMP_IO_OPEN_START(fl_xmpi, comm);
  6429.  #endif /* MPI_hpux */
  6430.  
  6431. -    if (comm == MPI_COMM_NULL) {
  6432. +    /* --BEGIN ERROR HANDLING-- */
  6433. +    if (comm == MPI_COMM_NULL)
  6434. +    {
  6435.  #ifdef MPICH2
  6436.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_COMM, "**comm", 0);
  6437.      return MPIR_Err_return_file(MPI_FILE_NULL, myname, error_code);
  6438.  #elif defined(PRINT_ERR_MSG)
  6439.      FPRINTF(stderr, "MPI_File_open: Invalid communicator\n");
  6440.      MPI_Abort(MPI_COMM_WORLD, 1);
  6441.  #else /* MPICH-1 */
  6442.      error_code = MPIR_Err_setmsg(MPI_ERR_COMM, MPIR_ERR_COMM_NULL,
  6443.                       myname, (char *) 0, (char *) 0);
  6444.      return ADIOI_Error(MPI_FILE_NULL, error_code, myname);
  6445.  #endif
  6446.      }
  6447. +    /* --END ERROR HANDLING-- */
  6448.  
  6449.      MPI_Comm_test_inter(comm, &flag);
  6450. -    if (flag) {
  6451. +    /* --BEGIN ERROR HANDLING-- */
  6452. +    if (flag)
  6453. +    {
  6454.  #ifdef MPICH2
  6455.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_COMM, 
  6456.          "**commnotintra", 0);
  6457.      return MPIR_Err_return_file(MPI_FILE_NULL, myname, error_code);
  6458.  #elif defined(PRINT_ERR_MSG)
  6459.      FPRINTF(stderr, "MPI_File_open: Intercommunicator cannot be passed to MPI_File_open\n");
  6460.      MPI_Abort(MPI_COMM_WORLD, 1);
  6461.  #else /* MPICH-1 */
  6462.      error_code = MPIR_Err_setmsg(MPI_ERR_COMM, MPIR_ERR_COMM_INTER,
  6463.                       myname, (char *) 0, (char *) 0);
  6464.      return ADIOI_Error(MPI_FILE_NULL, error_code, myname);
  6465.  #endif
  6466.      }
  6467.  
  6468.      if ( ((amode&MPI_MODE_RDONLY)?1:0) + ((amode&MPI_MODE_RDWR)?1:0) +
  6469. -     ((amode&MPI_MODE_WRONLY)?1:0) != 1 ) {
  6470. +     ((amode&MPI_MODE_WRONLY)?1:0) != 1 )
  6471. +    {
  6472.  #ifdef MPICH2
  6473.           error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_AMODE, 
  6474.           "**fileamodeone", 0);
  6475.           return MPIR_Err_return_file(MPI_FILE_NULL, myname, error_code);
  6476.  #elif defined(PRINT_ERR_MSG)
  6477.      FPRINTF(stderr, "MPI_File_open: Exactly one of MPI_MODE_RDONLY, MPI_MODE_WRONLY, or MPI_MODE_RDWR must be specified\n");
  6478.      MPI_Abort(MPI_COMM_WORLD, 1); 
  6479.  #else /* MPICH-1 */
  6480.      error_code = MPIR_Err_setmsg(MPI_ERR_AMODE, 3,
  6481.                       myname, (char *) 0, (char *) 0);
  6482.      return ADIOI_Error(MPI_FILE_NULL, error_code, myname);
  6483.  #endif
  6484.      }
  6485.  
  6486.      if ((amode & MPI_MODE_RDONLY) && 
  6487. -            ((amode & MPI_MODE_CREATE) || (amode & MPI_MODE_EXCL))) {
  6488. +            ((amode & MPI_MODE_CREATE) || (amode & MPI_MODE_EXCL)))
  6489. +    {
  6490.  #ifdef MPICH2
  6491.          error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_AMODE, 
  6492.              "**fileamoderead", 0);
  6493.          return MPIR_Err_return_file(MPI_FILE_NULL, myname, error_code);
  6494.  #elif defined(PRINT_ERR_MSG)
  6495.      FPRINTF(stderr, "MPI_File_open: It is erroneous to specify MPI_MODE_CREATE or MPI_MODE_EXCL with MPI_MODE_RDONLY\n");
  6496.      MPI_Abort(MPI_COMM_WORLD, 1);
  6497.  #else /* MPICH-1 */
  6498.      error_code = MPIR_Err_setmsg(MPI_ERR_AMODE, 5,
  6499.                       myname, (char *) 0, (char *) 0);
  6500.      return ADIOI_Error(MPI_FILE_NULL, error_code, myname);
  6501.  #endif
  6502.      }
  6503.  
  6504. -    if ((amode & MPI_MODE_RDWR) && (amode & MPI_MODE_SEQUENTIAL)) {
  6505. +    if ((amode & MPI_MODE_RDWR) && (amode & MPI_MODE_SEQUENTIAL))
  6506. +    {
  6507.  #ifdef MPICH2
  6508.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_AMODE, 
  6509.          "**fileamodeseq", 0);
  6510.      return MPIR_Err_return_file(MPI_FILE_NULL, myname, error_code);
  6511.  #elif defined(PRINT_ERR_MSG)
  6512.      FPRINTF(stderr, "MPI_File_open: It is erroneous to specify MPI_MODE_SEQUENTIAL with MPI_MODE_RDWR\n");
  6513.      MPI_Abort(MPI_COMM_WORLD, 1);
  6514.  #else /* MPICH-1 */
  6515.      error_code = MPIR_Err_setmsg(MPI_ERR_AMODE, 7,
  6516.                       myname, (char *) 0, (char *) 0);
  6517.      return ADIOI_Error(MPI_FILE_NULL, error_code, myname);
  6518.  #endif
  6519.      }
  6520. +    /* --END ERROR HANDLING-- */
  6521.  
  6522.  /* check if amode is the same on all processes */
  6523.      MPI_Comm_dup(comm, &dupcomm);
  6524.  
  6525.  /*  
  6526.      Removed this check because broadcast is too expensive. 
  6527.      tmp_amode = amode;
  6528.      MPI_Bcast(&tmp_amode, 1, MPI_INT, 0, dupcomm);
  6529.      if (amode != tmp_amode) {
  6530.      FPRINTF(stderr, "MPI_File_open: amode must be the same on all processes\n");
  6531.      MPI_Abort(MPI_COMM_WORLD, 1);
  6532.      }
  6533.  */
  6534.  
  6535.  /* check if ADIO has been initialized. If not, initialize it */
  6536. -    if (ADIO_Init_keyval == MPI_KEYVAL_INVALID) {
  6537. +    if (ADIO_Init_keyval == MPI_KEYVAL_INVALID)
  6538. +    {
  6539.  
  6540.  /* check if MPI itself has been initialized. If not, flag an error.
  6541.     Can't initialize it here, because don't know argc, argv */
  6542.      MPI_Initialized(&flag);
  6543.      /* --BEGIN ERROR HANDLING-- */
  6544.      if (!flag) {
  6545.          FPRINTF(stderr, "Error: MPI_Init() must be called before using MPI-IO\n");
  6546.          MPI_Abort(MPI_COMM_WORLD, 1);
  6547. @@ -175,17 +185,19 @@
  6548.      ADIO_Init( (int *)0, (char ***)0, &error_code);
  6549.      }
  6550.  
  6551.  
  6552.      file_system = -1;
  6553.  
  6554.      /* resolve file system type from file name; this is a collective call */
  6555.      ADIO_ResolveFileType(dupcomm, filename, &file_system, &fsops, &error_code);
  6556. -    if (error_code != MPI_SUCCESS) {
  6557. +    /* --BEGIN ERROR HANDLING-- */
  6558. +    if (error_code != MPI_SUCCESS)
  6559. +    {
  6560.      /* ADIO_ResolveFileType() will print as informative a message as it
  6561.       * possibly can or call MPIR_Err_setmsg.  We just need to propagate 
  6562.       * the error up.  In the PRINT_ERR_MSG case MPI_Abort has already
  6563.       * been called as well, so we probably didn't even make it this far.
  6564.       */
  6565.  #ifdef MPICH2
  6566.      return MPIR_Err_return_file(MPI_FILE_NULL, myname, error_code);
  6567.  #elif defined(PRINT_ERR_MSG)
  6568. @@ -197,45 +209,50 @@
  6569.  
  6570.      /* Test for invalid flags in amode.
  6571.       *
  6572.       * eventually we should allow the ADIO implementations to test for 
  6573.       * invalid flags through some functional interface rather than having
  6574.       *  these tests here. -- Rob, 06/06/2001
  6575.       */
  6576.      if (((file_system == ADIO_PIOFS) || (file_system == ADIO_PVFS) || (file_system == ADIO_PVFS2)) && 
  6577. -        (amode & MPI_MODE_SEQUENTIAL)) {
  6578. +        (amode & MPI_MODE_SEQUENTIAL))
  6579. +    {
  6580.  #ifdef MPICH2
  6581.          error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_UNSUPPORTED_OPERATION, 
  6582.          "**iosequnsupported", 0);
  6583.          return MPIR_Err_return_file(MPI_FILE_NULL, myname, error_code);
  6584.  #elif defined(PRINT_ERR_MSG)
  6585.      FPRINTF(stderr, "MPI_File_open: MPI_MODE_SEQUENTIAL not supported on PIOFS and PVFS\n");
  6586.      MPI_Abort(MPI_COMM_WORLD, 1);
  6587.  #else /* MPICH-1 */
  6588.      error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, 
  6589.                      MPIR_ERR_NO_MODE_SEQ, myname, (char *) 0, (char *) 0);
  6590.      return ADIOI_Error(MPI_FILE_NULL, error_code, myname);
  6591.  #endif
  6592.      }
  6593. +    /* --END ERROR HANDLING-- */
  6594.  
  6595.      /* strip off prefix if there is one */
  6596.      tmp = strchr(filename, ':');
  6597.      /* Only skip prefixes greater than length one to allow for windows drive specification (c:\...)*/
  6598.      /*if (tmp) filename = tmp + 1;*/
  6599.      if (tmp > filename + 1)
  6600.      filename = tmp + 1;
  6601.  
  6602.  /* use default values for disp, etype, filetype */    
  6603.  /* set iomode=M_ASYNC. It is used to implement the Intel PFS interface
  6604.     on top of ADIO. Not relevant for MPI-IO implementation */    
  6605.  
  6606.      *fh = ADIO_Open(comm, dupcomm, filename, file_system, amode, 0, MPI_BYTE,
  6607.                      MPI_BYTE, M_ASYNC, info, ADIO_PERM_NULL, &error_code);
  6608.  
  6609. +    if (error_code != MPI_SUCCESS)
  6610. +        MPI_Comm_free(&dupcomm);
  6611. +
  6612.      /* determine name of file that will hold the shared file pointer */
  6613.      /* can't support shared file pointers on a file system that doesn't
  6614.         support file locking, e.g., PIOFS, PVFS, PVFS2 */
  6615.      if ((error_code == MPI_SUCCESS) && ((*fh)->file_system != ADIO_PIOFS)
  6616.            && ((*fh)->file_system != ADIO_PVFS) 
  6617.        && ((*fh)->file_system != ADIO_PVFS2) ){
  6618.      MPI_Comm_rank(dupcomm, &rank);
  6619.      ADIOI_Shfp_fname(*fh, rank);
  6620. Index: romio/mpi-io/read_alle.c
  6621. ===================================================================
  6622. RCS file: /home/MPI/cvsMaster/romio/mpi-io/read_alle.c,v
  6623. retrieving revision 1.15
  6624. retrieving revision 1.16
  6625. --- romio/mpi-io/read_alle.c    8 Sep 2003 13:35:04 -0000    1.15
  6626. +++ romio/mpi-io/read_alle.c    12 Feb 2004 06:08:42 -0000    1.16
  6627. @@ -1,11 +1,11 @@
  6628.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  6629.  /* 
  6630. - *   $Id: read_alle.c,v 1.15 2003/09/08 13:35:04 gropp Exp $    
  6631. + *   $Id: read_alle.c,v 1.16 2004/02/12 06:08:42 David Exp $    
  6632.   *
  6633.   *   Copyright (C) 1997 University of Chicago. 
  6634.   *   See COPYRIGHT notice in top-level directory.
  6635.   */
  6636.  
  6637.  #include "mpioimpl.h"
  6638.  
  6639.  #ifdef HAVE_WEAK_SYMBOLS
  6640. @@ -38,39 +38,43 @@
  6641.  @*/
  6642.  int MPI_File_read_all_end(MPI_File fh, void *buf, MPI_Status *status)
  6643.  {
  6644.  #if defined(MPICH2) || !defined(PRINT_ERR_MSG)
  6645.      int error_code;
  6646.      static char myname[] = "MPI_FILE_IREAD";
  6647.  #endif
  6648.  
  6649. +    /* --BEGIN ERROR HANDLING-- */
  6650.  #ifdef PRINT_ERR_MSG
  6651. -    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {
  6652. +    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE))
  6653. +    {
  6654.      FPRINTF(stderr, "MPI_File_read_all_end: Invalid file handle\n");
  6655.      MPI_Abort(MPI_COMM_WORLD, 1);
  6656.      }
  6657.  #else
  6658.      ADIOI_TEST_FILE_HANDLE(fh, myname);
  6659.  #endif
  6660.  
  6661. -    if (!(fh->split_coll_count)) {
  6662. +    if (!(fh->split_coll_count))
  6663. +    {
  6664.  #ifdef MPICH2
  6665.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, 
  6666.          "**iosplitcollnone", 0);
  6667.      return MPIR_Err_return_file(fh, myname, error_code);
  6668.  #elif defined(PRINT_ERR_MSG)
  6669.          FPRINTF(stderr, "MPI_File_read_all_end: Does not match a previous MPI_File_read_all_begin\n");
  6670.          MPI_Abort(MPI_COMM_WORLD, 1);
  6671.  #else /* MPICH-1 */
  6672.      error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_SPLIT_COLL,
  6673.                                myname, (char *) 0, (char *) 0);
  6674.      return ADIOI_Error(fh, error_code, myname);
  6675.  #endif
  6676.      }
  6677. +    /* --END ERROR HANDLING-- */
  6678.  
  6679.  #ifdef HAVE_STATUS_SET_BYTES
  6680.      if (status != MPI_STATUS_IGNORE)
  6681.         *status = fh->split_status;
  6682.  #endif
  6683.      fh->split_coll_count = 0;
  6684.  
  6685.      return MPI_SUCCESS;
  6686. Index: romio/mpi-io/read_at.c
  6687. ===================================================================
  6688. RCS file: /home/MPI/cvsMaster/romio/mpi-io/read_at.c,v
  6689. retrieving revision 1.20
  6690. retrieving revision 1.21
  6691. --- romio/mpi-io/read_at.c    8 Sep 2003 13:33:43 -0000    1.20
  6692. +++ romio/mpi-io/read_at.c    12 Feb 2004 06:08:44 -0000    1.21
  6693. @@ -1,11 +1,11 @@
  6694.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  6695.  /* 
  6696. - *   $Id: read_at.c,v 1.20 2003/09/08 13:33:43 gropp Exp $    
  6697. + *   $Id: read_at.c,v 1.21 2004/02/12 06:08:44 David Exp $    
  6698.   *
  6699.   *   Copyright (C) 1997 University of Chicago. 
  6700.   *   See COPYRIGHT notice in top-level directory.
  6701.   */
  6702.  
  6703.  #include "mpioimpl.h"
  6704.  
  6705.  #ifdef HAVE_WEAK_SYMBOLS
  6706. @@ -52,134 +52,147 @@
  6707.      int datatype_size;
  6708.      ADIO_Offset off;
  6709.  #ifdef MPI_hpux
  6710.      int fl_xmpi;
  6711.  
  6712.      HPMP_IO_START(fl_xmpi, BLKMPIFILEREADAT, TRDTBLOCK, fh, datatype, count);
  6713.  #endif /* MPI_hpux */
  6714.  
  6715. +    /* --BEGIN ERROR HANDLING-- */
  6716.  #ifdef PRINT_ERR_MSG
  6717. -    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {
  6718. +    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE))
  6719. +    {
  6720.      FPRINTF(stderr, "MPI_File_read_at: Invalid file handle\n");
  6721.      MPI_Abort(MPI_COMM_WORLD, 1);
  6722.      }
  6723.  #else
  6724.      ADIOI_TEST_FILE_HANDLE(fh, myname);
  6725.  #endif
  6726.  
  6727. -    if (offset < 0) {
  6728. +    if (offset < 0)
  6729. +    {
  6730.  #ifdef MPICH2
  6731.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ARG,
  6732.          "**iobadoffset", 0);
  6733.      return MPIR_Err_return_file(fh, myname, error_code);
  6734.  #elif defined(PRINT_ERR_MSG)
  6735.      FPRINTF(stderr, "MPI_File_read_at: Invalid offset argument\n");
  6736.      MPI_Abort(MPI_COMM_WORLD, 1);
  6737.  #else /* MPICH-1 */
  6738.      error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG,
  6739.                       myname, (char *) 0, (char *) 0);
  6740.      return ADIOI_Error(fh, error_code, myname);        
  6741.  #endif
  6742.      }
  6743.  
  6744. -    if (count < 0) {
  6745. +    if (count < 0)
  6746. +    {
  6747.  #ifdef MPICH2
  6748.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ARG, 
  6749.          "**iobadcount", 0);
  6750.      return MPIR_Err_return_file(fh, myname, error_code);
  6751.  #elif defined(PRINT_ERR_MSG)
  6752.      FPRINTF(stderr, "MPI_File_read_at: Invalid count argument\n");
  6753.      MPI_Abort(MPI_COMM_WORLD, 1);
  6754.  #else /* MPICH-1 */
  6755.      error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG,
  6756.                       myname, (char *) 0, (char *) 0);
  6757.      return ADIOI_Error(fh, error_code, myname);
  6758.  #endif
  6759.      }
  6760.  
  6761. -    if (datatype == MPI_DATATYPE_NULL) {
  6762. +    if (datatype == MPI_DATATYPE_NULL)
  6763. +    {
  6764.  #ifdef MPICH2
  6765.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_TYPE, 
  6766.          "**dtypenull", 0);
  6767.      return MPIR_Err_return_file(fh, myname, error_code);
  6768.  #elif defined(PRINT_ERR_MSG)
  6769.          FPRINTF(stderr, "MPI_File_read_at: Invalid datatype\n");
  6770.          MPI_Abort(MPI_COMM_WORLD, 1);
  6771.  #else
  6772.      error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL,
  6773.                       myname, (char *) 0, (char *) 0);
  6774.      return ADIOI_Error(fh, error_code, myname);        
  6775.  #endif
  6776.      }
  6777. +    /* --END ERROR HANDLING-- */
  6778.  
  6779.      MPI_Type_size(datatype, &datatype_size);
  6780. -    if (count*datatype_size == 0) {
  6781. +    if (count*datatype_size == 0)
  6782. +    {
  6783.  #ifdef MPI_hpux
  6784.      HPMP_IO_END(fl_xmpi, fh, datatype, count);
  6785.  #endif /* MPI_hpux */
  6786.  #ifdef HAVE_STATUS_SET_BYTES
  6787.         MPIR_Status_set_bytes(status, datatype, 0);
  6788.  #endif
  6789.      return MPI_SUCCESS;
  6790.      }
  6791.  
  6792. -    if ((count*datatype_size) % fh->etype_size != 0) {
  6793. +    /* --BEGIN ERROR HANDLING-- */
  6794. +    if ((count*datatype_size) % fh->etype_size != 0)
  6795. +    {
  6796.  #ifdef MPICH2
  6797.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, 
  6798.          "**ioetype", 0);
  6799.      return MPIR_Err_return_file(fh, myname, error_code);
  6800.  #elif defined(PRINT_ERR_MSG)
  6801.          FPRINTF(stderr, "MPI_File_read_at: Only an integral number of etypes can be accessed\n");
  6802.          MPI_Abort(MPI_COMM_WORLD, 1);
  6803.  #else /* MPICH-1 */
  6804.      error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL,
  6805.                       myname, (char *) 0, (char *) 0);
  6806.      return ADIOI_Error(fh, error_code, myname);        
  6807.  #endif
  6808.      }
  6809.  
  6810. -    if (fh->access_mode & MPI_MODE_WRONLY) {
  6811. +    if (fh->access_mode & MPI_MODE_WRONLY)
  6812. +    {
  6813.  #ifdef MPICH2
  6814.      error_code=  MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ACCESS, 
  6815.          "**ioneedrd", 0);
  6816.      return MPIR_Err_return_file(fh, myname, error_code);
  6817.  #elif defined(PRINT_ERR_MSG)
  6818.      FPRINTF(stderr, "MPI_File_read_at: Can't read from a file opened with MPI_MODE_WRONLY\n");
  6819.      MPI_Abort(MPI_COMM_WORLD, 1);
  6820.  #else /* MPICH-1 */
  6821.      error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, 
  6822.           MPIR_ERR_MODE_WRONLY, myname, (char *) 0, (char *) 0);
  6823.      return ADIOI_Error(fh, error_code, myname);        
  6824.  #endif
  6825.      }
  6826.  
  6827. -    if (fh->access_mode & MPI_MODE_SEQUENTIAL) {
  6828. +    if (fh->access_mode & MPI_MODE_SEQUENTIAL)
  6829. +    {
  6830.  #ifdef MPICH2
  6831.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_UNSUPPORTED_OPERATION,
  6832.          "**ioamodeseq", 0);
  6833.      return MPIR_Err_return_file(fh, myname, error_code);
  6834.  #elif defined(PRINT_ERR_MSG)
  6835.      FPRINTF(stderr, "MPI_File_read_at: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n");
  6836.      MPI_Abort(MPI_COMM_WORLD, 1);
  6837.  #else /* MPICH-1 */
  6838.      error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, 
  6839.                          MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0);
  6840.      return ADIOI_Error(fh, error_code, myname);
  6841.  #endif
  6842.      }
  6843. +    /* --END ERROR HANDLING-- */
  6844.  
  6845.      ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
  6846.      ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig);
  6847.  
  6848.      ADIOI_TEST_DEFERRED(fh, "MPI_File_read_at", &error_code);
  6849.  
  6850.      /* contiguous or strided? */
  6851.  
  6852. -    if (buftype_is_contig && filetype_is_contig) {
  6853. +    if (buftype_is_contig && filetype_is_contig)
  6854. +    {
  6855.      /* convert count and offset to bytes */
  6856.      bufsize = datatype_size * count;
  6857.      off = fh->disp + fh->etype_size * offset;
  6858.  
  6859.          /* if atomic mode requested, lock (exclusive) the region, because there
  6860.             could be a concurrent noncontiguous request. Locking doesn't 
  6861.             work on PIOFS and PVFS, and on NFS it is done in the ADIO_ReadContig.*/
  6862.  
  6863. @@ -191,19 +204,22 @@
  6864.      ADIO_ReadContig(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
  6865.              off, status, &error_code); 
  6866.  
  6867.          if ((fh->atomicity) && (fh->file_system != ADIO_PIOFS) && 
  6868.              (fh->file_system != ADIO_NFS) && (fh->file_system != ADIO_PVFS) &&
  6869.              (fh->file_system != ADIO_PVFS2))
  6870.              ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize);
  6871.      }
  6872. -    else ADIO_ReadStrided(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
  6873. +    else
  6874. +    {
  6875. +    ADIO_ReadStrided(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
  6876.                offset, status, &error_code); 
  6877.      /* For strided and atomic mode, locking is done in ADIO_ReadStrided */
  6878. +    }
  6879.  
  6880.  
  6881.  #ifdef MPI_hpux
  6882.      HPMP_IO_END(fl_xmpi, fh, datatype, count);
  6883.  #endif /* MPI_hpux */
  6884.      return error_code;
  6885.  }
  6886.  
  6887. Index: romio/mpi-io/read_ordb.c
  6888. ===================================================================
  6889. RCS file: /home/MPI/cvsMaster/romio/mpi-io/read_ordb.c,v
  6890. retrieving revision 1.20
  6891. retrieving revision 1.21
  6892. --- romio/mpi-io/read_ordb.c    25 Sep 2003 13:25:11 -0000    1.20
  6893. +++ romio/mpi-io/read_ordb.c    12 Feb 2004 06:08:49 -0000    1.21
  6894. @@ -1,11 +1,11 @@
  6895.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  6896.  /* 
  6897. - *   $Id: read_ordb.c,v 1.20 2003/09/25 13:25:11 gropp Exp $    
  6898. + *   $Id: read_ordb.c,v 1.21 2004/02/12 06:08:49 David Exp $    
  6899.   *
  6900.   *   Copyright (C) 1997 University of Chicago. 
  6901.   *   See COPYRIGHT notice in top-level directory.
  6902.   */
  6903.  
  6904.  #include "mpioimpl.h"
  6905.  
  6906.  #ifdef HAVE_WEAK_SYMBOLS
  6907. @@ -42,125 +42,138 @@
  6908.  {
  6909.      int error_code, datatype_size, nprocs, myrank, incr;
  6910.      int source, dest;
  6911.  #if defined(MPICH2) || !defined(PRINT_ERR_MSG)
  6912.      static char myname[] = "MPI_FILE_READ_ORDERED_BEGIN";
  6913.  #endif
  6914.      ADIO_Offset shared_fp;
  6915.  
  6916. +    /* --BEGIN ERROR HANDLING-- */
  6917.  #ifdef PRINT_ERR_MSG
  6918. -    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {
  6919. +    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE))
  6920. +    {
  6921.      FPRINTF(stderr, "MPI_File_read_ordered_begin: Invalid file handle\n");
  6922.      MPI_Abort(MPI_COMM_WORLD, 1);
  6923.      }
  6924.  #else
  6925.      ADIOI_TEST_FILE_HANDLE(fh, myname);
  6926.  #endif
  6927.  
  6928. -    if (count < 0) {
  6929. +    if (count < 0)
  6930. +    {
  6931.  #ifdef MPICH2
  6932.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ARG, 
  6933.          "**iobadcount", 0);
  6934.      return MPIR_Err_return_file(fh, myname, error_code);
  6935.  #elif defined(PRINT_ERR_MSG)
  6936.      FPRINTF(stderr, "MPI_File_read_ordered_begin: Invalid count argument\n");
  6937.      MPI_Abort(MPI_COMM_WORLD, 1);
  6938.  #else /* MPICH-1 */
  6939.      error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG,
  6940.                       myname, (char *) 0, (char *) 0);
  6941.      return ADIOI_Error(fh, error_code, myname);
  6942.  #endif
  6943.      }
  6944.  
  6945. -    if (datatype == MPI_DATATYPE_NULL) {
  6946. +    if (datatype == MPI_DATATYPE_NULL)
  6947. +    {
  6948.  #ifdef MPICH2
  6949.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_TYPE, 
  6950.          "**dtypenull", 0);
  6951.      return MPIR_Err_return_file(fh, myname, error_code);
  6952.  #elif defined(PRINT_ERR_MSG)
  6953.          FPRINTF(stderr, "MPI_File_read_ordered_begin: Invalid datatype\n");
  6954.          MPI_Abort(MPI_COMM_WORLD, 1);
  6955.  #else /* MPICH-1 */
  6956.      error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL,
  6957.                       myname, (char *) 0, (char *) 0);
  6958.      return ADIOI_Error(fh, error_code, myname);        
  6959.  #endif
  6960.      }
  6961.  
  6962. -    if (fh->split_coll_count) {
  6963. +    if (fh->split_coll_count)
  6964. +    {
  6965.  #ifdef MPICH2
  6966.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, 
  6967.          "**iosplitcoll", 0);
  6968.      return MPIR_Err_return_file(fh, myname, error_code);
  6969.  #elif defined(PRINT_ERR_MSG)
  6970.          FPRINTF(stderr, "MPI_File_read_ordered_begin: Only one active split collective I/O operation allowed per file handle\n");
  6971.          MPI_Abort(MPI_COMM_WORLD, 1);
  6972.  #else /* MPICH-1 */    
  6973.      error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_MULTIPLE_SPLIT_COLL,
  6974.                                myname, (char *) 0, (char *) 0);
  6975.      return ADIOI_Error(fh, error_code, myname);
  6976.  #endif
  6977.      }
  6978. +    /* --END ERROR HANDLING-- */
  6979.  
  6980.      fh->split_coll_count = 1;
  6981.  
  6982.      MPI_Type_size(datatype, &datatype_size);
  6983. -    if ((count*datatype_size) % fh->etype_size != 0) {
  6984. +    /* --BEGIN ERROR HANDLING-- */
  6985. +    if ((count*datatype_size) % fh->etype_size != 0)
  6986. +    {
  6987.  #ifdef MPICH2
  6988.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, 
  6989.          "**ioetype", 0);
  6990.      return MPIR_Err_return_file(fh, myname, error_code);
  6991.  #elif defined(PRINT_ERR_MSG)
  6992.          FPRINTF(stderr, "MPI_File_read_ordered_begin: Only an integral number of etypes can be accessed\n");
  6993.          MPI_Abort(MPI_COMM_WORLD, 1);
  6994.  #else /* MPICH-1 */
  6995.      error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL,
  6996.                       myname, (char *) 0, (char *) 0);
  6997.      return ADIOI_Error(fh, error_code, myname);        
  6998.  #endif
  6999.      }
  7000.  
  7001.      if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS) || 
  7002. -            (fh->file_system == ADIO_PVFS2)) {
  7003. +            (fh->file_system == ADIO_PVFS2))
  7004. +    {
  7005.  #ifdef MPICH2
  7006.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_UNSUPPORTED_OPERATION, "**iosharedunsupported", 0);
  7007.      return MPIR_Err_return_file(fh, myname, error_code);
  7008.  #elif defined(PRINT_ERR_MSG)
  7009.      FPRINTF(stderr, "MPI_File_read_ordered_begin: Shared file pointer not supported on PIOFS and PVFS\n");
  7010.      MPI_Abort(MPI_COMM_WORLD, 1);
  7011.  #else /* MPICH-1 */
  7012.      error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, 
  7013.                      MPIR_ERR_NO_SHARED_FP, myname, (char *) 0, (char *) 0);
  7014.      return ADIOI_Error(fh, error_code, myname);
  7015.  #endif
  7016.      }
  7017. +    /* --END ERROR HANDLING-- */
  7018.  
  7019.      ADIOI_TEST_DEFERRED(fh, "MPI_File_read_ordered_begin", &error_code);
  7020.  
  7021.      MPI_Comm_size(fh->comm, &nprocs);
  7022.      MPI_Comm_rank(fh->comm, &myrank);
  7023.  
  7024.      incr = (count*datatype_size)/fh->etype_size;
  7025.      /* Use a message as a 'token' to order the operations */
  7026.      source = myrank - 1;
  7027.      dest   = myrank + 1;
  7028.      if (source < 0) source = MPI_PROC_NULL;
  7029.      if (dest >= nprocs) dest = MPI_PROC_NULL;
  7030.      MPI_Recv( NULL, 0, MPI_BYTE, source, 0, fh->comm, MPI_STATUS_IGNORE );
  7031.      ADIO_Get_shared_fp(fh, incr, &shared_fp, &error_code);
  7032. -    if (error_code != MPI_SUCCESS) {
  7033. +    /* --BEGIN ERROR HANDLING-- */
  7034. +    if (error_code != MPI_SUCCESS)
  7035. +    {
  7036.  #ifdef MPICH2
  7037.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, myname, __LINE__, MPI_ERR_INTERN, 
  7038.                        "**iosharedfailed", 0);
  7039.      return MPIR_Err_return_file(fh, myname, error_code);
  7040.  #else
  7041.      FPRINTF(stderr, "MPI_File_read_ordered_begin: Error! Could not access shared file pointer.\n");
  7042.      MPI_Abort(MPI_COMM_WORLD, 1);
  7043.  #endif
  7044.      }
  7045. +    /* --END ERROR HANDLING-- */
  7046.      MPI_Send( NULL, 0, MPI_BYTE, dest, 0, fh->comm );
  7047.  
  7048.      ADIO_ReadStridedColl(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
  7049.               shared_fp, &fh->split_status, &error_code);
  7050.  
  7051.      return error_code;
  7052.  }
  7053. Index: romio/mpi-io/read_orde.c
  7054. ===================================================================
  7055. RCS file: /home/MPI/cvsMaster/romio/mpi-io/read_orde.c,v
  7056. retrieving revision 1.15
  7057. retrieving revision 1.16
  7058. --- romio/mpi-io/read_orde.c    8 Sep 2003 13:35:04 -0000    1.15
  7059. +++ romio/mpi-io/read_orde.c    12 Feb 2004 06:08:51 -0000    1.16
  7060. @@ -1,11 +1,11 @@
  7061.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  7062.  /* 
  7063. - *   $Id: read_orde.c,v 1.15 2003/09/08 13:35:04 gropp Exp $    
  7064. + *   $Id: read_orde.c,v 1.16 2004/02/12 06:08:51 David Exp $    
  7065.   *
  7066.   *   Copyright (C) 1997 University of Chicago. 
  7067.   *   See COPYRIGHT notice in top-level directory.
  7068.   */
  7069.  
  7070.  #include "mpioimpl.h"
  7071.  
  7072.  #ifdef HAVE_WEAK_SYMBOLS
  7073. @@ -47,30 +47,33 @@
  7074.      if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {
  7075.      FPRINTF(stderr, "MPI_File_read_ordered_end: Invalid file handle\n");
  7076.      MPI_Abort(MPI_COMM_WORLD, 1);
  7077.      }
  7078.  #else
  7079.      ADIOI_TEST_FILE_HANDLE(fh, myname);
  7080.  #endif
  7081.  
  7082. -    if (!(fh->split_coll_count)) {
  7083. +    /* --BEGIN ERROR HANDLING-- */
  7084. +    if (!(fh->split_coll_count))
  7085. +    {
  7086.  #ifdef MPICH2
  7087.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, 
  7088.          "**iosplitcollnone", 0);
  7089.      return MPIR_Err_return_file(fh, myname, error_code);
  7090.  #elif defined(PRINT_ERR_MSG)
  7091.          FPRINTF(stderr, "MPI_File_read_ordered_end: Does not match a previous MPI_File_read_ordered_begin\n");
  7092.          MPI_Abort(MPI_COMM_WORLD, 1);
  7093.  #else /* MPICH-1 */
  7094.      error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_SPLIT_COLL,
  7095.                                myname, (char *) 0, (char *) 0);
  7096.      return ADIOI_Error(fh, error_code, myname);
  7097.  #endif
  7098.      }
  7099. +    /* --END ERROR HANDLING-- */
  7100.  
  7101.  #ifdef HAVE_STATUS_SET_BYTES
  7102.      if (status != MPI_STATUS_IGNORE)
  7103.         *status = fh->split_status;
  7104.  #endif
  7105.      fh->split_coll_count = 0;
  7106.  
  7107.      return MPI_SUCCESS;
  7108. Index: romio/mpi-io/read_sh.c
  7109. ===================================================================
  7110. RCS file: /home/MPI/cvsMaster/romio/mpi-io/read_sh.c,v
  7111. retrieving revision 1.19
  7112. retrieving revision 1.20
  7113. --- romio/mpi-io/read_sh.c    15 Sep 2003 13:33:31 -0000    1.19
  7114. +++ romio/mpi-io/read_sh.c    12 Feb 2004 06:08:53 -0000    1.20
  7115. @@ -1,11 +1,11 @@
  7116.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  7117.  /* 
  7118. - *   $Id: read_sh.c,v 1.19 2003/09/15 13:33:31 gropp Exp $    
  7119. + *   $Id: read_sh.c,v 1.20 2004/02/12 06:08:53 David Exp $    
  7120.   *
  7121.   *   Copyright (C) 1997 University of Chicago. 
  7122.   *   See COPYRIGHT notice in top-level directory.
  7123.   */
  7124.  
  7125.  #include "mpioimpl.h"
  7126.  
  7127.  #ifdef HAVE_WEAK_SYMBOLS
  7128. @@ -45,112 +45,126 @@
  7129.  {
  7130.      int error_code, bufsize, buftype_is_contig, filetype_is_contig;
  7131.  #if defined(MPICH2) || !defined(PRINT_ERR_MSG)
  7132.      static char myname[] = "MPI_FILE_READ_SHARED";
  7133.  #endif
  7134.      int datatype_size, incr;
  7135.      ADIO_Offset off, shared_fp;
  7136.  
  7137. +    /* --BEGIN ERROR HANDLING-- */
  7138.  #ifdef PRINT_ERR_MSG
  7139. -    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {
  7140. +    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE))
  7141. +    {
  7142.      FPRINTF(stderr, "MPI_File_read_shared: Invalid file handle\n");
  7143.      MPI_Abort(MPI_COMM_WORLD, 1);
  7144.      }
  7145.  #else
  7146.      ADIOI_TEST_FILE_HANDLE(fh, myname);
  7147.  #endif
  7148.  
  7149. -    if (count < 0) {
  7150. +    if (count < 0)
  7151. +    {
  7152.  #ifdef MPICH2
  7153.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ARG, 
  7154.          "**iobadcount", 0);
  7155.      return MPIR_Err_return_file(fh, myname, error_code);
  7156.  #elif defined(PRINT_ERR_MSG)
  7157.      FPRINTF(stderr, "MPI_File_read_shared: Invalid count argument\n");
  7158.      MPI_Abort(MPI_COMM_WORLD, 1);
  7159.  #else /* MPICH-1 */
  7160.      error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG,
  7161.                       myname, (char *) 0, (char *) 0);
  7162.      return ADIOI_Error(fh, error_code, myname);
  7163.  #endif
  7164.      }
  7165.  
  7166. -    if (datatype == MPI_DATATYPE_NULL) {
  7167. +    if (datatype == MPI_DATATYPE_NULL)
  7168. +    {
  7169.  #ifdef MPICH2
  7170.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_TYPE, 
  7171.          "**dtypenull", 0);
  7172.      return MPIR_Err_return_file(fh, myname, error_code);
  7173.  #elif defined(PRINT_ERR_MSG)
  7174.          FPRINTF(stderr, "MPI_File_read_shared: Invalid datatype\n");
  7175.          MPI_Abort(MPI_COMM_WORLD, 1);
  7176.  #else /* MPICH-1 */
  7177.      error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL,
  7178.                       myname, (char *) 0, (char *) 0);
  7179.      return ADIOI_Error(fh, error_code, myname);        
  7180.  #endif
  7181.      }
  7182. +    /* --END ERROR HANDLING-- */
  7183.  
  7184.      MPI_Type_size(datatype, &datatype_size);
  7185. -    if (count*datatype_size == 0) {
  7186. +    if (count*datatype_size == 0)
  7187. +    {
  7188.  #ifdef HAVE_STATUS_SET_BYTES
  7189.      MPIR_Status_set_bytes(status, datatype, 0);
  7190.  #endif
  7191.      return MPI_SUCCESS;
  7192.      }
  7193.  
  7194. -    if ((count*datatype_size) % fh->etype_size != 0) {
  7195. +    /* --BEGIN ERROR HANDLING-- */
  7196. +    if ((count*datatype_size) % fh->etype_size != 0)
  7197. +    {
  7198.  #ifdef MPICH2
  7199.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, 
  7200.          "**ioetype", 0);
  7201.      return MPIR_Err_return_file(fh, myname, error_code);
  7202.  #elif defined(PRINT_ERR_MSG)
  7203.      FPRINTF(stderr, "MPI_File_read_shared: Only an integral number of etypes can be accessed\n");
  7204.      MPI_Abort(MPI_COMM_WORLD, 1);
  7205.  #else /* MPICH-1 */
  7206.      error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL,
  7207.                       myname, (char *) 0, (char *) 0);
  7208.      return ADIOI_Error(fh, error_code, myname);        
  7209.  #endif
  7210.      }
  7211.  
  7212. -    if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS) || (fh->file_system == ADIO_PVFS2)) {
  7213. +    if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS) || (fh->file_system == ADIO_PVFS2))
  7214. +    {
  7215.  #ifdef MPICH2
  7216.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_UNSUPPORTED_OPERATION, "**iosharedunsupported", 0);
  7217.      return MPIR_Err_return_file(fh, myname, error_code);
  7218.  #elif defined(PRINT_ERR_MSG)
  7219.      FPRINTF(stderr, "MPI_File_read_shared: Shared file pointer not supported on PIOFS and PVFS\n");
  7220.      MPI_Abort(MPI_COMM_WORLD, 1);
  7221.  #else /* MPICH-1 */
  7222.      error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, 
  7223.                      MPIR_ERR_NO_SHARED_FP, myname, (char *) 0, (char *) 0);
  7224.      return ADIOI_Error(fh, error_code, myname);
  7225.  #endif
  7226.      }
  7227. +    /* --END ERROR HANDLING-- */
  7228.  
  7229.      ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
  7230.      ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig);
  7231.  
  7232.      ADIOI_TEST_DEFERRED(fh, "MPI_File_read_shared", &error_code);
  7233.  
  7234.      incr = (count*datatype_size)/fh->etype_size;
  7235.      ADIO_Get_shared_fp(fh, incr, &shared_fp, &error_code);
  7236. -    if (error_code != MPI_SUCCESS) {
  7237. +    /* --BEGIN ERROR HANDLING-- */
  7238. +    if (error_code != MPI_SUCCESS)
  7239. +    {
  7240.  #ifdef MPICH2
  7241.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, myname, __LINE__, MPI_ERR_INTERN, 
  7242.                        "**iosharedfailed", 0);
  7243.      return MPIR_Err_return_file(fh, myname, error_code);
  7244.  #else
  7245.      FPRINTF(stderr, "MPI_File_read_shared: Error! Could not access shared file pointer.\n");
  7246.      MPI_Abort(MPI_COMM_WORLD, 1);
  7247.  #endif
  7248.      }
  7249. +    /* --END ERROR HANDLING-- */
  7250.  
  7251.      /* contiguous or strided? */
  7252. -    if (buftype_is_contig && filetype_is_contig) {
  7253. +    if (buftype_is_contig && filetype_is_contig)
  7254. +    {
  7255.      /* convert count and shared_fp to bytes */
  7256.          bufsize = datatype_size * count;
  7257.          off = fh->disp + fh->etype_size * shared_fp;
  7258.  
  7259.          /* if atomic mode requested, lock (exclusive) the region, because there
  7260.             could be a concurrent noncontiguous request. On NFS, locking 
  7261.             is done in the ADIO_ReadContig.*/
  7262.  
  7263. @@ -158,14 +172,17 @@
  7264.              ADIOI_WRITE_LOCK(fh, off, SEEK_SET, bufsize);
  7265.  
  7266.          ADIO_ReadContig(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
  7267.                          off, status, &error_code); 
  7268.  
  7269.          if ((fh->atomicity) && (fh->file_system != ADIO_NFS))
  7270.              ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize);
  7271.      }
  7272. -    else ADIO_ReadStrided(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
  7273. +    else
  7274. +    {
  7275. +    ADIO_ReadStrided(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
  7276.                            shared_fp, status, &error_code); 
  7277.      /* For strided and atomic mode, locking is done in ADIO_ReadStrided */
  7278. +    }
  7279.  
  7280.      return error_code;
  7281.  }
  7282. Index: romio/mpi-io/seek_sh.c
  7283. ===================================================================
  7284. RCS file: /home/MPI/cvsMaster/romio/mpi-io/seek_sh.c,v
  7285. retrieving revision 1.18
  7286. retrieving revision 1.19
  7287. --- romio/mpi-io/seek_sh.c    15 Sep 2003 13:33:31 -0000    1.18
  7288. +++ romio/mpi-io/seek_sh.c    12 Feb 2004 06:09:02 -0000    1.19
  7289. @@ -1,11 +1,11 @@
  7290.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  7291.  /* 
  7292. - *   $Id: seek_sh.c,v 1.18 2003/09/15 13:33:31 gropp Exp $    
  7293. + *   $Id: seek_sh.c,v 1.19 2004/02/12 06:09:02 David Exp $    
  7294.   *
  7295.   *   Copyright (C) 1997 University of Chicago. 
  7296.   *   See COPYRIGHT notice in top-level directory.
  7297.   */
  7298.  
  7299.  #include "mpioimpl.h"
  7300.  
  7301.  #ifdef HAVE_WEAK_SYMBOLS
  7302. @@ -37,171 +37,198 @@
  7303.  int MPI_File_seek_shared(MPI_File fh, MPI_Offset offset, int whence)
  7304.  {
  7305.      int error_code=MPI_SUCCESS, tmp_whence, myrank;
  7306.  #if defined(MPICH2) || !defined(PRINT_ERR_MSG)
  7307.      static char myname[] = "MPI_FILE_SEEK_SHARED";
  7308.  #endif
  7309.      MPI_Offset curr_offset, eof_offset, tmp_offset;
  7310.  
  7311. +    /* --BEGIN ERROR HANDLING-- */
  7312.  #ifdef PRINT_ERR_MSG
  7313. -    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {
  7314. +    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE))
  7315. +    {
  7316.      FPRINTF(stderr, "MPI_File_seek_shared: Invalid file handle\n");
  7317.      MPI_Abort(MPI_COMM_WORLD, 1);
  7318.      }
  7319.  #else
  7320.      ADIOI_TEST_FILE_HANDLE(fh, myname);
  7321.  #endif
  7322.  
  7323. -    if (fh->access_mode & MPI_MODE_SEQUENTIAL) {
  7324. +    if (fh->access_mode & MPI_MODE_SEQUENTIAL)
  7325. +    {
  7326.  #ifdef MPICH2
  7327.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_UNSUPPORTED_OPERATION,
  7328.          "**ioamodeseq", 0);
  7329.      return MPIR_Err_return_file(fh, myname, error_code);
  7330.  #elif defined(PRINT_ERR_MSG)
  7331.          FPRINTF(stderr, "MPI_File_seek_shared: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n");
  7332.          MPI_Abort(MPI_COMM_WORLD, 1);
  7333.  #else /* MPICH-1 */
  7334.      error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, 
  7335.                          MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0);
  7336.      return ADIOI_Error(fh, error_code, myname);
  7337.  #endif
  7338.      }
  7339.  
  7340. -    if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS)|| (fh->file_system == ADIO_PVFS2)) {
  7341. +    if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS)|| (fh->file_system == ADIO_PVFS2))
  7342. +    {
  7343.  #ifdef MPICH2
  7344.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_UNSUPPORTED_OPERATION, 
  7345.          "**iosharedunsupported", 0);
  7346.      return MPIR_Err_return_file(fh, myname, error_code);
  7347.  #elif defined(PRINT_ERR_MSG)
  7348.      FPRINTF(stderr, "MPI_File_seek_shared: Shared file pointer not supported on PIOFS and PVFS\n");
  7349.      MPI_Abort(MPI_COMM_WORLD, 1);
  7350.  #else /* MPICH-1 */
  7351.      error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, 
  7352.                      MPIR_ERR_NO_SHARED_FP, myname, (char *) 0, (char *) 0);
  7353.      return ADIOI_Error(fh, error_code, myname);
  7354.  #endif
  7355.      }
  7356. +    /* --END ERROR HANDLING-- */
  7357.  
  7358.      tmp_offset = offset;
  7359.      MPI_Bcast(&tmp_offset, 1, ADIO_OFFSET, 0, fh->comm);
  7360. -    if (tmp_offset != offset) {
  7361. +    /* --BEGIN ERROR HANDLING-- */
  7362. +    if (tmp_offset != offset)
  7363. +    {
  7364.  #ifdef MPICH2
  7365.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ARG, "**notsame", 0);
  7366.      return MPIR_Err_return_file(fh, myname, error_code);
  7367.  #elif defined(PRINT_ERR_MSG)
  7368.          FPRINTF(stderr, "MPI_File_seek_shared: offset must be the same on all processes\n");
  7369.          MPI_Abort(MPI_COMM_WORLD, 1);
  7370.  #else /* MPICH-1 */
  7371.      error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG_NOT_SAME,
  7372.                       myname, (char *) 0, (char *) 0);
  7373.      return ADIOI_Error(fh, error_code, myname);
  7374.  #endif
  7375.      }
  7376. +    /* --END ERROR HANDLING-- */
  7377.  
  7378.      tmp_whence = whence;
  7379.      MPI_Bcast(&tmp_whence, 1, MPI_INT, 0, fh->comm);
  7380. -    if (tmp_whence != whence) {
  7381. +    /* --BEGIN ERROR HANDLING-- */
  7382. +    if (tmp_whence != whence)
  7383. +    {
  7384.  #ifdef MPICH2
  7385.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ARG,
  7386.          "**iobadwhence", 0);
  7387.      return MPIR_Err_return_file(fh, myname, error_code);
  7388.  #elif defined(PRINT_ERR_MSG)
  7389.          FPRINTF(stderr, "MPI_File_seek_shared: whence argument must be the same on all processes\n");
  7390.          MPI_Abort(MPI_COMM_WORLD, 1);
  7391.  #else /* MPICH-1 */
  7392.      error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_WHENCE_ARG_NOT_SAME,
  7393.                       myname, (char *) 0, (char *) 0);
  7394.      return ADIOI_Error(fh, error_code, myname);
  7395.  #endif
  7396.      }
  7397. +    /* --END ERROR HANDLING-- */
  7398.  
  7399.      ADIOI_TEST_DEFERRED(fh, "MPI_File_seek_shared", &error_code);
  7400.  
  7401.      MPI_Comm_rank(fh->comm, &myrank);
  7402.  
  7403. -    if (!myrank) {
  7404. -    switch(whence) {
  7405. +    if (!myrank)
  7406. +    {
  7407. +    switch(whence)
  7408. +    {
  7409.      case MPI_SEEK_SET:
  7410. -        if (offset < 0) {
  7411. +        /* --BEGIN ERROR HANDLING-- */
  7412. +        if (offset < 0)
  7413. +        {
  7414.  #ifdef MPICH2
  7415.          error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ARG,
  7416.              "**iobadoffset", 0);
  7417.          return MPIR_Err_return_file(fh, myname, error_code);
  7418.  #elif defined(PRINT_ERR_MSG)
  7419.          FPRINTF(stderr, "MPI_File_seek_shared: Invalid offset argument\n");
  7420.          MPI_Abort(MPI_COMM_WORLD, 1);
  7421.  #else /* MPICH-1 */
  7422.      error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG,
  7423.                       myname, (char *) 0, (char *) 0);
  7424.      return ADIOI_Error(fh, error_code, myname);        
  7425.  #endif
  7426.          }
  7427. +        /* --END ERROR HANDLING-- */
  7428.          break;
  7429.      case MPI_SEEK_CUR:
  7430.          /* get current location of shared file pointer */
  7431.          ADIO_Get_shared_fp(fh, 0, &curr_offset, &error_code);
  7432. -        if (error_code != MPI_SUCCESS) {
  7433. +        /* --BEGIN ERROR HANDLING-- */
  7434. +        if (error_code != MPI_SUCCESS)
  7435. +        {
  7436.  #ifdef MPICH2
  7437.          error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, myname, __LINE__, MPI_ERR_INTERN, 
  7438.          "**iosharedfailed", 0);
  7439.          return MPIR_Err_return_file(fh, myname, error_code);
  7440.  #else
  7441.          FPRINTF(stderr, "MPI_File_seek_shared: Error! Could not access shared file pointer.\n");
  7442.          MPI_Abort(MPI_COMM_WORLD, 1);
  7443.  #endif
  7444.          }
  7445. +        /* --END ERROR HANDLING-- */
  7446.          offset += curr_offset;
  7447. -        if (offset < 0) {
  7448. +        /* --BEGIN ERROR HANDLING-- */
  7449. +        if (offset < 0)
  7450. +        {
  7451.  #ifdef MPICH2
  7452.          error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ARG,
  7453.              "**ionegoffset", 0);
  7454.          return MPIR_Err_return_file(fh, myname, error_code);
  7455.  #elif defined(PRINT_ERR_MSG)
  7456.          FPRINTF(stderr, "MPI_File_seek_shared: offset points to a negative location in the file\n");
  7457.          MPI_Abort(MPI_COMM_WORLD, 1);
  7458.  #else /* MPICH-1 */
  7459.      error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG_NEG,
  7460.                       myname, (char *) 0, (char *) 0);
  7461.      return ADIOI_Error(fh, error_code, myname);        
  7462.  #endif
  7463.          }
  7464. +        /* --END ERROR HANDLING-- */
  7465.          break;
  7466.      case MPI_SEEK_END:
  7467.          /* find offset corr. to end of file */
  7468.          ADIOI_Get_eof_offset(fh, &eof_offset);
  7469.          offset += eof_offset;
  7470. -        if (offset < 0) {
  7471. +        /* --BEGIN ERROR HANDLING-- */
  7472. +        if (offset < 0)
  7473. +        {
  7474.  #ifdef MPICH2
  7475.          error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ARG,
  7476.              "**ionegoffset", 0);
  7477.          return MPIR_Err_return_file(fh, myname, error_code);
  7478.  #elif defined(PRINT_ERR_MSG)
  7479.          FPRINTF(stderr, "MPI_File_seek_shared: offset points to a negative location in the file\n");
  7480.          MPI_Abort(MPI_COMM_WORLD, 1);
  7481.  #else /* MPICH-1 */
  7482.      error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG_NEG,
  7483.                       myname, (char *) 0, (char *) 0);
  7484.      return ADIOI_Error(fh, error_code, myname);        
  7485.  #endif
  7486.          }
  7487. +        /* --END ERROR HANDLING-- */
  7488.          break;
  7489.      default:
  7490. +        /* --BEGIN ERROR HANDLING-- */
  7491.  #ifdef MPICH2
  7492.          error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ARG,
  7493.          "**iobadwhence", 0);
  7494.          return MPIR_Err_return_file(fh, myname, error_code);
  7495.  #elif defined(PRINT_ERR_MSG)
  7496.          FPRINTF(stderr, "MPI_File_seek_shared: Invalid whence argument\n");
  7497.          MPI_Abort(MPI_COMM_WORLD, 1);
  7498.  #else /* MPICH-1 */
  7499.          error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_WHENCE_ARG,
  7500.                       myname, (char *) 0, (char *) 0);
  7501.          return ADIOI_Error(fh, error_code, myname);
  7502.  #endif
  7503. +        /* --END ERROR HANDLING-- */
  7504.      }
  7505.  
  7506.      ADIO_Set_shared_fp(fh, offset, &error_code);
  7507.      }
  7508.  
  7509.      /* FIXME: explain why the barrier is necessary */
  7510.      MPI_Barrier(fh->comm);
  7511.  
  7512. Index: romio/mpi-io/set_errh.c
  7513. ===================================================================
  7514. RCS file: /home/MPI/cvsMaster/romio/mpi-io/set_errh.c,v
  7515. retrieving revision 1.11
  7516. retrieving revision 1.12
  7517. --- romio/mpi-io/set_errh.c    18 Apr 2003 20:15:12 -0000    1.11
  7518. +++ romio/mpi-io/set_errh.c    16 Dec 2003 17:32:34 -0000    1.12
  7519. @@ -1,11 +1,11 @@
  7520.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  7521.  /* 
  7522. - *   $Id: set_errh.c,v 1.11 2003/04/18 20:15:12 David Exp $    
  7523. + *   $Id: set_errh.c,v 1.12 2003/12/16 17:32:34 thakur Exp $    
  7524.   *
  7525.   *   Copyright (C) 1997 University of Chicago. 
  7526.   *   See COPYRIGHT notice in top-level directory.
  7527.   */
  7528.  
  7529.  #include "mpioimpl.h"
  7530.  #include "adio_extern.h"
  7531.  
  7532. @@ -36,17 +36,17 @@
  7533.  @*/
  7534.  int MPI_File_set_errhandler(MPI_File fh, MPI_Errhandler errhandler)
  7535.  {
  7536.      int error_code = MPI_SUCCESS;
  7537.  #if defined(MPICH2) || !defined(PRINT_ERR_MSG)
  7538.      static char myname[] = "MPI_FILE_SET_ERRHANDLER";
  7539.  #endif
  7540.  
  7541. -    if ((errhandler != MPI_ERRORS_RETURN) || (errhandler != MPI_ERRORS_ARE_FATAL)) {
  7542. +    if ((errhandler != MPI_ERRORS_RETURN) && (errhandler != MPI_ERRORS_ARE_FATAL)) {
  7543.      FPRINTF(stderr, "Only MPI_ERRORS_RETURN and MPI_ERRORS_ARE_FATAL are currently supported for MPI_File_set_errhandler\n");
  7544.      MPI_Abort(MPI_COMM_WORLD, 1);
  7545.      }
  7546.  
  7547.      if (fh == MPI_FILE_NULL) ADIOI_DFLT_ERR_HANDLER = errhandler;
  7548.      else if (fh->cookie != ADIOI_FILE_COOKIE) {
  7549.  #ifdef MPICH2
  7550.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_FILE, "**iobadfh", 0);
  7551. Index: romio/mpi-io/wr_atallb.c
  7552. ===================================================================
  7553. RCS file: /home/MPI/cvsMaster/romio/mpi-io/wr_atallb.c,v
  7554. retrieving revision 1.16
  7555. retrieving revision 1.17
  7556. --- romio/mpi-io/wr_atallb.c    5 Sep 2003 22:33:57 -0000    1.16
  7557. +++ romio/mpi-io/wr_atallb.c    12 Feb 2004 06:09:09 -0000    1.17
  7558. @@ -1,11 +1,11 @@
  7559.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  7560.  /* 
  7561. - *   $Id: wr_atallb.c,v 1.16 2003/09/05 22:33:57 gropp Exp $    
  7562. + *   $Id: wr_atallb.c,v 1.17 2004/02/12 06:09:09 David Exp $    
  7563.   *
  7564.   *   Copyright (C) 1997 University of Chicago. 
  7565.   *   See COPYRIGHT notice in top-level directory.
  7566.   */
  7567.  
  7568.  #include "mpioimpl.h"
  7569.  
  7570.  #ifdef HAVE_WEAK_SYMBOLS
  7571. @@ -39,113 +39,124 @@
  7572.  int MPI_File_write_at_all_begin(MPI_File fh, MPI_Offset offset, void *buf,
  7573.                           int count, MPI_Datatype datatype)
  7574.  {
  7575.      int error_code, datatype_size;
  7576.  #if defined(MPICH2) || !defined(PRINT_ERR_MSG)
  7577.      static char myname[] = "MPI_FILE_WRITE_AT_ALL_BEGIN";
  7578.  #endif
  7579.  
  7580. +    /* --BEGIN ERROR HANDLING-- */
  7581.  #ifdef PRINT_ERR_MSG
  7582. -    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {
  7583. +    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE))
  7584. +    {
  7585.      FPRINTF(stderr, "MPI_File_write_at_all_begin: Invalid file handle\n");
  7586.      MPI_Abort(MPI_COMM_WORLD, 1);
  7587.      }
  7588.  #else
  7589.      ADIOI_TEST_FILE_HANDLE(fh, myname);
  7590.  #endif
  7591.  
  7592. -    if (offset < 0) {
  7593. +    if (offset < 0)
  7594. +    {
  7595.  #ifdef MPICH2
  7596.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ARG, "**iobadoffset", 0);
  7597.      return MPIR_Err_return_file(fh, myname, error_code);
  7598.  #elif defined(PRINT_ERR_MSG)
  7599.      FPRINTF(stderr, "MPI_File_write_at_all_begin: Invalid offset argument\n");
  7600.      MPI_Abort(MPI_COMM_WORLD, 1);
  7601.  #else /* MPICH-1 */
  7602.      error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG,
  7603.                       myname, (char *) 0, (char *) 0);
  7604.      return ADIOI_Error(fh, error_code, myname);        
  7605.  #endif
  7606.      }
  7607.  
  7608. -    if (count < 0) {
  7609. +    if (count < 0)
  7610. +    {
  7611.  #ifdef MPICH2
  7612.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ARG, "**iobadcount", 0);
  7613.      return MPIR_Err_return_file(fh, myname, error_code);
  7614.  #elif defined(PRINT_ERR_MSG)
  7615.      FPRINTF(stderr, "MPI_File_write_at_all_begin: Invalid count argument\n");
  7616.      MPI_Abort(MPI_COMM_WORLD, 1);
  7617.  #else /* MPICH-1 */
  7618.      error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG,
  7619.                       myname, (char *) 0, (char *) 0);
  7620.      return ADIOI_Error(fh, error_code, myname);        
  7621.  #endif
  7622.      }
  7623.  
  7624. -    if (datatype == MPI_DATATYPE_NULL) {
  7625. +    if (datatype == MPI_DATATYPE_NULL)
  7626. +    {
  7627.  #ifdef MPICH2
  7628.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_TYPE, 
  7629.          "**dtypenull", 0);
  7630.      return MPIR_Err_return_file(fh, myname, error_code);
  7631.  #elif defined(PRINT_ERR_MSG)
  7632.          FPRINTF(stderr, "MPI_File_write_at_all_begin: Invalid datatype\n");
  7633.          MPI_Abort(MPI_COMM_WORLD, 1);
  7634.  #else /* MPICH-1 */
  7635.      error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL,
  7636.                       myname, (char *) 0, (char *) 0);
  7637.      return ADIOI_Error(fh, error_code, myname);        
  7638.  #endif
  7639.      }
  7640.  
  7641. -    if (fh->access_mode & MPI_MODE_SEQUENTIAL) {
  7642. +    if (fh->access_mode & MPI_MODE_SEQUENTIAL)
  7643. +    {
  7644.  #ifdef MPICH2
  7645.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_UNSUPPORTED_OPERATION, 
  7646.          "**ioamodeseq", 0);
  7647.      return MPIR_Err_return_file(fh, myname, error_code);
  7648.  #elif defined(PRINT_ERR_MSG)
  7649.          FPRINTF(stderr, "MPI_File_write_at_all_begin: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n");
  7650.          MPI_Abort(MPI_COMM_WORLD, 1);
  7651.  #else /* MPICH-1 */
  7652.      error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, 
  7653.                          MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0);
  7654.      return ADIOI_Error(fh, error_code, myname);
  7655.  #endif
  7656.      }
  7657.  
  7658. -    if (fh->split_coll_count) {
  7659. +    if (fh->split_coll_count)
  7660. +    {
  7661.  #ifdef MPICH2
  7662.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, 
  7663.          "**iosplitcoll", 0);
  7664.      return MPIR_Err_return_file(fh, myname, error_code);
  7665.  #elif defined(PRINT_ERR_MSG)
  7666.          FPRINTF(stderr, "MPI_File_write_at_all_begin: Only one active split collective I/O operation allowed per file handle\n");
  7667.          MPI_Abort(MPI_COMM_WORLD, 1);
  7668.  #else /* MPICH-1 */
  7669.      error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_MULTIPLE_SPLIT_COLL,
  7670.                                myname, (char *) 0, (char *) 0);
  7671.      return ADIOI_Error(fh, error_code, myname);
  7672.  #endif
  7673.      }
  7674. +    /* --END ERROR HANDLING-- */
  7675.  
  7676.      fh->split_coll_count = 1;
  7677.  
  7678.      MPI_Type_size(datatype, &datatype_size);
  7679. -    if ((count*datatype_size) % fh->etype_size != 0) {
  7680. +    /* --BEGIN ERROR HANDLING-- */
  7681. +    if ((count*datatype_size) % fh->etype_size != 0)
  7682. +    {
  7683.  #ifdef MPICH2
  7684.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, 
  7685.          "**ioetype", 0);
  7686.      return MPIR_Err_return_file(fh, myname, error_code);
  7687.  #elif defined(PRINT_ERR_MSG)
  7688.          FPRINTF(stderr, "MPI_File_write_at_all_begin: Only an integral number of etypes can be accessed\n");
  7689.          MPI_Abort(MPI_COMM_WORLD, 1);
  7690.  #else /* MPICH-1 */
  7691.      error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL,
  7692.                       myname, (char *) 0, (char *) 0);
  7693.      return ADIOI_Error(fh, error_code, myname);        
  7694.  #endif
  7695.      }
  7696. +    /* --END ERROR HANDLING-- */
  7697.  
  7698.      fh->split_datatype = datatype;
  7699.      ADIO_WriteStridedColl(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
  7700.                offset, &fh->split_status, &error_code);
  7701.      return error_code;
  7702.  }
  7703. Index: romio/mpi-io/wr_atalle.c
  7704. ===================================================================
  7705. RCS file: /home/MPI/cvsMaster/romio/mpi-io/wr_atalle.c,v
  7706. retrieving revision 1.16
  7707. retrieving revision 1.17
  7708. --- romio/mpi-io/wr_atalle.c    8 Sep 2003 13:35:05 -0000    1.16
  7709. +++ romio/mpi-io/wr_atalle.c    12 Feb 2004 06:09:10 -0000    1.17
  7710. @@ -1,11 +1,11 @@
  7711.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  7712.  /* 
  7713. - *   $Id: wr_atalle.c,v 1.16 2003/09/08 13:35:05 gropp Exp $    
  7714. + *   $Id: wr_atalle.c,v 1.17 2004/02/12 06:09:10 David Exp $    
  7715.   *
  7716.   *   Copyright (C) 1997 University of Chicago. 
  7717.   *   See COPYRIGHT notice in top-level directory.
  7718.   */
  7719.  
  7720.  #include "mpioimpl.h"
  7721.  
  7722.  #ifdef HAVE_WEAK_SYMBOLS
  7723. @@ -38,39 +38,43 @@
  7724.  @*/
  7725.  int MPI_File_write_at_all_end(MPI_File fh, void *buf, MPI_Status *status)
  7726.  {
  7727.  #if defined(MPICH2) || !defined(PRINT_ERR_MSG)
  7728.      int error_code;
  7729.      static char myname[] = "MPI_FILE_WRITE_AT_ALL_END";
  7730.  #endif
  7731.  
  7732. +    /* --BEGIN ERROR HANDLING-- */
  7733.  #ifdef PRINT_ERR_MSG
  7734. -    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {
  7735. +    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE))
  7736. +    {
  7737.      FPRINTF(stderr, "MPI_File_write_at_all_end: Invalid file handle\n");
  7738.      MPI_Abort(MPI_COMM_WORLD, 1);
  7739.      }
  7740.  #else
  7741.      ADIOI_TEST_FILE_HANDLE(fh, myname);
  7742.  #endif
  7743.  
  7744. -    if (!(fh->split_coll_count)) {
  7745. +    if (!(fh->split_coll_count))
  7746. +    {
  7747.  #ifdef MPICH2
  7748.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, 
  7749.          "**iosplitcollnone", 0);
  7750.      return MPIR_Err_return_file(fh, myname, error_code);
  7751.  #elif defined(PRINT_ERR_MSG)
  7752.          FPRINTF(stderr, "MPI_File_write_at_all_end: Does not match a previous MPI_File_write_at_all_begin\n");
  7753.          MPI_Abort(MPI_COMM_WORLD, 1);
  7754.  #else /* MPICH-1 */
  7755.      error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_SPLIT_COLL,
  7756.                                myname, (char *) 0, (char *) 0);
  7757.      return ADIOI_Error(fh, error_code, myname);
  7758.  #endif
  7759.      }
  7760. +    /* --END ERROR HANDLING-- */
  7761.  
  7762.  #ifdef HAVE_STATUS_SET_BYTES
  7763.      /* FIXME - we should really ensure that the split_datatype remains
  7764.         valid by incrementing the ref count in the write_allb.c routine
  7765.         and decrement it here after setting the bytes */
  7766.      if (status != MPI_STATUS_IGNORE)
  7767.         *status = fh->split_status;
  7768.  #endif
  7769. Index: romio/mpi-io/write_allb.c
  7770. ===================================================================
  7771. RCS file: /home/MPI/cvsMaster/romio/mpi-io/write_allb.c,v
  7772. retrieving revision 1.15
  7773. retrieving revision 1.16
  7774. --- romio/mpi-io/write_allb.c    5 Sep 2003 22:34:31 -0000    1.15
  7775. +++ romio/mpi-io/write_allb.c    12 Feb 2004 06:09:12 -0000    1.16
  7776. @@ -1,11 +1,11 @@
  7777.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  7778.  /* 
  7779. - *   $Id: write_allb.c,v 1.15 2003/09/05 22:34:31 gropp Exp $    
  7780. + *   $Id: write_allb.c,v 1.16 2004/02/12 06:09:12 David Exp $    
  7781.   *
  7782.   *   Copyright (C) 1997 University of Chicago. 
  7783.   *   See COPYRIGHT notice in top-level directory.
  7784.   */
  7785.  
  7786.  #include "mpioimpl.h"
  7787.  
  7788.  #ifdef HAVE_WEAK_SYMBOLS
  7789. @@ -38,100 +38,110 @@
  7790.  int MPI_File_write_all_begin(MPI_File fh, void *buf, int count, 
  7791.                              MPI_Datatype datatype)
  7792.  {
  7793.      int error_code, datatype_size;
  7794.  #if defined(MPICH2) || !defined(PRINT_ERR_MSG)
  7795.      static char myname[] = "MPI_FILE_WRITE_ALL_BEGIN";
  7796.  #endif
  7797.  
  7798. +    /* --BEGIN ERROR HANDLING-- */
  7799.  #ifdef PRINT_ERR_MSG
  7800. -    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {
  7801. +    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE))
  7802. +    {
  7803.      FPRINTF(stderr, "MPI_File_write_all_begin: Invalid file handle\n");
  7804.      MPI_Abort(MPI_COMM_WORLD, 1);
  7805.      }
  7806.  #else
  7807.      ADIOI_TEST_FILE_HANDLE(fh, myname);
  7808.  #endif
  7809.  
  7810. -    if (count < 0) {
  7811. +    if (count < 0)
  7812. +    {
  7813.  #ifdef MPICH2
  7814.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ARG, 
  7815.          "**iobadcount", 0);
  7816.      return MPIR_Err_return_file(fh, myname, error_code);
  7817.  #elif defined(PRINT_ERR_MSG)
  7818.      FPRINTF(stderr, "MPI_File_write_all_begin: Invalid count argument\n");
  7819.      MPI_Abort(MPI_COMM_WORLD, 1);
  7820.  #else /* MPICH-1 */
  7821.      error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG,
  7822.                       myname, (char *) 0, (char *) 0);
  7823.      return ADIOI_Error(fh, error_code, myname);
  7824.  #endif
  7825.      }
  7826.  
  7827. -    if (datatype == MPI_DATATYPE_NULL) {
  7828. +    if (datatype == MPI_DATATYPE_NULL)
  7829. +    {
  7830.  #ifdef MPICH2
  7831.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_TYPE, 
  7832.          "**dtypenull", 0);
  7833.      return MPIR_Err_return_file(fh, myname, error_code);
  7834.  #elif defined(PRINT_ERR_MSG)
  7835.          FPRINTF(stderr, "MPI_File_write_all_begin: Invalid datatype\n");
  7836.          MPI_Abort(MPI_COMM_WORLD, 1);
  7837.  #else /* MPICH-1 */
  7838.      error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL,
  7839.                       myname, (char *) 0, (char *) 0);
  7840.      return ADIOI_Error(fh, error_code, myname);        
  7841.  #endif
  7842.      }
  7843.  
  7844. -    if (fh->access_mode & MPI_MODE_SEQUENTIAL) {
  7845. +    if (fh->access_mode & MPI_MODE_SEQUENTIAL)
  7846. +    {
  7847.  #ifdef MPICH2
  7848.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_UNSUPPORTED_OPERATION, 
  7849.          "**ioamodeseq", 0);
  7850.      return MPIR_Err_return_file(fh, myname, error_code);
  7851.  #elif defined(PRINT_ERR_MSG)
  7852.          FPRINTF(stderr, "MPI_File_write_all_begin: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n");
  7853.          MPI_Abort(MPI_COMM_WORLD, 1);
  7854.  #else /* MPICH-1 */
  7855.      error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, 
  7856.                          MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0);
  7857.      return ADIOI_Error(fh, error_code, myname);
  7858.  #endif
  7859.      }
  7860.  
  7861. -    if (fh->split_coll_count) {
  7862. +    if (fh->split_coll_count)
  7863. +    {
  7864.  #ifdef MPICH2
  7865.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, "**iosplitcoll", 0);
  7866.      return MPIR_Err_return_file(fh, myname, error_code);
  7867.  #elif defined(PRINT_ERR_MSG)
  7868.          FPRINTF(stderr, "MPI_File_write_all_begin: Only one active split collective I/O operation allowed per file handle\n");
  7869.          MPI_Abort(MPI_COMM_WORLD, 1);
  7870.  #else /* MPICH-1 */
  7871.      error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_MULTIPLE_SPLIT_COLL,
  7872.                                myname, (char *) 0, (char *) 0);
  7873.      return ADIOI_Error(fh, error_code, myname);
  7874.  #endif
  7875.      }
  7876. +    /* --END ERROR HANDLING-- */
  7877.  
  7878.      fh->split_coll_count = 1;
  7879.  
  7880.      MPI_Type_size(datatype, &datatype_size);
  7881. -    if ((count*datatype_size) % fh->etype_size != 0) {
  7882. +    /* --BEGIN ERROR HANDLING-- */
  7883. +    if ((count*datatype_size) % fh->etype_size != 0)
  7884. +    {
  7885.  #ifdef MPICH2
  7886.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO,
  7887.          "**ioetype", 0);
  7888.      return MPIR_Err_return_file(fh, myname, error_code);
  7889.  #elif defined(PRINT_ERR_MSG)
  7890.          FPRINTF(stderr, "MPI_File_write_all_begin: Only an integral number of etypes can be accessed\n");
  7891.          MPI_Abort(MPI_COMM_WORLD, 1);
  7892.  #else /* MPICH-1 */
  7893.      error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL,
  7894.                       myname, (char *) 0, (char *) 0);
  7895.      return ADIOI_Error(fh, error_code, myname);        
  7896.  #endif
  7897.      }
  7898. +    /* --END ERROR HANDLING-- */
  7899.  
  7900.      /* See FIXME in write_alle.c */
  7901.      fh->split_datatype = datatype;
  7902.      ADIO_WriteStridedColl(fh, buf, count, datatype, ADIO_INDIVIDUAL,
  7903.                0, &fh->split_status, &error_code);
  7904.      return error_code;
  7905.  }
  7906. Index: romio/mpi-io/write_alle.c
  7907. ===================================================================
  7908. RCS file: /home/MPI/cvsMaster/romio/mpi-io/write_alle.c,v
  7909. retrieving revision 1.15
  7910. retrieving revision 1.18
  7911. --- romio/mpi-io/write_alle.c    5 Sep 2003 22:34:32 -0000    1.15
  7912. +++ romio/mpi-io/write_alle.c    17 Mar 2004 20:31:27 -0000    1.18
  7913. @@ -1,11 +1,11 @@
  7914.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  7915.  /* 
  7916. - *   $Id: write_alle.c,v 1.15 2003/09/05 22:34:32 gropp Exp $    
  7917. + *   $Id: write_alle.c,v 1.18 2004/03/17 20:31:27 gropp Exp $    
  7918.   *
  7919.   *   Copyright (C) 1997 University of Chicago. 
  7920.   *   See COPYRIGHT notice in top-level directory.
  7921.   */
  7922.  
  7923.  #include "mpioimpl.h"
  7924.  
  7925.  #ifdef HAVE_WEAK_SYMBOLS
  7926. @@ -38,42 +38,46 @@
  7927.  @*/
  7928.  int MPI_File_write_all_end(MPI_File fh, void *buf, MPI_Status *status)
  7929.  {
  7930.  #if defined(MPICH2) || !defined(PRINT_ERR_MSG)
  7931.      int error_code;
  7932.      static char myname[] = "MPI_FILE_WRITE_ALL_END";
  7933.  #endif
  7934.  
  7935. +    /* --BEGIN ERROR HANDLING-- */
  7936.  #ifdef PRINT_ERR_MSG
  7937.      if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {
  7938.      FPRINTF(stderr, "MPI_File_write_all_end: Invalid file handle\n");
  7939.      MPI_Abort(MPI_COMM_WORLD, 1);
  7940.      }
  7941.  #else
  7942.      ADIOI_TEST_FILE_HANDLE(fh, myname);
  7943.  #endif
  7944.  
  7945. -    if (!(fh->split_coll_count)) {
  7946. +    if (!(fh->split_coll_count))
  7947. +    {
  7948.  #ifdef MPICH2
  7949.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO,
  7950.          "**iosplitcollnone", 0);
  7951.      return MPIR_Err_return_file(fh, myname, error_code);
  7952.  #elif defined(PRINT_ERR_MSG)
  7953.          FPRINTF(stderr, "MPI_File_write_all_end: Does not match a previous MPI_File_write_all_begin\n");
  7954.          MPI_Abort(MPI_COMM_WORLD, 1);
  7955.  #else /* MPICH-1 */
  7956.      error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_SPLIT_COLL,
  7957.                                myname, (char *) 0, (char *) 0);
  7958.      return ADIOI_Error(fh, error_code, myname);
  7959.  #endif
  7960.      }
  7961. +    /* --END ERROR HANDLING-- */
  7962.  
  7963.  #ifdef HAVE_STATUS_SET_BYTES
  7964.      /* FIXME - we should really ensure that the split_datatype remains
  7965.         valid by incrementing the ref count in the write_allb.c routine
  7966.         and decrement it here after setting the bytes */
  7967. +    if (status != MPI_STATUS_IGNORE)
  7968.         *status = fh->split_status;
  7969.  #endif
  7970.      fh->split_coll_count = 0;
  7971.  
  7972.      return MPI_SUCCESS;
  7973.  }
  7974. Index: romio/mpi-io/write_at.c
  7975. ===================================================================
  7976. RCS file: /home/MPI/cvsMaster/romio/mpi-io/write_at.c,v
  7977. retrieving revision 1.20
  7978. retrieving revision 1.21
  7979. --- romio/mpi-io/write_at.c    8 Sep 2003 21:29:22 -0000    1.20
  7980. +++ romio/mpi-io/write_at.c    12 Feb 2004 06:09:15 -0000    1.21
  7981. @@ -1,11 +1,11 @@
  7982.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  7983.  /* 
  7984. - *   $Id: write_at.c,v 1.20 2003/09/08 21:29:22 gropp Exp $    
  7985. + *   $Id: write_at.c,v 1.21 2004/02/12 06:09:15 David Exp $    
  7986.   *
  7987.   *   Copyright (C) 1997 University of Chicago. 
  7988.   *   See COPYRIGHT notice in top-level directory.
  7989.   */
  7990.  
  7991.  #include "mpioimpl.h"
  7992.  
  7993.  #ifdef HAVE_WEAK_SYMBOLS
  7994. @@ -53,135 +53,148 @@
  7995.      int datatype_size;
  7996.      ADIO_Offset off;
  7997.  #ifdef MPI_hpux
  7998.      int fl_xmpi;
  7999.  
  8000.      HPMP_IO_START(fl_xmpi, BLKMPIFILEWRITEAT, TRDTBLOCK, fh, datatype, count);
  8001.  #endif /* MPI_hpux */
  8002.  
  8003. +    /* --BEGIN ERROR HANDLING-- */
  8004.  #ifdef PRINT_ERR_MSG
  8005. -    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {
  8006. +    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE))
  8007. +    {
  8008.      FPRINTF(stderr, "MPI_File_write_at: Invalid file handle\n");
  8009.      MPI_Abort(MPI_COMM_WORLD, 1);
  8010.      }
  8011.  #else
  8012.      ADIOI_TEST_FILE_HANDLE(fh, myname);
  8013.  #endif
  8014.  
  8015. -    if (offset < 0) {
  8016. +    if (offset < 0)
  8017. +    {
  8018.  #ifdef MPICH2
  8019.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ARG, 
  8020.          "**iobadoffset", 0);
  8021.      return MPIR_Err_return_file(fh, myname, error_code);
  8022.  #elif defined(PRINT_ERR_MSG)
  8023.      FPRINTF(stderr, "MPI_File_write_at: Invalid offset argument\n");
  8024.      MPI_Abort(MPI_COMM_WORLD, 1);
  8025.  #else /* MPICH-1 */
  8026.      error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_OFFSET_ARG,
  8027.                       myname, (char *) 0, (char *) 0);
  8028.      return ADIOI_Error(fh, error_code, myname);        
  8029.  #endif
  8030.      }
  8031.  
  8032. -    if (count < 0) {
  8033. +    if (count < 0)
  8034. +    {
  8035.  #ifdef MPICH2
  8036.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ARG,
  8037.          "**iobadcount", 0);
  8038.      return MPIR_Err_return_file(fh, myname, error_code);
  8039.  #elif defined(PRINT_ERR_MSG)
  8040.      FPRINTF(stderr, "MPI_File_write_at: Invalid count argument\n");
  8041.      MPI_Abort(MPI_COMM_WORLD, 1);
  8042.  #else /* MPICH-1 */
  8043.      error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG,
  8044.                       myname, (char *) 0, (char *) 0);
  8045.      return ADIOI_Error(fh, error_code, myname);
  8046.  #endif
  8047.      }
  8048.  
  8049. -    if (datatype == MPI_DATATYPE_NULL) {
  8050. +    if (datatype == MPI_DATATYPE_NULL)
  8051. +    {
  8052.  #ifdef MPICH2
  8053.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_TYPE,
  8054.          "**dtypenull", 0);
  8055.      return MPIR_Err_return_file(fh, myname, error_code);
  8056.  #elif defined(PRINT_ERR_MSG)
  8057.          FPRINTF(stderr, "MPI_File_write_at: Invalid datatype\n");
  8058.          MPI_Abort(MPI_COMM_WORLD, 1);
  8059.  #else /* MPICH-1 */
  8060.      error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL,
  8061.                       myname, (char *) 0, (char *) 0);
  8062.      return ADIOI_Error(fh, error_code, myname);        
  8063.  #endif
  8064.      }
  8065. +    /* --END ERROR HANDLING-- */
  8066.  
  8067.      MPI_Type_size(datatype, &datatype_size);
  8068. -    if (count*datatype_size == 0) {
  8069. +    if (count*datatype_size == 0)
  8070. +    {
  8071.  #ifdef MPI_hpux
  8072.      HPMP_IO_END(fl_xmpi, fh, datatype, count);
  8073.  #endif /* MPI_hpux */
  8074.  #ifdef HAVE_STATUS_SET_BYTES
  8075.         MPIR_Status_set_bytes(status, datatype, 0);
  8076.  #endif
  8077.      
  8078.      return MPI_SUCCESS;
  8079.      }
  8080.  
  8081. -    if ((count*datatype_size) % fh->etype_size != 0) {
  8082. +    /* --BEGIN ERROR HANDLING-- */
  8083. +    if ((count*datatype_size) % fh->etype_size != 0)
  8084. +    {
  8085.  #ifdef MPICH2
  8086.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO,
  8087.          "**ioetype", 0);
  8088.      return MPIR_Err_return_file(fh, myname, error_code);
  8089.  #elif defined(PRINT_ERR_MSG)
  8090.          FPRINTF(stderr, "MPI_File_write_at: Only an integral number of etypes can be accessed\n");
  8091.          MPI_Abort(MPI_COMM_WORLD, 1);
  8092.  #else /* MPICH-1 */
  8093.      error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL,
  8094.                       myname, (char *) 0, (char *) 0);
  8095.      return ADIOI_Error(fh, error_code, myname);        
  8096.  #endif
  8097.      }
  8098.  
  8099. -    if (fh->access_mode & MPI_MODE_SEQUENTIAL) {
  8100. +    if (fh->access_mode & MPI_MODE_SEQUENTIAL)
  8101. +    {
  8102.  #ifdef MPICH2
  8103.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_UNSUPPORTED_OPERATION,
  8104.          "**ioamodeseq", 0);
  8105.      return MPIR_Err_return_file(fh, myname, error_code);
  8106.  #elif defined(PRINT_ERR_MSG)
  8107.      FPRINTF(stderr, "MPI_File_write_at: Can't use this function because file was opened with MPI_MODE_SEQUENTIAL\n");
  8108.      MPI_Abort(MPI_COMM_WORLD, 1);
  8109.  #else /* MPICH-1 */
  8110.      error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, 
  8111.                          MPIR_ERR_AMODE_SEQ, myname, (char *) 0, (char *) 0);
  8112.      return ADIOI_Error(fh, error_code, myname);
  8113.  #endif
  8114.      }
  8115. -    if (fh->access_mode & MPI_MODE_RDONLY) {
  8116. +
  8117. +    if (fh->access_mode & MPI_MODE_RDONLY)
  8118. +    {
  8119.  #ifdef MPICH2
  8120.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_READ_ONLY,
  8121.          "**filerdonly", "**filerdonly %s", fh->filename );
  8122.      return MPIR_Err_return_file(fh, myname, error_code);
  8123.  #elif defined(PRINT_ERR_MSG)
  8124.      FPRINTF(stderr, "MPI_File_write: Can't use this function because file was opened with MPI_MODE_RDONLY\n");
  8125.      MPI_Abort(MPI_COMM_WORLD, 1);
  8126.  #else /* MPICH-1 */
  8127.      error_code = MPIR_Err_setmsg(MPI_ERR_READ_ONLY, 
  8128.                          0, myname, (char *) 0, (char *) 0);
  8129.      return ADIOI_Error(fh, error_code, myname);
  8130.  #endif
  8131.      }
  8132. -
  8133. +    /* --END ERROR HANDLING-- */
  8134.  
  8135.      ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
  8136.      ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig);
  8137.  
  8138.      ADIOI_TEST_DEFERRED(fh, "MPI_File_write_at", &error_code);
  8139.  
  8140.      /* contiguous or strided? */
  8141.  
  8142. -    if (buftype_is_contig && filetype_is_contig) {
  8143. +    if (buftype_is_contig && filetype_is_contig)
  8144. +    {
  8145.      /* convert bufocunt and offset to bytes */
  8146.      bufsize = datatype_size * count;
  8147.      off = fh->disp + fh->etype_size * offset;
  8148.  
  8149.          /* if atomic mode requested, lock (exclusive) the region, because there
  8150.             could be a concurrent noncontiguous request. Locking doesn't 
  8151.             work on PIOFS and PVFS, and on NFS it is done in the ADIO_WriteContig.*/
  8152.  
  8153. @@ -194,17 +207,19 @@
  8154.               off, status, &error_code); 
  8155.  
  8156.          if ((fh->atomicity) && (fh->file_system != ADIO_PIOFS) && 
  8157.              (fh->file_system != ADIO_NFS) && (fh->file_system != ADIO_PVFS)&&
  8158.              (fh->file_system != ADIO_PVFS2))
  8159.              ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize);
  8160.      }
  8161.      else
  8162. +    {
  8163.      ADIO_WriteStrided(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
  8164.               offset, status, &error_code); 
  8165.      /* For strided and atomic mode, locking is done in ADIO_WriteStrided */
  8166. +    }
  8167.  
  8168.  #ifdef MPI_hpux
  8169.      HPMP_IO_END(fl_xmpi, fh, datatype, count);
  8170.  #endif /* MPI_hpux */
  8171.      return error_code;
  8172.  }
  8173. Index: romio/mpi-io/write_ordb.c
  8174. ===================================================================
  8175. RCS file: /home/MPI/cvsMaster/romio/mpi-io/write_ordb.c,v
  8176. retrieving revision 1.20
  8177. retrieving revision 1.21
  8178. --- romio/mpi-io/write_ordb.c    25 Sep 2003 13:25:11 -0000    1.20
  8179. +++ romio/mpi-io/write_ordb.c    12 Feb 2004 06:09:17 -0000    1.21
  8180. @@ -1,11 +1,11 @@
  8181.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  8182.  /* 
  8183. - *   $Id: write_ordb.c,v 1.20 2003/09/25 13:25:11 gropp Exp $    
  8184. + *   $Id: write_ordb.c,v 1.21 2004/02/12 06:09:17 David Exp $    
  8185.   *
  8186.   *   Copyright (C) 1997 University of Chicago. 
  8187.   *   See COPYRIGHT notice in top-level directory.
  8188.   */
  8189.  
  8190.  #include "mpioimpl.h"
  8191.  
  8192.  #ifdef HAVE_WEAK_SYMBOLS
  8193. @@ -42,127 +42,140 @@
  8194.  {
  8195.      int error_code, datatype_size, nprocs, myrank, incr;
  8196.      int source, dest;
  8197.  #if defined(MPICH2) || !defined(PRINT_ERR_MSG)
  8198.      static char myname[] = "MPI_FILE_WRITE_ORDERED_BEGIN";
  8199.  #endif
  8200.      ADIO_Offset shared_fp;
  8201.  
  8202. +    /* --BEGIN ERROR HANDLING-- */
  8203.  #ifdef PRINT_ERR_MSG
  8204. -    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {
  8205. +    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE))
  8206. +    {
  8207.      FPRINTF(stderr, "MPI_File_write_ordered_begin: Invalid file handle\n");
  8208.      MPI_Abort(MPI_COMM_WORLD, 1);
  8209.      }
  8210.  #else
  8211.      ADIOI_TEST_FILE_HANDLE(fh, myname);
  8212.  #endif
  8213.  
  8214. -    if (count < 0) {
  8215. +    if (count < 0)
  8216. +    {
  8217.  #ifdef MPICH2
  8218.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ARG,
  8219.          "**iobadcount", 0);
  8220.      return MPIR_Err_return_file(fh, myname, error_code);
  8221.  #elif defined(PRINT_ERR_MSG)
  8222.      FPRINTF(stderr, "MPI_File_write_ordered_begin: Invalid count argument\n");
  8223.      MPI_Abort(MPI_COMM_WORLD, 1);
  8224.  #else /* MPICH-1 */
  8225.      error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG,
  8226.                       myname, (char *) 0, (char *) 0);
  8227.      return ADIOI_Error(fh, error_code, myname);
  8228.  #endif
  8229.      }
  8230.  
  8231. -    if (datatype == MPI_DATATYPE_NULL) {
  8232. +    if (datatype == MPI_DATATYPE_NULL)
  8233. +    {
  8234.  #ifdef MPICH2
  8235.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_TYPE,
  8236.          "**dtypenull", 0);
  8237.      return MPIR_Err_return_file(fh, myname, error_code);
  8238.  #elif defined(PRINT_ERR_MSG)
  8239.          FPRINTF(stderr, "MPI_File_write_ordered_begin: Invalid datatype\n");
  8240.          MPI_Abort(MPI_COMM_WORLD, 1);
  8241.  #else /* MPICH-1 */
  8242.      error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL,
  8243.                       myname, (char *) 0, (char *) 0);
  8244.      return ADIOI_Error(fh, error_code, myname);        
  8245.  #endif
  8246.      }
  8247.  
  8248. -    if (fh->split_coll_count) {
  8249. +    if (fh->split_coll_count)
  8250. +    {
  8251.  #ifdef MPICH2
  8252.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, 
  8253.          "**iosplitcoll", 0);
  8254.      return MPIR_Err_return_file(fh, myname, error_code);
  8255.  #elif defined(PRINT_ERR_MSG)
  8256.          FPRINTF(stderr, "MPI_File_write_ordered_begin: Only one active split collective I/O operation allowed per file handle\n");
  8257.          MPI_Abort(MPI_COMM_WORLD, 1);
  8258.  #else /* MPICH-1 */
  8259.      error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_MULTIPLE_SPLIT_COLL,
  8260.                                myname, (char *) 0, (char *) 0);
  8261.      return ADIOI_Error(fh, error_code, myname);
  8262.  #endif
  8263.      }
  8264. +    /* --END ERROR HANDLING-- */
  8265.  
  8266.      fh->split_coll_count = 1;
  8267.  
  8268.      MPI_Type_size(datatype, &datatype_size);
  8269. -    if ((count*datatype_size) % fh->etype_size != 0) {
  8270. +    /* --BEGIN ERROR HANDLING-- */
  8271. +    if ((count*datatype_size) % fh->etype_size != 0)
  8272. +    {
  8273.  #ifdef MPICH2
  8274.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, 
  8275.          "**ioetype", 0);
  8276.      return MPIR_Err_return_file(fh, myname, error_code);
  8277.  #elif defined(PRINT_ERR_MSG)
  8278.          FPRINTF(stderr, "MPI_File_write_ordered_begin: Only an integral number of etypes can be accessed\n");
  8279.          MPI_Abort(MPI_COMM_WORLD, 1);
  8280.  #else /* MPICH-1 */
  8281.      error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL,
  8282.                       myname, (char *) 0, (char *) 0);
  8283.      return ADIOI_Error(fh, error_code, myname);        
  8284.  #endif
  8285.      }
  8286.  
  8287.      if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS) ||
  8288. -            (fh->file_system == ADIO_PVFS2)) {
  8289. +            (fh->file_system == ADIO_PVFS2))
  8290. +    {
  8291.  #ifdef MPICH2
  8292.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_UNSUPPORTED_OPERATION,
  8293.          "**iosharedunsupported", 0);
  8294.      return MPIR_Err_return_file(fh, myname, error_code);
  8295.  #elif defined(PRINT_ERR_MSG)
  8296.      FPRINTF(stderr, "MPI_File_write_ordered_begin: Shared file pointer not supported on PIOFS and PVFS\n");
  8297.      MPI_Abort(MPI_COMM_WORLD, 1);
  8298.  #else /* MPICH-1 */
  8299.      error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, 
  8300.                      MPIR_ERR_NO_SHARED_FP, myname, (char *) 0, (char *) 0);
  8301.      return ADIOI_Error(fh, error_code, myname);
  8302.  #endif
  8303.      }
  8304.  
  8305.      ADIOI_TEST_DEFERRED(fh, "MPI_File_write_ordered_begin", &error_code);
  8306. +    /* --END ERROR HANDLING-- */
  8307.  
  8308.      MPI_Comm_size(fh->comm, &nprocs);
  8309.      MPI_Comm_rank(fh->comm, &myrank);
  8310.  
  8311.      incr = (count*datatype_size)/fh->etype_size;
  8312.      /* Use a message as a 'token' to order the operations */
  8313.      source = myrank - 1;
  8314.      dest   = myrank + 1;
  8315.      if (source < 0) source = MPI_PROC_NULL;
  8316.      if (dest >= nprocs) dest = MPI_PROC_NULL;
  8317.      MPI_Recv( NULL, 0, MPI_BYTE, source, 0, fh->comm, MPI_STATUS_IGNORE );
  8318.      ADIO_Get_shared_fp(fh, incr, &shared_fp, &error_code);
  8319. -    if (error_code != MPI_SUCCESS) {
  8320. +    /* --BEGIN ERROR HANDLING-- */
  8321. +    if (error_code != MPI_SUCCESS)
  8322. +    {
  8323.  #ifdef MPICH2
  8324.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, myname, __LINE__, MPI_ERR_INTERN, 
  8325.                        "**iosharedfailed", 0);
  8326.      return MPIR_Err_return_file(fh, myname, error_code);
  8327.  #else
  8328.      FPRINTF(stderr, "MPI_File_write_ordered_begin: Error! Could not access shared file pointer.\n");
  8329.      MPI_Abort(MPI_COMM_WORLD, 1);
  8330.  #endif
  8331.      }
  8332. +    /* --END ERROR HANDLING-- */
  8333.      MPI_Send( NULL, 0, MPI_BYTE, dest, 0, fh->comm );
  8334.  
  8335.      ADIO_WriteStridedColl(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
  8336.               shared_fp, &fh->split_status, &error_code);
  8337.  
  8338.      /* FIXME: Check for error code from WriteStridedColl? */
  8339.      return error_code;
  8340.  }
  8341. Index: romio/mpi-io/write_orde.c
  8342. ===================================================================
  8343. RCS file: /home/MPI/cvsMaster/romio/mpi-io/write_orde.c,v
  8344. retrieving revision 1.15
  8345. retrieving revision 1.16
  8346. --- romio/mpi-io/write_orde.c    8 Sep 2003 13:35:05 -0000    1.15
  8347. +++ romio/mpi-io/write_orde.c    12 Feb 2004 06:09:19 -0000    1.16
  8348. @@ -1,11 +1,11 @@
  8349.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  8350.  /* 
  8351. - *   $Id: write_orde.c,v 1.15 2003/09/08 13:35:05 gropp Exp $    
  8352. + *   $Id: write_orde.c,v 1.16 2004/02/12 06:09:19 David Exp $    
  8353.   *
  8354.   *   Copyright (C) 1997 University of Chicago. 
  8355.   *   See COPYRIGHT notice in top-level directory.
  8356.   */
  8357.  
  8358.  #include "mpioimpl.h"
  8359.  
  8360.  #ifdef HAVE_WEAK_SYMBOLS
  8361. @@ -38,39 +38,43 @@
  8362.  @*/
  8363.  int MPI_File_write_ordered_end(MPI_File fh, void *buf, MPI_Status *status)
  8364.  {
  8365.  #if defined(MPICH2) || !defined(PRINT_ERR_MSG)
  8366.      int error_code;
  8367.      static char myname[] = "MPI_FILE_WRITE_ORDERED_END";
  8368.  #endif
  8369.  
  8370. +    /* --BEGIN ERROR HANDLING-- */
  8371.  #ifdef PRINT_ERR_MSG
  8372. -    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {
  8373. +    if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE))
  8374. +    {
  8375.      FPRINTF(stderr, "MPI_File_write_ordered_end: Invalid file handle\n");
  8376.      MPI_Abort(MPI_COMM_WORLD, 1);
  8377.      }
  8378.  #else
  8379.      ADIOI_TEST_FILE_HANDLE(fh, myname);
  8380.  #endif
  8381.  
  8382. -    if (!(fh->split_coll_count)) {
  8383. +    if (!(fh->split_coll_count))
  8384. +    {
  8385.  #ifdef MPICH2
  8386.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, 
  8387.          "**iosplitcollnone", 0);
  8388.      return MPIR_Err_return_file(fh, myname, error_code);
  8389.  #elif defined(PRINT_ERR_MSG)
  8390.          FPRINTF(stderr, "MPI_File_write_ordered_end: Does not match a previous MPI_File_write_ordered_begin\n");
  8391.          MPI_Abort(MPI_COMM_WORLD, 1);
  8392.  #else /* MPICH-1 */
  8393.      error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_NO_SPLIT_COLL,
  8394.                                myname, (char *) 0, (char *) 0);
  8395.      return ADIOI_Error(fh, error_code, myname);
  8396.  #endif
  8397.      }
  8398. +    /* --END ERROR HANDLING-- */
  8399.  
  8400.  #ifdef HAVE_STATUS_SET_BYTES
  8401.      if (status != MPI_STATUS_IGNORE)
  8402.         *status = fh->split_status;
  8403.  #endif
  8404.      fh->split_coll_count = 0;
  8405.  
  8406.      return MPI_SUCCESS;
  8407. Index: romio/mpi-io/write_sh.c
  8408. ===================================================================
  8409. RCS file: /home/MPI/cvsMaster/romio/mpi-io/write_sh.c,v
  8410. retrieving revision 1.19
  8411. retrieving revision 1.21
  8412. --- romio/mpi-io/write_sh.c    15 Sep 2003 13:33:36 -0000    1.19
  8413. +++ romio/mpi-io/write_sh.c    20 Feb 2004 19:47:59 -0000    1.21
  8414. @@ -1,11 +1,11 @@
  8415.  /* -*- Mode: C; c-basic-offset:4 ; -*- */
  8416.  /* 
  8417. - *   $Id: write_sh.c,v 1.19 2003/09/15 13:33:36 gropp Exp $    
  8418. + *   $Id: write_sh.c,v 1.21 2004/02/20 19:47:59 gropp Exp $    
  8419.   *
  8420.   *   Copyright (C) 1997 University of Chicago. 
  8421.   *   See COPYRIGHT notice in top-level directory.
  8422.   */
  8423.  
  8424.  #include "mpioimpl.h"
  8425.  
  8426.  #ifdef HAVE_WEAK_SYMBOLS
  8427. @@ -54,103 +54,115 @@
  8428.      if ((fh <= (MPI_File) 0) || (fh->cookie != ADIOI_FILE_COOKIE)) {
  8429.      FPRINTF(stderr, "MPI_File_write_shared: Invalid file handle\n");
  8430.      MPI_Abort(MPI_COMM_WORLD, 1);
  8431.      }
  8432.  #else
  8433.      ADIOI_TEST_FILE_HANDLE(fh, myname);
  8434.  #endif
  8435.  
  8436. -    if (count < 0) {
  8437. +    /* --BEGIN ERROR HANDLING-- */
  8438. +    if (count < 0)
  8439. +    {
  8440.  #ifdef MPICH2
  8441.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_ARG, 
  8442.          "**iobadcount", 0);
  8443.      return MPIR_Err_return_file(fh, myname, error_code);
  8444.  #elif defined(PRINT_ERR_MSG)
  8445.      FPRINTF(stderr, "MPI_File_write_shared: Invalid count argument\n");
  8446.      MPI_Abort(MPI_COMM_WORLD, 1);
  8447.  #else /* MPICH-1 */
  8448.      error_code = MPIR_Err_setmsg(MPI_ERR_ARG, MPIR_ERR_COUNT_ARG,
  8449.                       myname, (char *) 0, (char *) 0);
  8450.      return ADIOI_Error(fh, error_code, myname);
  8451.  #endif
  8452.      }
  8453.  
  8454. -    if (datatype == MPI_DATATYPE_NULL) {
  8455. +    if (datatype == MPI_DATATYPE_NULL)
  8456. +    {
  8457.  #ifdef MPICH2
  8458.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_TYPE, 
  8459.          "**dtypenull", 0);
  8460.      return MPIR_Err_return_file(fh, myname, error_code);
  8461.  #elif defined(PRINT_ERR_MSG)
  8462.          FPRINTF(stderr, "MPI_File_write_shared: Invalid datatype\n");
  8463.          MPI_Abort(MPI_COMM_WORLD, 1);
  8464.  #else /* MPICH-1 */
  8465.      error_code = MPIR_Err_setmsg(MPI_ERR_TYPE, MPIR_ERR_TYPE_NULL,
  8466.                       myname, (char *) 0, (char *) 0);
  8467.      return ADIOI_Error(fh, error_code, myname);        
  8468.  #endif
  8469.      }
  8470. +    /* --END ERROR HANDLING-- */
  8471.  
  8472.      MPI_Type_size(datatype, &datatype_size);
  8473.      if (count*datatype_size == 0) {
  8474.  #ifdef HAVE_STATUS_SET_BYTES
  8475.         MPIR_Status_set_bytes(status, datatype, 0);
  8476.  #endif
  8477.      return MPI_SUCCESS; 
  8478.      }
  8479.  
  8480. -    if ((count*datatype_size) % fh->etype_size != 0) {
  8481. +    /* --BEGIN ERROR HANDLING-- */
  8482. +    if ((count*datatype_size) % fh->etype_size != 0)
  8483. +    {
  8484.  #ifdef MPICH2
  8485.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_IO, 
  8486.          "**ioetype", 0);
  8487.      return MPIR_Err_return_file(fh, myname, error_code);
  8488.  #elif defined(PRINT_ERR_MSG)
  8489.          FPRINTF(stderr, "MPI_File_write_shared: Only an integral number of etypes can be accessed\n");
  8490.          MPI_Abort(MPI_COMM_WORLD, 1);
  8491.  #else /* MPICH-1 */
  8492.      error_code = MPIR_Err_setmsg(MPI_ERR_IO, MPIR_ERR_ETYPE_FRACTIONAL,
  8493.                       myname, (char *) 0, (char *) 0);
  8494.      return ADIOI_Error(fh, error_code, myname);        
  8495.  #endif
  8496.      }
  8497.  
  8498. -    if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS)|| (fh->file_system == ADIO_PVFS2)) {
  8499. +    if ((fh->file_system == ADIO_PIOFS) || (fh->file_system == ADIO_PVFS)|| (fh->file_system == ADIO_PVFS2))
  8500. +    {
  8501.  #ifdef MPICH2
  8502.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_RECOVERABLE, myname, __LINE__, MPI_ERR_UNSUPPORTED_OPERATION, "**iosharedunsupported", 0);
  8503.      return MPIR_Err_return_file(fh, myname, error_code);
  8504.  #elif defined(PRINT_ERR_MSG)
  8505.      FPRINTF(stderr, "MPI_File_write_shared: Shared file pointer not supported on PIOFS and PVFS\n");
  8506.      MPI_Abort(MPI_COMM_WORLD, 1);
  8507.  #else /* MPICH-1 */
  8508.      error_code = MPIR_Err_setmsg(MPI_ERR_UNSUPPORTED_OPERATION, 
  8509.                      MPIR_ERR_NO_SHARED_FP, myname, (char *) 0, (char *) 0);
  8510.      return ADIOI_Error(fh, error_code, myname);
  8511.  #endif
  8512.      }
  8513. +    /* --END ERROR HANDLING-- */
  8514.  
  8515.      ADIOI_Datatype_iscontig(datatype, &buftype_is_contig);
  8516.      ADIOI_Datatype_iscontig(fh->filetype, &filetype_is_contig);
  8517.  
  8518.      ADIOI_TEST_DEFERRED(fh, "MPI_File_write_shared", &error_code);
  8519.  
  8520.      incr = (count*datatype_size)/fh->etype_size;
  8521.      ADIO_Get_shared_fp(fh, incr, &shared_fp, &error_code);
  8522. -    if (error_code != MPI_SUCCESS) {
  8523. +    /* --BEGIN ERROR HANDLING-- */
  8524. +    if (error_code != MPI_SUCCESS)
  8525. +    {
  8526.  #ifdef MPICH2
  8527.      error_code = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, myname, __LINE__, MPI_ERR_INTERN, 
  8528.                        "**iosharedfailed", 0);
  8529.      return MPIR_Err_return_file(fh, myname, error_code);
  8530.  #else
  8531.      FPRINTF(stderr, "MPI_File_write_shared: Error! Could not access shared file pointer.\n");
  8532.      MPI_Abort(MPI_COMM_WORLD, 1);
  8533.  #endif
  8534.      }
  8535. +    /* --END ERROR HANDLING-- */
  8536.  
  8537.      /* contiguous or strided? */
  8538. -    if (buftype_is_contig && filetype_is_contig) {
  8539. +    if (buftype_is_contig && filetype_is_contig)
  8540. +    {
  8541.          /* convert bufocunt and shared_fp to bytes */
  8542.      bufsize = datatype_size * count;
  8543.      off = fh->disp + fh->etype_size * shared_fp;
  8544.  
  8545.          /* if atomic mode requested, lock (exclusive) the region, because there
  8546.             could be a concurrent noncontiguous request. On NFS, locking is 
  8547.             done in the ADIO_WriteContig.*/
  8548.  
  8549. @@ -159,14 +171,16 @@
  8550.  
  8551.      ADIO_WriteContig(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
  8552.               off, status, &error_code); 
  8553.  
  8554.          if ((fh->atomicity) && (fh->file_system != ADIO_NFS))
  8555.              ADIOI_UNLOCK(fh, off, SEEK_SET, bufsize);
  8556.      }
  8557.      else
  8558. +    {
  8559.      ADIO_WriteStrided(fh, buf, count, datatype, ADIO_EXPLICIT_OFFSET,
  8560.               shared_fp, status, &error_code); 
  8561.      /* For strided and atomic mode, locking is done in ADIO_WriteStrided */
  8562. +    }
  8563.  
  8564.      return error_code;
  8565.  }
  8566. Index: romio/test/Makefile.in
  8567. ===================================================================
  8568. RCS file: /home/MPI/cvsMaster/romio/test/Makefile.in,v
  8569. retrieving revision 1.22
  8570. retrieving revision 1.23
  8571. --- romio/test/Makefile.in    25 Feb 2003 20:55:25 -0000    1.22
  8572. +++ romio/test/Makefile.in    1 Jun 2004 19:21:24 -0000    1.23
  8573. @@ -69,13 +69,13 @@
  8574.      $(F77) $(USER_FFLAGS) -o  $@ $< $(OUR_LIBS)
  8575.  
  8576.  fmisc: fmisc.f
  8577.      $(F77) $(USER_FFLAGS) -o  $@ $< $(OUR_LIBS)
  8578.  
  8579.  pfcoll_test: pfcoll_test.f    
  8580.      $(F77) $(USER_FFLAGS) -o  $@ $< $(OUR_LIBS)
  8581.  
  8582. -testing: 
  8583. -    -./runtests $(TESTARGS)
  8584. +#testing: 
  8585. +#    -./runtests $(TESTARGS)
  8586.  
  8587.  cleanall:
  8588. -    -@rm -f .P* PI* misc.c large_file.c fcoll_test.f fmisc.f fperf.f \mpif.h simple async coll_test coll_perf misc perf fcoll_test fperf fmisc file_info excl large_array large_file noncontig i_noncontig noncontig_coll atomicity *.out runtests pfcoll_test.f noncontig_coll2
  8589. +    -@rm -f .P* PI* misc.c large_file.c fcoll_test.f fmisc.f fperf.f \mpif.h simple async coll_test coll_perf misc perf fcoll_test fperf fmisc file_info excl large_array large_file noncontig i_noncontig noncontig_coll atomicity *.out runtests pfcoll_test.f pfcoll_test noncontig_coll2
  8590. Index: romio/test/Mfile.in
  8591. ===================================================================
  8592. RCS file: /home/MPI/cvsMaster/romio/test/Mfile.in,v
  8593. retrieving revision 1.3
  8594. retrieving revision 1.4
  8595. --- romio/test/Mfile.in    28 Mar 2003 21:37:34 -0000    1.3
  8596. +++ romio/test/Mfile.in    8 Jun 2004 19:13:33 -0000    1.4
  8597. @@ -46,17 +46,17 @@
  8598.  testing: 
  8599.        -./runtests $(TESTARGS)
  8600.  
  8601.  all: testing
  8602.  
  8603.  fortran_tests: $(FTESTS)
  8604.  #
  8605.  # The Fortran tests must be built with the Fortran linker
  8606. -fperf: ${srcdir}/fperf.f
  8607. +fperf: fperf.f
  8608.      $(F77) $(USER_FFLAGS) -o  $@ $< $(FLIBS)
  8609.  
  8610.  # Some of the Fortran tests must be derived, so their code will be in the
  8611.  # LOCAL directory
  8612.  fcoll_test: fcoll_test.f
  8613.      $(F77) $(USER_FFLAGS) -o  fcoll_test fcoll_test.f $(FLIBS)
  8614.  
  8615.  fmisc: fmisc.f
  8616. Index: romio/test/async.c
  8617. ===================================================================
  8618. RCS file: /home/MPI/cvsMaster/romio/test/async.c,v
  8619. retrieving revision 1.6
  8620. retrieving revision 1.7
  8621. --- romio/test/async.c    23 Feb 2003 16:17:22 -0000    1.6
  8622. +++ romio/test/async.c    27 Jan 2004 23:23:37 -0000    1.7
  8623. @@ -61,27 +61,36 @@
  8624.      tmp = (char *) malloc(len+10);
  8625.      strcpy(tmp, filename);
  8626.      sprintf(filename, "%s.%d", tmp, rank);
  8627.  
  8628.      MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, 
  8629.                    MPI_INFO_NULL, &fh);
  8630.      MPI_File_set_view(fh, 0, MPI_INT, MPI_INT, "native", MPI_INFO_NULL);
  8631.      MPI_File_iwrite(fh, buf, nints, MPI_INT, &request);
  8632. +#ifdef MPIO_USES_MPI_REQUEST
  8633. +    MPI_Wait( &request, &status );
  8634. +#else    
  8635.      MPIO_Wait(&request, &status);
  8636. +#endif
  8637.      MPI_File_close(&fh);
  8638.  
  8639.      /* reopen the file and read the data back */
  8640.  
  8641.      for (i=0; i<nints; i++) buf[i] = 0;
  8642.      MPI_File_open(MPI_COMM_SELF, filename, MPI_MODE_CREATE | MPI_MODE_RDWR, 
  8643.                    MPI_INFO_NULL, &fh);
  8644.      MPI_File_set_view(fh, 0, MPI_INT, MPI_INT, "native", MPI_INFO_NULL);
  8645.      MPI_File_iread(fh, buf, nints, MPI_INT, &request);
  8646. +#ifdef MPIO_USES_MPI_REQUEST
  8647. +    MPI_Wait( &request, &status );
  8648. +#else
  8649.      MPIO_Wait(&request, &status);
  8650. +#endif
  8651. +
  8652.      MPI_File_close(&fh);
  8653.  
  8654.      /* check if the data read is correct */
  8655.      for (i=0; i<nints; i++) {
  8656.      if (buf[i] != (rank*100000 + i)) {
  8657.          errs++;
  8658.          fprintf(stderr, "Process %d: error, read %d, should be %d\n", rank, buf[i], rank*100000+i);
  8659.      }
  8660. Index: romio/test/coll_test.c
  8661. ===================================================================
  8662. RCS file: /home/MPI/cvsMaster/romio/test/coll_test.c,v
  8663. retrieving revision 1.8
  8664. retrieving revision 1.9
  8665. --- romio/test/coll_test.c    28 May 2003 23:52:20 -0000    1.8
  8666. +++ romio/test/coll_test.c    1 Jun 2004 19:21:24 -0000    1.9
  8667. @@ -14,16 +14,18 @@
  8668.  /* Uses collective I/O. Writes a 3D block-distributed array to a file
  8669.     corresponding to the global array in row-major (C) order, reads it
  8670.     back, and checks that the data read is correct. */
  8671.  
  8672.  /* The file name is taken as a command-line argument. */
  8673.  
  8674.  /* Note that the file access pattern is noncontiguous. */
  8675.     
  8676. +void handle_error(int errcode, char *str);
  8677. +
  8678.  void handle_error(int errcode, char *str)
  8679.  {
  8680.      char msg[MPI_MAX_ERROR_STRING];
  8681.      int resultlen;
  8682.      MPI_Error_string(errcode, msg, &resultlen);
  8683.      fprintf(stderr, "%s: %s\n", str, msg);
  8684.      MPI_Abort(MPI_COMM_WORLD, 1);
  8685.  }
  8686. Index: romio/test/fperf.f.in
  8687. ===================================================================
  8688. RCS file: /home/MPI/cvsMaster/romio/test/fperf.f.in,v
  8689. retrieving revision 1.1.1.1
  8690. retrieving revision 1.2
  8691. --- romio/test/fperf.f.in    15 May 1998 20:48:15 -0000    1.1.1.1
  8692. +++ romio/test/fperf.f.in    1 Jun 2004 19:21:24 -0000    1.2
  8693. @@ -1,13 +1,13 @@
  8694.        program main
  8695.        implicit none
  8696.  
  8697.        include 'mpif.h'
  8698. -      include 'mpiof.h'
  8699. +      @F77MPIOINC@
  8700.  
  8701.  !     Fortran equivalent of perf.c
  8702.  
  8703.        integer SIZE 
  8704.        parameter (SIZE=1048576*4)
  8705.  !     read/write size per node in bytes
  8706.  
  8707.        integer buf(SIZE/4), j, mynod, nprocs, ntimes, flag
  8708. Index: romio/test/i_noncontig.c
  8709. ===================================================================
  8710. RCS file: /home/MPI/cvsMaster/romio/test/i_noncontig.c,v
  8711. retrieving revision 1.6
  8712. retrieving revision 1.7
  8713. --- romio/test/i_noncontig.c    23 Feb 2003 16:31:15 -0000    1.6
  8714. +++ romio/test/i_noncontig.c    29 Jan 2004 16:30:22 -0000    1.7
  8715. @@ -86,24 +86,32 @@
  8716.  
  8717.      MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | 
  8718.               MPI_MODE_RDWR, MPI_INFO_NULL, &fh);
  8719.  
  8720.      MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL);
  8721.  
  8722.      for (i=0; i<SIZE; i++) buf[i] = i + mynod*SIZE;
  8723.      MPI_File_iwrite(fh, buf, 1, newtype, &req);
  8724. +#ifdef MPIO_USES_MPI_REQUEST
  8725. +    MPI_Wait(&req, &status);
  8726. +#else
  8727.      MPIO_Wait(&req, &status);
  8728. +#endif
  8729.  
  8730.      MPI_Barrier(MPI_COMM_WORLD);
  8731.  
  8732.      for (i=0; i<SIZE; i++) buf[i] = -1;
  8733.  
  8734.      MPI_File_iread_at(fh, 0, buf, 1, newtype, &req);
  8735. +#ifdef MPIO_USES_MPI_REQUEST
  8736. +    MPI_Wait(&req, &status);
  8737. +#else
  8738.      MPIO_Wait(&req, &status);
  8739. +#endif
  8740.  
  8741.      for (i=0; i<SIZE; i++) {
  8742.      if (!mynod) {
  8743.          if ((i%2) && (buf[i] != -1)) {
  8744.          errs++;
  8745.          fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", 
  8746.              mynod, i, buf[i]);
  8747.          }
  8748. @@ -139,24 +147,32 @@
  8749.      }
  8750.      MPI_Barrier(MPI_COMM_WORLD);
  8751.  
  8752.      MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | 
  8753.               MPI_MODE_RDWR, MPI_INFO_NULL, &fh);
  8754.  
  8755.      for (i=0; i<SIZE; i++) buf[i] = i + mynod*SIZE;
  8756.      MPI_File_iwrite_at(fh, mynod*(SIZE/2)*sizeof(int), buf, 1, newtype, &req);
  8757. +#ifdef MPIO_USES_MPI_REQUEST
  8758. +    MPI_Wait(&req, &status);
  8759. +#else
  8760.      MPIO_Wait(&req, &status);
  8761. +#endif
  8762.  
  8763.      MPI_Barrier(MPI_COMM_WORLD);
  8764.  
  8765.      for (i=0; i<SIZE; i++) buf[i] = -1;
  8766.  
  8767.      MPI_File_iread_at(fh, mynod*(SIZE/2)*sizeof(int), buf, 1, newtype, &req);
  8768. +#ifdef MPIO_USES_MPI_REQUEST
  8769. +    MPI_Wait(&req, &status);
  8770. +#else
  8771.      MPIO_Wait(&req, &status);
  8772. +#endif
  8773.  
  8774.      for (i=0; i<SIZE; i++) {
  8775.      if (!mynod) {
  8776.          if ((i%2) && (buf[i] != -1)) {
  8777.          errs++;
  8778.          fprintf(stderr, "Process %d: buf %d is %d, should be -1\n", 
  8779.              mynod, i, buf[i]);
  8780.          }
  8781. @@ -194,24 +210,32 @@
  8782.  
  8783.      MPI_File_open(MPI_COMM_WORLD, filename, MPI_MODE_CREATE | 
  8784.               MPI_MODE_RDWR, MPI_INFO_NULL, &fh);
  8785.  
  8786.      MPI_File_set_view(fh, 0, MPI_INT, newtype, "native", MPI_INFO_NULL);
  8787.  
  8788.      for (i=0; i<SIZE; i++) buf[i] = i + mynod*SIZE;
  8789.      MPI_File_iwrite(fh, buf, SIZE, MPI_INT, &req);
  8790. +#ifdef MPIO_USES_MPI_REQUEST
  8791. +    MPI_Wait(&req, &status);
  8792. +#else
  8793.      MPIO_Wait(&req, &status);
  8794. +#endif
  8795.  
  8796.      MPI_Barrier(MPI_COMM_WORLD);
  8797.  
  8798.      for (i=0; i<SIZE; i++) buf[i] = -1;
  8799.  
  8800.      MPI_File_iread_at(fh, 0, buf, SIZE, MPI_INT, &req);
  8801. +#ifdef MPIO_USES_MPI_REQUEST
  8802. +    MPI_Wait(&req, &status);
  8803. +#else
  8804.      MPIO_Wait(&req, &status);
  8805. +#endif
  8806.  
  8807.      for (i=0; i<SIZE; i++) {
  8808.      if (!mynod) {
  8809.          if (buf[i] != i) {
  8810.          errs++;
  8811.          fprintf(stderr, "Process %d: buf %d is %d, should be %d\n", 
  8812.              mynod, i, buf[i], i);
  8813.          }
  8814. Index: romio/test/misc.c.in
  8815. ===================================================================
  8816. RCS file: /home/MPI/cvsMaster/romio/test/misc.c.in,v
  8817. retrieving revision 1.4
  8818. retrieving revision 1.5
  8819. --- romio/test/misc.c.in    25 Mar 2003 15:37:02 -0000    1.4
  8820. +++ romio/test/misc.c.in    1 Jun 2004 19:21:24 -0000    1.5
  8821. @@ -71,17 +71,17 @@
  8822.      fprintf(stderr, "atomicity is %d, should be 0\n", flag);
  8823.      }
  8824.  #if VERBOSE
  8825.      if (!mynod) fprintf(stderr, "setting atomic mode\n");
  8826.  #endif
  8827.      MPI_File_set_atomicity(fh, 1);
  8828.      MPI_File_get_atomicity(fh, &flag);
  8829.      if (!flag) {
  8830. -    errs;
  8831. +    errs++;
  8832.      fprintf(stderr, "atomicity is %d, should be 1\n", flag);
  8833.      }
  8834.      MPI_File_set_atomicity(fh, 0);
  8835.  #if VERBOSE
  8836.      if (!mynod) fprintf(stderr, "reverting back to nonatomic mode\n");
  8837.  #endif
  8838.  
  8839.      MPI_Type_vector(10, 10, 20, MPI_INT, &newtype);
  8840. Index: romio/test/noncontig_coll2.c
  8841. ===================================================================
  8842. RCS file: /home/MPI/cvsMaster/romio/test/noncontig_coll2.c,v
  8843. retrieving revision 1.9
  8844. retrieving revision 1.10
  8845. --- romio/test/noncontig_coll2.c    2 Dec 2003 21:05:59 -0000    1.9
  8846. +++ romio/test/noncontig_coll2.c    1 Jun 2004 19:21:24 -0000    1.10
  8847. @@ -35,16 +35,32 @@
  8848.   */ 
  8849.  struct ADIO_cb_name_arrayD {   
  8850.         int refct;              
  8851.         int namect;
  8852.         char **names;
  8853.  };  
  8854.  typedef struct ADIO_cb_name_arrayD *ADIO_cb_name_array;
  8855.  
  8856. +void handle_error(int errcode, char *str);
  8857. +int cb_copy_name_array(MPI_Comm comm, 
  8858. +               int *keyval, 
  8859. +               void *extra, 
  8860. +               void *attr_in,
  8861. +               void **attr_out, 
  8862. +               int *flag);
  8863. +int cb_delete_name_array(MPI_Comm comm, 
  8864. +             int *keyval, 
  8865. +             void *attr_val, 
  8866. +             void *extra);
  8867. +int cb_gather_name_array(MPI_Comm comm, ADIO_cb_name_array *arrayp);
  8868. +void default_str(int mynod, int len, ADIO_cb_name_array array, char *dest);
  8869. +void reverse_str(int mynod, int len, ADIO_cb_name_array array, char *dest);
  8870. +void reverse_alternating_str(int mynod, int len, ADIO_cb_name_array array, char *dest);
  8871. +void simple_shuffle_str(int mynod, int len, ADIO_cb_name_array array, char *dest);
  8872.  
  8873.  
  8874.  void handle_error(int errcode, char *str) 
  8875.  {
  8876.      char msg[MPI_MAX_ERROR_STRING];
  8877.      int resultlen;
  8878.      MPI_Error_string(errcode, msg, &resultlen);
  8879.      fprintf(stderr, "%s: %s\n", str, msg);
  8880. Index: romio/test/runtests.in
  8881. ===================================================================
  8882. RCS file: /home/MPI/cvsMaster/romio/test/runtests.in,v
  8883. retrieving revision 1.10
  8884. retrieving revision 1.11
  8885. --- romio/test/runtests.in    19 Dec 2002 22:31:35 -0000    1.10
  8886. +++ romio/test/runtests.in    8 Jan 2004 22:39:12 -0000    1.11
  8887. @@ -1,11 +1,11 @@
  8888.  #! /bin/sh
  8889.  mpirun="@MPIRUN@"
  8890. -STOPFILE=$HOME/.stopmpichtests
  8891. +STOPFILE=${MPITEST_STOPTEST:-"$HOME/.stopmpichtests"}
  8892.  #
  8893.  # If the programs are not available, run make.
  8894.  runtests=1
  8895.  makeeach=0
  8896.  check_at_once=1
  8897.  quiet=0
  8898.  MAKE="@MAKE@"
  8899.  srcdir=@srcdir@
  8900. Index: romio/util/nfslock.c
  8901. ===================================================================
  8902. RCS file: romio/util/nfslock.c
  8903. --- /dev/null    1 Jan 1970 00:00:00 -0000
  8904. +++ romio/util/nfslock.c    20 Jan 2004 16:23:54 -0000    1.2
  8905. @@ -0,0 +1,69 @@
  8906. +/* -*- Mode: C; c-basic-offset:4 ; -*- */
  8907. +/*  
  8908. + *  (C) 2004 by Argonne National Laboratory.
  8909. + *      See COPYRIGHT in top-level directory.
  8910. + */
  8911. +#include <stdio.h>
  8912. +#include <fcntl.h>
  8913. +#include <errno.h>
  8914. +#include <unistd.h>
  8915. +
  8916. +/*
  8917. + * This routine tests to see if fcntl returns success when asked to 
  8918. + * establish a file lock.  This test is intended for use on file systems
  8919. + * such as NFS that may not implement file locks.  ROMIO makes use
  8920. + * of file locks to implement certain operations, and may not work
  8921. + * properly if file locks are not available.  
  8922. + *
  8923. + * This is a simple test and has at least two limitations:
  8924. + * 
  8925. + * 1. Some implementations of NFS are known to return success for 
  8926. + * setting a file lock when in fact no lock has been set.  This
  8927. + * test will not detect such erroneous implementations of NFS
  8928. + *
  8929. + * 2. Some implementations will hang (enter and wait indefinitately)
  8930. + * within the fcntl call.  This program will also hang in that case.
  8931. + * Under normal conditions, this program should only take a few seconds to 
  8932. + * run.
  8933. + *
  8934. + * This program prints a message showing the success or failure of
  8935. + * setting the file lock and sets the return status to 0 on success and
  8936. + * non-zero on failure.  If there is a failure, the system routine
  8937. + * perror is also called to explain the reason.
  8938. + */
  8939. +int main( int argc, char *argv[] )
  8940. +{
  8941. +    struct flock lock;
  8942. +    int fd, err;
  8943. +    char *filename;
  8944. +
  8945. +    /* Set the filename.  Either arg[1] or conftest.dat */
  8946. +    if (argc > 1 && argv[1]) {
  8947. +      filename = argv[1];
  8948. +    }
  8949. +    else {
  8950. +      filename = "conftest.dat";
  8951. +    }
  8952. +
  8953. +       
  8954. +    lock.l_type   = F_WRLCK;
  8955. +    lock.l_start  = 0;
  8956. +    lock.l_whence = SEEK_SET;
  8957. +    lock.l_len    = 100;
  8958. +
  8959. +    fd = open(filename, O_RDWR | O_CREAT, 0644);
  8960. +
  8961. +    err = fcntl(fd, F_SETLKW, &lock);
  8962. +
  8963. +    if (err) {
  8964. +      printf( "Failed to set a file lock on %s\n", filename );
  8965. +      perror( "Reason " );
  8966. +    }
  8967. +    else {
  8968. +      printf( "fcntl claims success in setting a file lock on %s\n", filename );
  8969. +    }
  8970. +   /* printf("err = %d, errno = %d\n", err, errno); */
  8971. +    close(fd);
  8972. +    unlink( filename );
  8973. +    return err;
  8974. +}
  8975.