[adios] 14/207: Adios release 1.3

Alastair McKinstry mckinstry at moszumanska.debian.org
Fri Jun 12 06:04:25 UTC 2015


This is an automated email from the git hooks/post-receive script.

mckinstry pushed a commit to branch master
in repository adios.

commit 31f01a22f8fe2aaf54c3e482b0d04e49cea4818d
Author: Alastair McKinstry <mckinstry at debian.org>
Date:   Tue Aug 9 20:32:05 2011 +0100

    Adios release 1.3
---
 Makefile.am                                        |    7 +
 Makefile.in                                        |   17 +
 NEWS                                               |    5 +
 README                                             |    2 +-
 aclocal.m4                                         |    1 +
 adios_config                                       |   44 +-
 adios_config.flags.in                              |    8 +-
 config.h.in                                        |    3 +
 config/ac_datatap.m4                               |    4 +-
 config/ac_dmalloc.m4                               |    2 +-
 config/ac_hdf5.m4                                  |    2 +-
 config/ac_lustre.m4                                |   73 +
 config/ac_nc4par.m4                                |    3 +
 configure                                          |  559 +-
 configure.ac                                       |  277 +-
 examples/C/Makefile.in                             |   10 +
 examples/C/arrays/Makefile.in                      |   10 +
 examples/C/attributes/Makefile.in                  |   10 +
 examples/C/global-array-time/Makefile.am           |    2 +-
 examples/C/global-array-time/Makefile.in           |   12 +-
 examples/C/global-array-time/adios_globaltime.c    |   14 +-
 examples/C/global-array-time/adios_globaltime.xml  |    8 +-
 .../C/global-array-time/adios_globaltime_no_xml.c  |    2 +-
 .../C/global-array-time/adios_read_globaltime.c    |    2 +-
 .../{gread_temperature.ch => gread_restart.ch}     |    4 +
 .../{gwrite_temperature.ch => gwrite_restart.ch}   |    6 +-
 examples/C/global-array/Makefile.in                |   10 +
 examples/C/global-array/adios_global.xml           |    4 +-
 examples/C/global-array/adios_global_2files.c      |    2 +-
 examples/C/global-array/adios_global_no_xml.c      |  101 +-
 examples/C/global-array/adios_read_global.c        |    2 +-
 examples/C/global-array/adios_read_global_no_xml.c |   28 +-
 examples/C/global-array/job.pbs                    |    4 +-
 examples/C/manual/Makefile.in                      |   10 +
 examples/C/read_all/Makefile.in                    |   10 +
 examples/C/scalars/Makefile.in                     |   10 +
 examples/C/stat/Makefile.in                        |   10 +
 examples/Fortran/Makefile.in                       |   10 +
 examples/Fortran/arrays/Makefile.in                |   10 +
 examples/Fortran/global-array-time/Makefile.am     |    2 +-
 examples/Fortran/global-array-time/Makefile.in     |   12 +-
 .../Fortran/global-array-time/adios_globaltime.F90 |   15 +-
 .../Fortran/global-array-time/adios_globaltime.xml |    8 +-
 .../{gread_temperature.fh => gread_restart.fh}     |    4 +
 .../{gwrite_temperature.fh => gwrite_restart.fh}   |    6 +-
 examples/Fortran/global-array/Makefile.in          |   10 +
 .../Fortran/global-array/adios_global_no_xml.F90   |    2 +-
 examples/Fortran/scalars/Makefile.in               |   10 +
 examples/Makefile.in                               |   10 +
 runconf                                            |  187 +-
 scripts/create.nssi.config.sh                      |    7 +
 scripts/kill.nssi.staging.sh                       |   14 +-
 src/Makefile.am                                    |  129 +-
 src/Makefile.in                                    |  956 +++-
 src/adios.c                                        |   49 +
 src/adios.h                                        |  114 +-
 src/adios_bp_v1.c                                  |   33 +-
 src/adios_bp_v1.h                                  |   10 +-
 src/adios_dart.c                                   |  605 ++-
 src/adios_datatap.c                                |    1 -
 src/adios_dimes.c                                  |    5 -
 src/adios_error.c                                  |    4 +-
 src/adios_error.h                                  |    7 +-
 src/adios_internals.c                              |  131 +-
 src/adios_internals.h                              |    7 +-
 src/adios_internals_mxml.c                         |   45 +-
 src/adios_mpi.c                                    |   14 +-
 src/adios_mpi_amr.c                                | 1914 ++++---
 src/adios_mpi_lustre.c                             |  333 +-
 src/adios_nc4.c                                    |   36 +-
 src/adios_nssi.c                                   |  295 +-
 src/adios_nssi_args.x                              |   91 +-
 src/adios_posix.c                                  |   10 +-
 src/adios_posix1.c                                 |   27 +-
 src/adios_read.c                                   |   10 +
 src/adios_read.h                                   |  122 +-
 src/adios_read_hooks.c                             |   17 +-
 src/adios_read_hooks.h                             |   44 +-
 src/adios_transport_hooks.c                        |   64 +-
 src/adios_transport_hooks.h                        |   35 +-
 src/adiosf.c                                       |   43 +-
 src/adiosf_read.c                                  |   28 +
 src/bp_types.h                                     |   12 +
 src/bp_utils.c                                     |   16 +-
 src/common_adios.c                                 |   11 +-
 src/common_read.c                                  |   46 +-
 src/common_read.h                                  |    7 +-
 src/ds_metadata.h                                  |  109 +
 src/futils.c                                       |    2 +-
 src/globals.c                                      |   58 +
 src/globals.h                                      |    7 +
 src/mpidummy.c                                     |    8 +
 src/mpidummy.h                                     |    9 +-
 src/nssi_coupling_server.cpp                       | 1703 ++++++
 src/nssi_staging_server.cpp                        |   52 +-
 src/read_bp.c                                      |  716 ++-
 src/read_bp_staged.c                               | 5649 ++++++++++++++++++++
 src/read_dart.c                                    |  809 ++-
 src/read_datatap.c                                 | 2304 ++++++++
 src/read_dimes.c                                   |   30 +-
 src/read_nssi.c                                    |  653 +++
 tests/C/Makefile.in                                |   10 +
 tests/C/config_c.xml                               |    8 +-
 tests/Fortran/Makefile.in                          |   10 +
 tests/Makefile.in                                  |   10 +
 tests/bp_read/Makefile.in                          |   10 +
 tests/bp_read/bp_read_f.F90                        |  134 +-
 tests/genarray/Makefile.in                         |   10 +
 tests/genarray/genarray.F90                        |   73 +-
 tests/genarray/genarray3d.xml                      |   22 +-
 tests/suite/Makefile.in                            |   10 +
 tests/suite/programs/Makefile.in                   |   10 +
 tests/suite/reference/global_array_no_xml_bpls.txt |  206 +-
 tests/suite/reference/global_array_no_xml_read.txt |  216 +-
 tests/suite/reference/global_array_time_bpls.txt   |    8 +-
 tests/suite/tests/07_global_array_no_xml.sh        |    2 +-
 utils/Makefile.am                                  |    2 +-
 utils/Makefile.in                                  |   14 +-
 utils/adios_lint/Makefile.am                       |    6 +-
 utils/adios_lint/Makefile.in                       |   16 +-
 utils/bp2ascii/Makefile.am                         |    6 +-
 utils/bp2ascii/Makefile.in                         |   16 +-
 utils/bp2bp/Makefile.am                            |   19 +
 utils/{bp2ascii => bp2bp}/Makefile.in              |   62 +-
 utils/bp2bp/README                                 |    2 +
 utils/bp2bp/bp2bp.c                                |  963 ++++
 utils/bp2h5/Makefile.am                            |   19 +-
 utils/bp2h5/Makefile.in                            |   38 +-
 utils/bp2h5/README                                 |   92 +-
 utils/bp2h5/bp2h5.c                                |  685 ++-
 utils/bp2h5/hw-utils.c                             | 1665 ------
 utils/bp2h5/hw-utils.h                             |  163 -
 utils/bp2ncd/Makefile.am                           |   17 +-
 utils/bp2ncd/Makefile.in                           |   33 +-
 utils/bpdump/Makefile.am                           |    6 +-
 utils/bpdump/Makefile.in                           |   16 +-
 utils/bpdump/bpdump.c                              |   10 +-
 utils/bpls/Makefile.in                             |   10 +
 utils/bpls/bpls.c                                  |   21 +-
 utils/bpsplit/Makefile.am                          |   18 +-
 utils/bpsplit/Makefile.in                          |   28 +-
 utils/gpp/Makefile.in                              |   10 +
 utils/gpp/gpp.py                                   |   28 +-
 143 files changed, 19166 insertions(+), 4503 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index eddca2a..d7bf994 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -24,5 +24,12 @@ if HAVE_NSSI
 endif
 
 install-data-hook:
+	echo -n "VERSIONSTRING=\"$(PACKAGE) version $(VERSION) svn revision " >> adios_config.flags
+	if type svnversion &>/dev/null; then \
+	    echo `svnversion`\" >> adios_config.flags; \
+	else \
+	    echo "unknown\""; >> adios_config.flags \
+	    echo "Error: svnversion command not found"; \
+	fi 
 	cp adios_config.flags $(DESTDIR)$(bindir)
         
diff --git a/Makefile.in b/Makefile.in
index 5b4cbbc..6ec3f1f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -54,6 +54,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -100,6 +101,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -174,6 +179,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -208,6 +215,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
@@ -792,6 +802,13 @@ uninstall-info: uninstall-info-recursive
 
 
 install-data-hook:
+	echo -n "VERSIONSTRING=\"$(PACKAGE) version $(VERSION) svn revision " >> adios_config.flags
+	if type svnversion &>/dev/null; then \
+	    echo `svnversion`\" >> adios_config.flags; \
+	else \
+	    echo "unknown\""; >> adios_config.flags \
+	    echo "Error: svnversion command not found"; \
+	fi 
 	cp adios_config.flags $(DESTDIR)$(bindir)
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/NEWS b/NEWS
index 4f8c99a..a50d299 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,8 @@
+1.3 Released July 12, 2011
+    - New read method BP_STAGED for reading files with improved performance
+    - Changes in MPI_AMR and MPI_LUSTRE to support default parameters. Parameters for MPI_LUSTRE and MPI_AMR
+      in XML file are not mandatory any more.
+
 1.2.1 Released Aug 25, 2010
     - Bug fix in read API (arrays written every timestep but without time dimension caused aborts)
     - DIMES method from Rutgers
diff --git a/README b/README
index d793d17..a3419e3 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-ADIOS 1.2 Release
+ADIOS 1.3 Release
 -----------------
 
 Please look at the examples/ directory for the example codes on how to 
diff --git a/aclocal.m4 b/aclocal.m4
index fd62727..39ab2ce 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -7281,6 +7281,7 @@ m4_include([config/ac_dimes.m4])
 m4_include([config/ac_dmalloc.m4])
 m4_include([config/ac_hdf5.m4])
 m4_include([config/ac_infiniband.m4])
+m4_include([config/ac_lustre.m4])
 m4_include([config/ac_mxml.m4])
 m4_include([config/ac_nc4par.m4])
 m4_include([config/ac_netcdf.m4])
diff --git a/adios_config b/adios_config
index 030c271..6e814e2 100755
--- a/adios_config
+++ b/adios_config
@@ -14,16 +14,15 @@ fi
 . ${FLAGSFILE}
 
 function Usage () {
-    echo "`basename $0` [-d | -c | -l] [-f] [-r] [-s]
+    echo "`basename $0` [-d | -c | -l] [-f] [-r] [-s] [-v]
 Arguments
    -d   Print base directory for ADIOS install
    -c   Print compiler flags for C/C++, using ADIOS write/read methods
    -l   Print linker flags for C/C++, using ADIOS write/read methods
    -f   Print above flags for Fortran90
    -r   Print above flags for using ADIOS read library only.
-   -s   Print above flags for using ADIOS read library only and
-          in a sequential code (no MPI). 
-          -r is implicit for -s, because the write API is parallel-only. 
+   -s   Print above flags for using ADIOS in a sequential code (no MPI). 
+   -v   Print version of the installed package
 Notes
    - Multiple options of d,c,l are enabled. In such a case, the output is
      a list of FLAG=flags, where FLAG is one of (DIR, CFLAGS, LDFLAGS)
@@ -42,7 +41,7 @@ OPT_READ=no
 OPT_SEQ=no
 NFLAGS_ASKED=0
 
-while getopts ":dclfrsh" Option
+while getopts ":dclfrsvh" Option
 do          
   case $Option in               
         d) PRINT_DIR=yes; let "NFLAGS_ASKED=NFLAGS_ASKED+1";;
@@ -51,6 +50,7 @@ do
         f) OPT_FORTRAN=yes;;
         r) OPT_READ=yes;;
         s) OPT_SEQ=yes;;
+        v) echo "$VERSIONSTRING"; exit 0;;
         h) Usage; exit 0;;
         *) echo "Invalid option -$Option."; Usage; exit 255;;   # DEFAULT
   esac
@@ -64,9 +64,9 @@ if [ $NFLAGS_ASKED == 0 ]; then
     PRINT_LDFLAGS=yes
 fi
 
-if [ "$OPT_SEQ" == "yes" ]; then
-    OPT_READ=yes
-fi
+#if [ "$OPT_SEQ" == "yes" ]; then
+#    OPT_READ=yes
+#fi
 
 # Print requested values
 if [ "$PRINT_DIR" == "yes" ]; then
@@ -84,7 +84,11 @@ if [ "$PRINT_CFLAGS" == "yes" ]; then
             CFLAGS="$ADIOSREAD_INC"
         fi 
     else
-        CFLAGS="$ADIOS_INC"
+        if [ "$OPT_SEQ" == "yes" ]; then
+            CFLAGS="$ADIOS_SEQ_INC"
+        else
+            CFLAGS="$ADIOS_INC"
+        fi 
     fi
     if [ $NFLAGS_ASKED -gt 1 ]; then
         echo -n "CFLAGS="
@@ -94,18 +98,30 @@ fi
 
 if [ "$PRINT_LDFLAGS" == "yes" ]; then
     if [ "$OPT_SEQ" == "yes" ]; then
-        if [ "$OPT_FORTRAN" == "yes" ]; then
-            LDFLAGS="$ADIOSREAD_SEQ_FLIB"
-        else
-            LDFLAGS="$ADIOSREAD_SEQ_CLIB"
+        if [ "$OPT_READ" == "yes" ]; then
+            # ADIOSREAD + SEQ
+            if [ "$OPT_FORTRAN" == "yes" ]; then
+                LDFLAGS="$ADIOSREAD_SEQ_FLIB"
+            else
+                LDFLAGS="$ADIOSREAD_SEQ_CLIB"
+            fi
+        else  # ADIOS + SEQ
+            if [ "$OPT_FORTRAN" == "yes" ]; then
+                #LDFLAGS="$ADIOS_SEQ_FLIB"
+                LDFLAGS="There is no Fortran library of ADIOS for sequential codes"
+            else
+                LDFLAGS="$ADIOS_SEQ_CLIB"
+            fi
         fi
     elif [ "$OPT_READ" == "yes" ]; then
+        # ADIOSREAD + parallel code
         if [ "$OPT_FORTRAN" == "yes" ]; then
             LDFLAGS="$ADIOSREAD_FLIB"
         else
             LDFLAGS="$ADIOSREAD_CLIB"
         fi
-    else
+    else 
+        # ADIOS + parallel code
         if [ "$OPT_FORTRAN" == "yes" ]; then
             LDFLAGS="$ADIOS_FLIB"
         else
diff --git a/adios_config.flags.in b/adios_config.flags.in
index dfdea3b..2e1c883 100755
--- a/adios_config.flags.in
+++ b/adios_config.flags.in
@@ -20,7 +20,11 @@ ADIOSREAD_SEQ_INC="-I${ADIOS_DIR}/include @ADIOSREADLIB_SEQ_CPPFLAGS@ @ADIOSREAD
 ADIOSREAD_SEQ_CLIB="-L${ADIOS_DIR}/lib -ladiosread_nompi @ADIOSREADLIB_SEQ_LDFLAGS@ @ADIOSREADLIB_SEQ_LDADD@"
 ADIOSREAD_SEQ_FLIB="-L${ADIOS_DIR}/lib -ladiosreadf_nompi @ADIOSREADLIB_SEQ_LDFLAGS@ @ADIOSREADLIB_SEQ_LDADD@"
 
-#The following flags are not used. It is only for internal utilities of ADIOS, using libadios_internal_nompi.a
+#Flags to build code using ADIOS write API in a sequential code (no MPI)
 ADIOS_SEQ_INC="-I${ADIOS_DIR}/include @ADIOSLIB_SEQ_CPPFLAGS@ @ADIOSLIB_SEQ_CFLAGS@"
-ADIOS_SEQ_CLIB="-L${ADIOS_DIR}/lib -ladios_internal_nompi @ADIOSLIB_SEQ_LDFLAGS@ @ADIOSLIB_SEQ_LDADD@ @LDFLAGS@ @LIBS@"
+ADIOS_SEQ_CLIB="-L${ADIOS_DIR}/lib -ladios_nompi @ADIOSLIB_SEQ_LDFLAGS@ @ADIOSLIB_SEQ_LDADD@ @LDFLAGS@ @LIBS@"
+
+#The following flags are not used. It is only for internal utilities of ADIOS, using libadios_internal_nompi.a
+ADIOS_INT_INC="-I${ADIOS_DIR}/include @ADIOSLIB_INT_CPPFLAGS@ @ADIOSLIB_INT_CFLAGS@"
+ADIOS_INT_CLIB="-L${ADIOS_DIR}/lib -ladios_internal_nompi @ADIOSLIB_INT_LDFLAGS@ @ADIOSLIB_INT_LDADD@ @LDFLAGS@ @LIBS@"
 
diff --git a/config.h.in b/config.h.in
index 433243b..8aa08cc 100644
--- a/config.h.in
+++ b/config.h.in
@@ -71,6 +71,9 @@
 /* Define to 1 if you have the `rt' library (-lrt). */
 #undef HAVE_LIBRT
 
+/* Define if you have LUSTRE. */
+#undef HAVE_LUSTRE
+
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
diff --git a/config/ac_datatap.m4 b/config/ac_datatap.m4
index dd0d915..b2ec424 100644
--- a/config/ac_datatap.m4
+++ b/config/ac_datatap.m4
@@ -63,7 +63,7 @@ elif test x"$with_datatap" = xyes -o x"$with_datatap" = xcheck; then
 
 		if test -n "$cercs_cv_ptlpbio_link_dir";then
 			DT_LDFLAGS="$DT_LDFLAGS -L$cercs_cv_ptlpbio_link_dir"
-			DT_LIBS="$DT_LIBS -lptlclient"
+			DT_LIBS="$DT_LIBS -lptlclient -lptlserver -lbench -ldl"
 			datatap=portals
 		else
 			temptest=disable
@@ -114,7 +114,7 @@ dnl directory given .. add it to search path with CERCS_REQUIRE_PACKAGE
 
 		if test -n "$cercs_cv_ptlpbio_link_dir";then
 			DT_LDFLAGS="$DT_LDFLAGS -L$cercs_cv_ptlpbio_link_dir"
-			DT_LIBS="$DT_LIBS -lptlclient"
+			DT_LIBS="$DT_LIBS -lptlclient -lptlserver -lbench -ldl"
 			datatap=portals
 		else
 			temptest=disable
diff --git a/config/ac_dmalloc.m4 b/config/ac_dmalloc.m4
index ac2f8f1..2f5617f 100644
--- a/config/ac_dmalloc.m4
+++ b/config/ac_dmalloc.m4
@@ -40,7 +40,7 @@ fi
 # Check for the dmalloc library and headers
 AC_TRY_COMPILE([#include "dmalloc.h"],
         [char * s; s=malloc(sizeof(char)*10); free(s);],
-        [DMALLOC_LIBS="-ldmalloc"],
+        [DMALLOC_LIBS="-ldmallocth"],
         [AM_CONDITIONAL(HAVE_DMALLOC,false)])
 
 LIBS="$save_LIBS"
diff --git a/config/ac_hdf5.m4 b/config/ac_hdf5.m4
index 96e9004..fe7c1af 100644
--- a/config/ac_hdf5.m4
+++ b/config/ac_hdf5.m4
@@ -64,7 +64,7 @@ else
     dnl if hdf5 libs are not defined then guess and define it
     if test -z "${HDF5_LIBS}"; then
         dnl default HDF5 lib is usually just -lhdf5 -lz
-        HDF5_LIBS="-lhdf5 -lz"
+        HDF5_LIBS="-lhdf5_hl -lhdf5 -lz"
     fi
 
     save_CC="$CC"
diff --git a/config/ac_lustre.m4 b/config/ac_lustre.m4
new file mode 100644
index 0000000..f472dc2
--- /dev/null
+++ b/config/ac_lustre.m4
@@ -0,0 +1,73 @@
+#
+#
+# AC_LUSTRE
+#
+#
+#
+dnl @synopsis AC_LUSTRE
+dnl
+dnl This macro test if dmalloc is to be used. 
+dnl Use in C code:
+dnl     #ifdef DMALLOC
+dnl     #include "dmalloc.h"
+dnl     #endif
+dnl
+dnl @version 1.0
+dnl @author Qing Liu, UT
+dnl
+AC_DEFUN([AC_LUSTRE],[
+
+AC_MSG_NOTICE([=== checking for Lustre ===])
+
+AM_CONDITIONAL(HAVE_LUSTRE,true)
+
+AC_ARG_WITH(lustre,
+        [  --with-lustre=DIR      Location of lustre library],
+        [LUSTRE_LDFLAGS="-L$withval/lib";
+         LUSTRE_LIBS="-llustreapi";
+         LUSTRE_CPPFLAGS="-I$withval/include";],
+        [with_lustre=no])
+
+if test "x$with_lustre" == "xno"; then
+
+   AM_CONDITIONAL(HAVE_LUSTRE,false)
+
+else
+
+    save_CPPFLAGS="$CPPFLAGS"
+    save_LIBS="$LIBS"
+    save_LDFLAGS="$LDFLAGS"
+    LIBS="$LIBS -llustreapi"
+    LDFLAGS="$LDFLAGS $LUSTRE_LDFLAGS"
+    CPPFLAGS="$CPPFLAGS $LUSTRE_CPPFLAGS"
+    
+    dnl if test -z "${HAVE_DMALLOC_TRUE}"; then
+    dnl        AC_CHECK_HEADERS(dmalloc.h,
+    dnl                ,
+    dnl                [AM_CONDITIONAL(HAVE_DMALLOC,false)])
+    dnl fi
+    
+    # Check for the lustre library and headers
+    dnl AC_TRY_COMPILE([struct obd_uuid {char uuid[40];};int fd, num_ost;struct obd_uuid uuids[1024];],
+    dnl        [llapi_lov_get_uuids(fd, uuids, &num_ost);],
+    dnl        [LUSTRE_LIBS="-llustreapi"],
+    dnl        [AM_CONDITIONAL(HAVE_LUSTRE,false)])
+    
+    LIBS="$save_LIBS"
+    LDFLAGS="$save_LDFLAGS"
+    CPPFLAGS="$save_CPPFLAGS"
+    
+    AC_SUBST(LUSTRE_LIBS)
+    AC_SUBST(LUSTRE_LDFLAGS)
+    AC_SUBST(LUSTRE_CPPFLAGS)
+    
+    # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+    if test -z "${HAVE_LUSTRE_TRUE}"; then
+            ifelse([$1],,[AC_DEFINE(HAVE_LUSTRE,1,[Define if you have LUSTRE.])],[$1])
+            :
+    else
+            $2
+            :
+    fi
+fi
+])dnl AC_LUSTRE
diff --git a/config/ac_nc4par.m4 b/config/ac_nc4par.m4
index b5343c9..17bf271 100644
--- a/config/ac_nc4par.m4
+++ b/config/ac_nc4par.m4
@@ -91,12 +91,14 @@ else
         fi
     fi
 
+    save_CC="$CC"
     save_CPPFLAGS="$CPPFLAGS"
     save_LIBS="$LIBS"
     save_LDFLAGS="$LDFLAGS"
     LIBS="$LIBS $NC4PAR_LIBS"
     LDFLAGS="$LDFLAGS $NC4PAR_LDFLAGS"
     CPPFLAGS="$CPPFLAGS $NC4PAR_CPPFLAGS"
+    CC="$MPICC"
     
     if test -z "${HAVE_NC4PAR_TRUE}"; then
         AC_CHECK_HEADERS(netcdf.h,
@@ -132,6 +134,7 @@ else
     LIBS="$save_LIBS"
     LDFLAGS="$save_LDFLAGS"
     CPPFLAGS="$save_CPPFLAGS"
+    CC="$save_CC"
     
     # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
     if test -z "${HAVE_NC4PAR_TRUE}"; then
diff --git a/configure b/configure
index 62d29ed..e0b0228 100755
--- a/configure
+++ b/configure
@@ -464,7 +464,7 @@ ac_includes_default="\
 # include <unistd.h>
 #endif"
 
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INS [...]
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP ac_ct_STRIP INS [...]
 ac_subst_files=''
 
 # Initialize some variables set by options.
@@ -1100,6 +1100,7 @@ Optional Packages:
   --with-dimes-incdir=<location of dimes includes>
   --with-dimes-libdir=<location of dimes library>
   --with-dmalloc=DIR      Location of dmalloc library
+  --with-lustre=DIR      Location of lustre library
   --with-datatap=DIR 	Location of DataTap
   --with-installed        Don't use local copies of CERCS packages
   --with-local            Use only local copies of CERCS packages
@@ -1876,7 +1877,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE=adios
- VERSION=1.2.1
+ VERSION=1.3
 
 
 cat >>confdefs.h <<_ACEOF
@@ -5691,7 +5692,7 @@ fi
 
 
 # Provide some information about the compiler.
-echo "$as_me:5694:" \
+echo "$as_me:5695:" \
      "checking for Fortran compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
 { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -5936,7 +5937,7 @@ _ACEOF
 # flags.
 ac_save_FFLAGS=$FCFLAGS
 FCFLAGS="$FCFLAGS $ac_verb"
-(eval echo $as_me:5939: \"$ac_link\") >&5
+(eval echo $as_me:5940: \"$ac_link\") >&5
 ac_fc_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
 echo "$ac_fc_v_output" >&5
 FCFLAGS=$ac_save_FFLAGS
@@ -6014,7 +6015,7 @@ _ACEOF
 # flags.
 ac_save_FFLAGS=$FCFLAGS
 FCFLAGS="$FCFLAGS $ac_cv_prog_fc_v"
-(eval echo $as_me:6017: \"$ac_link\") >&5
+(eval echo $as_me:6018: \"$ac_link\") >&5
 ac_fc_v_output=`eval $ac_link 5>&1 2>&1 | grep -v 'Driving:'`
 echo "$ac_fc_v_output" >&5
 FCFLAGS=$ac_save_FFLAGS
@@ -7710,7 +7711,7 @@ ia64-*-hpux*)
   ;;
 *-*-irix6*)
   # Find out which ABI we are using.
-  echo '#line 7713 "configure"' > conftest.$ac_ext
+  echo '#line 7714 "configure"' > conftest.$ac_ext
   if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -8625,7 +8626,7 @@ fi
 
 
 # Provide some information about the compiler.
-echo "$as_me:8628:" \
+echo "$as_me:8629:" \
      "checking for Fortran 77 compiler version" >&5
 ac_compiler=`set X $ac_compile; echo $2`
 { (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
@@ -9688,11 +9689,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:9691: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:9692: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:9695: \$? = $ac_status" >&5
+   echo "$as_me:9696: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -9956,11 +9957,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:9959: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:9960: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:9963: \$? = $ac_status" >&5
+   echo "$as_me:9964: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -10060,11 +10061,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:10063: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:10064: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:10067: \$? = $ac_status" >&5
+   echo "$as_me:10068: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -11545,7 +11546,7 @@ linux*)
   libsuff=
   case "$host_cpu" in
   x86_64*|s390x*|powerpc64*)
-    echo '#line 11548 "configure"' > conftest.$ac_ext
+    echo '#line 11549 "configure"' > conftest.$ac_ext
     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -12498,7 +12499,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 12501 "configure"
+#line 12502 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -12598,7 +12599,7 @@ else
   lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
   lt_status=$lt_dlunknown
   cat > conftest.$ac_ext <<EOF
-#line 12601 "configure"
+#line 12602 "configure"
 #include "confdefs.h"
 
 #if HAVE_DLFCN_H
@@ -14957,11 +14958,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:14960: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:14961: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:14964: \$? = $ac_status" >&5
+   echo "$as_me:14965: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -15061,11 +15062,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:15064: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:15065: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:15068: \$? = $ac_status" >&5
+   echo "$as_me:15069: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -15597,7 +15598,7 @@ linux*)
   libsuff=
   case "$host_cpu" in
   x86_64*|s390x*|powerpc64*)
-    echo '#line 15600 "configure"' > conftest.$ac_ext
+    echo '#line 15601 "configure"' > conftest.$ac_ext
     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -16655,11 +16656,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16658: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16659: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:16662: \$? = $ac_status" >&5
+   echo "$as_me:16663: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -16759,11 +16760,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:16762: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:16763: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:16766: \$? = $ac_status" >&5
+   echo "$as_me:16767: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -18208,7 +18209,7 @@ linux*)
   libsuff=
   case "$host_cpu" in
   x86_64*|s390x*|powerpc64*)
-    echo '#line 18211 "configure"' > conftest.$ac_ext
+    echo '#line 18212 "configure"' > conftest.$ac_ext
     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -18986,11 +18987,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:18989: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:18990: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:18993: \$? = $ac_status" >&5
+   echo "$as_me:18994: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -19254,11 +19255,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:19257: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:19258: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>conftest.err)
    ac_status=$?
    cat conftest.err >&5
-   echo "$as_me:19261: \$? = $ac_status" >&5
+   echo "$as_me:19262: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s "$ac_outfile"; then
      # The compiler can only warn and ignore the option if not recognized
      # So say no if there are warnings other than the usual output.
@@ -19358,11 +19359,11 @@ else
    -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
    -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
    -e 's:$: $lt_compiler_flag:'`
-   (eval echo "\"\$as_me:19361: $lt_compile\"" >&5)
+   (eval echo "\"\$as_me:19362: $lt_compile\"" >&5)
    (eval "$lt_compile" 2>out/conftest.err)
    ac_status=$?
    cat out/conftest.err >&5
-   echo "$as_me:19365: \$? = $ac_status" >&5
+   echo "$as_me:19366: \$? = $ac_status" >&5
    if (exit $ac_status) && test -s out/conftest2.$ac_objext
    then
      # The compiler can only warn and ignore the option if not recognized
@@ -20843,7 +20844,7 @@ linux*)
   libsuff=
   case "$host_cpu" in
   x86_64*|s390x*|powerpc64*)
-    echo '#line 20846 "configure"' > conftest.$ac_ext
+    echo '#line 20847 "configure"' > conftest.$ac_ext
     if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   (eval $ac_compile) 2>&5
   ac_status=$?
@@ -24830,7 +24831,7 @@ else
         HDF5_LDFLAGS="-L${HDF5_LIBDIR}"
 
         if test -z "${HDF5_LIBS}"; then
-                HDF5_LIBS="-lhdf5 -lz"
+                HDF5_LIBS="-lhdf5_hl -lhdf5 -lz"
     fi
 
     save_CC="$CC"
@@ -25858,12 +25859,14 @@ fi;
         fi
     fi
 
+    save_CC="$CC"
     save_CPPFLAGS="$CPPFLAGS"
     save_LIBS="$LIBS"
     save_LDFLAGS="$LDFLAGS"
     LIBS="$LIBS $NC4PAR_LIBS"
     LDFLAGS="$LDFLAGS $NC4PAR_LDFLAGS"
     CPPFLAGS="$CPPFLAGS $NC4PAR_CPPFLAGS"
+    CC="$MPICC"
 
     if test -z "${HAVE_NC4PAR_TRUE}"; then
 
@@ -26126,6 +26129,7 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
     LIBS="$save_LIBS"
     LDFLAGS="$save_LDFLAGS"
     CPPFLAGS="$save_CPPFLAGS"
+    CC="$save_CC"
 
     # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
     if test -z "${HAVE_NC4PAR_TRUE}"; then
@@ -27915,7 +27919,7 @@ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
   ac_status=$?
   echo "$as_me:$LINENO: \$? = $ac_status" >&5
   (exit $ac_status); }; }; then
-  DMALLOC_LIBS="-ldmalloc"
+  DMALLOC_LIBS="-ldmallocth"
 else
   echo "$as_me: failed program was:" >&5
 sed 's/^/| /' conftest.$ac_ext >&5
@@ -27955,6 +27959,80 @@ else
 fi
 
 
+
+{ echo "$as_me:$LINENO: === checking for Lustre ===" >&5
+echo "$as_me: === checking for Lustre ===" >&6;}
+
+
+
+if true; then
+  HAVE_LUSTRE_TRUE=
+  HAVE_LUSTRE_FALSE='#'
+else
+  HAVE_LUSTRE_TRUE='#'
+  HAVE_LUSTRE_FALSE=
+fi
+
+
+
+# Check whether --with-lustre or --without-lustre was given.
+if test "${with_lustre+set}" = set; then
+  withval="$with_lustre"
+  LUSTRE_LDFLAGS="-L$withval/lib";
+         LUSTRE_LIBS="-llustreapi";
+         LUSTRE_CPPFLAGS="-I$withval/include";
+else
+  with_lustre=no
+fi;
+
+if test "x$with_lustre" == "xno"; then
+
+
+
+if false; then
+  HAVE_LUSTRE_TRUE=
+  HAVE_LUSTRE_FALSE='#'
+else
+  HAVE_LUSTRE_TRUE='#'
+  HAVE_LUSTRE_FALSE=
+fi
+
+
+else
+
+    save_CPPFLAGS="$CPPFLAGS"
+    save_LIBS="$LIBS"
+    save_LDFLAGS="$LDFLAGS"
+    LIBS="$LIBS -llustreapi"
+    LDFLAGS="$LDFLAGS $LUSTRE_LDFLAGS"
+    CPPFLAGS="$CPPFLAGS $LUSTRE_CPPFLAGS"
+
+
+    # Check for the lustre library and headers
+
+    LIBS="$save_LIBS"
+    LDFLAGS="$save_LDFLAGS"
+    CPPFLAGS="$save_CPPFLAGS"
+
+
+
+
+
+    # Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+    if test -z "${HAVE_LUSTRE_TRUE}"; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LUSTRE 1
+_ACEOF
+
+            :
+    else
+
+            :
+    fi
+fi
+
+
 # Check whether --with-installed or --without-installed was given.
 if test "${with_installed+set}" = set; then
   withval="$with_installed"
@@ -28189,11 +28267,11 @@ fi
 
 search_list="$datatap_dir/thin_ib.h $datatap_dir/lib/thin_ib.h $datatap_dir/include/thin_ib.h $search_list /usr/include/thin_ib.h /usr/local/include/thin_ib.h /opt/ibpbio/include/thin_ib.h /opt/misc/include/thin_ib.h /opt/misc/include/$cercs_cv_archive/thin_ib.h"
 tmp_search_results=""
-echo "configure:28192: searching for $search_list " >&5
+echo "configure:28270: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:28196: first found $tmp_search_results " >&5
+	echo "configure:28274: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -28281,11 +28359,11 @@ fi
 
 search_list="$datatap_dir/libibclient.la $datatap_dir/lib/libibclient.la $datatap_dir/include/libibclient.la $search_list /usr/lib/libibclient.la /usr/local/lib/libibclient.la /opt/ibpbio/lib/libibclient.la /opt/misc/lib/libibclient.la /opt/misc/lib/$cercs_cv_archive/libibclient.la"
 tmp_search_results=""
-echo "configure:28284: searching for $search_list " >&5
+echo "configure:28362: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:28288: first found $tmp_search_results " >&5
+	echo "configure:28366: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -28354,11 +28432,11 @@ else
 
 search_list="$PWD/../ibpbio $PWD/../../ibpbio $PWD/../../../ibpbio"
 tmp_search_results=""
-echo "configure:28357: searching for $search_list " >&5
+echo "configure:28435: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:28361: first found $tmp_search_results " >&5
+	echo "configure:28439: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -28396,11 +28474,11 @@ else
 
 search_list="$PWD/../ibpbio $PWD/../../ibpbio $PWD/../../../ibpbio"
 tmp_search_results=""
-echo "configure:28399: searching for $search_list " >&5
+echo "configure:28477: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:28403: first found $tmp_search_results " >&5
+	echo "configure:28481: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -28524,11 +28602,11 @@ fi
 
 search_list="$datatap_dir/ffs.h $datatap_dir/lib/ffs.h $datatap_dir/include/ffs.h $search_list /usr/include/ffs.h /usr/local/include/ffs.h /opt/ffs/include/ffs.h /opt/misc/include/ffs.h /opt/misc/include/$cercs_cv_archive/ffs.h"
 tmp_search_results=""
-echo "configure:28527: searching for $search_list " >&5
+echo "configure:28605: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:28531: first found $tmp_search_results " >&5
+	echo "configure:28609: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -28616,11 +28694,11 @@ fi
 
 search_list="$datatap_dir/libffs.la $datatap_dir/lib/libffs.la $datatap_dir/include/libffs.la $search_list /usr/lib/libffs.la /usr/local/lib/libffs.la /opt/ffs/lib/libffs.la /opt/misc/lib/libffs.la /opt/misc/lib/$cercs_cv_archive/libffs.la"
 tmp_search_results=""
-echo "configure:28619: searching for $search_list " >&5
+echo "configure:28697: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:28623: first found $tmp_search_results " >&5
+	echo "configure:28701: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -28689,11 +28767,11 @@ else
 
 search_list="$PWD/../ffs $PWD/../../ffs $PWD/../../../ffs"
 tmp_search_results=""
-echo "configure:28692: searching for $search_list " >&5
+echo "configure:28770: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:28696: first found $tmp_search_results " >&5
+	echo "configure:28774: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -28731,11 +28809,11 @@ else
 
 search_list="$PWD/../ffs $PWD/../../ffs $PWD/../../../ffs"
 tmp_search_results=""
-echo "configure:28734: searching for $search_list " >&5
+echo "configure:28812: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:28738: first found $tmp_search_results " >&5
+	echo "configure:28816: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -28859,11 +28937,11 @@ fi
 
 search_list="$datatap_dir/gen_thread.h $datatap_dir/lib/gen_thread.h $datatap_dir/include/gen_thread.h $search_list /usr/include/gen_thread.h /usr/local/include/gen_thread.h /opt/gen_thread/include/gen_thread.h /opt/misc/include/gen_thread.h /opt/misc/include/$cercs_cv_archive/gen_thread.h"
 tmp_search_results=""
-echo "configure:28862: searching for $search_list " >&5
+echo "configure:28940: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:28866: first found $tmp_search_results " >&5
+	echo "configure:28944: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -28951,11 +29029,11 @@ fi
 
 search_list="$datatap_dir/libgen_thread.la $datatap_dir/lib/libgen_thread.la $datatap_dir/include/libgen_thread.la $search_list /usr/lib/libgen_thread.la /usr/local/lib/libgen_thread.la /opt/gen_thread/lib/libgen_thread.la /opt/misc/lib/libgen_thread.la /opt/misc/lib/$cercs_cv_archive/libgen_thread.la"
 tmp_search_results=""
-echo "configure:28954: searching for $search_list " >&5
+echo "configure:29032: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:28958: first found $tmp_search_results " >&5
+	echo "configure:29036: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -29024,11 +29102,11 @@ else
 
 search_list="$PWD/../gen_thread $PWD/../../gen_thread $PWD/../../../gen_thread"
 tmp_search_results=""
-echo "configure:29027: searching for $search_list " >&5
+echo "configure:29105: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:29031: first found $tmp_search_results " >&5
+	echo "configure:29109: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -29066,11 +29144,11 @@ else
 
 search_list="$PWD/../gen_thread $PWD/../../gen_thread $PWD/../../../gen_thread"
 tmp_search_results=""
-echo "configure:29069: searching for $search_list " >&5
+echo "configure:29147: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:29073: first found $tmp_search_results " >&5
+	echo "configure:29151: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -29217,11 +29295,11 @@ fi
 
 search_list="$datatap_dir/thin_portal.h $datatap_dir/lib/thin_portal.h $datatap_dir/include/thin_portal.h $search_list /usr/include/thin_portal.h /usr/local/include/thin_portal.h /opt/ptlpbio/include/thin_portal.h /opt/misc/include/thin_portal.h /opt/misc/include/$cercs_cv_archive/thin_portal.h"
 tmp_search_results=""
-echo "configure:29220: searching for $search_list " >&5
+echo "configure:29298: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:29224: first found $tmp_search_results " >&5
+	echo "configure:29302: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -29309,11 +29387,11 @@ fi
 
 search_list="$datatap_dir/libptlclient.a $datatap_dir/lib/libptlclient.a $datatap_dir/include/libptlclient.a $search_list /usr/lib/libptlclient.a /usr/local/lib/libptlclient.a /opt/ptlpbio/lib/libptlclient.a /opt/misc/lib/libptlclient.a /opt/misc/lib/$cercs_cv_archive/libptlclient.a"
 tmp_search_results=""
-echo "configure:29312: searching for $search_list " >&5
+echo "configure:29390: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:29316: first found $tmp_search_results " >&5
+	echo "configure:29394: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -29382,11 +29460,11 @@ else
 
 search_list="$PWD/../ptlpbio $PWD/../../ptlpbio $PWD/../../../ptlpbio"
 tmp_search_results=""
-echo "configure:29385: searching for $search_list " >&5
+echo "configure:29463: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:29389: first found $tmp_search_results " >&5
+	echo "configure:29467: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -29424,11 +29502,11 @@ else
 
 search_list="$PWD/../ptlpbio $PWD/../../ptlpbio $PWD/../../../ptlpbio"
 tmp_search_results=""
-echo "configure:29427: searching for $search_list " >&5
+echo "configure:29505: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:29431: first found $tmp_search_results " >&5
+	echo "configure:29509: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -29475,7 +29553,7 @@ fi
 
 		if test -n "$cercs_cv_ptlpbio_link_dir";then
 			DT_LDFLAGS="$DT_LDFLAGS -L$cercs_cv_ptlpbio_link_dir"
-			DT_LIBS="$DT_LIBS -lptlclient"
+			DT_LIBS="$DT_LIBS -lptlclient -lptlserver -lbench -ldl"
 			datatap=portals
 		else
 			temptest=disable
@@ -29584,11 +29662,11 @@ fi
 
 search_list="$datatap_dir/thin_ib.h $datatap_dir/lib/thin_ib.h $datatap_dir/include/thin_ib.h $search_list /usr/include/thin_ib.h /usr/local/include/thin_ib.h /opt/ibpbio/include/thin_ib.h /opt/misc/include/thin_ib.h /opt/misc/include/$cercs_cv_archive/thin_ib.h"
 tmp_search_results=""
-echo "configure:29587: searching for $search_list " >&5
+echo "configure:29665: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:29591: first found $tmp_search_results " >&5
+	echo "configure:29669: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -29676,11 +29754,11 @@ fi
 
 search_list="$datatap_dir/libibclient.la $datatap_dir/lib/libibclient.la $datatap_dir/include/libibclient.la $search_list /usr/lib/libibclient.la /usr/local/lib/libibclient.la /opt/ibpbio/lib/libibclient.la /opt/misc/lib/libibclient.la /opt/misc/lib/$cercs_cv_archive/libibclient.la"
 tmp_search_results=""
-echo "configure:29679: searching for $search_list " >&5
+echo "configure:29757: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:29683: first found $tmp_search_results " >&5
+	echo "configure:29761: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -29749,11 +29827,11 @@ else
 
 search_list="$PWD/../ibpbio $PWD/../../ibpbio $PWD/../../../ibpbio"
 tmp_search_results=""
-echo "configure:29752: searching for $search_list " >&5
+echo "configure:29830: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:29756: first found $tmp_search_results " >&5
+	echo "configure:29834: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -29791,11 +29869,11 @@ else
 
 search_list="$PWD/../ibpbio $PWD/../../ibpbio $PWD/../../../ibpbio"
 tmp_search_results=""
-echo "configure:29794: searching for $search_list " >&5
+echo "configure:29872: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:29798: first found $tmp_search_results " >&5
+	echo "configure:29876: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -29919,11 +29997,11 @@ fi
 
 search_list="$datatap_dir/ffs.h $datatap_dir/lib/ffs.h $datatap_dir/include/ffs.h $search_list /usr/include/ffs.h /usr/local/include/ffs.h /opt/ffs/include/ffs.h /opt/misc/include/ffs.h /opt/misc/include/$cercs_cv_archive/ffs.h"
 tmp_search_results=""
-echo "configure:29922: searching for $search_list " >&5
+echo "configure:30000: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:29926: first found $tmp_search_results " >&5
+	echo "configure:30004: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -30011,11 +30089,11 @@ fi
 
 search_list="$datatap_dir/libffs.la $datatap_dir/lib/libffs.la $datatap_dir/include/libffs.la $search_list /usr/lib/libffs.la /usr/local/lib/libffs.la /opt/ffs/lib/libffs.la /opt/misc/lib/libffs.la /opt/misc/lib/$cercs_cv_archive/libffs.la"
 tmp_search_results=""
-echo "configure:30014: searching for $search_list " >&5
+echo "configure:30092: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:30018: first found $tmp_search_results " >&5
+	echo "configure:30096: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -30084,11 +30162,11 @@ else
 
 search_list="$PWD/../ffs $PWD/../../ffs $PWD/../../../ffs"
 tmp_search_results=""
-echo "configure:30087: searching for $search_list " >&5
+echo "configure:30165: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:30091: first found $tmp_search_results " >&5
+	echo "configure:30169: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -30126,11 +30204,11 @@ else
 
 search_list="$PWD/../ffs $PWD/../../ffs $PWD/../../../ffs"
 tmp_search_results=""
-echo "configure:30129: searching for $search_list " >&5
+echo "configure:30207: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:30133: first found $tmp_search_results " >&5
+	echo "configure:30211: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -30254,11 +30332,11 @@ fi
 
 search_list="$datatap_dir/gen_thread.h $datatap_dir/lib/gen_thread.h $datatap_dir/include/gen_thread.h $search_list /usr/include/gen_thread.h /usr/local/include/gen_thread.h /opt/gen_thread/include/gen_thread.h /opt/misc/include/gen_thread.h /opt/misc/include/$cercs_cv_archive/gen_thread.h"
 tmp_search_results=""
-echo "configure:30257: searching for $search_list " >&5
+echo "configure:30335: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:30261: first found $tmp_search_results " >&5
+	echo "configure:30339: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -30346,11 +30424,11 @@ fi
 
 search_list="$datatap_dir/libgen_thread.la $datatap_dir/lib/libgen_thread.la $datatap_dir/include/libgen_thread.la $search_list /usr/lib/libgen_thread.la /usr/local/lib/libgen_thread.la /opt/gen_thread/lib/libgen_thread.la /opt/misc/lib/libgen_thread.la /opt/misc/lib/$cercs_cv_archive/libgen_thread.la"
 tmp_search_results=""
-echo "configure:30349: searching for $search_list " >&5
+echo "configure:30427: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:30353: first found $tmp_search_results " >&5
+	echo "configure:30431: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -30419,11 +30497,11 @@ else
 
 search_list="$PWD/../gen_thread $PWD/../../gen_thread $PWD/../../../gen_thread"
 tmp_search_results=""
-echo "configure:30422: searching for $search_list " >&5
+echo "configure:30500: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:30426: first found $tmp_search_results " >&5
+	echo "configure:30504: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -30461,11 +30539,11 @@ else
 
 search_list="$PWD/../gen_thread $PWD/../../gen_thread $PWD/../../../gen_thread"
 tmp_search_results=""
-echo "configure:30464: searching for $search_list " >&5
+echo "configure:30542: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:30468: first found $tmp_search_results " >&5
+	echo "configure:30546: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -30612,11 +30690,11 @@ fi
 
 search_list="$datatap_dir/thin_portal.h $datatap_dir/lib/thin_portal.h $datatap_dir/include/thin_portal.h $search_list /usr/include/thin_portal.h /usr/local/include/thin_portal.h /opt/ptlpbio/include/thin_portal.h /opt/misc/include/thin_portal.h /opt/misc/include/$cercs_cv_archive/thin_portal.h"
 tmp_search_results=""
-echo "configure:30615: searching for $search_list " >&5
+echo "configure:30693: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:30619: first found $tmp_search_results " >&5
+	echo "configure:30697: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -30704,11 +30782,11 @@ fi
 
 search_list="$datatap_dir/libptlclient.a $datatap_dir/lib/libptlclient.a $datatap_dir/include/libptlclient.a $search_list /usr/lib/libptlclient.a /usr/local/lib/libptlclient.a /opt/ptlpbio/lib/libptlclient.a /opt/misc/lib/libptlclient.a /opt/misc/lib/$cercs_cv_archive/libptlclient.a"
 tmp_search_results=""
-echo "configure:30707: searching for $search_list " >&5
+echo "configure:30785: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:30711: first found $tmp_search_results " >&5
+	echo "configure:30789: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -30777,11 +30855,11 @@ else
 
 search_list="$PWD/../ptlpbio $PWD/../../ptlpbio $PWD/../../../ptlpbio"
 tmp_search_results=""
-echo "configure:30780: searching for $search_list " >&5
+echo "configure:30858: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:30784: first found $tmp_search_results " >&5
+	echo "configure:30862: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -30819,11 +30897,11 @@ else
 
 search_list="$PWD/../ptlpbio $PWD/../../ptlpbio $PWD/../../../ptlpbio"
 tmp_search_results=""
-echo "configure:30822: searching for $search_list " >&5
+echo "configure:30900: searching for $search_list " >&5
 for tmp_search_value in $search_list; do
    if test -r $tmp_search_value; then
 	tmp_search_results=$tmp_search_value
-	echo "configure:30826: first found $tmp_search_results " >&5
+	echo "configure:30904: first found $tmp_search_results " >&5
 	break
    fi
 done
@@ -30870,7 +30948,7 @@ fi
 
 		if test -n "$cercs_cv_ptlpbio_link_dir";then
 			DT_LDFLAGS="$DT_LDFLAGS -L$cercs_cv_ptlpbio_link_dir"
-			DT_LIBS="$DT_LIBS -lptlclient"
+			DT_LIBS="$DT_LIBS -lptlclient -lptlserver -lbench -ldl"
 			datatap=portals
 		else
 			temptest=disable
@@ -31055,7 +31133,11 @@ ADIOSLIB_SEQ_CPPFLAGS="-D_NOMPI ${MXML_CPPFLAGS}"
 ADIOSLIB_SEQ_CFLAGS=
 ADIOSLIB_SEQ_LDFLAGS="${MXML_LDFLAGS}"
 ADIOSLIB_SEQ_LDADD="-lm ${MXML_LIBS}"
-ADIOSREADLIB_CPPFLAGS=""
+ADIOSLIB_INT_CPPFLAGS="-D_NOMPI ${MXML_CPPFLAGS}"
+ADIOSLIB_INT_CFLAGS=
+ADIOSLIB_INT_LDFLAGS="${MXML_LDFLAGS}"
+ADIOSLIB_INT_LDADD="-lm ${MXML_LIBS}"
+ADIOSREADLIB_CPPFLAGS=
 ADIOSREADLIB_CFLAGS=
 ADIOSREADLIB_LDFLAGS=
 ADIOSREADLIB_LDADD="-lm"
@@ -31068,12 +31150,24 @@ if test "x${datatap}" != "xdisable"; then
     ADIOSLIB_CFLAGS="${ADIOSLIB_CFLAGS} ${DT_CFLAGS}"
     ADIOSLIB_LDFLAGS="${ADIOSLIB_LDFLAGS} ${DT_LDFLAGS}"
     ADIOSLIB_LDADD="${ADIOSLIB_LDADD} ${DT_LIBS}"
+    ADIOSREADLIB_CPPFLAGS="${ADIOSREADLIB_CPPFLAGS} ${DT_CPPFLAGS}"
+    ADIOSREADLIB_CFLAGS="${ADIOSREADLIB_CFLAGS} ${DT_CFLAGS}"
+    ADIOSREADLIB_LDFLAGS="${ADIOSREADLIB_LDFLAGS} ${DT_LDFLAGS}"
+    ADIOSREADLIB_LDADD="${ADIOSREADLIB_LDADD} ${DT_LIBS}"
+    ADIOSREADLIB_SEQ_CPPFLAGS="${ADIOSREADLIB_SEQ_CPPFLAGS} ${DT_CPPFLAGS}"
+    ADIOSREADLIB_SEQ_CFLAGS="${ADIOSREADLIB_SEQ_CFLAGS} ${DT_CFLAGS}"
+    ADIOSREADLIB_SEQ_LDFLAGS="${ADIOSREADLIB_SEQ_LDFLAGS} ${DT_LDFLAGS}"
+    ADIOSREADLIB_SEQ_LDADD="${ADIOSREADLIB_SEQ_LDADD} ${DT_LIBS}"
 fi
 if test -z "${HAVE_DART_TRUE}"; then
     ADIOSLIB_CPPFLAGS="${ADIOSLIB_CPPFLAGS} ${DART_CPPFLAGS}"
     ADIOSLIB_CFLAGS="${ADIOSLIB_CFLAGS}"
     ADIOSLIB_LDFLAGS="${ADIOSLIB_LDFLAGS} ${DART_LDFLAGS}"
     ADIOSLIB_LDADD="${ADIOSLIB_LDADD} ${DART_LIBS}"
+    ADIOSLIB_SEQ_CPPFLAGS="${ADIOSLIB_SEQ_CPPFLAGS} ${DART_CPPFLAGS}"
+    ADIOSLIB_SEQ_CFLAGS="${ADIOSLIB_SEQ_CFLAGS}"
+    ADIOSLIB_SEQ_LDFLAGS="${ADIOSLIB_SEQ_LDFLAGS} ${DART_LDFLAGS}"
+    ADIOSLIB_SEQ_LDADD="${ADIOSLIB_SEQ_LDADD} ${DART_LIBS}"
     ADIOSREADLIB_CPPFLAGS="${ADIOSREADLIB_CPPFLAGS} ${DART_CPPFLAGS}"
     ADIOSREADLIB_CFLAGS="${ADIOSREADLIB_CFLAGS} ${DART_CFLAGS}"
     ADIOSREADLIB_LDFLAGS="${ADIOSREADLIB_LDFLAGS} ${DART_LDFLAGS}"
@@ -31088,6 +31182,10 @@ if test -z "${HAVE_DIMES_TRUE}"; then
     ADIOSLIB_CFLAGS="${ADIOSLIB_CFLAGS}"
     ADIOSLIB_LDFLAGS="${ADIOSLIB_LDFLAGS} ${DIMES_LDFLAGS}"
     ADIOSLIB_LDADD="${ADIOSLIB_LDADD} ${DIMES_LIBS}"
+    ADIOSLIB_SEQ_CPPFLAGS="${ADIOSLIB_SEQ_CPPFLAGS} ${DIMES_CPPFLAGS}"
+    ADIOSLIB_SEQ_CFLAGS="${ADIOSLIB_SEQ_CFLAGS}"
+    ADIOSLIB_SEQ_LDFLAGS="${ADIOSLIB_SEQ_LDFLAGS} ${DIMES_LDFLAGS}"
+    ADIOSLIB_SEQ_LDADD="${ADIOSLIB_SEQ_LDADD} ${DIMES_LIBS}"
     ADIOSREADLIB_CPPFLAGS="${ADIOSREADLIB_CPPFLAGS} ${DIMES_CPPFLAGS}"
     ADIOSREADLIB_CFLAGS="${ADIOSREADLIB_CFLAGS} ${DIMES_CFLAGS}"
     ADIOSREADLIB_LDFLAGS="${ADIOSREADLIB_LDFLAGS} ${DIMES_LDFLAGS}"
@@ -31102,6 +31200,14 @@ if test -z "${HAVE_NSSI_TRUE}"; then
     ADIOSLIB_CFLAGS="${ADIOSLIB_CFLAGS} ${NSSI_CFLAGS}"
     ADIOSLIB_LDFLAGS="${ADIOSLIB_LDFLAGS} ${NSSI_LDFLAGS}"
     ADIOSLIB_LDADD="${ADIOSLIB_LDADD} ${NSSI_LIBS}"
+    ADIOSREADLIB_CPPFLAGS="${ADIOSREADLIB_CPPFLAGS} ${MXML_CPPFLAGS} ${NSSI_CPPFLAGS}"
+    ADIOSREADLIB_CFLAGS="${ADIOSREADLIB_CFLAGS} ${MXML_CPPFLAGS} ${NSSI_CFLAGS}"
+    ADIOSREADLIB_LDFLAGS="${ADIOSREADLIB_LDFLAGS} ${MXML_LDFLAGS} ${NSSI_LDFLAGS}"
+    ADIOSREADLIB_LDADD="${ADIOSREADLIB_LDADD} ${MXML_LIBS} ${NSSI_LIBS}"
+    ADIOSREADLIB_SEQ_CPPFLAGS="${ADIOSREADLIB_SEQ_CPPFLAGS} ${MXML_CPPFLAGS} ${NSSI_CPPFLAGS}"
+    ADIOSREADLIB_SEQ_CFLAGS="${ADIOSREADLIB_SEQ_CFLAGS} ${MXML_CPPFLAGS} ${NSSI_CFLAGS}"
+    ADIOSREADLIB_SEQ_LDFLAGS="${ADIOSREADLIB_SEQ_LDFLAGS} ${MXML_LDFLAGS} ${NSSI_LDFLAGS}"
+    ADIOSREADLIB_SEQ_LDADD="${ADIOSREADLIB_SEQ_LDADD} ${MXML_LIBS} ${NSSI_LIBS}"
 fi
 if test -z "${HAVE_NC4PAR_TRUE}"; then
     ADIOSLIB_CPPFLAGS="${ADIOSLIB_CPPFLAGS} ${NC4PAR_CPPFLAGS}"
@@ -31120,24 +31226,32 @@ if test -z "${HAVE_PORTALS_TRUE}"; then
     ADIOSLIB_CFLAGS="${ADIOSLIB_CFLAGS} ${PORTALS_CFLAGS}"
     ADIOSLIB_LDFLAGS="${ADIOSLIB_LDFLAGS} ${PORTALS_LDFLAGS}"
     ADIOSLIB_LDADD="${ADIOSLIB_LDADD} ${PORTALS_LIBS}"
+    ADIOSLIB_SEQ_CPPFLAGS="${ADIOSLIB_SEQ_CPPFLAGS} ${PORTALS_CPPFLAGS}"
+    ADIOSLIB_SEQ_CFLAGS="${ADIOSLIB_SEQ_CFLAGS} ${PORTALS_CFLAGS}"
+    ADIOSLIB_SEQ_LDFLAGS="${ADIOSLIB_SEQ_LDFLAGS} ${PORTALS_LDFLAGS}"
+    ADIOSLIB_SEQ_LDADD="${ADIOSLIB_SEQ_LDADD} ${PORTALS_LIBS}"
 fi
 if test -z "${HAVE_INFINIBAND_TRUE}"; then
     ADIOSLIB_CPPFLAGS="${ADIOSLIB_CPPFLAGS} ${INFINIBAND_CPPFLAGS}"
     ADIOSLIB_CFLAGS="${ADIOSLIB_CFLAGS} ${INFINIBAND_CFLAGS}"
     ADIOSLIB_LDFLAGS="${ADIOSLIB_LDFLAGS} ${INFINIBAND_LDFLAGS}"
     ADIOSLIB_LDADD="${ADIOSLIB_LDADD} ${INFINIBAND_LIBS}"
+    ADIOSLIB_SEQ_CPPFLAGS="${ADIOSLIB_SEQ_CPPFLAGS} ${INFINIBAND_CPPFLAGS}"
+    ADIOSLIB_SEQ_CFLAGS="${ADIOSLIB_SEQ_CFLAGS} ${INFINIBAND_CFLAGS}"
+    ADIOSLIB_SEQ_LDFLAGS="${ADIOSLIB_SEQ_LDFLAGS} ${INFINIBAND_LDFLAGS}"
+    ADIOSLIB_SEQ_LDADD="${ADIOSLIB_SEQ_LDADD} ${INFINIBAND_LIBS}"
 fi
 if test -z "${HAVE_NETCDF_TRUE}"; then
-    ADIOSLIB_SEQ_CPPFLAGS="${ADIOSLIB_SEQ_CPPFLAGS} ${NETCDF_CPPFLAGS}"
-    ADIOSLIB_SEQ_CFLAGS="${ADIOSLIB_SEQ_CFLAGS} ${NETCDF_CFLAGS}"
-    ADIOSLIB_SEQ_LDFLAGS="${ADIOSLIB_SEQ_LDFLAGS} ${NETCDF_LDFLAGS}"
-    ADIOSLIB_SEQ_LDADD="${ADIOSLIB_SEQ_LDADD} ${NETCDF_LIBS}"
+    ADIOSLIB_INT_CPPFLAGS="${ADIOSLIB_INT_CPPFLAGS} ${NETCDF_CPPFLAGS}"
+    ADIOSLIB_INT_CFLAGS="${ADIOSLIB_INT_CFLAGS} ${NETCDF_CFLAGS}"
+    ADIOSLIB_INT_LDFLAGS="${ADIOSLIB_INT_LDFLAGS} ${NETCDF_LDFLAGS}"
+    ADIOSLIB_INT_LDADD="${ADIOSLIB_INT_LDADD} ${NETCDF_LIBS}"
 fi
 if test -z "${HAVE_HDF5_TRUE}"; then
-    ADIOSLIB_SEQ_CPPFLAGS="${ADIOSLIB_SEQ_CPPFLAGS} ${HDF5_CPPFLAGS}"
-    ADIOSLIB_SEQ_CFLAGS="${ADIOSLIB_SEQ_CFLAGS} ${HDF5_CFLAGS}"
-    ADIOSLIB_SEQ_LDFLAGS="${ADIOSLIB_SEQ_LDFLAGS} ${HDF5_LDFLAGS}"
-    ADIOSLIB_SEQ_LDADD="${ADIOSLIB_SEQ_LDADD} ${HDF5_LIBS}"
+    ADIOSLIB_INT_CPPFLAGS="${ADIOSLIB_INT_CPPFLAGS} ${HDF5_CPPFLAGS}"
+    ADIOSLIB_INT_CFLAGS="${ADIOSLIB_INT_CFLAGS} ${HDF5_CFLAGS}"
+    ADIOSLIB_INT_LDFLAGS="${ADIOSLIB_INT_LDFLAGS} ${HDF5_LDFLAGS}"
+    ADIOSLIB_INT_LDADD="${ADIOSLIB_INT_LDADD} ${HDF5_LIBS}"
 fi
 if test -z "${HAVE_DMALLOC_TRUE}"; then
     ADIOSLIB_CPPFLAGS="${ADIOSLIB_CPPFLAGS} -DDMALLOC ${DMALLOC_CPPFLAGS}"
@@ -31148,6 +31262,10 @@ if test -z "${HAVE_DMALLOC_TRUE}"; then
     ADIOSLIB_SEQ_CFLAGS="${ADIOSLIB_SEQ_CFLAGS} ${DMALLOC_CFLAGS}"
     ADIOSLIB_SEQ_LDFLAGS="${ADIOSLIB_SEQ_LDFLAGS} ${DMALLOC_LDFLAGS}"
     ADIOSLIB_SEQ_LDADD="${ADIOSLIB_SEQ_LDADD} ${DMALLOC_LIBS}"
+    ADIOSLIB_INT_CPPFLAGS="${ADIOSLIB_INT_CPPFLAGS} ${DMALLOC_CPPFLAGS}"
+    ADIOSLIB_INT_CFLAGS="${ADIOSLIB_INT_CFLAGS} ${DMALLOC_CFLAGS}"
+    ADIOSLIB_INT_LDFLAGS="${ADIOSLIB_INT_LDFLAGS} ${DMALLOC_LDFLAGS}"
+    ADIOSLIB_INT_LDADD="${ADIOSLIB_INT_LDADD} ${DMALLOC_LIBS}"
     ADIOSREADLIB_CPPFLAGS="${ADIOSREADLIB_CPPFLAGS} ${DMALLOC_CPPFLAGS}"
     ADIOSREADLIB_CFLAGS="${ADIOSREADLIB_CFLAGS} ${DMALLOC_CFLAGS}"
     ADIOSREADLIB_LDFLAGS="${ADIOSREADLIB_LDFLAGS} ${DMALLOC_LDFLAGS}"
@@ -31157,6 +31275,20 @@ if test -z "${HAVE_DMALLOC_TRUE}"; then
     ADIOSREADLIB_SEQ_LDFLAGS="${ADIOSREADLIB_SEQ_LDFLAGS} ${DMALLOC_LDFLAGS}"
     ADIOSREADLIB_SEQ_LDADD="${ADIOSREADLIB_SEQ_LDADD} ${DMALLOC_LIBS}"
 fi
+if test -z "${HAVE_LUSTRE_TRUE}"; then
+    ADIOSLIB_CPPFLAGS="${ADIOSLIB_CPPFLAGS} ${LUSTRE_CPPFLAGS}"
+    ADIOSLIB_CFLAGS="${ADIOSLIB_CFLAGS} ${LUSTRE_CFLAGS}"
+    ADIOSLIB_LDFLAGS="${ADIOSLIB_LDFLAGS} ${LUSTRE_LDFLAGS}"
+    ADIOSLIB_LDADD="${ADIOSLIB_LDADD} ${LUSTRE_LIBS}"
+    ADIOSLIB_SEQ_CPPFLAGS="${ADIOSLIB_SEQ_CPPFLAGS} ${LUSTRE_CPPFLAGS}"
+    ADIOSLIB_SEQ_CFLAGS="${ADIOSLIB_SEQ_CFLAGS} ${LUSTRE_CFLAGS}"
+    ADIOSLIB_SEQ_LDFLAGS="${ADIOSLIB_SEQ_LDFLAGS} ${LUSTRE_LDFLAGS}"
+    ADIOSLIB_SEQ_LDADD="${ADIOSLIB_SEQ_LDADD} ${LUSTRE_LIBS}"
+fi
+
+
+
+
 
 
 
@@ -31184,7 +31316,7 @@ _ACEOF
         echo "#### Defined USE_PARALLEL_COMPILER to = [${USE_PARALLEL_COMPILER}]"
 fi
 
-                                                                                                                                                                                                                                                                                                                                                    ac_config_files="$ac_config_files Makefile src/Makefile tests/Makefile tests/C/Makefile tests/Fortran/Makefile tests/genarray/Makefile tests/bp_read/Mak [...]
+                                                                                                                                                                                                                                                                                                                                                              ac_config_files="$ac_config_files Makefile src/Makefile tests/Makefile tests/C/Makefile tests/Fortran/Makefile tests/genarray/Makefile tests/b [...]
 
 
 cat >confcache <<\_ACEOF
@@ -31656,6 +31788,20 @@ echo "$as_me: error: conditional \"HAVE_DMALLOC\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
+if test -z "${HAVE_LUSTRE_TRUE}" && test -z "${HAVE_LUSTRE_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"HAVE_LUSTRE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"HAVE_LUSTRE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${HAVE_LUSTRE_TRUE}" && test -z "${HAVE_LUSTRE_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"HAVE_LUSTRE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"HAVE_LUSTRE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
 if test -z "${RESEARCH_TRANSPORTS_TRUE}" && test -z "${RESEARCH_TRANSPORTS_FALSE}"; then
   { { echo "$as_me:$LINENO: error: conditional \"RESEARCH_TRANSPORTS\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
@@ -32174,6 +32320,7 @@ do
   "utils/bp2ascii/Makefile" ) CONFIG_FILES="$CONFIG_FILES utils/bp2ascii/Makefile" ;;
   "utils/bpsplit/Makefile" ) CONFIG_FILES="$CONFIG_FILES utils/bpsplit/Makefile" ;;
   "utils/bpls/Makefile" ) CONFIG_FILES="$CONFIG_FILES utils/bpls/Makefile" ;;
+  "utils/bp2bp/Makefile" ) CONFIG_FILES="$CONFIG_FILES utils/bp2bp/Makefile" ;;
   "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
   "examples/C/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/C/Makefile" ;;
   "examples/C/scalars/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/C/scalars/Makefile" ;;
@@ -32430,6 +32577,11 @@ s, at HAVE_DMALLOC_FALSE@,$HAVE_DMALLOC_FALSE,;t t
 s, at DMALLOC_LIBS@,$DMALLOC_LIBS,;t t
 s, at DMALLOC_LDFLAGS@,$DMALLOC_LDFLAGS,;t t
 s, at DMALLOC_CPPFLAGS@,$DMALLOC_CPPFLAGS,;t t
+s, at HAVE_LUSTRE_TRUE@,$HAVE_LUSTRE_TRUE,;t t
+s, at HAVE_LUSTRE_FALSE@,$HAVE_LUSTRE_FALSE,;t t
+s, at LUSTRE_LIBS@,$LUSTRE_LIBS,;t t
+s, at LUSTRE_LDFLAGS@,$LUSTRE_LDFLAGS,;t t
+s, at LUSTRE_CPPFLAGS@,$LUSTRE_CPPFLAGS,;t t
 s, at CSH@,$CSH,;t t
 s, at PATHPROG@,$PATHPROG,;t t
 s, at DT_LIBS@,$DT_LIBS,;t t
@@ -32451,6 +32603,10 @@ s, at ADIOSLIB_SEQ_CPPFLAGS@,$ADIOSLIB_SEQ_CPPFLAGS,;t t
 s, at ADIOSLIB_SEQ_CFLAGS@,$ADIOSLIB_SEQ_CFLAGS,;t t
 s, at ADIOSLIB_SEQ_LDFLAGS@,$ADIOSLIB_SEQ_LDFLAGS,;t t
 s, at ADIOSLIB_SEQ_LDADD@,$ADIOSLIB_SEQ_LDADD,;t t
+s, at ADIOSLIB_INT_CPPFLAGS@,$ADIOSLIB_INT_CPPFLAGS,;t t
+s, at ADIOSLIB_INT_CFLAGS@,$ADIOSLIB_INT_CFLAGS,;t t
+s, at ADIOSLIB_INT_LDFLAGS@,$ADIOSLIB_INT_LDFLAGS,;t t
+s, at ADIOSLIB_INT_LDADD@,$ADIOSLIB_INT_LDADD,;t t
 s, at ADIOSREADLIB_CPPFLAGS@,$ADIOSREADLIB_CPPFLAGS,;t t
 s, at ADIOSREADLIB_CFLAGS@,$ADIOSREADLIB_CFLAGS,;t t
 s, at ADIOSREADLIB_LDFLAGS@,$ADIOSREADLIB_LDFLAGS,;t t
@@ -33178,13 +33334,20 @@ if test "$no_create" != yes; then
 fi
 
 
+# Get the version of the source we are configuring here
+# Just to print it out at the end of configure
+# see also Makefile.am:install-data-hook
+if type svnversion &>/dev/null; then
+    SVNVERSION=`svnversion`
+else
+    SVNVERSION="unknown"
+fi
+
 echo
 echo "*********************************"
 echo $PACKAGE configured as follows:
 echo "*********************************"
 echo
-
-echo
 echo "  - General Compile FLAGS";
 echo "      - CC  = $CC";
 echo "      - CXX = $CXX";
@@ -33203,130 +33366,144 @@ echo "      - MPILIBS = $MPILIBS";
 echo
 
 if test "x$enable_research_transports" == "xyes"; then
-        echo "  - Research Transports Included";
+    echo "  - Research Transports Included";
 
 else
-        echo "  - No research transport methods";
+    echo "  - No research transport methods";
 fi
 
 if test -z "${HAVE_MXML_TRUE}"; then
-        echo "  - MXML";
-        echo "      - MXML_CFLAGS = $MXML_CFLAGS";
-        echo "      - MXML_CPPFLAGS = $MXML_CPPFLAGS";
-        echo "      - MXML_LDFLAGS = $MXML_LDFLAGS";
-        echo "      - MXML_LIBS = $MXML_LIBS";
+    echo "  - MXML";
+    echo "      - MXML_CFLAGS = $MXML_CFLAGS";
+    echo "      - MXML_CPPFLAGS = $MXML_CPPFLAGS";
+    echo "      - MXML_LDFLAGS = $MXML_LDFLAGS";
+    echo "      - MXML_LIBS = $MXML_LIBS";
+    echo
+else
+    echo "  - No MXML"
+fi
+
+if test -z "${HAVE_LUSTRE_TRUE}"; then
+        echo "  - LUSTRE";
+        echo "      - LUSTRE_CFLAGS = $LUSTRE_CFLAGS";
+        echo "      - LUSTRE_CPPFLAGS = $LUSTRE_CPPFLAGS";
+        echo "      - LUSTRE_LDFLAGS = $LUSTRE_LDFLAGS";
+        echo "      - LUSTRE_LIBS = $LUSTRE_LIBS";
         echo
 else
-        echo "  - No MXML"
+        echo "  - No LUSTRE"
 fi
 
 if test -z "${HAVE_PORTALS_TRUE}"; then
-        echo "  - PORTALS";
-        echo "      - PORTALS_CFLAGS = $PORTALS_CFLAGS";
-        echo "      - PORTALS_CPPFLAGS = $PORTALS_CPPFLAGS";
-        echo "      - PORTALS_LDFLAGS = $PORTALS_LDFLAGS";
-        echo "      - PORTALS_LIBS = $PORTALS_LIBS";
-        echo
+    echo "  - PORTALS";
+    echo "      - PORTALS_CFLAGS = $PORTALS_CFLAGS";
+    echo "      - PORTALS_CPPFLAGS = $PORTALS_CPPFLAGS";
+    echo "      - PORTALS_LDFLAGS = $PORTALS_LDFLAGS";
+    echo "      - PORTALS_LIBS = $PORTALS_LIBS";
+    echo
 else
-	echo "  - No Portals"
+    echo "  - No Portals"
 fi
 
 if test -z "${HAVE_INFINIBAND_TRUE}"; then
-        echo "  - INFINIBAND";
-        echo "      - INFINIBAND_CFLAGS = $INFINIBAND_CFLAGS";
-        echo "      - INFINIBAND_CPPFLAGS = $INFINIBAND_CPPFLAGS";
-        echo "      - INFINIBAND_LDFLAGS = $INFINIBAND_LDFLAGS";
-        echo "      - INFINIBAND_LIBS = $INFINIBAND_LIBS";
-        echo
+    echo "  - INFINIBAND";
+    echo "      - INFINIBAND_CFLAGS = $INFINIBAND_CFLAGS";
+    echo "      - INFINIBAND_CPPFLAGS = $INFINIBAND_CPPFLAGS";
+    echo "      - INFINIBAND_LDFLAGS = $INFINIBAND_LDFLAGS";
+    echo "      - INFINIBAND_LIBS = $INFINIBAND_LIBS";
+    echo
 else
-	echo "  - No InfiniBand"
+    echo "  - No InfiniBand"
 fi
 
 
 if test "x${datatap}" != "xdisable"; then
-        echo "  - DataTap with interconnect: $datatap";
-	echo "	   - DT_CFLAGS     = $DT_CFLAGS";
-	echo "	   - DT_CPPFLAGS   = $DT_CPPFLAGS";
-	echo "	   - DT_LDFLAGS    = $DT_LDFLAGS";
-	echo "	   - DT_LIBS       = $DT_LIBS";
-        echo
+    echo "  - DataTap with interconnect: $datatap";
+    echo "      - DT_CFLAGS     = $DT_CFLAGS";
+    echo "      - DT_CPPFLAGS   = $DT_CPPFLAGS";
+    echo "      - DT_LDFLAGS    = $DT_LDFLAGS";
+    echo "      - DT_LIBS       = $DT_LIBS";
+    echo
 else
-        echo "  - No DataTap transport";
+    echo "  - No DataTap transport";
 fi
 
 if test -z "${HAVE_DART_TRUE}"; then
-        echo "  - DART transport method";
-        echo "      - DART_CFLAGS = $DART_CFLAGS";
-        echo "      - DART_CPPFLAGS = $DART_CPPFLAGS";
-        echo "      - DART_LDFLAGS = $DART_LDFLAGS";
-        echo "      - DART_LIBS = $DART_LIBS";
-        echo
+    echo "  - DART transport method";
+    echo "      - DART_CFLAGS = $DART_CFLAGS";
+    echo "      - DART_CPPFLAGS = $DART_CPPFLAGS";
+    echo "      - DART_LDFLAGS = $DART_LDFLAGS";
+    echo "      - DART_LIBS = $DART_LIBS";
+    echo
 else
-	echo "  - No DART to build DART transport method"
+    echo "  - No DART to build DART transport method"
 fi
 
 if test -z "${HAVE_DIMES_TRUE}"; then
-        echo "  - DIMES transport method";
-        echo "      - DIMES_CFLAGS = $DIMES_CFLAGS";
-        echo "      - DIMES_CPPFLAGS = $DIMES_CPPFLAGS";
-        echo "      - DIMES_LDFLAGS = $DIMES_LDFLAGS";
-        echo "      - DIMES_LIBS = $DIMES_LIBS";
-        echo
+    echo "  - DIMES transport method";
+    echo "      - DIMES_CFLAGS = $DIMES_CFLAGS";
+    echo "      - DIMES_CPPFLAGS = $DIMES_CPPFLAGS";
+    echo "      - DIMES_LDFLAGS = $DIMES_LDFLAGS";
+    echo "      - DIMES_LIBS = $DIMES_LIBS";
+    echo
 else
-        echo "  - No DIMES to build DIMES transport method"
+    echo "  - No DIMES to build DIMES transport method"
 fi
 
 if test -z "${HAVE_PHDF5_TRUE}"; then
-        echo "  - PHDF5";
-        echo "      - PHDF5_CFLAGS = $PHDF5_CFLAGS";
-        echo "      - PHDF5_CPPFLAGS = $PHDF5_CPPFLAGS";
-        echo "      - PHDF5_LDFLAGS = $PHDF5_LDFLAGS";
-        echo "      - PHDF5_LIBS = $PHDF5_LIBS";
-        echo
+    echo "  - PHDF5";
+    echo "      - PHDF5_CFLAGS = $PHDF5_CFLAGS";
+    echo "      - PHDF5_CPPFLAGS = $PHDF5_CPPFLAGS";
+    echo "      - PHDF5_LDFLAGS = $PHDF5_LDFLAGS";
+    echo "      - PHDF5_LIBS = $PHDF5_LIBS";
+    echo
 else
-	echo "  - No PHDF5"
+    echo "  - No PHDF5"
 fi
 
 if test -z "${HAVE_HDF5_TRUE}"; then
-        echo "  - HDF5";
-        echo "      - HDF5_CFLAGS = $HDF5_CFLAGS";
-        echo "      - HDF5_CPPFLAGS = $HDF5_CPPFLAGS";
-        echo "      - HDF5_LDFLAGS = $HDF5_LDFLAGS";
-        echo "      - HDF5_LIBS = $HDF5_LIBS";
-        echo
+    echo "  - HDF5";
+    echo "      - HDF5_CFLAGS = $HDF5_CFLAGS";
+    echo "      - HDF5_CPPFLAGS = $HDF5_CPPFLAGS";
+    echo "      - HDF5_LDFLAGS = $HDF5_LDFLAGS";
+    echo "      - HDF5_LIBS = $HDF5_LIBS";
+    echo
 else
-	echo "  - No HDF5"
+    echo "  - No HDF5"
 fi
 
 if test -z "${HAVE_NC4PAR_TRUE}"; then
-        echo "  - NetCDF 4 Parallel";
-        echo "      - NC4PAR_CFLAGS = $NC4PAR_CFLAGS";
-        echo "      - NC4PAR_CPPFLAGS = $NC4PAR_CPPFLAGS";
-        echo "      - NC4PAR_LDFLAGS = $NC4PAR_LDFLAGS";
-        echo "      - NC4PAR_LIBS = $NC4PAR_LIBS";
-        echo
+    echo "  - NetCDF 4 Parallel";
+    echo "      - NC4PAR_CFLAGS = $NC4PAR_CFLAGS";
+    echo "      - NC4PAR_CPPFLAGS = $NC4PAR_CPPFLAGS";
+    echo "      - NC4PAR_LDFLAGS = $NC4PAR_LDFLAGS";
+    echo "      - NC4PAR_LIBS = $NC4PAR_LIBS";
+    echo
 else
-	echo "  - No NETCDF 4 Parallel"
+    echo "  - No NETCDF 4 Parallel"
 fi
 
 if test -z "${HAVE_NETCDF_TRUE}"; then
-        echo "  - NetCDF";
-        echo "      - NETCDF_CFLAGS = $NETCDF_CFLAGS";
-        echo "      - NETCDF_CPPFLAGS = $NETCDF_CPPFLAGS";
-        echo "      - NETCDF_LDFLAGS = $NETCDF_LDFLAGS";
-        echo "      - NETCDF_LIBS = $NETCDF_LIBS";
-        echo
+    echo "  - NetCDF";
+    echo "      - NETCDF_CFLAGS = $NETCDF_CFLAGS";
+    echo "      - NETCDF_CPPFLAGS = $NETCDF_CPPFLAGS";
+    echo "      - NETCDF_LDFLAGS = $NETCDF_LDFLAGS";
+    echo "      - NETCDF_LIBS = $NETCDF_LIBS";
+    echo
 else
-	echo "  - No NETCDF"
+    echo "  - No NETCDF"
 fi
 
 if test -z "${HAVE_NSSI_TRUE}"; then
-        echo "  - NSSI";
-        echo "      - NSSI_CFLAGS = $NSSI_CFLAGS";
-        echo "      - NSSI_CPPFLAGS = $NSSI_CPPFLAGS";
-        echo "      - NSSI_LDFLAGS = $NSSI_LDFLAGS";
-        echo "      - NSSI_LIBS = $NSSI_LIBS";
-        echo
+    echo "  - NSSI";
+    echo "      - NSSI_CFLAGS = $NSSI_CFLAGS";
+    echo "      - NSSI_CPPFLAGS = $NSSI_CPPFLAGS";
+    echo "      - NSSI_LDFLAGS = $NSSI_LDFLAGS";
+    echo "      - NSSI_LIBS = $NSSI_LIBS";
+    echo
 else
-	echo "  - No NSSI"
+    echo "  - No NSSI"
 fi
+
+echo "  - SVN version = ${SVNVERSION}"
+echo "  - Install path = ${prefix}"
diff --git a/configure.ac b/configure.ac
index 0023a4d..f1d4d63 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ AC_CONFIG_AUX_DIR(config)
 AC_REVISION($Revision$)
 
 AC_CONFIG_HEADERS(config.h)
-AM_INIT_AUTOMAKE(adios,1.2.1)
+AM_INIT_AUTOMAKE(adios,1.3)
 
 AC_LANG(C)
 AC_C_STRINGIZE
@@ -20,7 +20,7 @@ ACX_MPI([], [AC_MSG_ERROR([couldn't find mpi library for C])])
 AC_LANG(C++)
 ACX_MPI([], [AC_MSG_ERROR([couldn't find mpi library for C++])])
 
-AC_ARG_ENABLE(fortran, 
+AC_ARG_ENABLE(fortran,
     [AS_HELP_STRING([--disable-fortran],[disable Fortran test programs in ADIOS.])])
 AM_CONDITIONAL([BUILD_FORTRAN], [test "x$enable_fortran" != "xno"])
 
@@ -66,13 +66,14 @@ AC_NSSI
 AC_PROG_DART
 AC_PROG_DIMES
 AC_DMALLOC
+AC_LUSTRE
 AC_DATATAP
 
 AC_LANG(C)
 
 
-AC_ARG_ENABLE(research-transports, 
-    [AS_HELP_STRING([--enable-research-transports], 
+AC_ARG_ENABLE(research-transports,
+    [AS_HELP_STRING([--enable-research-transports],
         [Enable building the various research transports. Default is not to build these as they are not part of the base distribution.])])
 AM_CONDITIONAL([RESEARCH_TRANSPORTS], [test "x$enable_research_transports" == "xyes"])
 
@@ -80,7 +81,7 @@ AC_LANG(C)
 
 AM_CONDITIONAL([HAVE_DATATAP], [test x$datatap != xdisable])
 
-AC_ARG_ENABLE(write, 
+AC_ARG_ENABLE(write,
     [AS_HELP_STRING([--disable-write],[disable building the write methods in ADIOS. Must be used on MacOSX])])
 AM_CONDITIONAL([BUILD_WRITE], [test "x$enable_write" != "xno"])
 
@@ -119,8 +120,10 @@ fi
 
 dnl Generate flags for adios lib creation which depends on the packages we found
 dnl ADIOSLIB_* for compiling libadios.a and libadiosf.a, and linking codes with those
-dnl ADIOSLIB_SEQ_* for codes using libadios_internal_nompi.a (like bp2ncd, bp2h5, bpdump etc)
-dnl ADIOSREADLIB_* for codes using libadiosread.a, libadiosreadf.a, libadiosread_nompi.a 
+dnl ADIOSLIB_SEQ_* for compiling libadios_nompi.a and libadiosf_nompi.a with dummy MPI
+dnl ADIOSLIB_INT_* for codes using libadios_internal_nompi.a (like bp2ncd, bp2h5, bpdump etc)
+dnl ADIOSREADLIB_* for codes using libadiosread.a, libadiosreadf.a
+dnl ADIOSREADLIB_SEQ_* for codes using libadiosread_nompi.a
 dnl adios_config will contain flags for users' code linking based on these flags
 dnl EXTRA flags are used for compiling adios stuff, which need not go into adios_config for user codes
 ADIOSLIB_EXTRA_CPPFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_GNU_SOURCE"
@@ -132,7 +135,11 @@ ADIOSLIB_SEQ_CPPFLAGS="-D_NOMPI ${MXML_CPPFLAGS}"
 ADIOSLIB_SEQ_CFLAGS=
 ADIOSLIB_SEQ_LDFLAGS="${MXML_LDFLAGS}"
 ADIOSLIB_SEQ_LDADD="-lm ${MXML_LIBS}"
-ADIOSREADLIB_CPPFLAGS=""
+ADIOSLIB_INT_CPPFLAGS="-D_NOMPI ${MXML_CPPFLAGS}"
+ADIOSLIB_INT_CFLAGS=
+ADIOSLIB_INT_LDFLAGS="${MXML_LDFLAGS}"
+ADIOSLIB_INT_LDADD="-lm ${MXML_LIBS}"
+ADIOSREADLIB_CPPFLAGS=
 ADIOSREADLIB_CFLAGS=
 ADIOSREADLIB_LDFLAGS=
 ADIOSREADLIB_LDADD="-lm"
@@ -145,12 +152,24 @@ if test "x${datatap}" != "xdisable"; then
     ADIOSLIB_CFLAGS="${ADIOSLIB_CFLAGS} ${DT_CFLAGS}"
     ADIOSLIB_LDFLAGS="${ADIOSLIB_LDFLAGS} ${DT_LDFLAGS}"
     ADIOSLIB_LDADD="${ADIOSLIB_LDADD} ${DT_LIBS}"
+    ADIOSREADLIB_CPPFLAGS="${ADIOSREADLIB_CPPFLAGS} ${DT_CPPFLAGS}"
+    ADIOSREADLIB_CFLAGS="${ADIOSREADLIB_CFLAGS} ${DT_CFLAGS}"
+    ADIOSREADLIB_LDFLAGS="${ADIOSREADLIB_LDFLAGS} ${DT_LDFLAGS}"
+    ADIOSREADLIB_LDADD="${ADIOSREADLIB_LDADD} ${DT_LIBS}"
+    ADIOSREADLIB_SEQ_CPPFLAGS="${ADIOSREADLIB_SEQ_CPPFLAGS} ${DT_CPPFLAGS}"
+    ADIOSREADLIB_SEQ_CFLAGS="${ADIOSREADLIB_SEQ_CFLAGS} ${DT_CFLAGS}"
+    ADIOSREADLIB_SEQ_LDFLAGS="${ADIOSREADLIB_SEQ_LDFLAGS} ${DT_LDFLAGS}"
+    ADIOSREADLIB_SEQ_LDADD="${ADIOSREADLIB_SEQ_LDADD} ${DT_LIBS}"
 fi
 if test -z "${HAVE_DART_TRUE}"; then
     ADIOSLIB_CPPFLAGS="${ADIOSLIB_CPPFLAGS} ${DART_CPPFLAGS}"
     ADIOSLIB_CFLAGS="${ADIOSLIB_CFLAGS}"
     ADIOSLIB_LDFLAGS="${ADIOSLIB_LDFLAGS} ${DART_LDFLAGS}"
     ADIOSLIB_LDADD="${ADIOSLIB_LDADD} ${DART_LIBS}"
+    ADIOSLIB_SEQ_CPPFLAGS="${ADIOSLIB_SEQ_CPPFLAGS} ${DART_CPPFLAGS}"
+    ADIOSLIB_SEQ_CFLAGS="${ADIOSLIB_SEQ_CFLAGS}"
+    ADIOSLIB_SEQ_LDFLAGS="${ADIOSLIB_SEQ_LDFLAGS} ${DART_LDFLAGS}"
+    ADIOSLIB_SEQ_LDADD="${ADIOSLIB_SEQ_LDADD} ${DART_LIBS}"
     ADIOSREADLIB_CPPFLAGS="${ADIOSREADLIB_CPPFLAGS} ${DART_CPPFLAGS}"
     ADIOSREADLIB_CFLAGS="${ADIOSREADLIB_CFLAGS} ${DART_CFLAGS}"
     ADIOSREADLIB_LDFLAGS="${ADIOSREADLIB_LDFLAGS} ${DART_LDFLAGS}"
@@ -165,6 +184,10 @@ if test -z "${HAVE_DIMES_TRUE}"; then
     ADIOSLIB_CFLAGS="${ADIOSLIB_CFLAGS}"
     ADIOSLIB_LDFLAGS="${ADIOSLIB_LDFLAGS} ${DIMES_LDFLAGS}"
     ADIOSLIB_LDADD="${ADIOSLIB_LDADD} ${DIMES_LIBS}"
+    ADIOSLIB_SEQ_CPPFLAGS="${ADIOSLIB_SEQ_CPPFLAGS} ${DIMES_CPPFLAGS}"
+    ADIOSLIB_SEQ_CFLAGS="${ADIOSLIB_SEQ_CFLAGS}"
+    ADIOSLIB_SEQ_LDFLAGS="${ADIOSLIB_SEQ_LDFLAGS} ${DIMES_LDFLAGS}"
+    ADIOSLIB_SEQ_LDADD="${ADIOSLIB_SEQ_LDADD} ${DIMES_LIBS}"
     ADIOSREADLIB_CPPFLAGS="${ADIOSREADLIB_CPPFLAGS} ${DIMES_CPPFLAGS}"
     ADIOSREADLIB_CFLAGS="${ADIOSREADLIB_CFLAGS} ${DIMES_CFLAGS}"
     ADIOSREADLIB_LDFLAGS="${ADIOSREADLIB_LDFLAGS} ${DIMES_LDFLAGS}"
@@ -179,6 +202,14 @@ if test -z "${HAVE_NSSI_TRUE}"; then
     ADIOSLIB_CFLAGS="${ADIOSLIB_CFLAGS} ${NSSI_CFLAGS}"
     ADIOSLIB_LDFLAGS="${ADIOSLIB_LDFLAGS} ${NSSI_LDFLAGS}"
     ADIOSLIB_LDADD="${ADIOSLIB_LDADD} ${NSSI_LIBS}"
+    ADIOSREADLIB_CPPFLAGS="${ADIOSREADLIB_CPPFLAGS} ${MXML_CPPFLAGS} ${NSSI_CPPFLAGS}"
+    ADIOSREADLIB_CFLAGS="${ADIOSREADLIB_CFLAGS} ${MXML_CPPFLAGS} ${NSSI_CFLAGS}"
+    ADIOSREADLIB_LDFLAGS="${ADIOSREADLIB_LDFLAGS} ${MXML_LDFLAGS} ${NSSI_LDFLAGS}"
+    ADIOSREADLIB_LDADD="${ADIOSREADLIB_LDADD} ${MXML_LIBS} ${NSSI_LIBS}"
+    ADIOSREADLIB_SEQ_CPPFLAGS="${ADIOSREADLIB_SEQ_CPPFLAGS} ${MXML_CPPFLAGS} ${NSSI_CPPFLAGS}"
+    ADIOSREADLIB_SEQ_CFLAGS="${ADIOSREADLIB_SEQ_CFLAGS} ${MXML_CPPFLAGS} ${NSSI_CFLAGS}"
+    ADIOSREADLIB_SEQ_LDFLAGS="${ADIOSREADLIB_SEQ_LDFLAGS} ${MXML_LDFLAGS} ${NSSI_LDFLAGS}"
+    ADIOSREADLIB_SEQ_LDADD="${ADIOSREADLIB_SEQ_LDADD} ${MXML_LIBS} ${NSSI_LIBS}"
 fi
 if test -z "${HAVE_NC4PAR_TRUE}"; then
     ADIOSLIB_CPPFLAGS="${ADIOSLIB_CPPFLAGS} ${NC4PAR_CPPFLAGS}"
@@ -197,24 +228,32 @@ if test -z "${HAVE_PORTALS_TRUE}"; then
     ADIOSLIB_CFLAGS="${ADIOSLIB_CFLAGS} ${PORTALS_CFLAGS}"
     ADIOSLIB_LDFLAGS="${ADIOSLIB_LDFLAGS} ${PORTALS_LDFLAGS}"
     ADIOSLIB_LDADD="${ADIOSLIB_LDADD} ${PORTALS_LIBS}"
+    ADIOSLIB_SEQ_CPPFLAGS="${ADIOSLIB_SEQ_CPPFLAGS} ${PORTALS_CPPFLAGS}"
+    ADIOSLIB_SEQ_CFLAGS="${ADIOSLIB_SEQ_CFLAGS} ${PORTALS_CFLAGS}"
+    ADIOSLIB_SEQ_LDFLAGS="${ADIOSLIB_SEQ_LDFLAGS} ${PORTALS_LDFLAGS}"
+    ADIOSLIB_SEQ_LDADD="${ADIOSLIB_SEQ_LDADD} ${PORTALS_LIBS}"
 fi
 if test -z "${HAVE_INFINIBAND_TRUE}"; then
     ADIOSLIB_CPPFLAGS="${ADIOSLIB_CPPFLAGS} ${INFINIBAND_CPPFLAGS}"
     ADIOSLIB_CFLAGS="${ADIOSLIB_CFLAGS} ${INFINIBAND_CFLAGS}"
     ADIOSLIB_LDFLAGS="${ADIOSLIB_LDFLAGS} ${INFINIBAND_LDFLAGS}"
     ADIOSLIB_LDADD="${ADIOSLIB_LDADD} ${INFINIBAND_LIBS}"
+    ADIOSLIB_SEQ_CPPFLAGS="${ADIOSLIB_SEQ_CPPFLAGS} ${INFINIBAND_CPPFLAGS}"
+    ADIOSLIB_SEQ_CFLAGS="${ADIOSLIB_SEQ_CFLAGS} ${INFINIBAND_CFLAGS}"
+    ADIOSLIB_SEQ_LDFLAGS="${ADIOSLIB_SEQ_LDFLAGS} ${INFINIBAND_LDFLAGS}"
+    ADIOSLIB_SEQ_LDADD="${ADIOSLIB_SEQ_LDADD} ${INFINIBAND_LIBS}"
 fi
 if test -z "${HAVE_NETCDF_TRUE}"; then
-    ADIOSLIB_SEQ_CPPFLAGS="${ADIOSLIB_SEQ_CPPFLAGS} ${NETCDF_CPPFLAGS}"
-    ADIOSLIB_SEQ_CFLAGS="${ADIOSLIB_SEQ_CFLAGS} ${NETCDF_CFLAGS}"
-    ADIOSLIB_SEQ_LDFLAGS="${ADIOSLIB_SEQ_LDFLAGS} ${NETCDF_LDFLAGS}"
-    ADIOSLIB_SEQ_LDADD="${ADIOSLIB_SEQ_LDADD} ${NETCDF_LIBS}"
+    ADIOSLIB_INT_CPPFLAGS="${ADIOSLIB_INT_CPPFLAGS} ${NETCDF_CPPFLAGS}"
+    ADIOSLIB_INT_CFLAGS="${ADIOSLIB_INT_CFLAGS} ${NETCDF_CFLAGS}"
+    ADIOSLIB_INT_LDFLAGS="${ADIOSLIB_INT_LDFLAGS} ${NETCDF_LDFLAGS}"
+    ADIOSLIB_INT_LDADD="${ADIOSLIB_INT_LDADD} ${NETCDF_LIBS}"
 fi
 if test -z "${HAVE_HDF5_TRUE}"; then
-    ADIOSLIB_SEQ_CPPFLAGS="${ADIOSLIB_SEQ_CPPFLAGS} ${HDF5_CPPFLAGS}"
-    ADIOSLIB_SEQ_CFLAGS="${ADIOSLIB_SEQ_CFLAGS} ${HDF5_CFLAGS}"
-    ADIOSLIB_SEQ_LDFLAGS="${ADIOSLIB_SEQ_LDFLAGS} ${HDF5_LDFLAGS}"
-    ADIOSLIB_SEQ_LDADD="${ADIOSLIB_SEQ_LDADD} ${HDF5_LIBS}"
+    ADIOSLIB_INT_CPPFLAGS="${ADIOSLIB_INT_CPPFLAGS} ${HDF5_CPPFLAGS}"
+    ADIOSLIB_INT_CFLAGS="${ADIOSLIB_INT_CFLAGS} ${HDF5_CFLAGS}"
+    ADIOSLIB_INT_LDFLAGS="${ADIOSLIB_INT_LDFLAGS} ${HDF5_LDFLAGS}"
+    ADIOSLIB_INT_LDADD="${ADIOSLIB_INT_LDADD} ${HDF5_LIBS}"
 fi
 if test -z "${HAVE_DMALLOC_TRUE}"; then
     ADIOSLIB_CPPFLAGS="${ADIOSLIB_CPPFLAGS} -DDMALLOC ${DMALLOC_CPPFLAGS}"
@@ -225,6 +264,10 @@ if test -z "${HAVE_DMALLOC_TRUE}"; then
     ADIOSLIB_SEQ_CFLAGS="${ADIOSLIB_SEQ_CFLAGS} ${DMALLOC_CFLAGS}"
     ADIOSLIB_SEQ_LDFLAGS="${ADIOSLIB_SEQ_LDFLAGS} ${DMALLOC_LDFLAGS}"
     ADIOSLIB_SEQ_LDADD="${ADIOSLIB_SEQ_LDADD} ${DMALLOC_LIBS}"
+    ADIOSLIB_INT_CPPFLAGS="${ADIOSLIB_INT_CPPFLAGS} ${DMALLOC_CPPFLAGS}"
+    ADIOSLIB_INT_CFLAGS="${ADIOSLIB_INT_CFLAGS} ${DMALLOC_CFLAGS}"
+    ADIOSLIB_INT_LDFLAGS="${ADIOSLIB_INT_LDFLAGS} ${DMALLOC_LDFLAGS}"
+    ADIOSLIB_INT_LDADD="${ADIOSLIB_INT_LDADD} ${DMALLOC_LIBS}"
     ADIOSREADLIB_CPPFLAGS="${ADIOSREADLIB_CPPFLAGS} ${DMALLOC_CPPFLAGS}"
     ADIOSREADLIB_CFLAGS="${ADIOSREADLIB_CFLAGS} ${DMALLOC_CFLAGS}"
     ADIOSREADLIB_LDFLAGS="${ADIOSREADLIB_LDFLAGS} ${DMALLOC_LDFLAGS}"
@@ -234,6 +277,16 @@ if test -z "${HAVE_DMALLOC_TRUE}"; then
     ADIOSREADLIB_SEQ_LDFLAGS="${ADIOSREADLIB_SEQ_LDFLAGS} ${DMALLOC_LDFLAGS}"
     ADIOSREADLIB_SEQ_LDADD="${ADIOSREADLIB_SEQ_LDADD} ${DMALLOC_LIBS}"
 fi
+if test -z "${HAVE_LUSTRE_TRUE}"; then
+    ADIOSLIB_CPPFLAGS="${ADIOSLIB_CPPFLAGS} ${LUSTRE_CPPFLAGS}" 
+    ADIOSLIB_CFLAGS="${ADIOSLIB_CFLAGS} ${LUSTRE_CFLAGS}"
+    ADIOSLIB_LDFLAGS="${ADIOSLIB_LDFLAGS} ${LUSTRE_LDFLAGS}"
+    ADIOSLIB_LDADD="${ADIOSLIB_LDADD} ${LUSTRE_LIBS}"
+    ADIOSLIB_SEQ_CPPFLAGS="${ADIOSLIB_SEQ_CPPFLAGS} ${LUSTRE_CPPFLAGS}"
+    ADIOSLIB_SEQ_CFLAGS="${ADIOSLIB_SEQ_CFLAGS} ${LUSTRE_CFLAGS}"
+    ADIOSLIB_SEQ_LDFLAGS="${ADIOSLIB_SEQ_LDFLAGS} ${LUSTRE_LDFLAGS}"
+    ADIOSLIB_SEQ_LDADD="${ADIOSLIB_SEQ_LDADD} ${LUSTRE_LIBS}"
+fi
 AC_SUBST(ADIOSLIB_CPPFLAGS)
 AC_SUBST(ADIOSLIB_CFLAGS)
 AC_SUBST(ADIOSLIB_LDFLAGS)
@@ -242,6 +295,10 @@ AC_SUBST(ADIOSLIB_SEQ_CPPFLAGS)
 AC_SUBST(ADIOSLIB_SEQ_CFLAGS)
 AC_SUBST(ADIOSLIB_SEQ_LDFLAGS)
 AC_SUBST(ADIOSLIB_SEQ_LDADD)
+AC_SUBST(ADIOSLIB_INT_CPPFLAGS)
+AC_SUBST(ADIOSLIB_INT_CFLAGS)
+AC_SUBST(ADIOSLIB_INT_LDFLAGS)
+AC_SUBST(ADIOSLIB_INT_LDADD)
 AC_SUBST(ADIOSREADLIB_CPPFLAGS)
 AC_SUBST(ADIOSREADLIB_CFLAGS)
 AC_SUBST(ADIOSREADLIB_LDFLAGS)
@@ -275,6 +332,7 @@ AC_CONFIG_FILES([Makefile
                  utils/bp2ascii/Makefile
                  utils/bpsplit/Makefile
                  utils/bpls/Makefile
+                 utils/bp2bp/Makefile
                  examples/Makefile
                  examples/C/Makefile
                  examples/C/scalars/Makefile
@@ -295,13 +353,20 @@ AC_CONFIG_FILES([Makefile
 
 AC_OUTPUT
 
+# Get the version of the source we are configuring here
+# Just to print it out at the end of configure
+# see also Makefile.am:install-data-hook
+if type svnversion &>/dev/null; then
+    SVNVERSION=`svnversion`
+else
+    SVNVERSION="unknown"
+fi
+
 echo
 echo "*********************************"
 echo $PACKAGE configured as follows:
 echo "*********************************"
 echo
-
-echo
 echo "  - General Compile FLAGS";
 echo "      - CC  = $CC";
 echo "      - CXX = $CXX";
@@ -319,44 +384,55 @@ echo "      - MPIFC   = $MPIFC";
 echo "      - MPILIBS = $MPILIBS";
 echo
 
-if test "x$enable_research_transports" == "xyes"; then 
-        echo "  - Research Transports Included";
+if test "x$enable_research_transports" == "xyes"; then
+    echo "  - Research Transports Included";
 
 else
-        echo "  - No research transport methods";
+    echo "  - No research transport methods";
 fi
 
 if test -z "${HAVE_MXML_TRUE}"; then
-        echo "  - MXML";
-        echo "      - MXML_CFLAGS = $MXML_CFLAGS";
-        echo "      - MXML_CPPFLAGS = $MXML_CPPFLAGS";
-        echo "      - MXML_LDFLAGS = $MXML_LDFLAGS";
-        echo "      - MXML_LIBS = $MXML_LIBS";
+    echo "  - MXML";
+    echo "      - MXML_CFLAGS = $MXML_CFLAGS";
+    echo "      - MXML_CPPFLAGS = $MXML_CPPFLAGS";
+    echo "      - MXML_LDFLAGS = $MXML_LDFLAGS";
+    echo "      - MXML_LIBS = $MXML_LIBS";
+    echo
+else
+    echo "  - No MXML"
+fi
+
+if test -z "${HAVE_LUSTRE_TRUE}"; then
+        echo "  - LUSTRE";
+        echo "      - LUSTRE_CFLAGS = $LUSTRE_CFLAGS";
+        echo "      - LUSTRE_CPPFLAGS = $LUSTRE_CPPFLAGS";
+        echo "      - LUSTRE_LDFLAGS = $LUSTRE_LDFLAGS";
+        echo "      - LUSTRE_LIBS = $LUSTRE_LIBS";
         echo
 else
-        echo "  - No MXML"
+        echo "  - No LUSTRE"
 fi
 
 if test -z "${HAVE_PORTALS_TRUE}"; then
-        echo "  - PORTALS";
-        echo "      - PORTALS_CFLAGS = $PORTALS_CFLAGS";
-        echo "      - PORTALS_CPPFLAGS = $PORTALS_CPPFLAGS";
-        echo "      - PORTALS_LDFLAGS = $PORTALS_LDFLAGS";
-        echo "      - PORTALS_LIBS = $PORTALS_LIBS";
-        echo
+    echo "  - PORTALS";
+    echo "      - PORTALS_CFLAGS = $PORTALS_CFLAGS";
+    echo "      - PORTALS_CPPFLAGS = $PORTALS_CPPFLAGS";
+    echo "      - PORTALS_LDFLAGS = $PORTALS_LDFLAGS";
+    echo "      - PORTALS_LIBS = $PORTALS_LIBS";
+    echo
 else
-	echo "  - No Portals"
+    echo "  - No Portals"
 fi
 
 if test -z "${HAVE_INFINIBAND_TRUE}"; then
-        echo "  - INFINIBAND";
-        echo "      - INFINIBAND_CFLAGS = $INFINIBAND_CFLAGS";
-        echo "      - INFINIBAND_CPPFLAGS = $INFINIBAND_CPPFLAGS";
-        echo "      - INFINIBAND_LDFLAGS = $INFINIBAND_LDFLAGS";
-        echo "      - INFINIBAND_LIBS = $INFINIBAND_LIBS";
-        echo
+    echo "  - INFINIBAND";
+    echo "      - INFINIBAND_CFLAGS = $INFINIBAND_CFLAGS";
+    echo "      - INFINIBAND_CPPFLAGS = $INFINIBAND_CPPFLAGS";
+    echo "      - INFINIBAND_LDFLAGS = $INFINIBAND_LDFLAGS";
+    echo "      - INFINIBAND_LIBS = $INFINIBAND_LIBS";
+    echo
 else
-	echo "  - No InfiniBand"
+    echo "  - No InfiniBand"
 fi
 
 dnl if test -z "${HAVE_GENGETOPT_TRUE}"; then
@@ -371,89 +447,92 @@ dnl         echo "  - No Gengetopt"
 dnl fi
 
 if test "x${datatap}" != "xdisable"; then
-        echo "  - DataTap with interconnect: $datatap";
-	echo "	   - DT_CFLAGS     = $DT_CFLAGS";
-	echo "	   - DT_CPPFLAGS   = $DT_CPPFLAGS";
-	echo "	   - DT_LDFLAGS    = $DT_LDFLAGS";
-	echo "	   - DT_LIBS       = $DT_LIBS";
-        echo
-else	
-        echo "  - No DataTap transport";
+    echo "  - DataTap with interconnect: $datatap";
+    echo "      - DT_CFLAGS     = $DT_CFLAGS";
+    echo "      - DT_CPPFLAGS   = $DT_CPPFLAGS";
+    echo "      - DT_LDFLAGS    = $DT_LDFLAGS";
+    echo "      - DT_LIBS       = $DT_LIBS";
+    echo
+else
+    echo "  - No DataTap transport";
 fi
 
 if test -z "${HAVE_DART_TRUE}"; then
-        echo "  - DART transport method";
-        echo "      - DART_CFLAGS = $DART_CFLAGS";
-        echo "      - DART_CPPFLAGS = $DART_CPPFLAGS";
-        echo "      - DART_LDFLAGS = $DART_LDFLAGS";
-        echo "      - DART_LIBS = $DART_LIBS";
-        echo
+    echo "  - DART transport method";
+    echo "      - DART_CFLAGS = $DART_CFLAGS";
+    echo "      - DART_CPPFLAGS = $DART_CPPFLAGS";
+    echo "      - DART_LDFLAGS = $DART_LDFLAGS";
+    echo "      - DART_LIBS = $DART_LIBS";
+    echo
 else
-	echo "  - No DART to build DART transport method"
+    echo "  - No DART to build DART transport method"
 fi
 
 if test -z "${HAVE_DIMES_TRUE}"; then
-        echo "  - DIMES transport method";
-        echo "      - DIMES_CFLAGS = $DIMES_CFLAGS";
-        echo "      - DIMES_CPPFLAGS = $DIMES_CPPFLAGS";
-        echo "      - DIMES_LDFLAGS = $DIMES_LDFLAGS";
-        echo "      - DIMES_LIBS = $DIMES_LIBS";
-        echo
+    echo "  - DIMES transport method";
+    echo "      - DIMES_CFLAGS = $DIMES_CFLAGS";
+    echo "      - DIMES_CPPFLAGS = $DIMES_CPPFLAGS";
+    echo "      - DIMES_LDFLAGS = $DIMES_LDFLAGS";
+    echo "      - DIMES_LIBS = $DIMES_LIBS";
+    echo
 else
-        echo "  - No DIMES to build DIMES transport method"
-fi  
+    echo "  - No DIMES to build DIMES transport method"
+fi
 
 if test -z "${HAVE_PHDF5_TRUE}"; then
-        echo "  - PHDF5";
-        echo "      - PHDF5_CFLAGS = $PHDF5_CFLAGS";
-        echo "      - PHDF5_CPPFLAGS = $PHDF5_CPPFLAGS";
-        echo "      - PHDF5_LDFLAGS = $PHDF5_LDFLAGS";
-        echo "      - PHDF5_LIBS = $PHDF5_LIBS";
-        echo
+    echo "  - PHDF5";
+    echo "      - PHDF5_CFLAGS = $PHDF5_CFLAGS";
+    echo "      - PHDF5_CPPFLAGS = $PHDF5_CPPFLAGS";
+    echo "      - PHDF5_LDFLAGS = $PHDF5_LDFLAGS";
+    echo "      - PHDF5_LIBS = $PHDF5_LIBS";
+    echo
 else
-	echo "  - No PHDF5"
+    echo "  - No PHDF5"
 fi
 
 if test -z "${HAVE_HDF5_TRUE}"; then
-        echo "  - HDF5";
-        echo "      - HDF5_CFLAGS = $HDF5_CFLAGS";
-        echo "      - HDF5_CPPFLAGS = $HDF5_CPPFLAGS";
-        echo "      - HDF5_LDFLAGS = $HDF5_LDFLAGS";
-        echo "      - HDF5_LIBS = $HDF5_LIBS";
-        echo
+    echo "  - HDF5";
+    echo "      - HDF5_CFLAGS = $HDF5_CFLAGS";
+    echo "      - HDF5_CPPFLAGS = $HDF5_CPPFLAGS";
+    echo "      - HDF5_LDFLAGS = $HDF5_LDFLAGS";
+    echo "      - HDF5_LIBS = $HDF5_LIBS";
+    echo
 else
-	echo "  - No HDF5"
+    echo "  - No HDF5"
 fi
 
 if test -z "${HAVE_NC4PAR_TRUE}"; then
-        echo "  - NetCDF 4 Parallel";
-        echo "      - NC4PAR_CFLAGS = $NC4PAR_CFLAGS";
-        echo "      - NC4PAR_CPPFLAGS = $NC4PAR_CPPFLAGS";
-        echo "      - NC4PAR_LDFLAGS = $NC4PAR_LDFLAGS";
-        echo "      - NC4PAR_LIBS = $NC4PAR_LIBS";
-        echo
+    echo "  - NetCDF 4 Parallel";
+    echo "      - NC4PAR_CFLAGS = $NC4PAR_CFLAGS";
+    echo "      - NC4PAR_CPPFLAGS = $NC4PAR_CPPFLAGS";
+    echo "      - NC4PAR_LDFLAGS = $NC4PAR_LDFLAGS";
+    echo "      - NC4PAR_LIBS = $NC4PAR_LIBS";
+    echo
 else
-	echo "  - No NETCDF 4 Parallel"
+    echo "  - No NETCDF 4 Parallel"
 fi
 
 if test -z "${HAVE_NETCDF_TRUE}"; then
-        echo "  - NetCDF";
-        echo "      - NETCDF_CFLAGS = $NETCDF_CFLAGS";
-        echo "      - NETCDF_CPPFLAGS = $NETCDF_CPPFLAGS";
-        echo "      - NETCDF_LDFLAGS = $NETCDF_LDFLAGS";
-        echo "      - NETCDF_LIBS = $NETCDF_LIBS";
-        echo
+    echo "  - NetCDF";
+    echo "      - NETCDF_CFLAGS = $NETCDF_CFLAGS";
+    echo "      - NETCDF_CPPFLAGS = $NETCDF_CPPFLAGS";
+    echo "      - NETCDF_LDFLAGS = $NETCDF_LDFLAGS";
+    echo "      - NETCDF_LIBS = $NETCDF_LIBS";
+    echo
 else
-	echo "  - No NETCDF"
+    echo "  - No NETCDF"
 fi
 
 if test -z "${HAVE_NSSI_TRUE}"; then
-        echo "  - NSSI";
-        echo "      - NSSI_CFLAGS = $NSSI_CFLAGS";
-        echo "      - NSSI_CPPFLAGS = $NSSI_CPPFLAGS";
-        echo "      - NSSI_LDFLAGS = $NSSI_LDFLAGS";
-        echo "      - NSSI_LIBS = $NSSI_LIBS";
-        echo
+    echo "  - NSSI";
+    echo "      - NSSI_CFLAGS = $NSSI_CFLAGS";
+    echo "      - NSSI_CPPFLAGS = $NSSI_CPPFLAGS";
+    echo "      - NSSI_LDFLAGS = $NSSI_LDFLAGS";
+    echo "      - NSSI_LIBS = $NSSI_LIBS";
+    echo
 else
-	echo "  - No NSSI"
+    echo "  - No NSSI"
 fi
+
+echo "  - SVN version = ${SVNVERSION}"
+echo "  - Install path = ${prefix}"
diff --git a/examples/C/Makefile.in b/examples/C/Makefile.in
index a98adee..daba5e0 100644
--- a/examples/C/Makefile.in
+++ b/examples/C/Makefile.in
@@ -44,6 +44,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -75,6 +76,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -149,6 +154,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -183,6 +190,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/examples/C/arrays/Makefile.in b/examples/C/arrays/Makefile.in
index 3135f42..6554512 100644
--- a/examples/C/arrays/Makefile.in
+++ b/examples/C/arrays/Makefile.in
@@ -46,6 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -91,6 +92,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -165,6 +170,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -199,6 +206,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/examples/C/attributes/Makefile.in b/examples/C/attributes/Makefile.in
index 6285bc2..3b99660 100644
--- a/examples/C/attributes/Makefile.in
+++ b/examples/C/attributes/Makefile.in
@@ -46,6 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -91,6 +92,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -165,6 +170,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -199,6 +206,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/examples/C/global-array-time/Makefile.am b/examples/C/global-array-time/Makefile.am
index 6ea0929..197e937 100644
--- a/examples/C/global-array-time/Makefile.am
+++ b/examples/C/global-array-time/Makefile.am
@@ -20,4 +20,4 @@ adios_read_globaltime_LDADD += $(ADIOSLIB_LDADD)
                 
 CLEANFILES = *.bp
 CC=$(MPICC)
-EXTRA_DIST = adios_globaltime.xml gread_temperature.ch gwrite_temperature.ch job.pbs
+EXTRA_DIST = adios_globaltime.xml gread_restart.ch gwrite_restart.ch job.pbs
diff --git a/examples/C/global-array-time/Makefile.in b/examples/C/global-array-time/Makefile.in
index dd7f07d..a09adaa 100644
--- a/examples/C/global-array-time/Makefile.in
+++ b/examples/C/global-array-time/Makefile.in
@@ -48,6 +48,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -103,6 +104,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -177,6 +182,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -211,6 +218,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
@@ -328,7 +338,7 @@ adios_read_globaltime_LDADD = $(top_builddir)/src/libadiosread.a \
 	$(ADIOSLIB_LDADD)
 adios_read_globaltime_LDFLAGS = $(ADIOSLIB_LDFLAGS)
 CLEANFILES = *.bp
-EXTRA_DIST = adios_globaltime.xml gread_temperature.ch gwrite_temperature.ch job.pbs
+EXTRA_DIST = adios_globaltime.xml gread_restart.ch gwrite_restart.ch job.pbs
 all: all-am
 
 .SUFFIXES:
diff --git a/examples/C/global-array-time/adios_globaltime.c b/examples/C/global-array-time/adios_globaltime.c
index cbd759f..750b96a 100644
--- a/examples/C/global-array-time/adios_globaltime.c
+++ b/examples/C/global-array-time/adios_globaltime.c
@@ -13,8 +13,11 @@ int main (int argc, char ** argv)
 {
 	char        filename [256];
 	int         rank, size, i, it;
-	int         NX = 10; 
+	int         NX = 10;
+        // NY = 1 for testing purpose
+	int         NY = 1; 
 	double      t[NX];
+	double      p[NY];
 
 	/* ADIOS variables declarations for matching gwrite_temperature.ch */
 	int         adios_err;
@@ -32,13 +35,16 @@ int main (int argc, char ** argv)
 
         	for (i = 0; i < NX; i++)
             		t[i] = it*100.0 + rank*NX + i;
+
+        	for (i = 0; i < NY; i++)
+            		p[i] = it*1000.0 + rank*NY + i;
 		
                 if (it==1)
-		    adios_open (&adios_handle, "temperature", filename, "w", &comm);
+		    adios_open (&adios_handle, "restart", filename, "w", &comm);
                 else
-		    adios_open (&adios_handle, "temperature", filename, "a", &comm);
+		    adios_open (&adios_handle, "restart", filename, "a", &comm);
 
-        	#include "gwrite_temperature.ch"
+        	#include "gwrite_restart.ch"
         	adios_close (adios_handle);
 		MPI_Barrier (comm);
                 //if (rank==0) printf("Timestep %d written\n", it+1);
diff --git a/examples/C/global-array-time/adios_globaltime.xml b/examples/C/global-array-time/adios_globaltime.xml
index fb8ef82..77a708f 100644
--- a/examples/C/global-array-time/adios_globaltime.xml
+++ b/examples/C/global-array-time/adios_globaltime.xml
@@ -1,18 +1,22 @@
 <?xml version="1.0"?>
 <adios-config host-language="C">
-    <adios-group name="temperature" coordination-communicator="comm" time-index="iter">
+    <adios-group name="restart" coordination-communicator="comm" time-index="iter">
     <var name="NX" type="integer"/>
+    <var name="NY" type="integer"/>
     <var name="size" type="integer"/>
     <var name="rank" type="integer"/>
     <global-bounds dimensions="size,NX" offsets="rank,0">
        <var name="temperature" gwrite="t" type="double" dimensions="iter,1,NX"/>
     </global-bounds>
+    <global-bounds dimensions="size,NY" offsets="rank,0">
+       <var name="pressure" gwrite="p" type="double" dimensions="iter,1,NY"/>
+    </global-bounds>
     <attribute name="description" path="/temperature" 
         value="Global array written from 'size' processes over several timesteps" 
         type="string"/>
 </adios-group>
 
-<method group="temperature" method="MPI"/>
+<method group="restart" method="MPI"/>
 
 <buffer size-MB="5" allocate-time="now"/>
 
diff --git a/examples/C/global-array-time/adios_globaltime_no_xml.c b/examples/C/global-array-time/adios_globaltime_no_xml.c
index ca95a79..9ddd9f1 100644
--- a/examples/C/global-array-time/adios_globaltime_no_xml.c
+++ b/examples/C/global-array-time/adios_globaltime_no_xml.c
@@ -51,7 +51,7 @@ int main (int argc, char ** argv)
         int64_t       m_adios_group;
         int64_t       m_adios_file;
 
-        adios_declare_group (&m_adios_group, "restart", "iter");
+        adios_declare_group (&m_adios_group, "restart", "iter", adios_flag_yes);
         adios_select_method (m_adios_group, "MPI", "", "");
 
         adios_define_var (m_adios_group, "NX"
diff --git a/examples/C/global-array-time/adios_read_globaltime.c b/examples/C/global-array-time/adios_read_globaltime.c
index 1e48638..e52f625 100644
--- a/examples/C/global-array-time/adios_read_globaltime.c
+++ b/examples/C/global-array-time/adios_read_globaltime.c
@@ -33,7 +33,7 @@ int main (int argc, char ** argv)
         return -1;
     }
 
-    ADIOS_GROUP * g = adios_gopen (f, "temperature");
+    ADIOS_GROUP * g = adios_gopen (f, "restart");
     if (g == NULL)
     {
         printf ("%s\n", adios_errmsg());
diff --git a/examples/C/global-array-time/gread_temperature.ch b/examples/C/global-array-time/gread_restart.ch
similarity index 72%
rename from examples/C/global-array-time/gread_temperature.ch
rename to examples/C/global-array-time/gread_restart.ch
index c7178d5..ce0e50a 100644
--- a/examples/C/global-array-time/gread_temperature.ch
+++ b/examples/C/global-array-time/gread_restart.ch
@@ -4,8 +4,12 @@ adios_group_size (adios_handle, adios_groupsize, &adios_totalsize);
 adios_buf_size = 4;
 adios_read (adios_handle, "NX", &NX, adios_buf_size);
 adios_buf_size = 4;
+adios_read (adios_handle, "NY", &NY, adios_buf_size);
+adios_buf_size = 4;
 adios_read (adios_handle, "size", &size, adios_buf_size);
 adios_buf_size = 4;
 adios_read (adios_handle, "rank", &rank, adios_buf_size);
 adios_buf_size = 8 * (1) * (NX);
 adios_read (adios_handle, "temperature", temperature, adios_buf_size);
+adios_buf_size = 8 * (1) * (NY);
+adios_read (adios_handle, "pressure", pressure, adios_buf_size);
diff --git a/examples/C/global-array-time/gwrite_temperature.ch b/examples/C/global-array-time/gwrite_restart.ch
similarity index 63%
rename from examples/C/global-array-time/gwrite_temperature.ch
rename to examples/C/global-array-time/gwrite_restart.ch
index 1c8b279..3b0069f 100644
--- a/examples/C/global-array-time/gwrite_temperature.ch
+++ b/examples/C/global-array-time/gwrite_restart.ch
@@ -1,9 +1,13 @@
 adios_groupsize = 4 \
                 + 4 \
                 + 4 \
-                + 8 * (1) * (NX);
+                + 4 \
+                + 8 * (1) * (NX) \
+                + 8 * (1) * (NY);
 adios_group_size (adios_handle, adios_groupsize, &adios_totalsize);
 adios_write (adios_handle, "NX", &NX);
+adios_write (adios_handle, "NY", &NY);
 adios_write (adios_handle, "size", &size);
 adios_write (adios_handle, "rank", &rank);
 adios_write (adios_handle, "temperature", t);
+adios_write (adios_handle, "pressure", p);
diff --git a/examples/C/global-array/Makefile.in b/examples/C/global-array/Makefile.in
index 7f81f4c..e9ce9ef 100644
--- a/examples/C/global-array/Makefile.in
+++ b/examples/C/global-array/Makefile.in
@@ -48,6 +48,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -111,6 +112,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -185,6 +190,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -219,6 +226,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/examples/C/global-array/adios_global.xml b/examples/C/global-array/adios_global.xml
index c5c66b4..bbf5a65 100644
--- a/examples/C/global-array/adios_global.xml
+++ b/examples/C/global-array/adios_global.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
 <adios-config host-language="C">
-    <adios-group name="temperature" coordination-communicator="comm">
+    <adios-group name="temperature" coordination-communicator="comm" stats="On">
     <var name="NX" type="integer"/>
     <var name="size" type="integer"/>
     <var name="rank" type="integer"/>
@@ -10,7 +10,7 @@
     <attribute name="description" path="/temperature" value="Global array written from 'size' processes" type="string"/>
 </adios-group>
 
-<method group="temperature" method="MPI"/>
+<method group="temperature" method="MPI">stripe_count=1;stripe_size=10485760;num_aggregators=2;merging_pgs=0</method>
 
 <buffer size-MB="2" allocate-time="now"/>
 
diff --git a/examples/C/global-array/adios_global_2files.c b/examples/C/global-array/adios_global_2files.c
index c7519c9..8bb1376 100644
--- a/examples/C/global-array/adios_global_2files.c
+++ b/examples/C/global-array/adios_global_2files.c
@@ -13,7 +13,7 @@ int main (int argc, char ** argv)
 	char        filename [256];
 	int         rank;
 	int         NX = 10; 
-	double      t[NX];
+	double      t[NX], p[NX], s[NX];
 
 	/* ADIOS variables declarations for matching gwrite_temperature.ch */
 	int         adios_err;
diff --git a/examples/C/global-array/adios_global_no_xml.c b/examples/C/global-array/adios_global_no_xml.c
index 67c7511..f41d360 100644
--- a/examples/C/global-array/adios_global_no_xml.c
+++ b/examples/C/global-array/adios_global_no_xml.c
@@ -12,10 +12,18 @@
  * ADIOS config file: None
  *
 */
+
+/* This example will write out 2 sub blocks of the variable temperature
+   and place these in the global array.
+   This example illustrates both the use of sub blocks in writing, and
+   the usage of the ADIOS non-xml API's
+*/
+
 #include <stdio.h>
 #include <string.h>
 #include "mpi.h"
 #include "adios.h"
+#include "adios_types.h"
 
 #ifdef DMALLOC
 #include "dmalloc.h"
@@ -24,9 +32,10 @@
 int main (int argc, char ** argv) 
 {
 	char        filename [256];
-	int         rank, size, i;
-	int         NX = 10, G, O; 
+	int         rank, size, i, block;
+	int         NX = 100, Global_bounds, Offsets; 
 	double      t[NX];
+        int         sub_blocks = 3;
 	MPI_Comm    comm = MPI_COMM_WORLD;
 
 	/* ADIOS variables declarations for matching gwrite_temperature.ch */
@@ -38,10 +47,7 @@ int main (int argc, char ** argv)
 	MPI_Comm_rank (comm, &rank);
 	MPI_Comm_size (comm, &size);
 
-        G = 2 * NX * size;
-
-	for (i = 0; i < NX; i++)
-	    t[i] = rank * NX + i;
+        Global_bounds = sub_blocks * NX * size;
 
 	strcpy (filename, "adios_global_no_xml.bp");
 
@@ -51,70 +57,47 @@ int main (int argc, char ** argv)
         int64_t       m_adios_group;
         int64_t       m_adios_file;
 
-        adios_declare_group (&m_adios_group, "restart", "iter");
+        adios_declare_group (&m_adios_group, "restart", "iter", adios_flag_yes);
         adios_select_method (m_adios_group, "MPI", "", "");
 
-        adios_define_var (m_adios_group, "NX"
-                     ,"", 2
-                     ,0, 0, 0);
-
-        adios_define_var (m_adios_group, "G"
-                     ,"", 2
-                     ,0, 0, 0);
-
-        adios_define_var (m_adios_group, "O"
-                     ,"", 2
-                     ,0, 0, 0);
-
-        adios_define_var (m_adios_group, "temperature"
-                     ,"", 6
-                     ,"NX", "G", "O");
 
         adios_define_var (m_adios_group, "NX"
-                     ,"", 2
-                     ,0, 0, 0);
-
-        adios_define_var (m_adios_group, "G"
-                     ,"", 2
-                     ,0, 0, 0);
-
-        adios_define_var (m_adios_group, "O"
-                     ,"", 2
-                     ,0, 0, 0);
-
-        adios_define_var (m_adios_group, "temperature"
-                     ,"", 6
-                     ,"NX", "G", "O");
-
-
+			,"", adios_integer
+			,0, 0, 0);
+   
+	adios_define_var (m_adios_group, "Global_bounds"
+			,"", adios_integer
+			,0, 0, 0);
+
+        for (i=0;i<sub_blocks;i++) {
+   
+           adios_define_var (m_adios_group, "Offsets"
+                        ,"", adios_integer
+                        ,0, 0, 0);
+   
+           adios_define_var (m_adios_group, "temperature"
+                        ,"", adios_double
+                        ,"NX", "Global_bounds", "Offsets");
+        }
+   
         adios_open (&m_adios_file, "restart", filename, "w", &comm);
 
-        adios_groupsize = 4 + 4 + 4 + NX * 8
-                        + 4 + 4 + 4 + NX * 8;
+        adios_groupsize = sub_blocks * (4 + 4 + 4 + NX * 8);
 
         adios_group_size (m_adios_file, adios_groupsize, &adios_totalsize);
+	adios_write(m_adios_file, "NX", (void *) &NX);
+	adios_write(m_adios_file, "Global_bounds", (void *) &Global_bounds);
+/* now we will write the data for each sub block */
+        for (block=0;block<sub_blocks;block++) {
 
-        adios_write(m_adios_file, "NX", (void *) &NX);
-        adios_write(m_adios_file, "G", (void *) &G);
-
-        O = rank * 2 * NX;
-        adios_write(m_adios_file, "O", (void *) &O);
-
-        for (i = 0; i < NX; i++)
-            t[i] = O + i;
-
-        adios_write(m_adios_file, "temperature", t);
-
-        adios_write(m_adios_file, "NX", (void *) &NX);
-        adios_write(m_adios_file, "G", (void *) &G);
-
-        O = rank * 2 * NX + NX;
-        adios_write(m_adios_file, "O", (void *) &O);
+           Offsets = rank * sub_blocks * NX + block*NX;
+           adios_write(m_adios_file, "Offsets", (void *) &Offsets);
 
-        for (i = 0; i < NX; i++)
-            t[i] = O + i;
+           for (i = 0; i < NX; i++)
+               t[i] = Offsets + i;
 
-        adios_write(m_adios_file, "temperature", t);
+           adios_write(m_adios_file, "temperature", t);
+        }
 
         adios_close (m_adios_file);
 
diff --git a/examples/C/global-array/adios_read_global.c b/examples/C/global-array/adios_read_global.c
index d226227..5961227 100644
--- a/examples/C/global-array/adios_read_global.c
+++ b/examples/C/global-array/adios_read_global.c
@@ -74,7 +74,7 @@ int main (int argc, char ** argv)
     for (i = 0; i < slice_size; i++) {
         printf ("rank %d: [%lld,%d:%lld]", rank, start[0]+i, 0, slice_size);
         for (j = 0; j < v->dims[1]; j++)
-            printf (" %6.2g", * (double *)data + i * v->dims[1] + j);
+            printf (" %6.6g", * ((double *)data + i * v->dims[1] + j));
         printf ("\n");
     }
 
diff --git a/examples/C/global-array/adios_read_global_no_xml.c b/examples/C/global-array/adios_read_global_no_xml.c
index 1556856..a1d485f 100644
--- a/examples/C/global-array/adios_read_global_no_xml.c
+++ b/examples/C/global-array/adios_read_global_no_xml.c
@@ -20,14 +20,16 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 #include "mpi.h"
 #include "adios_read.h"
 
 int main (int argc, char ** argv) 
 {
     char        filename [256];
-    int         rank, size, i, j;
+    int         rank, size, i, j, npl, token;
     MPI_Comm    comm = MPI_COMM_WORLD;
+    MPI_Status  status;
     void * data = NULL;
     uint64_t start[1], count[1], bytes_read = 0;
 
@@ -67,17 +69,33 @@ int main (int argc, char ** argv)
 
     bytes_read = adios_read_var (g, "temperature", start, count, data);
 
-    for (i = 0; i < slice_size; i++) {
-        printf (" %6.3g", * (double *)data + i);
+    if (rank > 0) {
+        MPI_Recv (&token, 1, MPI_INT, rank-1, 0, comm, &status);
     }
-    printf ("\n");
+
+    printf (" ======== Rank %d ========== \n", rank);
+    npl = 10;
+    for (i = 0; i < slice_size; i+=npl) {
+        printf ("[%4.4d]  ", rank*slice_size+i);
+        for (j= 0; j < npl; j++) {
+            printf (" %6.6g", * ((double *)data + i + j));
+        }
+        printf ("\n");
+    }
+    fflush(stdout);
+    sleep(1);
+
+    if (rank < size-1) {
+        MPI_Send (&token, 1, MPI_INT, rank+1, 0, comm);
+    }
+
+    MPI_Barrier (comm);
 
     free (data);
 
     adios_gclose (g);
     adios_fclose (f);
 
-    MPI_Barrier (comm);
 
     MPI_Finalize ();
     return 0;
diff --git a/examples/C/global-array/job.pbs b/examples/C/global-array/job.pbs
index d52ca09..175223a 100644
--- a/examples/C/global-array/job.pbs
+++ b/examples/C/global-array/job.pbs
@@ -4,4 +4,6 @@
 #PBS -l walltime=00:05:00,nodes=3:ppn=2
 
 cd $PBS_O_WORKDIR
-mpirun -np 6 ./adios_global >& result.dat
+
+export num_aggregators=4
+mpirun -np 16 ./adios_read_global >& result.dat
diff --git a/examples/C/manual/Makefile.in b/examples/C/manual/Makefile.in
index 94b95fb..2a0c3c9 100644
--- a/examples/C/manual/Makefile.in
+++ b/examples/C/manual/Makefile.in
@@ -47,6 +47,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -102,6 +103,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -176,6 +181,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -210,6 +217,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/examples/C/read_all/Makefile.in b/examples/C/read_all/Makefile.in
index 3e59b37..c98a9bc 100644
--- a/examples/C/read_all/Makefile.in
+++ b/examples/C/read_all/Makefile.in
@@ -46,6 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -87,6 +88,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -161,6 +166,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -195,6 +202,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/examples/C/scalars/Makefile.in b/examples/C/scalars/Makefile.in
index f313929..ca74e5f 100644
--- a/examples/C/scalars/Makefile.in
+++ b/examples/C/scalars/Makefile.in
@@ -46,6 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -91,6 +92,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -165,6 +170,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -199,6 +206,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/examples/C/stat/Makefile.in b/examples/C/stat/Makefile.in
index 766409d..8f195d2 100644
--- a/examples/C/stat/Makefile.in
+++ b/examples/C/stat/Makefile.in
@@ -46,6 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -91,6 +92,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -165,6 +170,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -199,6 +206,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/examples/Fortran/Makefile.in b/examples/Fortran/Makefile.in
index 5028fde..22c7b8a 100644
--- a/examples/Fortran/Makefile.in
+++ b/examples/Fortran/Makefile.in
@@ -44,6 +44,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -75,6 +76,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -149,6 +154,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -183,6 +190,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/examples/Fortran/arrays/Makefile.in b/examples/Fortran/arrays/Makefile.in
index 616f581..d4b794c 100644
--- a/examples/Fortran/arrays/Makefile.in
+++ b/examples/Fortran/arrays/Makefile.in
@@ -46,6 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -89,6 +90,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -163,6 +168,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -197,6 +204,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/examples/Fortran/global-array-time/Makefile.am b/examples/Fortran/global-array-time/Makefile.am
index 3e97d43..4777406 100644
--- a/examples/Fortran/global-array-time/Makefile.am
+++ b/examples/Fortran/global-array-time/Makefile.am
@@ -18,4 +18,4 @@ FCLINK = \
 	$(LIBTOOL) --mode=link --tag F77 $(FC) \
 	$(AM_FCFLAGS) $(FCFLAGS) $(LDFLAGS) -o $@
 
-EXTRA_DIST = adios_globaltime.xml gread_temperature.fh gwrite_temperature.fh job.pbs
+EXTRA_DIST = adios_globaltime.xml gread_restart.fh gwrite_restart.fh job.pbs
diff --git a/examples/Fortran/global-array-time/Makefile.in b/examples/Fortran/global-array-time/Makefile.in
index aff3fc6..a06ca43 100644
--- a/examples/Fortran/global-array-time/Makefile.in
+++ b/examples/Fortran/global-array-time/Makefile.in
@@ -46,6 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -85,6 +86,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -159,6 +164,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -193,6 +200,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
@@ -306,7 +316,7 @@ FCLINK = \
 	$(LIBTOOL) --mode=link --tag F77 $(FC) \
 	$(AM_FCFLAGS) $(FCFLAGS) $(LDFLAGS) -o $@
 
-EXTRA_DIST = adios_globaltime.xml gread_temperature.fh gwrite_temperature.fh job.pbs
+EXTRA_DIST = adios_globaltime.xml gread_restart.fh gwrite_restart.fh job.pbs
 all: all-am
 
 .SUFFIXES:
diff --git a/examples/Fortran/global-array-time/adios_globaltime.F90 b/examples/Fortran/global-array-time/adios_globaltime.F90
index 4943148..3685cd1 100644
--- a/examples/Fortran/global-array-time/adios_globaltime.F90
+++ b/examples/Fortran/global-array-time/adios_globaltime.F90
@@ -19,7 +19,10 @@ program adios_global
     character(len=256)      :: filename = "adios_globaltime.bp"
     integer                 :: rank, size, i, it, ierr
     integer, parameter      :: NX = 10
+    ! NY = 1 for testing purpose
+    integer, parameter      :: NY = 1
     real*8                  :: t(NX)
+    real*8                  :: p(NY)
     integer                 :: comm
 
     ! ADIOS variables declarations for matching gwrite_temperature.fh
@@ -36,18 +39,22 @@ program adios_global
 
     do it = 1, 13
         do i = 1, NX
-            t(i)  = 100.0*it + NX*rank + i-1
+            t(i)  = 100.0*it + NX*rank + i - 1
+        enddo
+
+        do i = 1, NY
+            p(i)  = 1000.0*it + NY*rank + i - 1
         enddo
 
         ! We need to create the file in the first round,
         ! then we need to append to it
         if (it == 1) then
-            call adios_open (adios_handle, "temperature", filename, "w", comm, adios_err)
+            call adios_open (adios_handle, "restart", filename, "w", comm, adios_err)
         else
-            call adios_open (adios_handle, "temperature", filename, "a", comm, adios_err)
+            call adios_open (adios_handle, "restart", filename, "a", comm, adios_err)
         endif
 
-#include "gwrite_temperature.fh"
+#include "gwrite_restart.fh"
 
         call adios_close (adios_handle, adios_err)
 
diff --git a/examples/Fortran/global-array-time/adios_globaltime.xml b/examples/Fortran/global-array-time/adios_globaltime.xml
index 59b66a0..e383612 100644
--- a/examples/Fortran/global-array-time/adios_globaltime.xml
+++ b/examples/Fortran/global-array-time/adios_globaltime.xml
@@ -1,18 +1,22 @@
 <?xml version="1.0"?>
 <adios-config host-language="Fortran">
-    <adios-group name="temperature" coordination-communicator="comm" time-index="iter">
+    <adios-group name="restart" coordination-communicator="comm" time-index="iter">
     <var name="NX" type="integer"/>
+    <var name="NY" type="integer"/>
     <var name="size" type="integer"/>
     <var name="rank" type="integer"/>
     <global-bounds dimensions="NX,size" offsets="0,rank">
        <var name="temperature" gwrite="t" type="double" dimensions="NX,1,iter"/>
     </global-bounds>
+    <global-bounds dimensions="NY,size" offsets="0,rank">
+       <var name="pressure" gwrite="p" type="double" dimensions="NY,1,iter"/>
+    </global-bounds>
     <attribute name="description" path="/temperature" 
         value="Global array written from 'size' processes over several timesteps" 
         type="string"/>
 </adios-group>
 
-<method group="temperature" method="MPI"/>
+<method group="restart" method="MPI"/>
 
 <buffer size-MB="2" allocate-time="now"/>
 
diff --git a/examples/Fortran/global-array-time/gread_temperature.fh b/examples/Fortran/global-array-time/gread_restart.fh
similarity index 71%
rename from examples/Fortran/global-array-time/gread_temperature.fh
rename to examples/Fortran/global-array-time/gread_restart.fh
index e44284e..99b0e9f 100644
--- a/examples/Fortran/global-array-time/gread_temperature.fh
+++ b/examples/Fortran/global-array-time/gread_restart.fh
@@ -4,8 +4,12 @@ call adios_group_size (adios_handle, adios_groupsize, adios_totalsize, adios_err
 adios_buf_size = 4
 call adios_read (adios_handle, "NX", NX, adios_buf_size, adios_err)
 adios_buf_size = 4
+call adios_read (adios_handle, "NY", NY, adios_buf_size, adios_err)
+adios_buf_size = 4
 call adios_read (adios_handle, "size", size, adios_buf_size, adios_err)
 adios_buf_size = 4
 call adios_read (adios_handle, "rank", rank, adios_buf_size, adios_err)
 adios_buf_size = 8 * (NX) * (1)
 call adios_read (adios_handle, "temperature", temperature, adios_buf_size, adios_err)
+adios_buf_size = 8 * (NY) * (1)
+call adios_read (adios_handle, "pressure", pressure, adios_buf_size, adios_err)
diff --git a/examples/Fortran/global-array-time/gwrite_temperature.fh b/examples/Fortran/global-array-time/gwrite_restart.fh
similarity index 65%
rename from examples/Fortran/global-array-time/gwrite_temperature.fh
rename to examples/Fortran/global-array-time/gwrite_restart.fh
index a1699a5..7414805 100644
--- a/examples/Fortran/global-array-time/gwrite_temperature.fh
+++ b/examples/Fortran/global-array-time/gwrite_restart.fh
@@ -1,9 +1,13 @@
 adios_groupsize = 4 &
                 + 4 &
                 + 4 &
-                + 8 * (NX) * (1)
+                + 4 &
+                + 8 * (NX) * (1) &
+                + 8 * (NY) * (1)
 call adios_group_size (adios_handle, adios_groupsize, adios_totalsize, adios_err)
 call adios_write (adios_handle, "NX", NX, adios_err)
+call adios_write (adios_handle, "NY", NY, adios_err)
 call adios_write (adios_handle, "size", size, adios_err)
 call adios_write (adios_handle, "rank", rank, adios_err)
 call adios_write (adios_handle, "temperature", t, adios_err)
+call adios_write (adios_handle, "pressure", p, adios_err)
diff --git a/examples/Fortran/global-array/Makefile.in b/examples/Fortran/global-array/Makefile.in
index 100c643..88a56d6 100644
--- a/examples/Fortran/global-array/Makefile.in
+++ b/examples/Fortran/global-array/Makefile.in
@@ -46,6 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -89,6 +90,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -163,6 +168,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -197,6 +204,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/examples/Fortran/global-array/adios_global_no_xml.F90 b/examples/Fortran/global-array/adios_global_no_xml.F90
index cddcd72..756429d 100644
--- a/examples/Fortran/global-array/adios_global_no_xml.F90
+++ b/examples/Fortran/global-array/adios_global_no_xml.F90
@@ -35,7 +35,7 @@ program adios_global
     call adios_init_noxml (adios_err)
     call adios_allocate_buffer (10, adios_err)
 
-    call adios_declare_group (m_adios_group, "restart", "iter", adios_err)
+    call adios_declare_group (m_adios_group, "restart", "iter", 1, adios_err)
     call adios_select_method (m_adios_group, "MPI", "", "", adios_err)
 
     ! define a integer
diff --git a/examples/Fortran/scalars/Makefile.in b/examples/Fortran/scalars/Makefile.in
index b8dbf75..b25d095 100644
--- a/examples/Fortran/scalars/Makefile.in
+++ b/examples/Fortran/scalars/Makefile.in
@@ -46,6 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -89,6 +90,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -163,6 +168,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -197,6 +204,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/examples/Makefile.in b/examples/Makefile.in
index ac06d3a..3260d26 100644
--- a/examples/Makefile.in
+++ b/examples/Makefile.in
@@ -44,6 +44,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -75,6 +76,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -149,6 +154,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -183,6 +190,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/runconf b/runconf
index 27520cd..ee109ef 100755
--- a/runconf
+++ b/runconf
@@ -4,33 +4,42 @@
 # You can study it to figure out how to configure adios on your system
 #
 
-if [ `hostname | cut -c 1-4` == "ewok" ]; then
+if [ `hostname | cut -c 1-4` == "sith" ]; then
 
     ########
-    # Ewok #
+    # Sith #
     ########
-    echo "Configure on EWOK"
+    echo "Configure on SITH"
     source /etc/profile.d/modules.sh
     module unload hdf5
     module unload netcdf
     module unload PE-gnu
     module unload PE-pgi
+    module unload PE-intel
     module unload PE-pathscale
-    module unload pgi
+    module unload pgi gcc intel pathscale
     TARGET=pgi
     module load PE-$TARGET
+    module load mxml
     # Use both seq hdf5 (for utils) and 
     #   parallel hdf5 (for PHDF5 method)
-    module load hdf5/1.8.2
+    module load hdf5/1.8.5
     SEQ_HDF5_DIR=$HDF5_DIR
     SEQ_HDF5_CLIB=$HDF5_CLIB
     module unload hdf5
-    module load hdf5/1.8.2_par
+    module load hdf5/1.8.5_par
     PAR_HDF5_DIR=$HDF5_DIR
     PAR_HDF5_CLIB=$HDF5_CLIB
     module unload hdf5
-    # Seq NetCDF 3 for bp2ncd
-    module load netcdf/3.6.2
+    # Seq. and Parallel NetCDF 4 
+    module load netcdf/4.1.1
+    SEQ_NC_DIR=$NETCDF_DIR
+    SEQ_NC_CLIB=$NETCDF_CLIB
+    module unload netcdf
+    module load netcdf/4.1.1_par
+    PAR_NC_DIR=$NETCDF_DIR
+    PAR_NC_CLIB=$NETCDF_CLIB
+    module unload netcdf
     export MPICC=mpicc
     export MPICXX=mpiCC
     export MPIFC=mpif90
@@ -38,34 +47,89 @@ if [ `hostname | cut -c 1-4` == "ewok" ]; then
         export CC=pgcc
         export CXX=pgCC
         export FC=pgf90
-        module swap pgi pgi/10.5
     elif [ "$TARGET" == "gnu" ]; then
         export CC=gcc
         export CXX=g++
         export FC=gfortran
+    elif [ "$TARGET" == "intel" ]; then
+        export CC=icc
+        export CXX=icpc
+        export FC=ifort
     else
         echo "TARGET must be pgi or gnu"
         exit 1
     fi
         
     export CFLAGS="-g -fPIC" 
-    ./configure --prefix=/ccs/proj/e2e/pnorbert/ADIOS/ewok.$TARGET \
+    ./configure --prefix=/ccs/proj/e2e/pnorbert/ADIOS/sith.$TARGET \
         --enable-dependency-tracking \
-        --with-mxml=/ccs/proj/e2e/pnorbert/mxml \
         --enable-research-transports  \
-        --without-datatap \
         --with-hdf5=${SEQ_HDF5_DIR} \
         --with-hdf5-libs="${SEQ_HDF5_CLIB}" \
         --with-phdf5=${PAR_HDF5_DIR} \
-        --with-phdf5-libs="${PAR_HDF5_CLIB}"
+        --with-phdf5-libs="${PAR_HDF5_CLIB}" \
+        --with-netcdf=${SEQ_NC_DIR} \
+        --with-netcdf-libs="${SEQ_NC_CLIB}" \
+        --with-nc4par=${PAR_NC_DIR} \
+        --with-nc4par-libs="${PAR_NC_CLIB}" \
+        --with-lustre=/usr \
+        --without-datatap --without-infiniband
         #--with-dmalloc=/ccs/proj/e2e/pnorbert/dmalloc.$TARGET 
         #--with-datatap=/ccs/home/habbasi/work/ewok/
         #--enable-datatap=ib
 
 
+elif [ `hostname | cut -c 1-4` == "lens" ]; then
+    echo "Configure on LENS"
+    source /etc/profile.d/modules.sh
+    module unload hdf5
+    module unload netcdf
+    module unload PE-gnu
+    module unload PE-pgi
+    module unload PE-pathscale
+    module unload pgi
+    TARGET=pgi
+    module load PE-$TARGET
+    # Use both seq hdf5 (for utils) and 
+    #   parallel hdf5 (for PHDF5 method)
+    #module load hdf5/1.8.2
+    SEQ_HDF5_DIR=$HDF5_DIR
+    SEQ_HDF5_CLIB=$HDF5_CLIB
+    #module unload hdf5
+    #module load hdf5/1.8.2_par
+    PAR_HDF5_DIR=$HDF5_DIR
+    PAR_HDF5_CLIB=$HDF5_CLIB
+    #module unload hdf5
+    # Seq NetCDF 3 for bp2ncd
+    #module load netcdf/3.6.2
+    export MPICC=mpicc
+    export MPICXX=mpiCC
+    export MPIFC=mpif90
+    if [ "$TARGET" == "pgi" ]; then
+        export CC=pgcc
+        export CXX=pgCC
+        export FC=pgf90
+        module switch pgi pgi/10.5
+    elif [ "$TARGET" == "gnu" ]; then
+        export CC=gcc
+        export CXX=g++
+        export FC=gfortran
+    else
+        echo "TARGET must be pgi or gnu"
+        exit 1
+    fi
+
+    export CFLAGS="-g -fPIC"
+    ./configure --prefix=/ccs/proj/e2e/qliu/ADIOS/sith.$TARGET \
+        --enable-dependency-tracking \
+        --with-mxml=/ccs/proj/e2e/pnorbert/mxml \
+        --enable-research-transports  \
+        --without-datatap \
+        --with-dmalloc=/ccs/proj/e2e/qliu/dmalloc.lens.$TARGET
+
 elif [ `hostname | cut -c 1-6` == "jaguar" -o `hostname | cut -c 1-7` == "chester" ]; then
 
-    BUILD_STAGING=true
+    BUILD_STAGING=false
     if [ $BUILD_STAGING == "false" ]; then
     
         ##########
@@ -95,16 +159,19 @@ elif [ `hostname | cut -c 1-6` == "jaguar" -o `hostname | cut -c 1-7` == "cheste
         # use the two lines below for openmpi
         #export CC=mpicc
         #export FC=mpif90
-        CFLAGS="-g -fPIC" ./configure --prefix=/ccs/proj/e2e/pnorbert/ADIOS/xt5.gnu \
+        CFLAGS="-g -fPIC" ./configure --prefix=/ccs/proj/e2e/adios/xt5.$TARGET \
             --enable-dependency-tracking \
-            --with-mxml=/ccs/proj/e2e/pnorbert/mxml.xt5.$TARGET \
-            --without-portals 
+            --with-mxml=/ccs/proj/e2e/pnorbert/mxml.xt5.pgi \
+            --without-portals \
+            --with-lustre=/opt/xt-lustre-ss/2.2_1.6.5/usr
+#            --with-dmalloc=/ccs/proj/e2e/qliu/dmalloc.$TARGET
 #            --enable-research-transports \
 #            --with-netcdf=/opt/cray/netcdf/3.6.2/netcdf-${TARGET} \
 #            --with-nc4par=/opt/cray/netcdf-hdf5parallel/4.0.1.3/netcdf-hdf5parallel-$TARGET \
 #            --with-phdf5=/opt/cray/hdf5-parallel/1.8.4.1/hdf5-parallel-$TARGET \
 #            --with-hdf5=/sw/xt5/hdf5/1.8.2/cnl2.1_gnu7.2.3 \
 #            --with-hdf5=/sw/xt5/hdf5/1.8.2/cnl2.1_gnu4.2.0 \
+#            --with-mxml=/ccs/proj/e2e/pnorbert/mxml.xt5.$TARGET \
             
     else 
     
@@ -133,9 +200,14 @@ elif [ `hostname | cut -c 1-6` == "jaguar" -o `hostname | cut -c 1-7` == "cheste
             module swap pgi pgi/10.4.0
             # NSSI needs -pgcpplibs flag 
             export LDFLAGS="-pgcpplibs" 
+            WITHDART="--with-dart=/sw/xt5/adios/1.2.1/cnl2.2_pgi10.4/spaces"
         elif [ "$TARGET" == "gnu" ]; then
             # NSSI needs libstdc++
             export EXTRA_LIBS="/opt/gcc/4.4.4/snos/lib64/libstdc++.a"
+            module swap gcc gcc/4.4.4
+            WITHDART="--with-dart=/sw/xt5/adios/1.2.1/cnl2.2_gnu4.4.4/spaces"
+        else
+            WITHDART=""
         fi
      
         # NOTE hdf5-parallel module does not work with C++ compiler
@@ -147,19 +219,21 @@ elif [ `hostname | cut -c 1-6` == "jaguar" -o `hostname | cut -c 1-7` == "cheste
         # use the two lines below for openmpi
         #export CC=mpicc
         #export FC=mpif90
-        export CPPFLAGS="-DMPICH_IGNORE_CXX_SEEK" 
-        export CFLAGS="-fPIC" 
-        ./configure --prefix=/ccs/proj/e2e/pnorbert/ADIOS/xt5.$TARGET \
+        export CPPFLAGS="-DMPICH_IGNORE_CXX_SEEK -DDART_DO_VERSIONING" 
+        export CFLAGS="-fPIC -g -O0" 
+        #./configure --prefix=/ccs/proj/e2e/pnorbert/ADIOS/xt5.$TARGET \
+        ./configure --prefix=/ccs/proj/fus022/norbert/RMP/adios.xt5.$TARGET \
         --enable-dependency-tracking \
-        --with-portals \
+        --with-portals=/opt/xt-pe/2.2.41A \
         --with-netcdf=/opt/cray/netcdf/3.6.2/netcdf-${TARGET} \
         --with-hdf5=/sw/xt5/hdf5/1.8.2/cnl2.1_gnu4.2.0 \
         --with-nc4par=/opt/cray/netcdf-hdf5parallel/4.0.1.3/netcdf-hdf5parallel-$TARGET \
         --with-phdf5=/opt/cray/hdf5-parallel/1.8.4.1/hdf5-parallel-$TARGET \
-        --with-datatap=/ccs/proj/e2e/pnorbert/datatap/xt5/$TARGET \
-        --with-nssi=/ccs/proj/e2e/pnorbert/nssi/xt5/$TARGET \
-        --with-dart=/ccs/proj/e2e/pnorbert/spaces/$TARGET \
+        $WITHDART \
         --with-dimes=/ccs/proj/e2e/pnorbert/spaces/$TARGET
+        #--with-nssi=/ccs/proj/e2e/pnorbert/nssi/xt5/$TARGET \
+        #--with-datatap=/ccs/home/zf2/work/pe.$TARGET \
+        #--with-datatap=/ccs/proj/e2e/pnorbert/datatap/xt5/$TARGET \
     
     fi
     
@@ -170,21 +244,23 @@ elif [ `hostname | cut -c 1-4` == "euge" ]; then
     echo "Configure on Eugene (BlueGene)"
     export MPICC=mpixlc_r
     export MPIFC=mpixlf90
-    export CFLAGS="-g -O0"
+    #export CFLAGS="-g -O0"
+    export CFLAGS=""
     export FC=xlf90
     export CC=xlc_r
 
     source /etc/profile.d/modules.sh
+    module load python
     # NetCDF 3 for bp2ncd
     module load netcdf/3.6.2-linux
     # Seq HDF5 for bp2h5 
-    module load hdf5/1.8.1-linux
-    # HDF5_DIR is not defined by this hdf5 module so we do it here
-    HDF5_DIR=/sw/bgp/hdf5/1.8.1/sles10.1_xlc9.0xlf11.1
+    #module load hdf5/1.8.5-linux
+    export HDF5_DIR="/sw/bgp/hdf5/1.8.5/sles10.2_xlc9.0xlf11.1/install"
+    export HDF5_CLIB="-I/sw/bgp/hdf5/1.8.5/sles10.2_xlc9.0xlf11.1/install/include -L/sw/bgp/hdf5/1.8.5/sles10.2_xlc9.0xlf11.1/install/lib -lhdf5_hl -lhdf5 -L/sw/bgp/szip/2.1/sles10.1_xlc9.0/lib -lsz /usr/lib/libz.a"
+    module load mxml
 
     ./configure --prefix=/ccs/proj/e2e/pnorbert/ADIOS/eugene \
             --enable-dependency-tracking \
-            --with-mxml=/ccs/proj/e2e/adios/bgp \
             --with-hdf5=$HDF5_DIR \
             --with-hdf5-libs="$HDF5_CLIB" \
             --without-phdf5
@@ -227,9 +303,9 @@ elif [ `hostname | cut -c 1-4` == "nid0" ]; then
     module unload PrgEnv-cray
     TARGET=pgi
     module load PrgEnv-$TARGET
-    if [ "${TARGET}" == "pgi" ]; then
-        module swap pgi pgi/10.5.0
-    fi
+    #if [ "${TARGET}" == "pgi" ]; then
+    #    module swap pgi pgi/10.5.0
+    #fi
     export LDFLAGS="-pgcpplibs"
     export CPPFLAGS="-DMPICH_IGNORE_CXX_SEEK"
     export CFLAGS="-fPIC"
@@ -237,11 +313,11 @@ elif [ `hostname | cut -c 1-4` == "nid0" ]; then
     ./configure --prefix=/global/homes/p/pnorbert/adios \
         --enable-dependency-tracking \
         --with-mxml=$HOME/mxml \
-        --with-hdf5=/opt/cray/hdf5/1.8.4.1/hdf5-${TARGET} \
+        --with-hdf5=/opt/cray/hdf5/1.8.5.0/hdf5-${TARGET} \
         --with-netcdf=/opt/cray/netcdf/3.6.2/netcdf-${TARGET} \
-        --with-phdf5=/opt/cray/hdf5-parallel/1.8.4.1/hdf5-parallel-${TARGET} \
-        --with-nc4par=/opt/cray/netcdf-hdf5parallel/4.0.1.3/netcdf-hdf5parallel-${TARGET} \
-        --with-dart=/global/homes/p/pnorbert/dataspaces
+        --with-phdf5=/opt/cray/hdf5-parallel/1.8.5.0/hdf5-parallel-${TARGET} \
+        --with-nc4par=/opt/cray/netcdf-hdf5parallel/4.1.1.0/netcdf-hdf5parallel-${TARGET} \
+        --with-dart=/global/homes/p/pnorbert/dart.0628.pgi
     
 elif [ `hostname | cut -c 1-4` == "dyn9" -o `hostname | cut -c 1-3` == "pnb" ]; then
 
@@ -260,7 +336,8 @@ elif [ `hostname | cut -c 1-4` == "dyn9" -o `hostname | cut -c 1-3` == "pnb" ];
     CFLAGS="-DO_LARGEFILE=0 -fno-common" ./configure --prefix=/opt/adios \
         --with-mxml=/opt/mxml \
         --with-netcdf=/opt/netcdf \
-        --with-phdf5=/opt/hdf5
+        --with-phdf5=/opt/hdf5 \
+        --with-hdf5=/opt/hdf5.seq
 
 elif [ `hostname | cut -c 1-7` == "ubuntu" ]; then
 
@@ -290,6 +367,42 @@ elif [ `hostname | cut -c 1-6` == "tomato" ]; then
         --with-hdf5=/home/thkorde/local \
         --with-netcdf=/home/thkorde/local
 
+elif [ `hostname | cut -c 1-4` == "qliu" ]; then
+
+    #########################
+    # Gary's ubuntu laptop #
+    #########################
+    echo "Configure on UBUNTU"
+    export CC=mpicc
+    export CFLAGS="-g -O0 -fPIC"
+    ./configure --prefix=/home/qliu/ADIOS \
+        --enable-dependency-tracking \
+        --with-mxml=/home/qliu/mxml \
+        #--with-phdf5=/home/thkorde/local \
+        #--with-hdf5=/home/thkorde/local \
+        #--with-netcdf=/home/thkorde/local
+
+elif [ `hostname | cut -c 1-5` == "smoky" ]; then
+
+    #########
+    # Smoky #
+    #########
+    echo "Configure on SMOKY"
+export CC=mpicc
+export FC=mpif90
+# use the two lines below for openmpi
+#export CC=mpicc
+#export FC=mpif90
+# use for both MPI implementations
+./configure --prefix=/ccs/home/ge1/work/smoky \
+            --enable-dependency-tracking \
+            --with-mxml=/ccs/home/ge1/work/smoky \
+            --with-hdf5=/sw/xt5/hdf5/1.6.7/cnl2.1_gnu4.2.4 \
+            --with-hdf5-libdir="/sw/xt5/hdf5/1.6.7/cnl2.1_gnu4.2.4/lib -L/sw/xt5/szip/2.1/sles10.1_gnu4.2.4/lib -lsz -lz" \
+            --with-phdf5=/sw/xt5/hdf5/1.6.7/cnl2.1_gnu4.2.4_par \
+            --with-phdf5-libdir="/sw/xt5/hdf5/1.6.7/cnl2.1_gnu4.2.4_par/lib -L/sw/xt5/szip/2.1/sles10.1_gnu4.2.4/lib -lsz -lz" \
+            --with-netcdf=/sw/xt5/netcdf/3.6.2/sles10.1_gnu4.2.0
+
 else
     echo "Could not determine what machine is this"
     echo "This script is for configuring adios on the authors' machines"
diff --git a/scripts/create.nssi.config.sh b/scripts/create.nssi.config.sh
index 198d4a7..cb57d87 100755
--- a/scripts/create.nssi.config.sh
+++ b/scripts/create.nssi.config.sh
@@ -5,6 +5,13 @@ SERVER_CONTACT_INFO=$1 ; shift
 
 CONFIG_FRAG=/tmp/config.frag.$PBS_JOBID
 
+while [ ! -s ${SERVER_CONTACT_INFO} ]; do
+  echo "waiting for contact info.  retry in 1 second..."
+  sleep 1
+done
+ls -l ${SERVER_CONTACT_INFO}
+
+
 cat >$CONFIG_FRAG<<HERE
 <?xml version="1.0"?>
 <nssi-config>
diff --git a/scripts/kill.nssi.staging.sh b/scripts/kill.nssi.staging.sh
index b7010d4..10d0648 100755
--- a/scripts/kill.nssi.staging.sh
+++ b/scripts/kill.nssi.staging.sh
@@ -2,11 +2,9 @@
 
 SERVER_CONTACT_INFO=$1 ; shift
 
-SVC_LIST=`head ${SERVER_CONTACT_INFO} | awk '{ ML=$0" "ML } END { print ML }'`
-for SVC in $SVC_LIST; do
-  SVC_NID=`echo $SVC | sed -e 's/\(.*\)@\(.*\)@\(.*\)@\(.*\)/\1/'`
-  SVC_PID=`echo $SVC | sed -e 's/\(.*\)@\(.*\)@\(.*\)@\(.*\)/\2/'`
-  SVC_ADDR=`echo $SVC | sed -e 's/\(.*\)@\(.*\)@\(.*\)@\(.*\)/\3/'`
-  SVC_PORT=`echo $SVC | sed -e 's/\(.*\)@\(.*\)@\(.*\)@\(.*\)/\4/'`
-  $ADIOS_DIR/nssi/bin/nssi-kill --server-nid="$SVC_NID" --server-pid="$SVC_PID"
-done
+SVC=`head -1 ${SERVER_CONTACT_INFO} | awk '{ ML=$0" "ML } END { print ML }'`
+SVC_NID=`echo $SVC | sed -e 's/\(.*\)@\(.*\)@\(.*\)@\(.*\)/\1/'`
+SVC_PID=`echo $SVC | sed -e 's/\(.*\)@\(.*\)@\(.*\)@\(.*\)/\2/'`
+SVC_ADDR=`echo $SVC | sed -e 's/\(.*\)@\(.*\)@\(.*\)@\(.*\)/\3/'`
+SVC_PORT=`echo $SVC | sed -e 's/\(.*\)@\(.*\)@\(.*\)@\(.*\)/\4/'`
+$ADIOS_DIR/nssi/bin/nssi-kill --server-nid="$SVC_NID" --server-pid="$SVC_PID"
diff --git a/src/Makefile.am b/src/Makefile.am
index 0ddfcf5..1184558 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -5,6 +5,7 @@ METASOURCES=AUTO
 
 bin_PROGRAMS=
 if HAVE_NSSI
+
 bin_PROGRAMS+=nssi-staging-server
 
 nssi_staging_server_SOURCES = nssi_staging_server.cpp aggregation.cpp
@@ -14,13 +15,32 @@ nssi_staging_server_LDFLAGS = $(ADIOSLIB_LDFLAGS)
 nssi_staging_server_LDADD = $(top_builddir)/src/libadios.a
 nssi_staging_server_LDADD += $(ADIOSLIB_LDADD) $(NSSI_SERVER_LIBS)
 
+bin_PROGRAMS+=nssi-coupling-server
+
+nssi_coupling_server_SOURCES = nssi_coupling_server.cpp
+nssi_coupling_server_CFLAGS=$(ADIOSLIB_CFLAGS)
+nssi_coupling_server_CPPFLAGS=$(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_CPPFLAGS) -DPTL_IFACE_CLIENT=CRAY_USER_NAL -DPTL_IFACE_SERVER=CRAY_USER_NAL # -DUSE_TIMERS
+nssi_coupling_server_LDFLAGS = $(ADIOSLIB_LDFLAGS) 
+nssi_coupling_server_LDADD = $(top_builddir)/src/libadios.a
+nssi_coupling_server_LDADD += $(ADIOSLIB_LDADD) $(NSSI_SERVER_LIBS)
+
 endif # HAVE_NSSI
 
 include_HEADERS=
 lib_LIBRARIES=
 
+libadiosread_a_CPPFLAGS=
+libadiosreadf_a_CPPFLAGS=
+libadiosread_nompi_a_CPPFLAGS=
+libadiosreadf_nompi_a_CPPFLAGS=
+
+libadiosread_a_CFLAGS= 
+libadiosreadf_a_CFLAGS= 
+libadiosread_nompi_a_CFLAGS= 
+libadiosreadf_nompi_a_CFLAGS= 
+
 if BUILD_WRITE
-lib_LIBRARIES += libadios.a
+lib_LIBRARIES += libadios.a libadios_nompi.a
 libadios_a_SOURCES = adios.c \
                      common_adios.c \
                      adios_transport_hooks.c \
@@ -42,9 +62,33 @@ libadios_a_SOURCES = adios.c \
                      adios_read_hooks.c \
                      common_read.c \
                      read_bp.c \
+                     read_bp_staged.c \
                      globals.c
+
+libadios_nompi_a_SOURCES = adios.c \
+                     common_adios.c \
+                     adios_transport_hooks.c \
+                     adios_posix.c \
+                     adios_posix1.c \
+                     adios_internals.c \
+                     adios_internals_mxml.c \
+                     buffer.c \
+                     adios_socket.c \
+                     adios_bp_v1.c  \
+                     adios_endianness.c \
+                     bp_utils.c \
+                     futils.c \
+                     adios_error.c \
+                     adios_read.c \
+                     adios_read_hooks.c \
+                     common_read.c \
+                     read_bp.c \
+                     read_bp_staged.c \
+                     globals.c \
+                     mpidummy.c
+
 if BUILD_FORTRAN
-lib_LIBRARIES += libadiosf.a
+lib_LIBRARIES += libadiosf.a 
 libadiosf_a_SOURCES = adiosf.c \
                      common_adios.c \
                      adios_transport_hooks.c \
@@ -66,16 +110,20 @@ libadiosf_a_SOURCES = adiosf.c \
                      adios_read_hooks.c \
                      common_read.c \
                      read_bp.c \
+                     read_bp_staged.c \
                      globals.c
 endif # BUILD_FORTRAN
 
 libadios_a_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_CPPFLAGS) # -DUSE_TIMERS
 libadios_a_CFLAGS = $(ADIOSLIB_CFLAGS) 
-libadiosf_a_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_CPPFLAGS)
+libadios_nompi_a_CPPFLAGS = -D_NOMPI $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_SEQ_CPPFLAGS) # -DUSE_TIMERS
+libadios_nompi_a_CFLAGS = -D_NOMPI $(ADIOSLIB_SEQ_CFLAGS) 
+libadiosf_a_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_CPPFLAGS) # -DUSE_TIMERS
 libadiosf_a_CFLAGS = $(ADIOSLIB_CFLAGS) 
 
 if HAVE_DART
 libadios_a_SOURCES += adios_dart.c read_dart.c
+libadios_nompi_a_SOURCES += adios_dart.c read_dart.c
 if BUILD_FORTRAN
 libadiosf_a_SOURCES += adios_dart.c read_dart.c
 endif
@@ -83,15 +131,17 @@ endif
 
 if HAVE_DIMES
 libadios_a_SOURCES += adios_dimes.c read_dimes.c
+libadios_nompi_a_SOURCES += adios_dimes.c read_dimes.c
 if BUILD_FORTRAN
 libadiosf_a_SOURCES += adios_dimes.c read_dimes.c
 endif
 endif
 
 if HAVE_DATATAP
-libadios_a_SOURCES += adios_datatap.c
+libadios_a_SOURCES += adios_datatap.c read_datatap.c
+libadios_nompi_a_SOURCES += adios_datatap.c read_datatap.c
 if BUILD_FORTRAN
-libadiosf_a_SOURCES += adios_datatap.c
+libadiosf_a_SOURCES += adios_datatap.c read_datatap.c
 endif
 endif 
 
@@ -116,12 +166,12 @@ endif
 if HAVE_NSSI
 dist_libadios_a_SOURCES = adios_nssi_args.x
 nodist_libadios_a_SOURCES = adios_nssi_args.c adios_nssi_args.h
-libadios_a_SOURCES += adios_nssi_config.c adios_nssi.c adios_nssi_filter.c
+libadios_a_SOURCES += adios_nssi_config.c adios_nssi.c adios_nssi_filter.c read_nssi.c
 libadios_a_CPPFLAGS += -DPTL_IFACE_CLIENT=CRAY_USER_NAL -DPTL_IFACE_SERVER=CRAY_USER_NAL
 if BUILD_FORTRAN
 nodist_libadiosf_a_SOURCES = adios_nssi_args.c adios_nssi_args.h
 dist_libadiosf_a_SOURCES = adios_nssi_args.x
-libadiosf_a_SOURCES += adios_nssi_config.c adios_nssi.c adios_nssi_filter.c
+libadiosf_a_SOURCES += adios_nssi_config.c adios_nssi.c adios_nssi_filter.c read_nssi.c
 libadiosf_a_CPPFLAGS += -DPTL_IFACE_CLIENT=CRAY_USER_NAL -DPTL_IFACE_SERVER=CRAY_USER_NAL
 endif
 
@@ -169,6 +219,7 @@ libadiosf_a_SOURCES += adios_mpi_stagger.c \
 endif
 else
 libadios_a_CPPFLAGS += -DNO_RESEARCH_TRANSPORTS
+libadios_nompi_a_CPPFLAGS += -DNO_RESEARCH_TRANSPORTS
 libadiosf_a_CPPFLAGS += -DNO_RESEARCH_TRANSPORTS
 endif  # RESEARCH_TRANSPORTS
 
@@ -178,6 +229,7 @@ include_HEADERS += adios.h \
                    adios_types.h \
                    adios_read.h \
                    adios_read_hooks.h \
+                   adios_error.h \
                    mpidummy.h \
                    io_timer.h
 
@@ -191,6 +243,7 @@ libadiosread_a_SOURCES = adios_bp_v1.c \
                       adios_read_hooks.c \
                       common_read.c \
                       read_bp.c \
+                      read_bp_staged.c \
                       globals.c
 if HAVE_DART
 libadiosread_a_SOURCES += read_dart.c
@@ -198,7 +251,19 @@ endif
 if HAVE_DIMES
 libadiosread_a_SOURCES += read_dimes.c
 endif
-libadiosread_a_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSREADLIB_CPPFLAGS)
+if HAVE_DATATAP
+libadiosread_a_SOURCES += read_datatap.c
+endif
+if HAVE_NSSI
+dist_libadiosread_a_SOURCES = adios_nssi_args.x
+nodist_libadiosread_a_SOURCES = adios_nssi_args.c adios_nssi_args.h
+libadiosread_a_SOURCES += adios_nssi_config.c read_nssi.c
+libadiosread_a_CPPFLAGS += -DPTL_IFACE_CLIENT=CRAY_USER_NAL -DPTL_IFACE_SERVER=CRAY_USER_NAL
+#libadiosread_a_CPPFLAGS += $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_CPPFLAGS) # -DUSE_TIMERS
+libadiosread_a_CFLAGS   += $(ADIOSLIB_CFLAGS) 
+endif
+
+libadiosread_a_CPPFLAGS += $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSREADLIB_CPPFLAGS)
 
 if BUILD_FORTRAN
 lib_LIBRARIES += libadiosreadf.a
@@ -211,6 +276,7 @@ libadiosreadf_a_SOURCES = adios_bp_v1.c \
                       adios_read_hooks.c \
                       common_read.c \
                       read_bp.c \
+                      read_bp_staged.c \
                       globals.c
                       
 if HAVE_DART
@@ -219,8 +285,19 @@ endif
 if HAVE_DIMES
 libadiosreadf_a_SOURCES += read_dimes.c
 endif
+if HAVE_DATATAP
+libadiosreadf_a_SOURCES += read_datatap.c
+endif
+if HAVE_NSSI
+dist_libadiosreadf_a_SOURCES = adios_nssi_args.x
+nodist_libadiosreadf_a_SOURCES = adios_nssi_args.c adios_nssi_args.h
+libadiosreadf_a_SOURCES += adios_nssi_config.c read_nssi.c
+libadiosreadf_a_CPPFLAGS += -DPTL_IFACE_CLIENT=CRAY_USER_NAL -DPTL_IFACE_SERVER=CRAY_USER_NAL
+#libadiosreadf_a_CPPFLAGS += $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_CPPFLAGS) # -DUSE_TIMERS
+libadiosreadf_a_CFLAGS   += $(ADIOSLIB_CFLAGS) 
+endif
 
-libadiosreadf_a_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSREADLIB_CPPFLAGS)
+libadiosreadf_a_CPPFLAGS += $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSREADLIB_CPPFLAGS)
 
 # adiosf_read.mod is not really usable, 
 # so it is not used and installed right now
@@ -250,6 +327,17 @@ endif
 if HAVE_DIMES
 libadiosread_nompi_a_SOURCES += read_dimes.c
 endif
+if HAVE_DATATAP
+libadiosread_nompi_a_SOURCES += read_datatap.c
+endif
+if HAVE_NSSI
+dist_libadiosread_nompi_a_SOURCES = adios_nssi_args.x
+nodist_libadiosread_nompi_a_SOURCES = adios_nssi_args.c adios_nssi_args.h
+libadiosread_nompi_a_SOURCES += adios_nssi_config.c read_nssi.c
+libadiosread_nompi_a_CPPFLAGS += -DPTL_IFACE_CLIENT=CRAY_USER_NAL -DPTL_IFACE_SERVER=CRAY_USER_NAL
+libadiosread_nompi_a_CPPFLAGS += $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_CPPFLAGS) # -DUSE_TIMERS
+libadiosread_nompi_a_CFLAGS   += $(ADIOSLIB_CFLAGS) 
+endif
 # Note: utils/adios_lint needs to link with adios_internals_mxml.o which depends
 #       on adios_internals.c, buffer.c and adios_transport_hooks.c. 
 #       We put these objects in libadiosread_nompi
@@ -265,14 +353,26 @@ libadiosreadf_nompi_a_SOURCES = mpidummy.c\
                                 adiosf_read.c \
                                 adios_read_hooks.c \
                                 common_read.c \
-                                read_bp.c 
+                                read_bp.c \
+                                globals.c 
 if HAVE_DART
 libadiosreadf_nompi_a_SOURCES += read_dart.c
 endif
 if HAVE_DIMES
 libadiosreadf_nompi_a_SOURCES += read_dimes.c
 endif
+if HAVE_DATATAP
+libadiosread_nompi_a_SOURCES += read_datatap.c
+endif
+if HAVE_NSSI
+dist_libadiosreadf_nompi_a_SOURCES = adios_nssi_args.x
+nodist_libadiosreadf_nompi_a_SOURCES = adios_nssi_args.c adios_nssi_args.h
+libadiosreadf_nompi_a_SOURCES += adios_nssi_config.c read_nssi.c
+libadiosreadf_nompi_a_CPPFLAGS += -DPTL_IFACE_CLIENT=CRAY_USER_NAL -DPTL_IFACE_SERVER=CRAY_USER_NAL
+libadiosreadf_nompi_a_CPPFLAGS += $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_CPPFLAGS) # -DUSE_TIMERS
+libadiosreadf_nompi_a_CFLAGS   += $(ADIOSLIB_CFLAGS) 
 endif
+endif  #BUILD_FORTRAN
 
 noinst_LIBRARIES = libadios_internal_nompi.a
 libadios_internal_nompi_a_SOURCES = mpidummy.c \
@@ -286,9 +386,9 @@ libadios_internal_nompi_a_SOURCES = mpidummy.c \
                                     adios_internals_mxml.c
 
 
-libadiosread_nompi_a_CPPFLAGS = -D_NOMPI $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSREADLIB_CPPFLAGS)
-libadiosreadf_nompi_a_CPPFLAGS = -D_NOMPI $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSREADLIB_CPPFLAGS)
-libadios_internal_nompi_a_CPPFLAGS = -D_NOMPI $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_SEQ_CPPFLAGS)
+libadiosread_nompi_a_CPPFLAGS  += -D_NOMPI $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSREADLIB_CPPFLAGS)
+libadiosreadf_nompi_a_CPPFLAGS += -D_NOMPI $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSREADLIB_CPPFLAGS)
+libadios_internal_nompi_a_CPPFLAGS = -D_INTERNAL $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_INT_CPPFLAGS) $(ADIOSLIB_CPPFLAGS)
 #Note: -DNOMPI chokes IBM's bgxlf compiler but it can pass -D_NOMPI. 
 
 if HAVE_DMALLOC
@@ -327,5 +427,6 @@ CXX=$(MPICXX)
 EXTRA_DIST = adios_bp_v1.h adios_endianness.h adios_error.h \
              adios_internals.h adios_internals_mxml.h \
              adios_nssi_config.h adios_socket.h adios_transport_hooks.h aggregation.h \
-             bp_types.h bp_utils.h buffer.h common_adios.h common_read.h futils.h globals.h 
+             bp_types.h bp_utils.h buffer.h common_adios.h common_read.h futils.h globals.h \
+             ds_metadata.h
 
diff --git a/src/Makefile.in b/src/Makefile.in
index e1f225a..a317cca 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -39,27 +39,31 @@ POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
 bin_PROGRAMS = $(am__EXEEXT_1)
- at HAVE_NSSI_TRUE@am__append_1 = nssi-staging-server
- at BUILD_WRITE_TRUE@am__append_2 = libadios.a
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE at am__append_3 = libadiosf.a
+ at HAVE_NSSI_TRUE@am__append_1 = nssi-staging-server \
+ at HAVE_NSSI_TRUE@	nssi-coupling-server
+ at BUILD_WRITE_TRUE@am__append_2 = libadios.a libadios_nompi.a
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE at am__append_3 = libadiosf.a 
 @BUILD_WRITE_TRUE@@HAVE_DART_TRUE at am__append_4 = adios_dart.c read_dart.c
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_DART_TRUE at am__append_5 = adios_dart.c read_dart.c
- at BUILD_WRITE_TRUE@@HAVE_DIMES_TRUE at am__append_6 = adios_dimes.c read_dimes.c
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_DIMES_TRUE at am__append_7 = adios_dimes.c read_dimes.c
- at BUILD_WRITE_TRUE@@HAVE_DATATAP_TRUE at am__append_8 = adios_datatap.c
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_DATATAP_TRUE at am__append_9 = adios_datatap.c
- at BUILD_WRITE_TRUE@@HAVE_PHDF5_TRUE at am__append_10 = adios_phdf5.c 
- at BUILD_WRITE_TRUE@@HAVE_PHDF5_TRUE at am__append_11 = -DPHDF5 -DH5_USE_16_API 
- at BUILD_WRITE_TRUE@@HAVE_PHDF5_TRUE at am__append_12 = $(PHDF5_CPPFLAGS)
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_PHDF5_TRUE at am__append_13 = adios_phdf5.c 
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_PHDF5_TRUE at am__append_14 = $(PHDF5_CPPFLAGS)
- at BUILD_WRITE_TRUE@@HAVE_NC4PAR_TRUE at am__append_15 = adios_nc4.c 
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_NC4PAR_TRUE at am__append_16 = adios_nc4.c 
- at BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE at am__append_17 = adios_nssi_config.c adios_nssi.c adios_nssi_filter.c
- at BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE at am__append_18 = -DPTL_IFACE_CLIENT=CRAY_USER_NAL -DPTL_IFACE_SERVER=CRAY_USER_NAL
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE at am__append_19 = adios_nssi_config.c adios_nssi.c adios_nssi_filter.c
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE at am__append_20 = -DPTL_IFACE_CLIENT=CRAY_USER_NAL -DPTL_IFACE_SERVER=CRAY_USER_NAL
- at BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE at am__append_21 = adios_mpi_stagger.c \
+ at BUILD_WRITE_TRUE@@HAVE_DART_TRUE at am__append_5 = adios_dart.c read_dart.c
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_DART_TRUE at am__append_6 = adios_dart.c read_dart.c
+ at BUILD_WRITE_TRUE@@HAVE_DIMES_TRUE at am__append_7 = adios_dimes.c read_dimes.c
+ at BUILD_WRITE_TRUE@@HAVE_DIMES_TRUE at am__append_8 = adios_dimes.c read_dimes.c
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_DIMES_TRUE at am__append_9 = adios_dimes.c read_dimes.c
+ at BUILD_WRITE_TRUE@@HAVE_DATATAP_TRUE at am__append_10 = adios_datatap.c read_datatap.c
+ at BUILD_WRITE_TRUE@@HAVE_DATATAP_TRUE at am__append_11 = adios_datatap.c read_datatap.c
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_DATATAP_TRUE at am__append_12 = adios_datatap.c read_datatap.c
+ at BUILD_WRITE_TRUE@@HAVE_PHDF5_TRUE at am__append_13 = adios_phdf5.c 
+ at BUILD_WRITE_TRUE@@HAVE_PHDF5_TRUE at am__append_14 = -DPHDF5 -DH5_USE_16_API 
+ at BUILD_WRITE_TRUE@@HAVE_PHDF5_TRUE at am__append_15 = $(PHDF5_CPPFLAGS)
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_PHDF5_TRUE at am__append_16 = adios_phdf5.c 
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_PHDF5_TRUE at am__append_17 = $(PHDF5_CPPFLAGS)
+ at BUILD_WRITE_TRUE@@HAVE_NC4PAR_TRUE at am__append_18 = adios_nc4.c 
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_NC4PAR_TRUE at am__append_19 = adios_nc4.c 
+ at BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE at am__append_20 = adios_nssi_config.c adios_nssi.c adios_nssi_filter.c read_nssi.c
+ at BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE at am__append_21 = -DPTL_IFACE_CLIENT=CRAY_USER_NAL -DPTL_IFACE_SERVER=CRAY_USER_NAL
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE at am__append_22 = adios_nssi_config.c adios_nssi.c adios_nssi_filter.c read_nssi.c
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE at am__append_23 = -DPTL_IFACE_CLIENT=CRAY_USER_NAL -DPTL_IFACE_SERVER=CRAY_USER_NAL
+ at BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE at am__append_24 = adios_mpi_stagger.c \
 @BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE@                      adios_mpi_aggregate.c \
 @BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE@                      adios_provenance.c \
 @BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE@                      adios_mpi_cio.c \
@@ -67,7 +71,7 @@ bin_PROGRAMS = $(am__EXEEXT_1)
 @BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE@                      adios_mpi_amr1.c \
 @BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE@                      adios_adaptive.c 
 
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE at am__append_22 = adios_mpi_stagger.c \
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE at am__append_25 = adios_mpi_stagger.c \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE@                       adios_mpi_aggregate.c \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE@                       adios_provenance.c \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE@                       adios_mpi_cio.c \
@@ -75,25 +79,52 @@ bin_PROGRAMS = $(am__EXEEXT_1)
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE@                       adios_mpi_amr1.c \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE@                       adios_adaptive.c 
 
- at BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_FALSE at am__append_23 = -DNO_RESEARCH_TRANSPORTS
- at BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_FALSE at am__append_24 = -DNO_RESEARCH_TRANSPORTS
- at HAVE_DART_TRUE@am__append_25 = read_dart.c
- at HAVE_DIMES_TRUE@am__append_26 = read_dimes.c
- at BUILD_FORTRAN_TRUE@am__append_27 = libadiosreadf.a
- at BUILD_FORTRAN_TRUE@@HAVE_DART_TRUE at am__append_28 = read_dart.c
- at BUILD_FORTRAN_TRUE@@HAVE_DIMES_TRUE at am__append_29 = read_dimes.c
- at HAVE_DART_TRUE@am__append_30 = read_dart.c
- at HAVE_DIMES_TRUE@am__append_31 = read_dimes.c
+ at BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_FALSE at am__append_26 = -DNO_RESEARCH_TRANSPORTS
+ at BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_FALSE at am__append_27 = -DNO_RESEARCH_TRANSPORTS
+ at BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_FALSE at am__append_28 = -DNO_RESEARCH_TRANSPORTS
+ at HAVE_DART_TRUE@am__append_29 = read_dart.c
+ at HAVE_DIMES_TRUE@am__append_30 = read_dimes.c
+ at HAVE_DATATAP_TRUE@am__append_31 = read_datatap.c
+ at HAVE_NSSI_TRUE@am__append_32 = adios_nssi_config.c read_nssi.c
+ at HAVE_NSSI_TRUE@am__append_33 = -DPTL_IFACE_CLIENT=CRAY_USER_NAL -DPTL_IFACE_SERVER=CRAY_USER_NAL
+#libadiosread_a_CPPFLAGS += $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_CPPFLAGS) # -DUSE_TIMERS
+ at HAVE_NSSI_TRUE@am__append_34 = $(ADIOSLIB_CFLAGS) 
+ at BUILD_FORTRAN_TRUE@am__append_35 = libadiosreadf.a
+ at BUILD_FORTRAN_TRUE@@HAVE_DART_TRUE at am__append_36 = read_dart.c
+ at BUILD_FORTRAN_TRUE@@HAVE_DIMES_TRUE at am__append_37 = read_dimes.c
+ at BUILD_FORTRAN_TRUE@@HAVE_DATATAP_TRUE at am__append_38 = read_datatap.c
+ at BUILD_FORTRAN_TRUE@@HAVE_NSSI_TRUE at am__append_39 = adios_nssi_config.c read_nssi.c
+ at BUILD_FORTRAN_TRUE@@HAVE_NSSI_TRUE at am__append_40 = -DPTL_IFACE_CLIENT=CRAY_USER_NAL -DPTL_IFACE_SERVER=CRAY_USER_NAL
+#libadiosreadf_a_CPPFLAGS += $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_CPPFLAGS) # -DUSE_TIMERS
+ at BUILD_FORTRAN_TRUE@@HAVE_NSSI_TRUE at am__append_41 = $(ADIOSLIB_CFLAGS) 
+ at BUILD_FORTRAN_TRUE@am__append_42 = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSREADLIB_CPPFLAGS)
+ at HAVE_DART_TRUE@am__append_43 = read_dart.c
+ at HAVE_DIMES_TRUE@am__append_44 = read_dimes.c
+ at HAVE_DATATAP_TRUE@am__append_45 = read_datatap.c
+ at HAVE_NSSI_TRUE@am__append_46 = adios_nssi_config.c read_nssi.c
+ at HAVE_NSSI_TRUE@am__append_47 = -DPTL_IFACE_CLIENT=CRAY_USER_NAL \
+ at HAVE_NSSI_TRUE@	-DPTL_IFACE_SERVER=CRAY_USER_NAL \
+ at HAVE_NSSI_TRUE@	$(ADIOSLIB_EXTRA_CPPFLAGS) \
+ at HAVE_NSSI_TRUE@	$(ADIOSLIB_CPPFLAGS) # -DUSE_TIMERS
+ at HAVE_NSSI_TRUE@am__append_48 = $(ADIOSLIB_CFLAGS) 
 # Note: utils/adios_lint needs to link with adios_internals_mxml.o which depends
 #       on adios_internals.c, buffer.c and adios_transport_hooks.c. 
 #       We put these objects in libadiosread_nompi
 #       so we do not need to make another _nompi lib just for adios_lint
- at BUILD_FORTRAN_TRUE@am__append_32 = libadiosreadf_nompi.a
- at BUILD_FORTRAN_TRUE@@HAVE_DART_TRUE at am__append_33 = read_dart.c
- at BUILD_FORTRAN_TRUE@@HAVE_DIMES_TRUE at am__append_34 = read_dimes.c
+ at BUILD_FORTRAN_TRUE@am__append_49 = libadiosreadf_nompi.a
+ at BUILD_FORTRAN_TRUE@@HAVE_DART_TRUE at am__append_50 = read_dart.c
+ at BUILD_FORTRAN_TRUE@@HAVE_DIMES_TRUE at am__append_51 = read_dimes.c
+ at BUILD_FORTRAN_TRUE@@HAVE_DATATAP_TRUE at am__append_52 = read_datatap.c
+ at BUILD_FORTRAN_TRUE@@HAVE_NSSI_TRUE at am__append_53 = adios_nssi_config.c read_nssi.c
+ at BUILD_FORTRAN_TRUE@@HAVE_NSSI_TRUE at am__append_54 = -DPTL_IFACE_CLIENT=CRAY_USER_NAL \
+ at BUILD_FORTRAN_TRUE@@HAVE_NSSI_TRUE@	-DPTL_IFACE_SERVER=CRAY_USER_NAL \
+ at BUILD_FORTRAN_TRUE@@HAVE_NSSI_TRUE@	$(ADIOSLIB_EXTRA_CPPFLAGS) \
+ at BUILD_FORTRAN_TRUE@@HAVE_NSSI_TRUE@	$(ADIOSLIB_CPPFLAGS) # \
+ at BUILD_FORTRAN_TRUE@@HAVE_NSSI_TRUE@	-DUSE_TIMERS
+ at BUILD_FORTRAN_TRUE@@HAVE_NSSI_TRUE at am__append_55 = $(ADIOSLIB_CFLAGS) 
 #Note: -DNOMPI chokes IBM's bgxlf compiler but it can pass -D_NOMPI. 
- at HAVE_DMALLOC_TRUE@am__append_35 = -DDMALLOC 
- at HAVE_DMALLOC_TRUE@am__append_36 = -DDMALLOC 
+ at HAVE_DMALLOC_TRUE@am__append_56 = -DDMALLOC 
+ at HAVE_DMALLOC_TRUE@am__append_57 = -DDMALLOC 
 subdir = src
 DIST_COMMON = $(include_HEADERS) $(srcdir)/Makefile.am \
 	$(srcdir)/Makefile.in
@@ -104,6 +135,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -138,21 +170,24 @@ am__libadios_a_SOURCES_DIST = adios.c common_adios.c \
 	adios_internals_mxml.c buffer.c adios_socket.c adios_bp_v1.c \
 	adios_endianness.c bp_utils.c futils.c adios_error.c \
 	adios_read.c adios_read_hooks.c common_read.c read_bp.c \
-	globals.c adios_dart.c read_dart.c adios_dimes.c read_dimes.c \
-	adios_datatap.c adios_phdf5.c adios_nc4.c adios_nssi_config.c \
-	adios_nssi.c adios_nssi_filter.c adios_mpi_stagger.c \
+	read_bp_staged.c globals.c adios_dart.c read_dart.c \
+	adios_dimes.c read_dimes.c adios_datatap.c read_datatap.c \
+	adios_phdf5.c adios_nc4.c adios_nssi_config.c adios_nssi.c \
+	adios_nssi_filter.c read_nssi.c adios_mpi_stagger.c \
 	adios_mpi_aggregate.c adios_provenance.c adios_mpi_cio.c \
 	adios_mpi_stripe.c adios_mpi_amr1.c adios_adaptive.c
 @BUILD_WRITE_TRUE@@HAVE_DART_TRUE at am__objects_1 = libadios_a-adios_dart.$(OBJEXT) \
 @BUILD_WRITE_TRUE@@HAVE_DART_TRUE@	libadios_a-read_dart.$(OBJEXT)
 @BUILD_WRITE_TRUE@@HAVE_DIMES_TRUE at am__objects_2 = libadios_a-adios_dimes.$(OBJEXT) \
 @BUILD_WRITE_TRUE@@HAVE_DIMES_TRUE@	libadios_a-read_dimes.$(OBJEXT)
- at BUILD_WRITE_TRUE@@HAVE_DATATAP_TRUE at am__objects_3 = libadios_a-adios_datatap.$(OBJEXT)
+ at BUILD_WRITE_TRUE@@HAVE_DATATAP_TRUE at am__objects_3 = libadios_a-adios_datatap.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@@HAVE_DATATAP_TRUE@	libadios_a-read_datatap.$(OBJEXT)
 @BUILD_WRITE_TRUE@@HAVE_PHDF5_TRUE at am__objects_4 = libadios_a-adios_phdf5.$(OBJEXT)
 @BUILD_WRITE_TRUE@@HAVE_NC4PAR_TRUE at am__objects_5 = libadios_a-adios_nc4.$(OBJEXT)
 @BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE at am__objects_6 = libadios_a-adios_nssi_config.$(OBJEXT) \
 @BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE@	libadios_a-adios_nssi.$(OBJEXT) \
- at BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE@	libadios_a-adios_nssi_filter.$(OBJEXT)
+ at BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE@	libadios_a-adios_nssi_filter.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE@	libadios_a-read_nssi.$(OBJEXT)
 @BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE at am__objects_7 = libadios_a-adios_mpi_stagger.$(OBJEXT) \
 @BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE@	libadios_a-adios_mpi_aggregate.$(OBJEXT) \
 @BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE@	libadios_a-adios_provenance.$(OBJEXT) \
@@ -181,6 +216,7 @@ am__libadios_a_SOURCES_DIST = adios.c common_adios.c \
 @BUILD_WRITE_TRUE@	libadios_a-adios_read_hooks.$(OBJEXT) \
 @BUILD_WRITE_TRUE@	libadios_a-common_read.$(OBJEXT) \
 @BUILD_WRITE_TRUE@	libadios_a-read_bp.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	libadios_a-read_bp_staged.$(OBJEXT) \
 @BUILD_WRITE_TRUE@	libadios_a-globals.$(OBJEXT) \
 @BUILD_WRITE_TRUE@	$(am__objects_1) $(am__objects_2) \
 @BUILD_WRITE_TRUE@	$(am__objects_3) $(am__objects_4) \
@@ -205,6 +241,47 @@ am_libadios_internal_nompi_a_OBJECTS =  \
 	libadios_internal_nompi_a-adios_internals_mxml.$(OBJEXT)
 libadios_internal_nompi_a_OBJECTS =  \
 	$(am_libadios_internal_nompi_a_OBJECTS)
+libadios_nompi_a_AR = $(AR) $(ARFLAGS)
+libadios_nompi_a_LIBADD =
+am__libadios_nompi_a_SOURCES_DIST = adios.c common_adios.c \
+	adios_transport_hooks.c adios_posix.c adios_posix1.c \
+	adios_internals.c adios_internals_mxml.c buffer.c \
+	adios_socket.c adios_bp_v1.c adios_endianness.c bp_utils.c \
+	futils.c adios_error.c adios_read.c adios_read_hooks.c \
+	common_read.c read_bp.c read_bp_staged.c globals.c mpidummy.c \
+	adios_dart.c read_dart.c adios_dimes.c read_dimes.c \
+	adios_datatap.c read_datatap.c
+ at BUILD_WRITE_TRUE@@HAVE_DART_TRUE at am__objects_8 = libadios_nompi_a-adios_dart.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@@HAVE_DART_TRUE@	libadios_nompi_a-read_dart.$(OBJEXT)
+ at BUILD_WRITE_TRUE@@HAVE_DIMES_TRUE at am__objects_9 = libadios_nompi_a-adios_dimes.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@@HAVE_DIMES_TRUE@	libadios_nompi_a-read_dimes.$(OBJEXT)
+ at BUILD_WRITE_TRUE@@HAVE_DATATAP_TRUE at am__objects_10 = libadios_nompi_a-adios_datatap.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@@HAVE_DATATAP_TRUE@	libadios_nompi_a-read_datatap.$(OBJEXT)
+ at BUILD_WRITE_TRUE@am_libadios_nompi_a_OBJECTS =  \
+ at BUILD_WRITE_TRUE@	libadios_nompi_a-adios.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	libadios_nompi_a-common_adios.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	libadios_nompi_a-adios_transport_hooks.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	libadios_nompi_a-adios_posix.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	libadios_nompi_a-adios_posix1.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	libadios_nompi_a-adios_internals.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	libadios_nompi_a-adios_internals_mxml.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	libadios_nompi_a-buffer.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	libadios_nompi_a-adios_socket.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	libadios_nompi_a-adios_bp_v1.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	libadios_nompi_a-adios_endianness.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	libadios_nompi_a-bp_utils.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	libadios_nompi_a-futils.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	libadios_nompi_a-adios_error.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	libadios_nompi_a-adios_read.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	libadios_nompi_a-adios_read_hooks.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	libadios_nompi_a-common_read.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	libadios_nompi_a-read_bp.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	libadios_nompi_a-read_bp_staged.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	libadios_nompi_a-globals.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	libadios_nompi_a-mpidummy.$(OBJEXT) \
+ at BUILD_WRITE_TRUE@	$(am__objects_8) $(am__objects_9) \
+ at BUILD_WRITE_TRUE@	$(am__objects_10)
+libadios_nompi_a_OBJECTS = $(am_libadios_nompi_a_OBJECTS)
 libadiosf_a_AR = $(AR) $(ARFLAGS)
 libadiosf_a_LIBADD =
 am__libadiosf_a_SOURCES_DIST = adiosf.c common_adios.c \
@@ -213,22 +290,25 @@ am__libadiosf_a_SOURCES_DIST = adiosf.c common_adios.c \
 	adios_internals_mxml.c buffer.c adios_socket.c adios_bp_v1.c \
 	adios_endianness.c futils.c adios_error.c bp_utils.c \
 	adiosf_read.c adios_read_hooks.c common_read.c read_bp.c \
-	globals.c adios_dart.c read_dart.c adios_dimes.c read_dimes.c \
-	adios_datatap.c adios_phdf5.c adios_nc4.c adios_nssi_config.c \
-	adios_nssi.c adios_nssi_filter.c adios_mpi_stagger.c \
+	read_bp_staged.c globals.c adios_dart.c read_dart.c \
+	adios_dimes.c read_dimes.c adios_datatap.c read_datatap.c \
+	adios_phdf5.c adios_nc4.c adios_nssi_config.c adios_nssi.c \
+	adios_nssi_filter.c read_nssi.c adios_mpi_stagger.c \
 	adios_mpi_aggregate.c adios_provenance.c adios_mpi_cio.c \
 	adios_mpi_stripe.c adios_mpi_amr1.c adios_adaptive.c
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_DART_TRUE at am__objects_8 = libadiosf_a-adios_dart.$(OBJEXT) \
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_DART_TRUE at am__objects_11 = libadiosf_a-adios_dart.$(OBJEXT) \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_DART_TRUE@	libadiosf_a-read_dart.$(OBJEXT)
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_DIMES_TRUE at am__objects_9 = libadiosf_a-adios_dimes.$(OBJEXT) \
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_DIMES_TRUE at am__objects_12 = libadiosf_a-adios_dimes.$(OBJEXT) \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_DIMES_TRUE@	libadiosf_a-read_dimes.$(OBJEXT)
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_DATATAP_TRUE at am__objects_10 = libadiosf_a-adios_datatap.$(OBJEXT)
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_PHDF5_TRUE at am__objects_11 = libadiosf_a-adios_phdf5.$(OBJEXT)
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_NC4PAR_TRUE at am__objects_12 = libadiosf_a-adios_nc4.$(OBJEXT)
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE at am__objects_13 = libadiosf_a-adios_nssi_config.$(OBJEXT) \
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_DATATAP_TRUE at am__objects_13 = libadiosf_a-adios_datatap.$(OBJEXT) \
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_DATATAP_TRUE@	libadiosf_a-read_datatap.$(OBJEXT)
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_PHDF5_TRUE at am__objects_14 = libadiosf_a-adios_phdf5.$(OBJEXT)
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_NC4PAR_TRUE at am__objects_15 = libadiosf_a-adios_nc4.$(OBJEXT)
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE at am__objects_16 = libadiosf_a-adios_nssi_config.$(OBJEXT) \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE@	libadiosf_a-adios_nssi.$(OBJEXT) \
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE@	libadiosf_a-adios_nssi_filter.$(OBJEXT)
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE at am__objects_14 = libadiosf_a-adios_mpi_stagger.$(OBJEXT) \
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE@	libadiosf_a-adios_nssi_filter.$(OBJEXT) \
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE@	libadiosf_a-read_nssi.$(OBJEXT)
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE at am__objects_17 = libadiosf_a-adios_mpi_stagger.$(OBJEXT) \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE@	libadiosf_a-adios_mpi_aggregate.$(OBJEXT) \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE@	libadiosf_a-adios_provenance.$(OBJEXT) \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@RESEARCH_TRANSPORTS_TRUE@	libadiosf_a-adios_mpi_cio.$(OBJEXT) \
@@ -256,14 +336,15 @@ am__libadiosf_a_SOURCES_DIST = adiosf.c common_adios.c \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	libadiosf_a-adios_read_hooks.$(OBJEXT) \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	libadiosf_a-common_read.$(OBJEXT) \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	libadiosf_a-read_bp.$(OBJEXT) \
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	libadiosf_a-read_bp_staged.$(OBJEXT) \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	libadiosf_a-globals.$(OBJEXT) \
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__objects_8) \
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__objects_9) \
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__objects_10) \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__objects_11) \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__objects_12) \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__objects_13) \
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__objects_14)
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__objects_14) \
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__objects_15) \
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__objects_16) \
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__objects_17)
 am__dist_libadiosf_a_SOURCES_DIST = adios_nssi_args.x
 dist_libadiosf_a_OBJECTS =
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE at nodist_libadiosf_a_OBJECTS = libadiosf_a-adios_nssi_args.$(OBJEXT)
@@ -273,10 +354,16 @@ libadiosread_a_AR = $(AR) $(ARFLAGS)
 libadiosread_a_LIBADD =
 am__libadiosread_a_SOURCES_DIST = adios_bp_v1.c adios_endianness.c \
 	bp_utils.c futils.c adios_error.c adios_read.c \
-	adios_read_hooks.c common_read.c read_bp.c globals.c \
-	read_dart.c read_dimes.c
- at HAVE_DART_TRUE@am__objects_15 = libadiosread_a-read_dart.$(OBJEXT)
- at HAVE_DIMES_TRUE@am__objects_16 = libadiosread_a-read_dimes.$(OBJEXT)
+	adios_read_hooks.c common_read.c read_bp.c read_bp_staged.c \
+	globals.c read_dart.c read_dimes.c read_datatap.c \
+	adios_nssi_config.c read_nssi.c
+ at HAVE_DART_TRUE@am__objects_18 = libadiosread_a-read_dart.$(OBJEXT)
+ at HAVE_DIMES_TRUE@am__objects_19 = libadiosread_a-read_dimes.$(OBJEXT)
+ at HAVE_DATATAP_TRUE@am__objects_20 =  \
+ at HAVE_DATATAP_TRUE@	libadiosread_a-read_datatap.$(OBJEXT)
+ at HAVE_NSSI_TRUE@am__objects_21 =  \
+ at HAVE_NSSI_TRUE@	libadiosread_a-adios_nssi_config.$(OBJEXT) \
+ at HAVE_NSSI_TRUE@	libadiosread_a-read_nssi.$(OBJEXT)
 am_libadiosread_a_OBJECTS = libadiosread_a-adios_bp_v1.$(OBJEXT) \
 	libadiosread_a-adios_endianness.$(OBJEXT) \
 	libadiosread_a-bp_utils.$(OBJEXT) \
@@ -286,20 +373,32 @@ am_libadiosread_a_OBJECTS = libadiosread_a-adios_bp_v1.$(OBJEXT) \
 	libadiosread_a-adios_read_hooks.$(OBJEXT) \
 	libadiosread_a-common_read.$(OBJEXT) \
 	libadiosread_a-read_bp.$(OBJEXT) \
-	libadiosread_a-globals.$(OBJEXT) $(am__objects_15) \
-	$(am__objects_16)
-libadiosread_a_OBJECTS = $(am_libadiosread_a_OBJECTS)
+	libadiosread_a-read_bp_staged.$(OBJEXT) \
+	libadiosread_a-globals.$(OBJEXT) $(am__objects_18) \
+	$(am__objects_19) $(am__objects_20) $(am__objects_21)
+am__dist_libadiosread_a_SOURCES_DIST = adios_nssi_args.x
+dist_libadiosread_a_OBJECTS =
+ at HAVE_NSSI_TRUE@nodist_libadiosread_a_OBJECTS =  \
+ at HAVE_NSSI_TRUE@	libadiosread_a-adios_nssi_args.$(OBJEXT)
+libadiosread_a_OBJECTS = $(am_libadiosread_a_OBJECTS) \
+	$(dist_libadiosread_a_OBJECTS) \
+	$(nodist_libadiosread_a_OBJECTS)
 libadiosread_nompi_a_AR = $(AR) $(ARFLAGS)
 libadiosread_nompi_a_LIBADD =
 am__libadiosread_nompi_a_SOURCES_DIST = mpidummy.c adios_bp_v1.c \
 	adios_endianness.c bp_utils.c futils.c adios_error.c \
 	adios_read.c adios_read_hooks.c common_read.c read_bp.c \
 	adios_internals.c buffer.c adios_transport_hooks.c globals.c \
-	read_dart.c read_dimes.c
- at HAVE_DART_TRUE@am__objects_17 =  \
+	read_dart.c read_dimes.c read_datatap.c adios_nssi_config.c \
+	read_nssi.c
+ at HAVE_DART_TRUE@am__objects_22 =  \
 @HAVE_DART_TRUE@	libadiosread_nompi_a-read_dart.$(OBJEXT)
- at HAVE_DIMES_TRUE@am__objects_18 =  \
+ at HAVE_DIMES_TRUE@am__objects_23 =  \
 @HAVE_DIMES_TRUE@	libadiosread_nompi_a-read_dimes.$(OBJEXT)
+ at HAVE_DATATAP_TRUE@am__objects_24 = libadiosread_nompi_a-read_datatap.$(OBJEXT)
+ at HAVE_NSSI_TRUE@am__objects_25 = libadiosread_nompi_a-adios_nssi_config.$(OBJEXT) \
+ at HAVE_NSSI_TRUE@	libadiosread_nompi_a-read_nssi.$(OBJEXT)
+ at BUILD_FORTRAN_TRUE@@HAVE_DATATAP_TRUE at am__objects_26 = libadiosread_nompi_a-read_datatap.$(OBJEXT)
 am_libadiosread_nompi_a_OBJECTS =  \
 	libadiosread_nompi_a-mpidummy.$(OBJEXT) \
 	libadiosread_nompi_a-adios_bp_v1.$(OBJEXT) \
@@ -314,17 +413,27 @@ am_libadiosread_nompi_a_OBJECTS =  \
 	libadiosread_nompi_a-adios_internals.$(OBJEXT) \
 	libadiosread_nompi_a-buffer.$(OBJEXT) \
 	libadiosread_nompi_a-adios_transport_hooks.$(OBJEXT) \
-	libadiosread_nompi_a-globals.$(OBJEXT) $(am__objects_17) \
-	$(am__objects_18)
-libadiosread_nompi_a_OBJECTS = $(am_libadiosread_nompi_a_OBJECTS)
+	libadiosread_nompi_a-globals.$(OBJEXT) $(am__objects_22) \
+	$(am__objects_23) $(am__objects_24) $(am__objects_25) \
+	$(am__objects_26)
+am__dist_libadiosread_nompi_a_SOURCES_DIST = adios_nssi_args.x
+dist_libadiosread_nompi_a_OBJECTS =
+ at HAVE_NSSI_TRUE@nodist_libadiosread_nompi_a_OBJECTS = libadiosread_nompi_a-adios_nssi_args.$(OBJEXT)
+libadiosread_nompi_a_OBJECTS = $(am_libadiosread_nompi_a_OBJECTS) \
+	$(dist_libadiosread_nompi_a_OBJECTS) \
+	$(nodist_libadiosread_nompi_a_OBJECTS)
 libadiosreadf_a_AR = $(AR) $(ARFLAGS)
 libadiosreadf_a_LIBADD =
 am__libadiosreadf_a_SOURCES_DIST = adios_bp_v1.c adios_endianness.c \
 	bp_utils.c futils.c adios_error.c adiosf_read.c \
-	adios_read_hooks.c common_read.c read_bp.c globals.c \
-	read_dart.c read_dimes.c
- at BUILD_FORTRAN_TRUE@@HAVE_DART_TRUE at am__objects_19 = libadiosreadf_a-read_dart.$(OBJEXT)
- at BUILD_FORTRAN_TRUE@@HAVE_DIMES_TRUE at am__objects_20 = libadiosreadf_a-read_dimes.$(OBJEXT)
+	adios_read_hooks.c common_read.c read_bp.c read_bp_staged.c \
+	globals.c read_dart.c read_dimes.c read_datatap.c \
+	adios_nssi_config.c read_nssi.c
+ at BUILD_FORTRAN_TRUE@@HAVE_DART_TRUE at am__objects_27 = libadiosreadf_a-read_dart.$(OBJEXT)
+ at BUILD_FORTRAN_TRUE@@HAVE_DIMES_TRUE at am__objects_28 = libadiosreadf_a-read_dimes.$(OBJEXT)
+ at BUILD_FORTRAN_TRUE@@HAVE_DATATAP_TRUE at am__objects_29 = libadiosreadf_a-read_datatap.$(OBJEXT)
+ at BUILD_FORTRAN_TRUE@@HAVE_NSSI_TRUE at am__objects_30 = libadiosreadf_a-adios_nssi_config.$(OBJEXT) \
+ at BUILD_FORTRAN_TRUE@@HAVE_NSSI_TRUE@	libadiosreadf_a-read_nssi.$(OBJEXT)
 @BUILD_FORTRAN_TRUE at am_libadiosreadf_a_OBJECTS =  \
 @BUILD_FORTRAN_TRUE@	libadiosreadf_a-adios_bp_v1.$(OBJEXT) \
 @BUILD_FORTRAN_TRUE@	libadiosreadf_a-adios_endianness.$(OBJEXT) \
@@ -335,17 +444,27 @@ am__libadiosreadf_a_SOURCES_DIST = adios_bp_v1.c adios_endianness.c \
 @BUILD_FORTRAN_TRUE@	libadiosreadf_a-adios_read_hooks.$(OBJEXT) \
 @BUILD_FORTRAN_TRUE@	libadiosreadf_a-common_read.$(OBJEXT) \
 @BUILD_FORTRAN_TRUE@	libadiosreadf_a-read_bp.$(OBJEXT) \
+ at BUILD_FORTRAN_TRUE@	libadiosreadf_a-read_bp_staged.$(OBJEXT) \
 @BUILD_FORTRAN_TRUE@	libadiosreadf_a-globals.$(OBJEXT) \
- at BUILD_FORTRAN_TRUE@	$(am__objects_19) $(am__objects_20)
-libadiosreadf_a_OBJECTS = $(am_libadiosreadf_a_OBJECTS)
+ at BUILD_FORTRAN_TRUE@	$(am__objects_27) $(am__objects_28) \
+ at BUILD_FORTRAN_TRUE@	$(am__objects_29) $(am__objects_30)
+am__dist_libadiosreadf_a_SOURCES_DIST = adios_nssi_args.x
+dist_libadiosreadf_a_OBJECTS =
+ at BUILD_FORTRAN_TRUE@@HAVE_NSSI_TRUE at nodist_libadiosreadf_a_OBJECTS = libadiosreadf_a-adios_nssi_args.$(OBJEXT)
+libadiosreadf_a_OBJECTS = $(am_libadiosreadf_a_OBJECTS) \
+	$(dist_libadiosreadf_a_OBJECTS) \
+	$(nodist_libadiosreadf_a_OBJECTS)
 libadiosreadf_nompi_a_AR = $(AR) $(ARFLAGS)
 libadiosreadf_nompi_a_LIBADD =
 am__libadiosreadf_nompi_a_SOURCES_DIST = mpidummy.c adios_bp_v1.c \
 	adios_endianness.c bp_utils.c futils.c adios_error.c \
 	adiosf_read.c adios_read_hooks.c common_read.c read_bp.c \
-	read_dart.c read_dimes.c
- at BUILD_FORTRAN_TRUE@@HAVE_DART_TRUE at am__objects_21 = libadiosreadf_nompi_a-read_dart.$(OBJEXT)
- at BUILD_FORTRAN_TRUE@@HAVE_DIMES_TRUE at am__objects_22 = libadiosreadf_nompi_a-read_dimes.$(OBJEXT)
+	globals.c read_dart.c read_dimes.c adios_nssi_config.c \
+	read_nssi.c
+ at BUILD_FORTRAN_TRUE@@HAVE_DART_TRUE at am__objects_31 = libadiosreadf_nompi_a-read_dart.$(OBJEXT)
+ at BUILD_FORTRAN_TRUE@@HAVE_DIMES_TRUE at am__objects_32 = libadiosreadf_nompi_a-read_dimes.$(OBJEXT)
+ at BUILD_FORTRAN_TRUE@@HAVE_NSSI_TRUE at am__objects_33 = libadiosreadf_nompi_a-adios_nssi_config.$(OBJEXT) \
+ at BUILD_FORTRAN_TRUE@@HAVE_NSSI_TRUE@	libadiosreadf_nompi_a-read_nssi.$(OBJEXT)
 @BUILD_FORTRAN_TRUE at am_libadiosreadf_nompi_a_OBJECTS =  \
 @BUILD_FORTRAN_TRUE@	libadiosreadf_nompi_a-mpidummy.$(OBJEXT) \
 @BUILD_FORTRAN_TRUE@	libadiosreadf_nompi_a-adios_bp_v1.$(OBJEXT) \
@@ -357,17 +476,31 @@ am__libadiosreadf_nompi_a_SOURCES_DIST = mpidummy.c adios_bp_v1.c \
 @BUILD_FORTRAN_TRUE@	libadiosreadf_nompi_a-adios_read_hooks.$(OBJEXT) \
 @BUILD_FORTRAN_TRUE@	libadiosreadf_nompi_a-common_read.$(OBJEXT) \
 @BUILD_FORTRAN_TRUE@	libadiosreadf_nompi_a-read_bp.$(OBJEXT) \
- at BUILD_FORTRAN_TRUE@	$(am__objects_21) $(am__objects_22)
-libadiosreadf_nompi_a_OBJECTS = $(am_libadiosreadf_nompi_a_OBJECTS)
- at HAVE_NSSI_TRUE@am__EXEEXT_1 = nssi-staging-server$(EXEEXT)
+ at BUILD_FORTRAN_TRUE@	libadiosreadf_nompi_a-globals.$(OBJEXT) \
+ at BUILD_FORTRAN_TRUE@	$(am__objects_31) $(am__objects_32) \
+ at BUILD_FORTRAN_TRUE@	$(am__objects_33)
+am__dist_libadiosreadf_nompi_a_SOURCES_DIST = adios_nssi_args.x
+dist_libadiosreadf_nompi_a_OBJECTS =
+ at BUILD_FORTRAN_TRUE@@HAVE_NSSI_TRUE at nodist_libadiosreadf_nompi_a_OBJECTS = libadiosreadf_nompi_a-adios_nssi_args.$(OBJEXT)
+libadiosreadf_nompi_a_OBJECTS = $(am_libadiosreadf_nompi_a_OBJECTS) \
+	$(dist_libadiosreadf_nompi_a_OBJECTS) \
+	$(nodist_libadiosreadf_nompi_a_OBJECTS)
+ at HAVE_NSSI_TRUE@am__EXEEXT_1 = nssi-staging-server$(EXEEXT) \
+ at HAVE_NSSI_TRUE@	nssi-coupling-server$(EXEEXT)
 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(bin_PROGRAMS)
+am__nssi_coupling_server_SOURCES_DIST = nssi_coupling_server.cpp
+ at HAVE_NSSI_TRUE@am_nssi_coupling_server_OBJECTS = nssi_coupling_server-nssi_coupling_server.$(OBJEXT)
+nssi_coupling_server_OBJECTS = $(am_nssi_coupling_server_OBJECTS)
+am__DEPENDENCIES_1 =
+ at HAVE_NSSI_TRUE@nssi_coupling_server_DEPENDENCIES =  \
+ at HAVE_NSSI_TRUE@	$(top_builddir)/src/libadios.a \
+ at HAVE_NSSI_TRUE@	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 am__nssi_staging_server_SOURCES_DIST = nssi_staging_server.cpp \
 	aggregation.cpp
 @HAVE_NSSI_TRUE at am_nssi_staging_server_OBJECTS = nssi_staging_server-nssi_staging_server.$(OBJEXT) \
 @HAVE_NSSI_TRUE@	nssi_staging_server-aggregation.$(OBJEXT)
 nssi_staging_server_OBJECTS = $(am_nssi_staging_server_OBJECTS)
-am__DEPENDENCIES_1 =
 @HAVE_NSSI_TRUE at nssi_staging_server_DEPENDENCIES =  \
 @HAVE_NSSI_TRUE@	$(top_builddir)/src/libadios.a \
 @HAVE_NSSI_TRUE@	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
@@ -392,20 +525,35 @@ CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \
 	$(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
 SOURCES = $(libadios_a_SOURCES) $(dist_libadios_a_SOURCES) \
 	$(nodist_libadios_a_SOURCES) \
-	$(libadios_internal_nompi_a_SOURCES) $(libadiosf_a_SOURCES) \
+	$(libadios_internal_nompi_a_SOURCES) \
+	$(libadios_nompi_a_SOURCES) $(libadiosf_a_SOURCES) \
 	$(dist_libadiosf_a_SOURCES) $(nodist_libadiosf_a_SOURCES) \
-	$(libadiosread_a_SOURCES) $(libadiosread_nompi_a_SOURCES) \
-	$(libadiosreadf_a_SOURCES) $(libadiosreadf_nompi_a_SOURCES) \
-	$(nssi_staging_server_SOURCES)
+	$(libadiosread_a_SOURCES) $(dist_libadiosread_a_SOURCES) \
+	$(nodist_libadiosread_a_SOURCES) \
+	$(libadiosread_nompi_a_SOURCES) \
+	$(dist_libadiosread_nompi_a_SOURCES) \
+	$(nodist_libadiosread_nompi_a_SOURCES) \
+	$(libadiosreadf_a_SOURCES) $(dist_libadiosreadf_a_SOURCES) \
+	$(nodist_libadiosreadf_a_SOURCES) \
+	$(libadiosreadf_nompi_a_SOURCES) \
+	$(dist_libadiosreadf_nompi_a_SOURCES) \
+	$(nodist_libadiosreadf_nompi_a_SOURCES) \
+	$(nssi_coupling_server_SOURCES) $(nssi_staging_server_SOURCES)
 DIST_SOURCES = $(am__libadios_a_SOURCES_DIST) \
 	$(am__dist_libadios_a_SOURCES_DIST) \
 	$(libadios_internal_nompi_a_SOURCES) \
+	$(am__libadios_nompi_a_SOURCES_DIST) \
 	$(am__libadiosf_a_SOURCES_DIST) \
 	$(am__dist_libadiosf_a_SOURCES_DIST) \
 	$(am__libadiosread_a_SOURCES_DIST) \
+	$(am__dist_libadiosread_a_SOURCES_DIST) \
 	$(am__libadiosread_nompi_a_SOURCES_DIST) \
+	$(am__dist_libadiosread_nompi_a_SOURCES_DIST) \
 	$(am__libadiosreadf_a_SOURCES_DIST) \
+	$(am__dist_libadiosreadf_a_SOURCES_DIST) \
 	$(am__libadiosreadf_nompi_a_SOURCES_DIST) \
+	$(am__dist_libadiosreadf_nompi_a_SOURCES_DIST) \
+	$(am__nssi_coupling_server_SOURCES_DIST) \
 	$(am__nssi_staging_server_SOURCES_DIST)
 includeHEADERS_INSTALL = $(INSTALL_HEADER)
 HEADERS = $(include_HEADERS)
@@ -416,6 +564,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -494,6 +646,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -528,6 +682,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
@@ -563,7 +720,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
 PACKAGE_VERSION = @PACKAGE_VERSION@
 PATHPROG = @PATHPROG@
 PATH_SEPARATOR = @PATH_SEPARATOR@
-PHDF5_CPPFLAGS = @PHDF5_CPPFLAGS@ $(am__append_11)
+PHDF5_CPPFLAGS = @PHDF5_CPPFLAGS@ $(am__append_14)
 PHDF5_LDFLAGS = @PHDF5_LDFLAGS@
 PHDF5_LIBS = @PHDF5_LIBS@
 PORTALS_CFLAGS = @PORTALS_CFLAGS@
@@ -640,15 +797,34 @@ METASOURCES = AUTO
 @HAVE_NSSI_TRUE at nssi_staging_server_LDADD =  \
 @HAVE_NSSI_TRUE@	$(top_builddir)/src/libadios.a \
 @HAVE_NSSI_TRUE@	$(ADIOSLIB_LDADD) $(NSSI_SERVER_LIBS)
+ at HAVE_NSSI_TRUE@nssi_coupling_server_SOURCES = nssi_coupling_server.cpp
+ at HAVE_NSSI_TRUE@nssi_coupling_server_CFLAGS = $(ADIOSLIB_CFLAGS)
+ at HAVE_NSSI_TRUE@nssi_coupling_server_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_CPPFLAGS) -DPTL_IFACE_CLIENT=CRAY_USER_NAL -DPTL_IFACE_SERVER=CRAY_USER_NAL # -DUSE_TIMERS
+ at HAVE_NSSI_TRUE@nssi_coupling_server_LDFLAGS = $(ADIOSLIB_LDFLAGS) 
+ at HAVE_NSSI_TRUE@nssi_coupling_server_LDADD =  \
+ at HAVE_NSSI_TRUE@	$(top_builddir)/src/libadios.a \
+ at HAVE_NSSI_TRUE@	$(ADIOSLIB_LDADD) $(NSSI_SERVER_LIBS)
 include_HEADERS = adios.h adios_types.h adios_read.h \
-	adios_read_hooks.h mpidummy.h io_timer.h
+	adios_read_hooks.h adios_error.h mpidummy.h io_timer.h
 
 # adiosf_read.mod is not really usable, 
 # so it is not used and installed right now
 #libadiosread_a_SOURCES += adiosf_read_mod.F90
 #include_HEADERS += adiosf_read.mod 
 lib_LIBRARIES = $(am__append_2) $(am__append_3) libadiosread.a \
-	$(am__append_27) libadiosread_nompi.a $(am__append_32)
+	$(am__append_35) libadiosread_nompi.a $(am__append_49)
+libadiosread_a_CPPFLAGS = $(am__append_33) $(ADIOSLIB_EXTRA_CPPFLAGS) \
+	$(ADIOSREADLIB_CPPFLAGS) $(am__append_56)
+libadiosreadf_a_CPPFLAGS = $(am__append_40) $(am__append_42)
+libadiosread_nompi_a_CPPFLAGS = $(am__append_47) -D_NOMPI \
+	$(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSREADLIB_CPPFLAGS) \
+	$(am__append_57)
+libadiosreadf_nompi_a_CPPFLAGS = $(am__append_54) -D_NOMPI \
+	$(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSREADLIB_CPPFLAGS)
+libadiosread_a_CFLAGS = $(am__append_34)
+libadiosreadf_a_CFLAGS = $(am__append_41)
+libadiosread_nompi_a_CFLAGS = $(am__append_48)
+libadiosreadf_nompi_a_CFLAGS = $(am__append_55)
 @BUILD_WRITE_TRUE at libadios_a_SOURCES = adios.c common_adios.c \
 @BUILD_WRITE_TRUE@	adios_transport_hooks.c adios_mpi.c \
 @BUILD_WRITE_TRUE@	adios_mpi_lustre.c adios_mpi_amr.c \
@@ -658,10 +834,21 @@ lib_LIBRARIES = $(am__append_2) $(am__append_3) libadiosread.a \
 @BUILD_WRITE_TRUE@	adios_endianness.c bp_utils.c futils.c \
 @BUILD_WRITE_TRUE@	adios_error.c adios_read.c \
 @BUILD_WRITE_TRUE@	adios_read_hooks.c common_read.c read_bp.c \
- at BUILD_WRITE_TRUE@	globals.c $(am__append_4) $(am__append_6) \
- at BUILD_WRITE_TRUE@	$(am__append_8) $(am__append_10) \
- at BUILD_WRITE_TRUE@	$(am__append_15) $(am__append_17) \
- at BUILD_WRITE_TRUE@	$(am__append_21)
+ at BUILD_WRITE_TRUE@	read_bp_staged.c globals.c $(am__append_4) \
+ at BUILD_WRITE_TRUE@	$(am__append_7) $(am__append_10) \
+ at BUILD_WRITE_TRUE@	$(am__append_13) $(am__append_18) \
+ at BUILD_WRITE_TRUE@	$(am__append_20) $(am__append_24)
+ at BUILD_WRITE_TRUE@libadios_nompi_a_SOURCES = adios.c common_adios.c \
+ at BUILD_WRITE_TRUE@	adios_transport_hooks.c adios_posix.c \
+ at BUILD_WRITE_TRUE@	adios_posix1.c adios_internals.c \
+ at BUILD_WRITE_TRUE@	adios_internals_mxml.c buffer.c \
+ at BUILD_WRITE_TRUE@	adios_socket.c adios_bp_v1.c \
+ at BUILD_WRITE_TRUE@	adios_endianness.c bp_utils.c futils.c \
+ at BUILD_WRITE_TRUE@	adios_error.c adios_read.c \
+ at BUILD_WRITE_TRUE@	adios_read_hooks.c common_read.c read_bp.c \
+ at BUILD_WRITE_TRUE@	read_bp_staged.c globals.c mpidummy.c \
+ at BUILD_WRITE_TRUE@	$(am__append_5) $(am__append_8) \
+ at BUILD_WRITE_TRUE@	$(am__append_11)
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE at libadiosf_a_SOURCES = adiosf.c \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	common_adios.c \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	adios_transport_hooks.c \
@@ -679,21 +866,26 @@ lib_LIBRARIES = $(am__append_2) $(am__append_3) libadiosread.a \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	bp_utils.c adiosf_read.c \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	adios_read_hooks.c \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	common_read.c read_bp.c \
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	read_bp_staged.c \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	globals.c \
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__append_5) \
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__append_7) \
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__append_6) \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__append_9) \
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__append_13) \
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__append_12) \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__append_16) \
 @BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__append_19) \
- at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__append_22)
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__append_22) \
+ at BUILD_FORTRAN_TRUE@@BUILD_WRITE_TRUE@	$(am__append_25)
 @BUILD_WRITE_TRUE at libadios_a_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) \
- at BUILD_WRITE_TRUE@	$(ADIOSLIB_CPPFLAGS) $(am__append_12) \
- at BUILD_WRITE_TRUE@	$(am__append_18) $(am__append_23)
+ at BUILD_WRITE_TRUE@	$(ADIOSLIB_CPPFLAGS) $(am__append_15) \
+ at BUILD_WRITE_TRUE@	$(am__append_21) $(am__append_26)
 @BUILD_WRITE_TRUE at libadios_a_CFLAGS = $(ADIOSLIB_CFLAGS) 
+ at BUILD_WRITE_TRUE@libadios_nompi_a_CPPFLAGS = -D_NOMPI \
+ at BUILD_WRITE_TRUE@	$(ADIOSLIB_EXTRA_CPPFLAGS) \
+ at BUILD_WRITE_TRUE@	$(ADIOSLIB_SEQ_CPPFLAGS) $(am__append_27)
+ at BUILD_WRITE_TRUE@libadios_nompi_a_CFLAGS = -D_NOMPI $(ADIOSLIB_SEQ_CFLAGS) 
 @BUILD_WRITE_TRUE at libadiosf_a_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) \
- at BUILD_WRITE_TRUE@	$(ADIOSLIB_CPPFLAGS) $(am__append_14) \
- at BUILD_WRITE_TRUE@	$(am__append_20) $(am__append_24)
+ at BUILD_WRITE_TRUE@	$(ADIOSLIB_CPPFLAGS) $(am__append_17) \
+ at BUILD_WRITE_TRUE@	$(am__append_23) $(am__append_28)
 @BUILD_WRITE_TRUE at libadiosf_a_CFLAGS = $(ADIOSLIB_CFLAGS) 
 @BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE at dist_libadios_a_SOURCES = adios_nssi_args.x
 @BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE at nodist_libadios_a_SOURCES = adios_nssi_args.c adios_nssi_args.h
@@ -702,28 +894,37 @@ lib_LIBRARIES = $(am__append_2) $(am__append_3) libadiosread.a \
 @BUILD_WRITE_TRUE@@HAVE_NSSI_TRUE at CLEANFILES = adios_nssi_args.c adios_nssi_args.h
 libadiosread_a_SOURCES = adios_bp_v1.c adios_endianness.c bp_utils.c \
 	futils.c adios_error.c adios_read.c adios_read_hooks.c \
-	common_read.c read_bp.c globals.c $(am__append_25) \
-	$(am__append_26)
-libadiosread_a_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) \
-	$(ADIOSREADLIB_CPPFLAGS) $(am__append_35)
+	common_read.c read_bp.c read_bp_staged.c globals.c \
+	$(am__append_29) $(am__append_30) $(am__append_31) \
+	$(am__append_32)
+ at HAVE_NSSI_TRUE@dist_libadiosread_a_SOURCES = adios_nssi_args.x
+ at HAVE_NSSI_TRUE@nodist_libadiosread_a_SOURCES = adios_nssi_args.c adios_nssi_args.h
 @BUILD_FORTRAN_TRUE at libadiosreadf_a_SOURCES = adios_bp_v1.c \
 @BUILD_FORTRAN_TRUE@	adios_endianness.c bp_utils.c futils.c \
 @BUILD_FORTRAN_TRUE@	adios_error.c adiosf_read.c \
 @BUILD_FORTRAN_TRUE@	adios_read_hooks.c common_read.c read_bp.c \
- at BUILD_FORTRAN_TRUE@	globals.c $(am__append_28) \
- at BUILD_FORTRAN_TRUE@	$(am__append_29)
- at BUILD_FORTRAN_TRUE@libadiosreadf_a_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSREADLIB_CPPFLAGS)
+ at BUILD_FORTRAN_TRUE@	read_bp_staged.c globals.c \
+ at BUILD_FORTRAN_TRUE@	$(am__append_36) $(am__append_37) \
+ at BUILD_FORTRAN_TRUE@	$(am__append_38) $(am__append_39)
+ at BUILD_FORTRAN_TRUE@@HAVE_NSSI_TRUE at dist_libadiosreadf_a_SOURCES = adios_nssi_args.x
+ at BUILD_FORTRAN_TRUE@@HAVE_NSSI_TRUE at nodist_libadiosreadf_a_SOURCES = adios_nssi_args.c adios_nssi_args.h
 libadiosread_nompi_a_SOURCES = mpidummy.c adios_bp_v1.c \
 	adios_endianness.c bp_utils.c futils.c adios_error.c \
 	adios_read.c adios_read_hooks.c common_read.c read_bp.c \
 	adios_internals.c buffer.c adios_transport_hooks.c globals.c \
-	$(am__append_30) $(am__append_31)
+	$(am__append_43) $(am__append_44) $(am__append_45) \
+	$(am__append_46) $(am__append_52)
+ at HAVE_NSSI_TRUE@dist_libadiosread_nompi_a_SOURCES = adios_nssi_args.x
+ at HAVE_NSSI_TRUE@nodist_libadiosread_nompi_a_SOURCES = adios_nssi_args.c adios_nssi_args.h
 @BUILD_FORTRAN_TRUE at libadiosreadf_nompi_a_SOURCES = mpidummy.c \
 @BUILD_FORTRAN_TRUE@	adios_bp_v1.c adios_endianness.c \
 @BUILD_FORTRAN_TRUE@	bp_utils.c futils.c adios_error.c \
 @BUILD_FORTRAN_TRUE@	adiosf_read.c adios_read_hooks.c \
- at BUILD_FORTRAN_TRUE@	common_read.c read_bp.c $(am__append_33) \
- at BUILD_FORTRAN_TRUE@	$(am__append_34)
+ at BUILD_FORTRAN_TRUE@	common_read.c read_bp.c globals.c \
+ at BUILD_FORTRAN_TRUE@	$(am__append_50) $(am__append_51) \
+ at BUILD_FORTRAN_TRUE@	$(am__append_53)
+ at BUILD_FORTRAN_TRUE@@HAVE_NSSI_TRUE at dist_libadiosreadf_nompi_a_SOURCES = adios_nssi_args.x
+ at BUILD_FORTRAN_TRUE@@HAVE_NSSI_TRUE at nodist_libadiosreadf_nompi_a_SOURCES = adios_nssi_args.c adios_nssi_args.h
 noinst_LIBRARIES = libadios_internal_nompi.a
 libadios_internal_nompi_a_SOURCES = mpidummy.c \
                                     adios_bp_v1.c \
@@ -735,10 +936,7 @@ libadios_internal_nompi_a_SOURCES = mpidummy.c \
                                     adios_error.c \
                                     adios_internals_mxml.c
 
-libadiosread_nompi_a_CPPFLAGS = -D_NOMPI $(ADIOSLIB_EXTRA_CPPFLAGS) \
-	$(ADIOSREADLIB_CPPFLAGS) $(am__append_36)
-libadiosreadf_nompi_a_CPPFLAGS = -D_NOMPI $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSREADLIB_CPPFLAGS)
-libadios_internal_nompi_a_CPPFLAGS = -D_NOMPI $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_SEQ_CPPFLAGS)
+libadios_internal_nompi_a_CPPFLAGS = -D_INTERNAL $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_INT_CPPFLAGS) $(ADIOSLIB_CPPFLAGS)
 
 #bin_PROGRAMS+=adios_flags
 #nodist_adios_flags_SOURCES = adios_flags.h 
@@ -761,7 +959,8 @@ libadios_internal_nompi_a_CPPFLAGS = -D_NOMPI $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOS
 EXTRA_DIST = adios_bp_v1.h adios_endianness.h adios_error.h \
              adios_internals.h adios_internals_mxml.h \
              adios_nssi_config.h adios_socket.h adios_transport_hooks.h aggregation.h \
-             bp_types.h bp_utils.h buffer.h common_adios.h common_read.h futils.h globals.h 
+             bp_types.h bp_utils.h buffer.h common_adios.h common_read.h futils.h globals.h \
+             ds_metadata.h
 
 all: all-am
 
@@ -836,6 +1035,10 @@ libadios_internal_nompi.a: $(libadios_internal_nompi_a_OBJECTS) $(libadios_inter
 	-rm -f libadios_internal_nompi.a
 	$(libadios_internal_nompi_a_AR) libadios_internal_nompi.a $(libadios_internal_nompi_a_OBJECTS) $(libadios_internal_nompi_a_LIBADD)
 	$(RANLIB) libadios_internal_nompi.a
+libadios_nompi.a: $(libadios_nompi_a_OBJECTS) $(libadios_nompi_a_DEPENDENCIES) 
+	-rm -f libadios_nompi.a
+	$(libadios_nompi_a_AR) libadios_nompi.a $(libadios_nompi_a_OBJECTS) $(libadios_nompi_a_LIBADD)
+	$(RANLIB) libadios_nompi.a
 libadiosf.a: $(libadiosf_a_OBJECTS) $(libadiosf_a_DEPENDENCIES) 
 	-rm -f libadiosf.a
 	$(libadiosf_a_AR) libadiosf.a $(libadiosf_a_OBJECTS) $(libadiosf_a_LIBADD)
@@ -884,6 +1087,9 @@ clean-binPROGRAMS:
 	  echo " rm -f $$p $$f"; \
 	  rm -f $$p $$f ; \
 	done
+nssi-coupling-server$(EXEEXT): $(nssi_coupling_server_OBJECTS) $(nssi_coupling_server_DEPENDENCIES) 
+	@rm -f nssi-coupling-server$(EXEEXT)
+	$(CXXLINK) $(nssi_coupling_server_LDFLAGS) $(nssi_coupling_server_OBJECTS) $(nssi_coupling_server_LDADD) $(LIBS)
 nssi-staging-server$(EXEEXT): $(nssi_staging_server_OBJECTS) $(nssi_staging_server_DEPENDENCIES) 
 	@rm -f nssi-staging-server$(EXEEXT)
 	$(CXXLINK) $(nssi_staging_server_LDFLAGS) $(nssi_staging_server_OBJECTS) $(nssi_staging_server_LDADD) $(LIBS)
@@ -1029,6 +1235,12 @@ libadios_a-read_bp.o: read_bp.c
 libadios_a-read_bp.obj: read_bp.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_a_CPPFLAGS) $(CPPFLAGS) $(libadios_a_CFLAGS) $(CFLAGS) -c -o libadios_a-read_bp.obj `if test -f 'read_bp.c'; then $(CYGPATH_W) 'read_bp.c'; else $(CYGPATH_W) '$(srcdir)/read_bp.c'; fi`
 
+libadios_a-read_bp_staged.o: read_bp_staged.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_a_CPPFLAGS) $(CPPFLAGS) $(libadios_a_CFLAGS) $(CFLAGS) -c -o libadios_a-read_bp_staged.o `test -f 'read_bp_staged.c' || echo '$(srcdir)/'`read_bp_staged.c
+
+libadios_a-read_bp_staged.obj: read_bp_staged.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_a_CPPFLAGS) $(CPPFLAGS) $(libadios_a_CFLAGS) $(CFLAGS) -c -o libadios_a-read_bp_staged.obj `if test -f 'read_bp_staged.c'; then $(CYGPATH_W) 'read_bp_staged.c'; else $(CYGPATH_W) '$(srcdir)/read_bp_staged.c'; fi`
+
 libadios_a-globals.o: globals.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_a_CPPFLAGS) $(CPPFLAGS) $(libadios_a_CFLAGS) $(CFLAGS) -c -o libadios_a-globals.o `test -f 'globals.c' || echo '$(srcdir)/'`globals.c
 
@@ -1065,6 +1277,12 @@ libadios_a-adios_datatap.o: adios_datatap.c
 libadios_a-adios_datatap.obj: adios_datatap.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_a_CPPFLAGS) $(CPPFLAGS) $(libadios_a_CFLAGS) $(CFLAGS) -c -o libadios_a-adios_datatap.obj `if test -f 'adios_datatap.c'; then $(CYGPATH_W) 'adios_datatap.c'; else $(CYGPATH_W) '$(srcdir)/adios_datatap.c'; fi`
 
+libadios_a-read_datatap.o: read_datatap.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_a_CPPFLAGS) $(CPPFLAGS) $(libadios_a_CFLAGS) $(CFLAGS) -c -o libadios_a-read_datatap.o `test -f 'read_datatap.c' || echo '$(srcdir)/'`read_datatap.c
+
+libadios_a-read_datatap.obj: read_datatap.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_a_CPPFLAGS) $(CPPFLAGS) $(libadios_a_CFLAGS) $(CFLAGS) -c -o libadios_a-read_datatap.obj `if test -f 'read_datatap.c'; then $(CYGPATH_W) 'read_datatap.c'; else $(CYGPATH_W) '$(srcdir)/read_datatap.c'; fi`
+
 libadios_a-adios_phdf5.o: adios_phdf5.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_a_CPPFLAGS) $(CPPFLAGS) $(libadios_a_CFLAGS) $(CFLAGS) -c -o libadios_a-adios_phdf5.o `test -f 'adios_phdf5.c' || echo '$(srcdir)/'`adios_phdf5.c
 
@@ -1095,6 +1313,12 @@ libadios_a-adios_nssi_filter.o: adios_nssi_filter.c
 libadios_a-adios_nssi_filter.obj: adios_nssi_filter.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_a_CPPFLAGS) $(CPPFLAGS) $(libadios_a_CFLAGS) $(CFLAGS) -c -o libadios_a-adios_nssi_filter.obj `if test -f 'adios_nssi_filter.c'; then $(CYGPATH_W) 'adios_nssi_filter.c'; else $(CYGPATH_W) '$(srcdir)/adios_nssi_filter.c'; fi`
 
+libadios_a-read_nssi.o: read_nssi.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_a_CPPFLAGS) $(CPPFLAGS) $(libadios_a_CFLAGS) $(CFLAGS) -c -o libadios_a-read_nssi.o `test -f 'read_nssi.c' || echo '$(srcdir)/'`read_nssi.c
+
+libadios_a-read_nssi.obj: read_nssi.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_a_CPPFLAGS) $(CPPFLAGS) $(libadios_a_CFLAGS) $(CFLAGS) -c -o libadios_a-read_nssi.obj `if test -f 'read_nssi.c'; then $(CYGPATH_W) 'read_nssi.c'; else $(CYGPATH_W) '$(srcdir)/read_nssi.c'; fi`
+
 libadios_a-adios_mpi_stagger.o: adios_mpi_stagger.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_a_CPPFLAGS) $(CPPFLAGS) $(libadios_a_CFLAGS) $(CFLAGS) -c -o libadios_a-adios_mpi_stagger.o `test -f 'adios_mpi_stagger.c' || echo '$(srcdir)/'`adios_mpi_stagger.c
 
@@ -1197,6 +1421,168 @@ libadios_internal_nompi_a-adios_internals_mxml.o: adios_internals_mxml.c
 libadios_internal_nompi_a-adios_internals_mxml.obj: adios_internals_mxml.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_internal_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadios_internal_nompi_a-adios_internals_mxml.obj `if test -f 'adios_internals_mxml.c'; then $(CYGPATH_W) 'adios_internals_mxml.c'; else $(CYGPATH_W) '$(srcdir)/adios_internals_mxml.c'; fi`
 
+libadios_nompi_a-adios.o: adios.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios.o `test -f 'adios.c' || echo '$(srcdir)/'`adios.c
+
+libadios_nompi_a-adios.obj: adios.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios.obj `if test -f 'adios.c'; then $(CYGPATH_W) 'adios.c'; else $(CYGPATH_W) '$(srcdir)/adios.c'; fi`
+
+libadios_nompi_a-common_adios.o: common_adios.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-common_adios.o `test -f 'common_adios.c' || echo '$(srcdir)/'`common_adios.c
+
+libadios_nompi_a-common_adios.obj: common_adios.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-common_adios.obj `if test -f 'common_adios.c'; then $(CYGPATH_W) 'common_adios.c'; else $(CYGPATH_W) '$(srcdir)/common_adios.c'; fi`
+
+libadios_nompi_a-adios_transport_hooks.o: adios_transport_hooks.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_transport_hooks.o `test -f 'adios_transport_hooks.c' || echo '$(srcdir)/'`adios_transport_hooks.c
+
+libadios_nompi_a-adios_transport_hooks.obj: adios_transport_hooks.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_transport_hooks.obj `if test -f 'adios_transport_hooks.c'; then $(CYGPATH_W) 'adios_transport_hooks.c'; else $(CYGPATH_W) '$(srcdir)/adios_transport_hooks.c'; fi`
+
+libadios_nompi_a-adios_posix.o: adios_posix.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_posix.o `test -f 'adios_posix.c' || echo '$(srcdir)/'`adios_posix.c
+
+libadios_nompi_a-adios_posix.obj: adios_posix.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_posix.obj `if test -f 'adios_posix.c'; then $(CYGPATH_W) 'adios_posix.c'; else $(CYGPATH_W) '$(srcdir)/adios_posix.c'; fi`
+
+libadios_nompi_a-adios_posix1.o: adios_posix1.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_posix1.o `test -f 'adios_posix1.c' || echo '$(srcdir)/'`adios_posix1.c
+
+libadios_nompi_a-adios_posix1.obj: adios_posix1.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_posix1.obj `if test -f 'adios_posix1.c'; then $(CYGPATH_W) 'adios_posix1.c'; else $(CYGPATH_W) '$(srcdir)/adios_posix1.c'; fi`
+
+libadios_nompi_a-adios_internals.o: adios_internals.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_internals.o `test -f 'adios_internals.c' || echo '$(srcdir)/'`adios_internals.c
+
+libadios_nompi_a-adios_internals.obj: adios_internals.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_internals.obj `if test -f 'adios_internals.c'; then $(CYGPATH_W) 'adios_internals.c'; else $(CYGPATH_W) '$(srcdir)/adios_internals.c'; fi`
+
+libadios_nompi_a-adios_internals_mxml.o: adios_internals_mxml.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_internals_mxml.o `test -f 'adios_internals_mxml.c' || echo '$(srcdir)/'`adios_internals_mxml.c
+
+libadios_nompi_a-adios_internals_mxml.obj: adios_internals_mxml.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_internals_mxml.obj `if test -f 'adios_internals_mxml.c'; then $(CYGPATH_W) 'adios_internals_mxml.c'; else $(CYGPATH_W) '$(srcdir)/adios_internals_mxml.c'; fi`
+
+libadios_nompi_a-buffer.o: buffer.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-buffer.o `test -f 'buffer.c' || echo '$(srcdir)/'`buffer.c
+
+libadios_nompi_a-buffer.obj: buffer.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-buffer.obj `if test -f 'buffer.c'; then $(CYGPATH_W) 'buffer.c'; else $(CYGPATH_W) '$(srcdir)/buffer.c'; fi`
+
+libadios_nompi_a-adios_socket.o: adios_socket.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_socket.o `test -f 'adios_socket.c' || echo '$(srcdir)/'`adios_socket.c
+
+libadios_nompi_a-adios_socket.obj: adios_socket.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_socket.obj `if test -f 'adios_socket.c'; then $(CYGPATH_W) 'adios_socket.c'; else $(CYGPATH_W) '$(srcdir)/adios_socket.c'; fi`
+
+libadios_nompi_a-adios_bp_v1.o: adios_bp_v1.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_bp_v1.o `test -f 'adios_bp_v1.c' || echo '$(srcdir)/'`adios_bp_v1.c
+
+libadios_nompi_a-adios_bp_v1.obj: adios_bp_v1.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_bp_v1.obj `if test -f 'adios_bp_v1.c'; then $(CYGPATH_W) 'adios_bp_v1.c'; else $(CYGPATH_W) '$(srcdir)/adios_bp_v1.c'; fi`
+
+libadios_nompi_a-adios_endianness.o: adios_endianness.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_endianness.o `test -f 'adios_endianness.c' || echo '$(srcdir)/'`adios_endianness.c
+
+libadios_nompi_a-adios_endianness.obj: adios_endianness.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_endianness.obj `if test -f 'adios_endianness.c'; then $(CYGPATH_W) 'adios_endianness.c'; else $(CYGPATH_W) '$(srcdir)/adios_endianness.c'; fi`
+
+libadios_nompi_a-bp_utils.o: bp_utils.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-bp_utils.o `test -f 'bp_utils.c' || echo '$(srcdir)/'`bp_utils.c
+
+libadios_nompi_a-bp_utils.obj: bp_utils.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-bp_utils.obj `if test -f 'bp_utils.c'; then $(CYGPATH_W) 'bp_utils.c'; else $(CYGPATH_W) '$(srcdir)/bp_utils.c'; fi`
+
+libadios_nompi_a-futils.o: futils.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-futils.o `test -f 'futils.c' || echo '$(srcdir)/'`futils.c
+
+libadios_nompi_a-futils.obj: futils.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-futils.obj `if test -f 'futils.c'; then $(CYGPATH_W) 'futils.c'; else $(CYGPATH_W) '$(srcdir)/futils.c'; fi`
+
+libadios_nompi_a-adios_error.o: adios_error.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_error.o `test -f 'adios_error.c' || echo '$(srcdir)/'`adios_error.c
+
+libadios_nompi_a-adios_error.obj: adios_error.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_error.obj `if test -f 'adios_error.c'; then $(CYGPATH_W) 'adios_error.c'; else $(CYGPATH_W) '$(srcdir)/adios_error.c'; fi`
+
+libadios_nompi_a-adios_read.o: adios_read.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_read.o `test -f 'adios_read.c' || echo '$(srcdir)/'`adios_read.c
+
+libadios_nompi_a-adios_read.obj: adios_read.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_read.obj `if test -f 'adios_read.c'; then $(CYGPATH_W) 'adios_read.c'; else $(CYGPATH_W) '$(srcdir)/adios_read.c'; fi`
+
+libadios_nompi_a-adios_read_hooks.o: adios_read_hooks.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_read_hooks.o `test -f 'adios_read_hooks.c' || echo '$(srcdir)/'`adios_read_hooks.c
+
+libadios_nompi_a-adios_read_hooks.obj: adios_read_hooks.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_read_hooks.obj `if test -f 'adios_read_hooks.c'; then $(CYGPATH_W) 'adios_read_hooks.c'; else $(CYGPATH_W) '$(srcdir)/adios_read_hooks.c'; fi`
+
+libadios_nompi_a-common_read.o: common_read.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-common_read.o `test -f 'common_read.c' || echo '$(srcdir)/'`common_read.c
+
+libadios_nompi_a-common_read.obj: common_read.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-common_read.obj `if test -f 'common_read.c'; then $(CYGPATH_W) 'common_read.c'; else $(CYGPATH_W) '$(srcdir)/common_read.c'; fi`
+
+libadios_nompi_a-read_bp.o: read_bp.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-read_bp.o `test -f 'read_bp.c' || echo '$(srcdir)/'`read_bp.c
+
+libadios_nompi_a-read_bp.obj: read_bp.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-read_bp.obj `if test -f 'read_bp.c'; then $(CYGPATH_W) 'read_bp.c'; else $(CYGPATH_W) '$(srcdir)/read_bp.c'; fi`
+
+libadios_nompi_a-read_bp_staged.o: read_bp_staged.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-read_bp_staged.o `test -f 'read_bp_staged.c' || echo '$(srcdir)/'`read_bp_staged.c
+
+libadios_nompi_a-read_bp_staged.obj: read_bp_staged.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-read_bp_staged.obj `if test -f 'read_bp_staged.c'; then $(CYGPATH_W) 'read_bp_staged.c'; else $(CYGPATH_W) '$(srcdir)/read_bp_staged.c'; fi`
+
+libadios_nompi_a-globals.o: globals.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-globals.o `test -f 'globals.c' || echo '$(srcdir)/'`globals.c
+
+libadios_nompi_a-globals.obj: globals.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-globals.obj `if test -f 'globals.c'; then $(CYGPATH_W) 'globals.c'; else $(CYGPATH_W) '$(srcdir)/globals.c'; fi`
+
+libadios_nompi_a-mpidummy.o: mpidummy.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-mpidummy.o `test -f 'mpidummy.c' || echo '$(srcdir)/'`mpidummy.c
+
+libadios_nompi_a-mpidummy.obj: mpidummy.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-mpidummy.obj `if test -f 'mpidummy.c'; then $(CYGPATH_W) 'mpidummy.c'; else $(CYGPATH_W) '$(srcdir)/mpidummy.c'; fi`
+
+libadios_nompi_a-adios_dart.o: adios_dart.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_dart.o `test -f 'adios_dart.c' || echo '$(srcdir)/'`adios_dart.c
+
+libadios_nompi_a-adios_dart.obj: adios_dart.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_dart.obj `if test -f 'adios_dart.c'; then $(CYGPATH_W) 'adios_dart.c'; else $(CYGPATH_W) '$(srcdir)/adios_dart.c'; fi`
+
+libadios_nompi_a-read_dart.o: read_dart.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-read_dart.o `test -f 'read_dart.c' || echo '$(srcdir)/'`read_dart.c
+
+libadios_nompi_a-read_dart.obj: read_dart.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-read_dart.obj `if test -f 'read_dart.c'; then $(CYGPATH_W) 'read_dart.c'; else $(CYGPATH_W) '$(srcdir)/read_dart.c'; fi`
+
+libadios_nompi_a-adios_dimes.o: adios_dimes.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_dimes.o `test -f 'adios_dimes.c' || echo '$(srcdir)/'`adios_dimes.c
+
+libadios_nompi_a-adios_dimes.obj: adios_dimes.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_dimes.obj `if test -f 'adios_dimes.c'; then $(CYGPATH_W) 'adios_dimes.c'; else $(CYGPATH_W) '$(srcdir)/adios_dimes.c'; fi`
+
+libadios_nompi_a-read_dimes.o: read_dimes.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-read_dimes.o `test -f 'read_dimes.c' || echo '$(srcdir)/'`read_dimes.c
+
+libadios_nompi_a-read_dimes.obj: read_dimes.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-read_dimes.obj `if test -f 'read_dimes.c'; then $(CYGPATH_W) 'read_dimes.c'; else $(CYGPATH_W) '$(srcdir)/read_dimes.c'; fi`
+
+libadios_nompi_a-adios_datatap.o: adios_datatap.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_datatap.o `test -f 'adios_datatap.c' || echo '$(srcdir)/'`adios_datatap.c
+
+libadios_nompi_a-adios_datatap.obj: adios_datatap.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-adios_datatap.obj `if test -f 'adios_datatap.c'; then $(CYGPATH_W) 'adios_datatap.c'; else $(CYGPATH_W) '$(srcdir)/adios_datatap.c'; fi`
+
+libadios_nompi_a-read_datatap.o: read_datatap.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-read_datatap.o `test -f 'read_datatap.c' || echo '$(srcdir)/'`read_datatap.c
+
+libadios_nompi_a-read_datatap.obj: read_datatap.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadios_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadios_nompi_a_CFLAGS) $(CFLAGS) -c -o libadios_nompi_a-read_datatap.obj `if test -f 'read_datatap.c'; then $(CYGPATH_W) 'read_datatap.c'; else $(CYGPATH_W) '$(srcdir)/read_datatap.c'; fi`
+
 libadiosf_a-adiosf.o: adiosf.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosf_a_CFLAGS) $(CFLAGS) -c -o libadiosf_a-adiosf.o `test -f 'adiosf.c' || echo '$(srcdir)/'`adiosf.c
 
@@ -1323,6 +1709,12 @@ libadiosf_a-read_bp.o: read_bp.c
 libadiosf_a-read_bp.obj: read_bp.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosf_a_CFLAGS) $(CFLAGS) -c -o libadiosf_a-read_bp.obj `if test -f 'read_bp.c'; then $(CYGPATH_W) 'read_bp.c'; else $(CYGPATH_W) '$(srcdir)/read_bp.c'; fi`
 
+libadiosf_a-read_bp_staged.o: read_bp_staged.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosf_a_CFLAGS) $(CFLAGS) -c -o libadiosf_a-read_bp_staged.o `test -f 'read_bp_staged.c' || echo '$(srcdir)/'`read_bp_staged.c
+
+libadiosf_a-read_bp_staged.obj: read_bp_staged.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosf_a_CFLAGS) $(CFLAGS) -c -o libadiosf_a-read_bp_staged.obj `if test -f 'read_bp_staged.c'; then $(CYGPATH_W) 'read_bp_staged.c'; else $(CYGPATH_W) '$(srcdir)/read_bp_staged.c'; fi`
+
 libadiosf_a-globals.o: globals.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosf_a_CFLAGS) $(CFLAGS) -c -o libadiosf_a-globals.o `test -f 'globals.c' || echo '$(srcdir)/'`globals.c
 
@@ -1359,6 +1751,12 @@ libadiosf_a-adios_datatap.o: adios_datatap.c
 libadiosf_a-adios_datatap.obj: adios_datatap.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosf_a_CFLAGS) $(CFLAGS) -c -o libadiosf_a-adios_datatap.obj `if test -f 'adios_datatap.c'; then $(CYGPATH_W) 'adios_datatap.c'; else $(CYGPATH_W) '$(srcdir)/adios_datatap.c'; fi`
 
+libadiosf_a-read_datatap.o: read_datatap.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosf_a_CFLAGS) $(CFLAGS) -c -o libadiosf_a-read_datatap.o `test -f 'read_datatap.c' || echo '$(srcdir)/'`read_datatap.c
+
+libadiosf_a-read_datatap.obj: read_datatap.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosf_a_CFLAGS) $(CFLAGS) -c -o libadiosf_a-read_datatap.obj `if test -f 'read_datatap.c'; then $(CYGPATH_W) 'read_datatap.c'; else $(CYGPATH_W) '$(srcdir)/read_datatap.c'; fi`
+
 libadiosf_a-adios_phdf5.o: adios_phdf5.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosf_a_CFLAGS) $(CFLAGS) -c -o libadiosf_a-adios_phdf5.o `test -f 'adios_phdf5.c' || echo '$(srcdir)/'`adios_phdf5.c
 
@@ -1389,6 +1787,12 @@ libadiosf_a-adios_nssi_filter.o: adios_nssi_filter.c
 libadiosf_a-adios_nssi_filter.obj: adios_nssi_filter.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosf_a_CFLAGS) $(CFLAGS) -c -o libadiosf_a-adios_nssi_filter.obj `if test -f 'adios_nssi_filter.c'; then $(CYGPATH_W) 'adios_nssi_filter.c'; else $(CYGPATH_W) '$(srcdir)/adios_nssi_filter.c'; fi`
 
+libadiosf_a-read_nssi.o: read_nssi.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosf_a_CFLAGS) $(CFLAGS) -c -o libadiosf_a-read_nssi.o `test -f 'read_nssi.c' || echo '$(srcdir)/'`read_nssi.c
+
+libadiosf_a-read_nssi.obj: read_nssi.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosf_a_CFLAGS) $(CFLAGS) -c -o libadiosf_a-read_nssi.obj `if test -f 'read_nssi.c'; then $(CYGPATH_W) 'read_nssi.c'; else $(CYGPATH_W) '$(srcdir)/read_nssi.c'; fi`
+
 libadiosf_a-adios_mpi_stagger.o: adios_mpi_stagger.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosf_a_CFLAGS) $(CFLAGS) -c -o libadiosf_a-adios_mpi_stagger.o `test -f 'adios_mpi_stagger.c' || echo '$(srcdir)/'`adios_mpi_stagger.c
 
@@ -1438,316 +1842,424 @@ libadiosf_a-adios_nssi_args.obj: adios_nssi_args.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosf_a_CFLAGS) $(CFLAGS) -c -o libadiosf_a-adios_nssi_args.obj `if test -f 'adios_nssi_args.c'; then $(CYGPATH_W) 'adios_nssi_args.c'; else $(CYGPATH_W) '$(srcdir)/adios_nssi_args.c'; fi`
 
 libadiosread_a-adios_bp_v1.o: adios_bp_v1.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_bp_v1.o `test -f 'adios_bp_v1.c' || echo '$(srcdir)/'`adios_bp_v1.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_bp_v1.o `test -f 'adios_bp_v1.c' || echo '$(srcdir)/'`adios_bp_v1.c
 
 libadiosread_a-adios_bp_v1.obj: adios_bp_v1.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_bp_v1.obj `if test -f 'adios_bp_v1.c'; then $(CYGPATH_W) 'adios_bp_v1.c'; else $(CYGPATH_W) '$(srcdir)/adios_bp_v1.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_bp_v1.obj `if test -f 'adios_bp_v1.c'; then $(CYGPATH_W) 'adios_bp_v1.c'; else $(CYGPATH_W) '$(srcdir)/adios_bp_v1.c'; fi`
 
 libadiosread_a-adios_endianness.o: adios_endianness.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_endianness.o `test -f 'adios_endianness.c' || echo '$(srcdir)/'`adios_endianness.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_endianness.o `test -f 'adios_endianness.c' || echo '$(srcdir)/'`adios_endianness.c
 
 libadiosread_a-adios_endianness.obj: adios_endianness.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_endianness.obj `if test -f 'adios_endianness.c'; then $(CYGPATH_W) 'adios_endianness.c'; else $(CYGPATH_W) '$(srcdir)/adios_endianness.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_endianness.obj `if test -f 'adios_endianness.c'; then $(CYGPATH_W) 'adios_endianness.c'; else $(CYGPATH_W) '$(srcdir)/adios_endianness.c'; fi`
 
 libadiosread_a-bp_utils.o: bp_utils.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-bp_utils.o `test -f 'bp_utils.c' || echo '$(srcdir)/'`bp_utils.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-bp_utils.o `test -f 'bp_utils.c' || echo '$(srcdir)/'`bp_utils.c
 
 libadiosread_a-bp_utils.obj: bp_utils.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-bp_utils.obj `if test -f 'bp_utils.c'; then $(CYGPATH_W) 'bp_utils.c'; else $(CYGPATH_W) '$(srcdir)/bp_utils.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-bp_utils.obj `if test -f 'bp_utils.c'; then $(CYGPATH_W) 'bp_utils.c'; else $(CYGPATH_W) '$(srcdir)/bp_utils.c'; fi`
 
 libadiosread_a-futils.o: futils.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-futils.o `test -f 'futils.c' || echo '$(srcdir)/'`futils.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-futils.o `test -f 'futils.c' || echo '$(srcdir)/'`futils.c
 
 libadiosread_a-futils.obj: futils.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-futils.obj `if test -f 'futils.c'; then $(CYGPATH_W) 'futils.c'; else $(CYGPATH_W) '$(srcdir)/futils.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-futils.obj `if test -f 'futils.c'; then $(CYGPATH_W) 'futils.c'; else $(CYGPATH_W) '$(srcdir)/futils.c'; fi`
 
 libadiosread_a-adios_error.o: adios_error.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_error.o `test -f 'adios_error.c' || echo '$(srcdir)/'`adios_error.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_error.o `test -f 'adios_error.c' || echo '$(srcdir)/'`adios_error.c
 
 libadiosread_a-adios_error.obj: adios_error.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_error.obj `if test -f 'adios_error.c'; then $(CYGPATH_W) 'adios_error.c'; else $(CYGPATH_W) '$(srcdir)/adios_error.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_error.obj `if test -f 'adios_error.c'; then $(CYGPATH_W) 'adios_error.c'; else $(CYGPATH_W) '$(srcdir)/adios_error.c'; fi`
 
 libadiosread_a-adios_read.o: adios_read.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_read.o `test -f 'adios_read.c' || echo '$(srcdir)/'`adios_read.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_read.o `test -f 'adios_read.c' || echo '$(srcdir)/'`adios_read.c
 
 libadiosread_a-adios_read.obj: adios_read.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_read.obj `if test -f 'adios_read.c'; then $(CYGPATH_W) 'adios_read.c'; else $(CYGPATH_W) '$(srcdir)/adios_read.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_read.obj `if test -f 'adios_read.c'; then $(CYGPATH_W) 'adios_read.c'; else $(CYGPATH_W) '$(srcdir)/adios_read.c'; fi`
 
 libadiosread_a-adios_read_hooks.o: adios_read_hooks.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_read_hooks.o `test -f 'adios_read_hooks.c' || echo '$(srcdir)/'`adios_read_hooks.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_read_hooks.o `test -f 'adios_read_hooks.c' || echo '$(srcdir)/'`adios_read_hooks.c
 
 libadiosread_a-adios_read_hooks.obj: adios_read_hooks.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_read_hooks.obj `if test -f 'adios_read_hooks.c'; then $(CYGPATH_W) 'adios_read_hooks.c'; else $(CYGPATH_W) '$(srcdir)/adios_read_hooks.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_read_hooks.obj `if test -f 'adios_read_hooks.c'; then $(CYGPATH_W) 'adios_read_hooks.c'; else $(CYGPATH_W) '$(srcdir)/adios_read_hooks.c'; fi`
 
 libadiosread_a-common_read.o: common_read.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-common_read.o `test -f 'common_read.c' || echo '$(srcdir)/'`common_read.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-common_read.o `test -f 'common_read.c' || echo '$(srcdir)/'`common_read.c
 
 libadiosread_a-common_read.obj: common_read.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-common_read.obj `if test -f 'common_read.c'; then $(CYGPATH_W) 'common_read.c'; else $(CYGPATH_W) '$(srcdir)/common_read.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-common_read.obj `if test -f 'common_read.c'; then $(CYGPATH_W) 'common_read.c'; else $(CYGPATH_W) '$(srcdir)/common_read.c'; fi`
 
 libadiosread_a-read_bp.o: read_bp.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-read_bp.o `test -f 'read_bp.c' || echo '$(srcdir)/'`read_bp.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-read_bp.o `test -f 'read_bp.c' || echo '$(srcdir)/'`read_bp.c
 
 libadiosread_a-read_bp.obj: read_bp.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-read_bp.obj `if test -f 'read_bp.c'; then $(CYGPATH_W) 'read_bp.c'; else $(CYGPATH_W) '$(srcdir)/read_bp.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-read_bp.obj `if test -f 'read_bp.c'; then $(CYGPATH_W) 'read_bp.c'; else $(CYGPATH_W) '$(srcdir)/read_bp.c'; fi`
+
+libadiosread_a-read_bp_staged.o: read_bp_staged.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-read_bp_staged.o `test -f 'read_bp_staged.c' || echo '$(srcdir)/'`read_bp_staged.c
+
+libadiosread_a-read_bp_staged.obj: read_bp_staged.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-read_bp_staged.obj `if test -f 'read_bp_staged.c'; then $(CYGPATH_W) 'read_bp_staged.c'; else $(CYGPATH_W) '$(srcdir)/read_bp_staged.c'; fi`
 
 libadiosread_a-globals.o: globals.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-globals.o `test -f 'globals.c' || echo '$(srcdir)/'`globals.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-globals.o `test -f 'globals.c' || echo '$(srcdir)/'`globals.c
 
 libadiosread_a-globals.obj: globals.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-globals.obj `if test -f 'globals.c'; then $(CYGPATH_W) 'globals.c'; else $(CYGPATH_W) '$(srcdir)/globals.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-globals.obj `if test -f 'globals.c'; then $(CYGPATH_W) 'globals.c'; else $(CYGPATH_W) '$(srcdir)/globals.c'; fi`
 
 libadiosread_a-read_dart.o: read_dart.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-read_dart.o `test -f 'read_dart.c' || echo '$(srcdir)/'`read_dart.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-read_dart.o `test -f 'read_dart.c' || echo '$(srcdir)/'`read_dart.c
 
 libadiosread_a-read_dart.obj: read_dart.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-read_dart.obj `if test -f 'read_dart.c'; then $(CYGPATH_W) 'read_dart.c'; else $(CYGPATH_W) '$(srcdir)/read_dart.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-read_dart.obj `if test -f 'read_dart.c'; then $(CYGPATH_W) 'read_dart.c'; else $(CYGPATH_W) '$(srcdir)/read_dart.c'; fi`
 
 libadiosread_a-read_dimes.o: read_dimes.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-read_dimes.o `test -f 'read_dimes.c' || echo '$(srcdir)/'`read_dimes.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-read_dimes.o `test -f 'read_dimes.c' || echo '$(srcdir)/'`read_dimes.c
 
 libadiosread_a-read_dimes.obj: read_dimes.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_a-read_dimes.obj `if test -f 'read_dimes.c'; then $(CYGPATH_W) 'read_dimes.c'; else $(CYGPATH_W) '$(srcdir)/read_dimes.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-read_dimes.obj `if test -f 'read_dimes.c'; then $(CYGPATH_W) 'read_dimes.c'; else $(CYGPATH_W) '$(srcdir)/read_dimes.c'; fi`
+
+libadiosread_a-read_datatap.o: read_datatap.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-read_datatap.o `test -f 'read_datatap.c' || echo '$(srcdir)/'`read_datatap.c
+
+libadiosread_a-read_datatap.obj: read_datatap.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-read_datatap.obj `if test -f 'read_datatap.c'; then $(CYGPATH_W) 'read_datatap.c'; else $(CYGPATH_W) '$(srcdir)/read_datatap.c'; fi`
+
+libadiosread_a-adios_nssi_config.o: adios_nssi_config.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_nssi_config.o `test -f 'adios_nssi_config.c' || echo '$(srcdir)/'`adios_nssi_config.c
+
+libadiosread_a-adios_nssi_config.obj: adios_nssi_config.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_nssi_config.obj `if test -f 'adios_nssi_config.c'; then $(CYGPATH_W) 'adios_nssi_config.c'; else $(CYGPATH_W) '$(srcdir)/adios_nssi_config.c'; fi`
+
+libadiosread_a-read_nssi.o: read_nssi.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-read_nssi.o `test -f 'read_nssi.c' || echo '$(srcdir)/'`read_nssi.c
+
+libadiosread_a-read_nssi.obj: read_nssi.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-read_nssi.obj `if test -f 'read_nssi.c'; then $(CYGPATH_W) 'read_nssi.c'; else $(CYGPATH_W) '$(srcdir)/read_nssi.c'; fi`
+
+libadiosread_a-adios_nssi_args.o: adios_nssi_args.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_nssi_args.o `test -f 'adios_nssi_args.c' || echo '$(srcdir)/'`adios_nssi_args.c
+
+libadiosread_a-adios_nssi_args.obj: adios_nssi_args.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_a_CFLAGS) $(CFLAGS) -c -o libadiosread_a-adios_nssi_args.obj `if test -f 'adios_nssi_args.c'; then $(CYGPATH_W) 'adios_nssi_args.c'; else $(CYGPATH_W) '$(srcdir)/adios_nssi_args.c'; fi`
 
 libadiosread_nompi_a-mpidummy.o: mpidummy.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-mpidummy.o `test -f 'mpidummy.c' || echo '$(srcdir)/'`mpidummy.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-mpidummy.o `test -f 'mpidummy.c' || echo '$(srcdir)/'`mpidummy.c
 
 libadiosread_nompi_a-mpidummy.obj: mpidummy.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-mpidummy.obj `if test -f 'mpidummy.c'; then $(CYGPATH_W) 'mpidummy.c'; else $(CYGPATH_W) '$(srcdir)/mpidummy.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-mpidummy.obj `if test -f 'mpidummy.c'; then $(CYGPATH_W) 'mpidummy.c'; else $(CYGPATH_W) '$(srcdir)/mpidummy.c'; fi`
 
 libadiosread_nompi_a-adios_bp_v1.o: adios_bp_v1.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_bp_v1.o `test -f 'adios_bp_v1.c' || echo '$(srcdir)/'`adios_bp_v1.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_bp_v1.o `test -f 'adios_bp_v1.c' || echo '$(srcdir)/'`adios_bp_v1.c
 
 libadiosread_nompi_a-adios_bp_v1.obj: adios_bp_v1.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_bp_v1.obj `if test -f 'adios_bp_v1.c'; then $(CYGPATH_W) 'adios_bp_v1.c'; else $(CYGPATH_W) '$(srcdir)/adios_bp_v1.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_bp_v1.obj `if test -f 'adios_bp_v1.c'; then $(CYGPATH_W) 'adios_bp_v1.c'; else $(CYGPATH_W) '$(srcdir)/adios_bp_v1.c'; fi`
 
 libadiosread_nompi_a-adios_endianness.o: adios_endianness.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_endianness.o `test -f 'adios_endianness.c' || echo '$(srcdir)/'`adios_endianness.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_endianness.o `test -f 'adios_endianness.c' || echo '$(srcdir)/'`adios_endianness.c
 
 libadiosread_nompi_a-adios_endianness.obj: adios_endianness.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_endianness.obj `if test -f 'adios_endianness.c'; then $(CYGPATH_W) 'adios_endianness.c'; else $(CYGPATH_W) '$(srcdir)/adios_endianness.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_endianness.obj `if test -f 'adios_endianness.c'; then $(CYGPATH_W) 'adios_endianness.c'; else $(CYGPATH_W) '$(srcdir)/adios_endianness.c'; fi`
 
 libadiosread_nompi_a-bp_utils.o: bp_utils.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-bp_utils.o `test -f 'bp_utils.c' || echo '$(srcdir)/'`bp_utils.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-bp_utils.o `test -f 'bp_utils.c' || echo '$(srcdir)/'`bp_utils.c
 
 libadiosread_nompi_a-bp_utils.obj: bp_utils.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-bp_utils.obj `if test -f 'bp_utils.c'; then $(CYGPATH_W) 'bp_utils.c'; else $(CYGPATH_W) '$(srcdir)/bp_utils.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-bp_utils.obj `if test -f 'bp_utils.c'; then $(CYGPATH_W) 'bp_utils.c'; else $(CYGPATH_W) '$(srcdir)/bp_utils.c'; fi`
 
 libadiosread_nompi_a-futils.o: futils.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-futils.o `test -f 'futils.c' || echo '$(srcdir)/'`futils.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-futils.o `test -f 'futils.c' || echo '$(srcdir)/'`futils.c
 
 libadiosread_nompi_a-futils.obj: futils.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-futils.obj `if test -f 'futils.c'; then $(CYGPATH_W) 'futils.c'; else $(CYGPATH_W) '$(srcdir)/futils.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-futils.obj `if test -f 'futils.c'; then $(CYGPATH_W) 'futils.c'; else $(CYGPATH_W) '$(srcdir)/futils.c'; fi`
 
 libadiosread_nompi_a-adios_error.o: adios_error.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_error.o `test -f 'adios_error.c' || echo '$(srcdir)/'`adios_error.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_error.o `test -f 'adios_error.c' || echo '$(srcdir)/'`adios_error.c
 
 libadiosread_nompi_a-adios_error.obj: adios_error.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_error.obj `if test -f 'adios_error.c'; then $(CYGPATH_W) 'adios_error.c'; else $(CYGPATH_W) '$(srcdir)/adios_error.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_error.obj `if test -f 'adios_error.c'; then $(CYGPATH_W) 'adios_error.c'; else $(CYGPATH_W) '$(srcdir)/adios_error.c'; fi`
 
 libadiosread_nompi_a-adios_read.o: adios_read.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_read.o `test -f 'adios_read.c' || echo '$(srcdir)/'`adios_read.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_read.o `test -f 'adios_read.c' || echo '$(srcdir)/'`adios_read.c
 
 libadiosread_nompi_a-adios_read.obj: adios_read.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_read.obj `if test -f 'adios_read.c'; then $(CYGPATH_W) 'adios_read.c'; else $(CYGPATH_W) '$(srcdir)/adios_read.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_read.obj `if test -f 'adios_read.c'; then $(CYGPATH_W) 'adios_read.c'; else $(CYGPATH_W) '$(srcdir)/adios_read.c'; fi`
 
 libadiosread_nompi_a-adios_read_hooks.o: adios_read_hooks.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_read_hooks.o `test -f 'adios_read_hooks.c' || echo '$(srcdir)/'`adios_read_hooks.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_read_hooks.o `test -f 'adios_read_hooks.c' || echo '$(srcdir)/'`adios_read_hooks.c
 
 libadiosread_nompi_a-adios_read_hooks.obj: adios_read_hooks.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_read_hooks.obj `if test -f 'adios_read_hooks.c'; then $(CYGPATH_W) 'adios_read_hooks.c'; else $(CYGPATH_W) '$(srcdir)/adios_read_hooks.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_read_hooks.obj `if test -f 'adios_read_hooks.c'; then $(CYGPATH_W) 'adios_read_hooks.c'; else $(CYGPATH_W) '$(srcdir)/adios_read_hooks.c'; fi`
 
 libadiosread_nompi_a-common_read.o: common_read.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-common_read.o `test -f 'common_read.c' || echo '$(srcdir)/'`common_read.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-common_read.o `test -f 'common_read.c' || echo '$(srcdir)/'`common_read.c
 
 libadiosread_nompi_a-common_read.obj: common_read.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-common_read.obj `if test -f 'common_read.c'; then $(CYGPATH_W) 'common_read.c'; else $(CYGPATH_W) '$(srcdir)/common_read.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-common_read.obj `if test -f 'common_read.c'; then $(CYGPATH_W) 'common_read.c'; else $(CYGPATH_W) '$(srcdir)/common_read.c'; fi`
 
 libadiosread_nompi_a-read_bp.o: read_bp.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-read_bp.o `test -f 'read_bp.c' || echo '$(srcdir)/'`read_bp.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-read_bp.o `test -f 'read_bp.c' || echo '$(srcdir)/'`read_bp.c
 
 libadiosread_nompi_a-read_bp.obj: read_bp.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-read_bp.obj `if test -f 'read_bp.c'; then $(CYGPATH_W) 'read_bp.c'; else $(CYGPATH_W) '$(srcdir)/read_bp.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-read_bp.obj `if test -f 'read_bp.c'; then $(CYGPATH_W) 'read_bp.c'; else $(CYGPATH_W) '$(srcdir)/read_bp.c'; fi`
 
 libadiosread_nompi_a-adios_internals.o: adios_internals.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_internals.o `test -f 'adios_internals.c' || echo '$(srcdir)/'`adios_internals.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_internals.o `test -f 'adios_internals.c' || echo '$(srcdir)/'`adios_internals.c
 
 libadiosread_nompi_a-adios_internals.obj: adios_internals.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_internals.obj `if test -f 'adios_internals.c'; then $(CYGPATH_W) 'adios_internals.c'; else $(CYGPATH_W) '$(srcdir)/adios_internals.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_internals.obj `if test -f 'adios_internals.c'; then $(CYGPATH_W) 'adios_internals.c'; else $(CYGPATH_W) '$(srcdir)/adios_internals.c'; fi`
 
 libadiosread_nompi_a-buffer.o: buffer.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-buffer.o `test -f 'buffer.c' || echo '$(srcdir)/'`buffer.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-buffer.o `test -f 'buffer.c' || echo '$(srcdir)/'`buffer.c
 
 libadiosread_nompi_a-buffer.obj: buffer.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-buffer.obj `if test -f 'buffer.c'; then $(CYGPATH_W) 'buffer.c'; else $(CYGPATH_W) '$(srcdir)/buffer.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-buffer.obj `if test -f 'buffer.c'; then $(CYGPATH_W) 'buffer.c'; else $(CYGPATH_W) '$(srcdir)/buffer.c'; fi`
 
 libadiosread_nompi_a-adios_transport_hooks.o: adios_transport_hooks.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_transport_hooks.o `test -f 'adios_transport_hooks.c' || echo '$(srcdir)/'`adios_transport_hooks.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_transport_hooks.o `test -f 'adios_transport_hooks.c' || echo '$(srcdir)/'`adios_transport_hooks.c
 
 libadiosread_nompi_a-adios_transport_hooks.obj: adios_transport_hooks.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_transport_hooks.obj `if test -f 'adios_transport_hooks.c'; then $(CYGPATH_W) 'adios_transport_hooks.c'; else $(CYGPATH_W) '$(srcdir)/adios_transport_hooks.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_transport_hooks.obj `if test -f 'adios_transport_hooks.c'; then $(CYGPATH_W) 'adios_transport_hooks.c'; else $(CYGPATH_W) '$(srcdir)/adios_transport_hooks.c'; fi`
 
 libadiosread_nompi_a-globals.o: globals.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-globals.o `test -f 'globals.c' || echo '$(srcdir)/'`globals.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-globals.o `test -f 'globals.c' || echo '$(srcdir)/'`globals.c
 
 libadiosread_nompi_a-globals.obj: globals.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-globals.obj `if test -f 'globals.c'; then $(CYGPATH_W) 'globals.c'; else $(CYGPATH_W) '$(srcdir)/globals.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-globals.obj `if test -f 'globals.c'; then $(CYGPATH_W) 'globals.c'; else $(CYGPATH_W) '$(srcdir)/globals.c'; fi`
 
 libadiosread_nompi_a-read_dart.o: read_dart.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-read_dart.o `test -f 'read_dart.c' || echo '$(srcdir)/'`read_dart.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-read_dart.o `test -f 'read_dart.c' || echo '$(srcdir)/'`read_dart.c
 
 libadiosread_nompi_a-read_dart.obj: read_dart.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-read_dart.obj `if test -f 'read_dart.c'; then $(CYGPATH_W) 'read_dart.c'; else $(CYGPATH_W) '$(srcdir)/read_dart.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-read_dart.obj `if test -f 'read_dart.c'; then $(CYGPATH_W) 'read_dart.c'; else $(CYGPATH_W) '$(srcdir)/read_dart.c'; fi`
 
 libadiosread_nompi_a-read_dimes.o: read_dimes.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-read_dimes.o `test -f 'read_dimes.c' || echo '$(srcdir)/'`read_dimes.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-read_dimes.o `test -f 'read_dimes.c' || echo '$(srcdir)/'`read_dimes.c
 
 libadiosread_nompi_a-read_dimes.obj: read_dimes.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-read_dimes.obj `if test -f 'read_dimes.c'; then $(CYGPATH_W) 'read_dimes.c'; else $(CYGPATH_W) '$(srcdir)/read_dimes.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-read_dimes.obj `if test -f 'read_dimes.c'; then $(CYGPATH_W) 'read_dimes.c'; else $(CYGPATH_W) '$(srcdir)/read_dimes.c'; fi`
+
+libadiosread_nompi_a-read_datatap.o: read_datatap.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-read_datatap.o `test -f 'read_datatap.c' || echo '$(srcdir)/'`read_datatap.c
+
+libadiosread_nompi_a-read_datatap.obj: read_datatap.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-read_datatap.obj `if test -f 'read_datatap.c'; then $(CYGPATH_W) 'read_datatap.c'; else $(CYGPATH_W) '$(srcdir)/read_datatap.c'; fi`
+
+libadiosread_nompi_a-adios_nssi_config.o: adios_nssi_config.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_nssi_config.o `test -f 'adios_nssi_config.c' || echo '$(srcdir)/'`adios_nssi_config.c
+
+libadiosread_nompi_a-adios_nssi_config.obj: adios_nssi_config.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_nssi_config.obj `if test -f 'adios_nssi_config.c'; then $(CYGPATH_W) 'adios_nssi_config.c'; else $(CYGPATH_W) '$(srcdir)/adios_nssi_config.c'; fi`
+
+libadiosread_nompi_a-read_nssi.o: read_nssi.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-read_nssi.o `test -f 'read_nssi.c' || echo '$(srcdir)/'`read_nssi.c
+
+libadiosread_nompi_a-read_nssi.obj: read_nssi.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-read_nssi.obj `if test -f 'read_nssi.c'; then $(CYGPATH_W) 'read_nssi.c'; else $(CYGPATH_W) '$(srcdir)/read_nssi.c'; fi`
+
+libadiosread_nompi_a-adios_nssi_args.o: adios_nssi_args.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_nssi_args.o `test -f 'adios_nssi_args.c' || echo '$(srcdir)/'`adios_nssi_args.c
+
+libadiosread_nompi_a-adios_nssi_args.obj: adios_nssi_args.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosread_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosread_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosread_nompi_a-adios_nssi_args.obj `if test -f 'adios_nssi_args.c'; then $(CYGPATH_W) 'adios_nssi_args.c'; else $(CYGPATH_W) '$(srcdir)/adios_nssi_args.c'; fi`
 
 libadiosreadf_a-adios_bp_v1.o: adios_bp_v1.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adios_bp_v1.o `test -f 'adios_bp_v1.c' || echo '$(srcdir)/'`adios_bp_v1.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adios_bp_v1.o `test -f 'adios_bp_v1.c' || echo '$(srcdir)/'`adios_bp_v1.c
 
 libadiosreadf_a-adios_bp_v1.obj: adios_bp_v1.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adios_bp_v1.obj `if test -f 'adios_bp_v1.c'; then $(CYGPATH_W) 'adios_bp_v1.c'; else $(CYGPATH_W) '$(srcdir)/adios_bp_v1.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adios_bp_v1.obj `if test -f 'adios_bp_v1.c'; then $(CYGPATH_W) 'adios_bp_v1.c'; else $(CYGPATH_W) '$(srcdir)/adios_bp_v1.c'; fi`
 
 libadiosreadf_a-adios_endianness.o: adios_endianness.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adios_endianness.o `test -f 'adios_endianness.c' || echo '$(srcdir)/'`adios_endianness.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adios_endianness.o `test -f 'adios_endianness.c' || echo '$(srcdir)/'`adios_endianness.c
 
 libadiosreadf_a-adios_endianness.obj: adios_endianness.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adios_endianness.obj `if test -f 'adios_endianness.c'; then $(CYGPATH_W) 'adios_endianness.c'; else $(CYGPATH_W) '$(srcdir)/adios_endianness.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adios_endianness.obj `if test -f 'adios_endianness.c'; then $(CYGPATH_W) 'adios_endianness.c'; else $(CYGPATH_W) '$(srcdir)/adios_endianness.c'; fi`
 
 libadiosreadf_a-bp_utils.o: bp_utils.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-bp_utils.o `test -f 'bp_utils.c' || echo '$(srcdir)/'`bp_utils.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-bp_utils.o `test -f 'bp_utils.c' || echo '$(srcdir)/'`bp_utils.c
 
 libadiosreadf_a-bp_utils.obj: bp_utils.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-bp_utils.obj `if test -f 'bp_utils.c'; then $(CYGPATH_W) 'bp_utils.c'; else $(CYGPATH_W) '$(srcdir)/bp_utils.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-bp_utils.obj `if test -f 'bp_utils.c'; then $(CYGPATH_W) 'bp_utils.c'; else $(CYGPATH_W) '$(srcdir)/bp_utils.c'; fi`
 
 libadiosreadf_a-futils.o: futils.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-futils.o `test -f 'futils.c' || echo '$(srcdir)/'`futils.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-futils.o `test -f 'futils.c' || echo '$(srcdir)/'`futils.c
 
 libadiosreadf_a-futils.obj: futils.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-futils.obj `if test -f 'futils.c'; then $(CYGPATH_W) 'futils.c'; else $(CYGPATH_W) '$(srcdir)/futils.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-futils.obj `if test -f 'futils.c'; then $(CYGPATH_W) 'futils.c'; else $(CYGPATH_W) '$(srcdir)/futils.c'; fi`
 
 libadiosreadf_a-adios_error.o: adios_error.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adios_error.o `test -f 'adios_error.c' || echo '$(srcdir)/'`adios_error.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adios_error.o `test -f 'adios_error.c' || echo '$(srcdir)/'`adios_error.c
 
 libadiosreadf_a-adios_error.obj: adios_error.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adios_error.obj `if test -f 'adios_error.c'; then $(CYGPATH_W) 'adios_error.c'; else $(CYGPATH_W) '$(srcdir)/adios_error.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adios_error.obj `if test -f 'adios_error.c'; then $(CYGPATH_W) 'adios_error.c'; else $(CYGPATH_W) '$(srcdir)/adios_error.c'; fi`
 
 libadiosreadf_a-adiosf_read.o: adiosf_read.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adiosf_read.o `test -f 'adiosf_read.c' || echo '$(srcdir)/'`adiosf_read.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adiosf_read.o `test -f 'adiosf_read.c' || echo '$(srcdir)/'`adiosf_read.c
 
 libadiosreadf_a-adiosf_read.obj: adiosf_read.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adiosf_read.obj `if test -f 'adiosf_read.c'; then $(CYGPATH_W) 'adiosf_read.c'; else $(CYGPATH_W) '$(srcdir)/adiosf_read.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adiosf_read.obj `if test -f 'adiosf_read.c'; then $(CYGPATH_W) 'adiosf_read.c'; else $(CYGPATH_W) '$(srcdir)/adiosf_read.c'; fi`
 
 libadiosreadf_a-adios_read_hooks.o: adios_read_hooks.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adios_read_hooks.o `test -f 'adios_read_hooks.c' || echo '$(srcdir)/'`adios_read_hooks.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adios_read_hooks.o `test -f 'adios_read_hooks.c' || echo '$(srcdir)/'`adios_read_hooks.c
 
 libadiosreadf_a-adios_read_hooks.obj: adios_read_hooks.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adios_read_hooks.obj `if test -f 'adios_read_hooks.c'; then $(CYGPATH_W) 'adios_read_hooks.c'; else $(CYGPATH_W) '$(srcdir)/adios_read_hooks.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adios_read_hooks.obj `if test -f 'adios_read_hooks.c'; then $(CYGPATH_W) 'adios_read_hooks.c'; else $(CYGPATH_W) '$(srcdir)/adios_read_hooks.c'; fi`
 
 libadiosreadf_a-common_read.o: common_read.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-common_read.o `test -f 'common_read.c' || echo '$(srcdir)/'`common_read.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-common_read.o `test -f 'common_read.c' || echo '$(srcdir)/'`common_read.c
 
 libadiosreadf_a-common_read.obj: common_read.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-common_read.obj `if test -f 'common_read.c'; then $(CYGPATH_W) 'common_read.c'; else $(CYGPATH_W) '$(srcdir)/common_read.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-common_read.obj `if test -f 'common_read.c'; then $(CYGPATH_W) 'common_read.c'; else $(CYGPATH_W) '$(srcdir)/common_read.c'; fi`
 
 libadiosreadf_a-read_bp.o: read_bp.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-read_bp.o `test -f 'read_bp.c' || echo '$(srcdir)/'`read_bp.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-read_bp.o `test -f 'read_bp.c' || echo '$(srcdir)/'`read_bp.c
 
 libadiosreadf_a-read_bp.obj: read_bp.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-read_bp.obj `if test -f 'read_bp.c'; then $(CYGPATH_W) 'read_bp.c'; else $(CYGPATH_W) '$(srcdir)/read_bp.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-read_bp.obj `if test -f 'read_bp.c'; then $(CYGPATH_W) 'read_bp.c'; else $(CYGPATH_W) '$(srcdir)/read_bp.c'; fi`
+
+libadiosreadf_a-read_bp_staged.o: read_bp_staged.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-read_bp_staged.o `test -f 'read_bp_staged.c' || echo '$(srcdir)/'`read_bp_staged.c
+
+libadiosreadf_a-read_bp_staged.obj: read_bp_staged.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-read_bp_staged.obj `if test -f 'read_bp_staged.c'; then $(CYGPATH_W) 'read_bp_staged.c'; else $(CYGPATH_W) '$(srcdir)/read_bp_staged.c'; fi`
 
 libadiosreadf_a-globals.o: globals.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-globals.o `test -f 'globals.c' || echo '$(srcdir)/'`globals.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-globals.o `test -f 'globals.c' || echo '$(srcdir)/'`globals.c
 
 libadiosreadf_a-globals.obj: globals.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-globals.obj `if test -f 'globals.c'; then $(CYGPATH_W) 'globals.c'; else $(CYGPATH_W) '$(srcdir)/globals.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-globals.obj `if test -f 'globals.c'; then $(CYGPATH_W) 'globals.c'; else $(CYGPATH_W) '$(srcdir)/globals.c'; fi`
 
 libadiosreadf_a-read_dart.o: read_dart.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-read_dart.o `test -f 'read_dart.c' || echo '$(srcdir)/'`read_dart.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-read_dart.o `test -f 'read_dart.c' || echo '$(srcdir)/'`read_dart.c
 
 libadiosreadf_a-read_dart.obj: read_dart.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-read_dart.obj `if test -f 'read_dart.c'; then $(CYGPATH_W) 'read_dart.c'; else $(CYGPATH_W) '$(srcdir)/read_dart.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-read_dart.obj `if test -f 'read_dart.c'; then $(CYGPATH_W) 'read_dart.c'; else $(CYGPATH_W) '$(srcdir)/read_dart.c'; fi`
 
 libadiosreadf_a-read_dimes.o: read_dimes.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-read_dimes.o `test -f 'read_dimes.c' || echo '$(srcdir)/'`read_dimes.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-read_dimes.o `test -f 'read_dimes.c' || echo '$(srcdir)/'`read_dimes.c
 
 libadiosreadf_a-read_dimes.obj: read_dimes.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-read_dimes.obj `if test -f 'read_dimes.c'; then $(CYGPATH_W) 'read_dimes.c'; else $(CYGPATH_W) '$(srcdir)/read_dimes.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-read_dimes.obj `if test -f 'read_dimes.c'; then $(CYGPATH_W) 'read_dimes.c'; else $(CYGPATH_W) '$(srcdir)/read_dimes.c'; fi`
+
+libadiosreadf_a-read_datatap.o: read_datatap.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-read_datatap.o `test -f 'read_datatap.c' || echo '$(srcdir)/'`read_datatap.c
+
+libadiosreadf_a-read_datatap.obj: read_datatap.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-read_datatap.obj `if test -f 'read_datatap.c'; then $(CYGPATH_W) 'read_datatap.c'; else $(CYGPATH_W) '$(srcdir)/read_datatap.c'; fi`
+
+libadiosreadf_a-adios_nssi_config.o: adios_nssi_config.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adios_nssi_config.o `test -f 'adios_nssi_config.c' || echo '$(srcdir)/'`adios_nssi_config.c
+
+libadiosreadf_a-adios_nssi_config.obj: adios_nssi_config.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adios_nssi_config.obj `if test -f 'adios_nssi_config.c'; then $(CYGPATH_W) 'adios_nssi_config.c'; else $(CYGPATH_W) '$(srcdir)/adios_nssi_config.c'; fi`
+
+libadiosreadf_a-read_nssi.o: read_nssi.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-read_nssi.o `test -f 'read_nssi.c' || echo '$(srcdir)/'`read_nssi.c
+
+libadiosreadf_a-read_nssi.obj: read_nssi.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-read_nssi.obj `if test -f 'read_nssi.c'; then $(CYGPATH_W) 'read_nssi.c'; else $(CYGPATH_W) '$(srcdir)/read_nssi.c'; fi`
+
+libadiosreadf_a-adios_nssi_args.o: adios_nssi_args.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adios_nssi_args.o `test -f 'adios_nssi_args.c' || echo '$(srcdir)/'`adios_nssi_args.c
+
+libadiosreadf_a-adios_nssi_args.obj: adios_nssi_args.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_a-adios_nssi_args.obj `if test -f 'adios_nssi_args.c'; then $(CYGPATH_W) 'adios_nssi_args.c'; else $(CYGPATH_W) '$(srcdir)/adios_nssi_args.c'; fi`
 
 libadiosreadf_nompi_a-mpidummy.o: mpidummy.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-mpidummy.o `test -f 'mpidummy.c' || echo '$(srcdir)/'`mpidummy.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-mpidummy.o `test -f 'mpidummy.c' || echo '$(srcdir)/'`mpidummy.c
 
 libadiosreadf_nompi_a-mpidummy.obj: mpidummy.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-mpidummy.obj `if test -f 'mpidummy.c'; then $(CYGPATH_W) 'mpidummy.c'; else $(CYGPATH_W) '$(srcdir)/mpidummy.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-mpidummy.obj `if test -f 'mpidummy.c'; then $(CYGPATH_W) 'mpidummy.c'; else $(CYGPATH_W) '$(srcdir)/mpidummy.c'; fi`
 
 libadiosreadf_nompi_a-adios_bp_v1.o: adios_bp_v1.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adios_bp_v1.o `test -f 'adios_bp_v1.c' || echo '$(srcdir)/'`adios_bp_v1.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adios_bp_v1.o `test -f 'adios_bp_v1.c' || echo '$(srcdir)/'`adios_bp_v1.c
 
 libadiosreadf_nompi_a-adios_bp_v1.obj: adios_bp_v1.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adios_bp_v1.obj `if test -f 'adios_bp_v1.c'; then $(CYGPATH_W) 'adios_bp_v1.c'; else $(CYGPATH_W) '$(srcdir)/adios_bp_v1.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adios_bp_v1.obj `if test -f 'adios_bp_v1.c'; then $(CYGPATH_W) 'adios_bp_v1.c'; else $(CYGPATH_W) '$(srcdir)/adios_bp_v1.c'; fi`
 
 libadiosreadf_nompi_a-adios_endianness.o: adios_endianness.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adios_endianness.o `test -f 'adios_endianness.c' || echo '$(srcdir)/'`adios_endianness.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adios_endianness.o `test -f 'adios_endianness.c' || echo '$(srcdir)/'`adios_endianness.c
 
 libadiosreadf_nompi_a-adios_endianness.obj: adios_endianness.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adios_endianness.obj `if test -f 'adios_endianness.c'; then $(CYGPATH_W) 'adios_endianness.c'; else $(CYGPATH_W) '$(srcdir)/adios_endianness.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adios_endianness.obj `if test -f 'adios_endianness.c'; then $(CYGPATH_W) 'adios_endianness.c'; else $(CYGPATH_W) '$(srcdir)/adios_endianness.c'; fi`
 
 libadiosreadf_nompi_a-bp_utils.o: bp_utils.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-bp_utils.o `test -f 'bp_utils.c' || echo '$(srcdir)/'`bp_utils.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-bp_utils.o `test -f 'bp_utils.c' || echo '$(srcdir)/'`bp_utils.c
 
 libadiosreadf_nompi_a-bp_utils.obj: bp_utils.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-bp_utils.obj `if test -f 'bp_utils.c'; then $(CYGPATH_W) 'bp_utils.c'; else $(CYGPATH_W) '$(srcdir)/bp_utils.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-bp_utils.obj `if test -f 'bp_utils.c'; then $(CYGPATH_W) 'bp_utils.c'; else $(CYGPATH_W) '$(srcdir)/bp_utils.c'; fi`
 
 libadiosreadf_nompi_a-futils.o: futils.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-futils.o `test -f 'futils.c' || echo '$(srcdir)/'`futils.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-futils.o `test -f 'futils.c' || echo '$(srcdir)/'`futils.c
 
 libadiosreadf_nompi_a-futils.obj: futils.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-futils.obj `if test -f 'futils.c'; then $(CYGPATH_W) 'futils.c'; else $(CYGPATH_W) '$(srcdir)/futils.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-futils.obj `if test -f 'futils.c'; then $(CYGPATH_W) 'futils.c'; else $(CYGPATH_W) '$(srcdir)/futils.c'; fi`
 
 libadiosreadf_nompi_a-adios_error.o: adios_error.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adios_error.o `test -f 'adios_error.c' || echo '$(srcdir)/'`adios_error.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adios_error.o `test -f 'adios_error.c' || echo '$(srcdir)/'`adios_error.c
 
 libadiosreadf_nompi_a-adios_error.obj: adios_error.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adios_error.obj `if test -f 'adios_error.c'; then $(CYGPATH_W) 'adios_error.c'; else $(CYGPATH_W) '$(srcdir)/adios_error.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adios_error.obj `if test -f 'adios_error.c'; then $(CYGPATH_W) 'adios_error.c'; else $(CYGPATH_W) '$(srcdir)/adios_error.c'; fi`
 
 libadiosreadf_nompi_a-adiosf_read.o: adiosf_read.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adiosf_read.o `test -f 'adiosf_read.c' || echo '$(srcdir)/'`adiosf_read.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adiosf_read.o `test -f 'adiosf_read.c' || echo '$(srcdir)/'`adiosf_read.c
 
 libadiosreadf_nompi_a-adiosf_read.obj: adiosf_read.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adiosf_read.obj `if test -f 'adiosf_read.c'; then $(CYGPATH_W) 'adiosf_read.c'; else $(CYGPATH_W) '$(srcdir)/adiosf_read.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adiosf_read.obj `if test -f 'adiosf_read.c'; then $(CYGPATH_W) 'adiosf_read.c'; else $(CYGPATH_W) '$(srcdir)/adiosf_read.c'; fi`
 
 libadiosreadf_nompi_a-adios_read_hooks.o: adios_read_hooks.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adios_read_hooks.o `test -f 'adios_read_hooks.c' || echo '$(srcdir)/'`adios_read_hooks.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adios_read_hooks.o `test -f 'adios_read_hooks.c' || echo '$(srcdir)/'`adios_read_hooks.c
 
 libadiosreadf_nompi_a-adios_read_hooks.obj: adios_read_hooks.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adios_read_hooks.obj `if test -f 'adios_read_hooks.c'; then $(CYGPATH_W) 'adios_read_hooks.c'; else $(CYGPATH_W) '$(srcdir)/adios_read_hooks.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adios_read_hooks.obj `if test -f 'adios_read_hooks.c'; then $(CYGPATH_W) 'adios_read_hooks.c'; else $(CYGPATH_W) '$(srcdir)/adios_read_hooks.c'; fi`
 
 libadiosreadf_nompi_a-common_read.o: common_read.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-common_read.o `test -f 'common_read.c' || echo '$(srcdir)/'`common_read.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-common_read.o `test -f 'common_read.c' || echo '$(srcdir)/'`common_read.c
 
 libadiosreadf_nompi_a-common_read.obj: common_read.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-common_read.obj `if test -f 'common_read.c'; then $(CYGPATH_W) 'common_read.c'; else $(CYGPATH_W) '$(srcdir)/common_read.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-common_read.obj `if test -f 'common_read.c'; then $(CYGPATH_W) 'common_read.c'; else $(CYGPATH_W) '$(srcdir)/common_read.c'; fi`
 
 libadiosreadf_nompi_a-read_bp.o: read_bp.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-read_bp.o `test -f 'read_bp.c' || echo '$(srcdir)/'`read_bp.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-read_bp.o `test -f 'read_bp.c' || echo '$(srcdir)/'`read_bp.c
 
 libadiosreadf_nompi_a-read_bp.obj: read_bp.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-read_bp.obj `if test -f 'read_bp.c'; then $(CYGPATH_W) 'read_bp.c'; else $(CYGPATH_W) '$(srcdir)/read_bp.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-read_bp.obj `if test -f 'read_bp.c'; then $(CYGPATH_W) 'read_bp.c'; else $(CYGPATH_W) '$(srcdir)/read_bp.c'; fi`
+
+libadiosreadf_nompi_a-globals.o: globals.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-globals.o `test -f 'globals.c' || echo '$(srcdir)/'`globals.c
+
+libadiosreadf_nompi_a-globals.obj: globals.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-globals.obj `if test -f 'globals.c'; then $(CYGPATH_W) 'globals.c'; else $(CYGPATH_W) '$(srcdir)/globals.c'; fi`
 
 libadiosreadf_nompi_a-read_dart.o: read_dart.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-read_dart.o `test -f 'read_dart.c' || echo '$(srcdir)/'`read_dart.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-read_dart.o `test -f 'read_dart.c' || echo '$(srcdir)/'`read_dart.c
 
 libadiosreadf_nompi_a-read_dart.obj: read_dart.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-read_dart.obj `if test -f 'read_dart.c'; then $(CYGPATH_W) 'read_dart.c'; else $(CYGPATH_W) '$(srcdir)/read_dart.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-read_dart.obj `if test -f 'read_dart.c'; then $(CYGPATH_W) 'read_dart.c'; else $(CYGPATH_W) '$(srcdir)/read_dart.c'; fi`
 
 libadiosreadf_nompi_a-read_dimes.o: read_dimes.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-read_dimes.o `test -f 'read_dimes.c' || echo '$(srcdir)/'`read_dimes.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-read_dimes.o `test -f 'read_dimes.c' || echo '$(srcdir)/'`read_dimes.c
 
 libadiosreadf_nompi_a-read_dimes.obj: read_dimes.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-read_dimes.obj `if test -f 'read_dimes.c'; then $(CYGPATH_W) 'read_dimes.c'; else $(CYGPATH_W) '$(srcdir)/read_dimes.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-read_dimes.obj `if test -f 'read_dimes.c'; then $(CYGPATH_W) 'read_dimes.c'; else $(CYGPATH_W) '$(srcdir)/read_dimes.c'; fi`
+
+libadiosreadf_nompi_a-adios_nssi_config.o: adios_nssi_config.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adios_nssi_config.o `test -f 'adios_nssi_config.c' || echo '$(srcdir)/'`adios_nssi_config.c
+
+libadiosreadf_nompi_a-adios_nssi_config.obj: adios_nssi_config.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adios_nssi_config.obj `if test -f 'adios_nssi_config.c'; then $(CYGPATH_W) 'adios_nssi_config.c'; else $(CYGPATH_W) '$(srcdir)/adios_nssi_config.c'; fi`
+
+libadiosreadf_nompi_a-read_nssi.o: read_nssi.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-read_nssi.o `test -f 'read_nssi.c' || echo '$(srcdir)/'`read_nssi.c
+
+libadiosreadf_nompi_a-read_nssi.obj: read_nssi.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-read_nssi.obj `if test -f 'read_nssi.c'; then $(CYGPATH_W) 'read_nssi.c'; else $(CYGPATH_W) '$(srcdir)/read_nssi.c'; fi`
+
+libadiosreadf_nompi_a-adios_nssi_args.o: adios_nssi_args.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adios_nssi_args.o `test -f 'adios_nssi_args.c' || echo '$(srcdir)/'`adios_nssi_args.c
+
+libadiosreadf_nompi_a-adios_nssi_args.obj: adios_nssi_args.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libadiosreadf_nompi_a_CPPFLAGS) $(CPPFLAGS) $(libadiosreadf_nompi_a_CFLAGS) $(CFLAGS) -c -o libadiosreadf_nompi_a-adios_nssi_args.obj `if test -f 'adios_nssi_args.c'; then $(CYGPATH_W) 'adios_nssi_args.c'; else $(CYGPATH_W) '$(srcdir)/adios_nssi_args.c'; fi`
 
 .cpp.o:
 	$(CXXCOMPILE) -c -o $@ $<
@@ -1758,6 +2270,12 @@ libadiosreadf_nompi_a-read_dimes.obj: read_dimes.c
 .cpp.lo:
 	$(LTCXXCOMPILE) -c -o $@ $<
 
+nssi_coupling_server-nssi_coupling_server.o: nssi_coupling_server.cpp
+	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nssi_coupling_server_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nssi_coupling_server-nssi_coupling_server.o `test -f 'nssi_coupling_server.cpp' || echo '$(srcdir)/'`nssi_coupling_server.cpp
+
+nssi_coupling_server-nssi_coupling_server.obj: nssi_coupling_server.cpp
+	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nssi_coupling_server_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nssi_coupling_server-nssi_coupling_server.obj `if test -f 'nssi_coupling_server.cpp'; then $(CYGPATH_W) 'nssi_coupling_server.cpp'; else $(CYGPATH_W) '$(srcdir)/nssi_coupling_server.cpp'; fi`
+
 nssi_staging_server-nssi_staging_server.o: nssi_staging_server.cpp
 	$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(nssi_staging_server_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o nssi_staging_server-nssi_staging_server.o `test -f 'nssi_staging_server.cpp' || echo '$(srcdir)/'`nssi_staging_server.cpp
 
diff --git a/src/adios.c b/src/adios.c
index a2e47dc..888ebed 100644
--- a/src/adios.c
+++ b/src/adios.c
@@ -23,6 +23,10 @@
 #include "adios_internals_mxml.h"
 #include "globals.h"
 
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
+
 extern struct adios_transport_struct * adios_transports;
 
 int adios_set_application_id (int id)
@@ -129,6 +133,49 @@ int adios_write (int64_t fd_p, const char * name, void * var)
         v->data = 0;
     }
 
+    // Q.L. 10-2010. To fix a memory leak problem.
+    if (v->stats)
+    {   
+        int j, idx;
+        int c, count = 1;
+
+        if (v->type == adios_complex || v->type == adios_double_complex)
+            count = 3;
+
+        for (c = 0; c < count; c ++)
+        {   
+            j = idx = 0;
+            while (v->bitmap >> j)
+            {   
+                if (v->bitmap >> j & 1)
+                {   
+                    if (j == adios_statistic_hist)
+                    {   
+                        struct adios_index_characteristics_hist_struct * hist =
+                            (struct adios_index_characteristics_hist_struct *) v->stats[c][idx].data;
+                        if (hist)
+                        {   
+                            free (hist->breaks);
+                            free (hist->frequencies);
+                            free (hist);
+                            v->stats[c][idx].data = 0;
+                        }
+                    }
+                    else
+                    {
+                        if (v->stats[c][idx].data)
+                        {
+                            free (v->stats[c][idx].data);
+                            v->stats[c][idx].data = 0;
+                        }
+                    }
+                    idx ++;
+                }
+                j ++;
+            }
+        }
+    }
+
     if (v->dimensions)
     {
         v->data = var;
@@ -267,6 +314,7 @@ int adios_close (int64_t fd_p)
 // group a list of vars into a composite group
 int adios_declare_group (int64_t * id, const char * name
                         ,const char * time_index
+                        ,enum ADIOS_FLAG stats
                         )
 {
     int ret;
@@ -274,6 +322,7 @@ int adios_declare_group (int64_t * id, const char * name
                                       ,""
                                       ,""
                                       ,time_index
+                                      ,stats
                                       );
     if (ret == 1) {
         struct adios_group_struct * g = (struct adios_group_struct *) *id;
diff --git a/src/adios.h b/src/adios.h
index c52b220..80b4cb4 100644
--- a/src/adios.h
+++ b/src/adios.h
@@ -11,75 +11,84 @@
 #include "adios_types.h"
 #include <stdint.h>
 
+#ifdef _NOMPI
+/* Sequential processes can use the library compiled with -D_NOMPI */
+#   include "mpidummy.h"
+#else
+/* Parallel applications should use MPI to communicate file info and slices of data */
+#   include "mpi.h"
+#endif
+
 // ADIOS - Adaptable IO System
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-// Global setup using the XML file
-int adios_init (const char * config);
+    // Global setup using the XML file
+    int adios_init (const char * config);
 
-int adios_finalize (int mype);
+    int adios_finalize (int mype);
 
-// end user calls for each I/O operation
-// modes = "r" = "read", "w" = "write", "a" = "append", "u" = "update"
-int adios_open (int64_t * fd, const char * group_name, const char * name
-               ,const char * mode, void * comm
-               );
+    // end user calls for each I/O operation
+    // modes = "r" = "read", "w" = "write", "a" = "append", "u" = "update"
+    int adios_open (int64_t * fd, const char * group_name, const char * name
+            ,const char * mode, void * comm
+            );
 
-int adios_group_size (int64_t fd_p, uint64_t data_size
-                     ,uint64_t * total_size
-                     );
+    int adios_group_size (int64_t fd_p, uint64_t data_size
+            ,uint64_t * total_size
+            );
 
-int adios_write (int64_t fd_p, const char * name, void * var);
+    int adios_write (int64_t fd_p, const char * name, void * var);
 
-int adios_get_write_buffer (int64_t fd_p, const char * name
-                           ,uint64_t * size
-                           ,void ** buffer
-                           );
+    int adios_get_write_buffer (int64_t fd_p, const char * name
+            ,uint64_t * size
+            ,void ** buffer
+            );
 
-int adios_read (int64_t fd_p, const char * name, void * buffer
-               ,uint64_t buffer_size
-               );
+    int adios_read (int64_t fd_p, const char * name, void * buffer
+            ,uint64_t buffer_size
+            );
 
-int adios_set_path (int64_t fd_p, const char * path);
+    int adios_set_path (int64_t fd_p, const char * path);
 
-int adios_set_path_var (int64_t fd_p, const char * path, const char * name);
+    int adios_set_path_var (int64_t fd_p, const char * path, const char * name);
 
-int adios_end_iteration (void);
+    int adios_end_iteration (void);
 
-int adios_start_calculation (void);
+    int adios_start_calculation (void);
 
-int adios_stop_calculation (void);
+    int adios_stop_calculation (void);
 
-int adios_close (int64_t fd_p);
+    int adios_close (int64_t fd_p);
 
-// ADIOS No-XML API's
-int adios_init_noxml (void);
+    // ADIOS No-XML API's
+    int adios_init_noxml (void);
 
-// To allocate ADIOS buffer
-int adios_allocate_buffer (enum ADIOS_BUFFER_ALLOC_WHEN adios_buffer_alloc_when
-                          ,uint64_t buffer_size);
+    // To allocate ADIOS buffer
+    int adios_allocate_buffer (enum ADIOS_BUFFER_ALLOC_WHEN adios_buffer_alloc_when
+            ,uint64_t buffer_size);
 
-// To declare a ADIOS group
-int adios_declare_group (int64_t * id, const char * name
-                        ,const char * time_index
-                        );
-// To free a ADIOS group
-int adios_free_group (int64_t id);
+    // To declare a ADIOS group
+    int adios_declare_group (int64_t * id, const char * name
+            ,const char * time_index
+            ,enum ADIOS_FLAG stats
+            );
+    // To free a ADIOS group
+    int adios_free_group (int64_t id);
 
-// To select a I/O method for a ADIOS group
-int adios_select_method (int64_t group, const char * method
-                        ,const char * parameters
-                        ,const char * base_path
-                        );
+    // To select a I/O method for a ADIOS group
+    int adios_select_method (int64_t group, const char * method
+            ,const char * parameters
+            ,const char * base_path
+            );
 
-// To define a ADIOS variable
-int adios_define_var (int64_t group_id, const char * name
-                     ,const char * path, int type
-                     ,const char * dimensions
-                     ,const char * global_dimensions
+    // To define a ADIOS variable
+    int adios_define_var (int64_t group_id, const char * name
+            ,const char * path, int type
+            ,const char * dimensions
+            ,const char * global_dimensions
                      ,const char * local_offsets
                      );
 
@@ -88,6 +97,19 @@ int adios_define_attribute (int64_t group, const char * name
                            ,const char * value, const char * var
                            );
 
+/** Set the application's ID for adios_read_init()
+ *  when using a staging method (DART, DIMES, NSSI or DATATAP).
+ *  The ID should be unique for each application accessing the staging area
+ *  IN:  id   a number unique for this application
+ *  RETURN:       0 if accepted, <0 on error
+ *  It is optional to use it before calling adios_init. Default is 1. 
+ *  It has no effect for file based methods.
+ *  Note: this function is defined both in adios.h and adios_read.h so that
+ *  writing-only and reading-only applications can both use it.
+ */ 
+int adios_set_application_id (int id);
+
+
 /********************************************/
 /*           F O R T R A N  A P I           */
 /********************************************/
diff --git a/src/adios_bp_v1.c b/src/adios_bp_v1.c
index c07ed12..f1312d4 100644
--- a/src/adios_bp_v1.c
+++ b/src/adios_bp_v1.c
@@ -25,6 +25,11 @@
 #endif
 
 #define BYTE_ALIGN 8
+
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
+
 static void alloc_aligned (struct adios_bp_buffer_struct_v1 * b, uint64_t size)
 {
     b->allocated_buff_ptr = malloc (size + BYTE_ALIGN - 1);
@@ -695,18 +700,14 @@ int adios_parse_vars_index_v1 (struct adios_bp_buffer_struct_v1 * b
                         break;
                     }
 
-                    case adios_characteristic_file_name:
+                    case adios_characteristic_file_index:
                     {
-                        len = *(uint16_t *) (b->buff + b->offset);
+                        (*root)->characteristics [j].file_index =
+                                            *(uint32_t *) (b->buff + b->offset);
                         if(b->change_endianness == adios_flag_yes) {
-                            swap_64(len);
+                            swap_32((*root)->characteristics [j].file_index);
                         }
-                        b->offset += 2;
-
-                        (*root)->characteristics [j].file_name = malloc (len + 1);
-                        (*root)->characteristics [j].file_name[len] = '\0';
-                        strncpy ((*root)->characteristics [j].file_name, b->buff + b->offset, len);
-                        b->offset += len;
+                        b->offset += 4;
 
                         break;
                     }
@@ -1034,18 +1035,14 @@ int adios_parse_attributes_index_v1 (struct adios_bp_buffer_struct_v1 * b
                         break;
                     }
 
-                    case adios_characteristic_file_name:
+                    case adios_characteristic_file_index:
                     {
-                        len = *(uint16_t *) (b->buff + b->offset);
+                        (*root)->characteristics [j].file_index =
+                                            *(uint32_t *) (b->buff + b->offset);
                         if(b->change_endianness == adios_flag_yes) {
-                            swap_64(len);
+                            swap_32((*root)->characteristics [j].file_index);
                         }
-                        b->offset += 2;
-
-                        (*root)->characteristics [j].file_name = malloc (len + 1);
-                        (*root)->characteristics [j].file_name[len] = '\0';
-                        strncpy ((*root)->characteristics [j].file_name, b->buff + b->offset, len);
-                        b->offset += len;
+                        b->offset += 4;
 
                         break;
                     }
diff --git a/src/adios_bp_v1.h b/src/adios_bp_v1.h
index 991449d..e7a5d42 100644
--- a/src/adios_bp_v1.h
+++ b/src/adios_bp_v1.h
@@ -24,7 +24,7 @@ enum ADIOS_CHARACTERISTICS
     ,adios_characteristic_dimensions     = 4
     ,adios_characteristic_var_id         = 5
     ,adios_characteristic_payload_offset = 6
-    ,adios_characteristic_file_name      = 7
+    ,adios_characteristic_file_index     = 7
     ,adios_characteristic_time_index     = 8
     ,adios_characteristic_bitmap         = 9
     ,adios_characteristic_stat           = 10
@@ -112,14 +112,14 @@ struct adios_index_characteristic_struct_v1
     uint64_t offset;  // beginning of the var or attr entry
     struct adios_index_characteristic_dims_struct_v1 dims;
     uint16_t var_id;
-	void * value;
+    void * value;
     uint64_t payload_offset;   // beginning of the var or attr payload
-    char * file_name;
+    uint32_t file_index;  // subfile index
     uint32_t time_index;
 
-	uint32_t bitmap;
+    uint32_t bitmap;
 
-	struct adios_index_characteristics_stat_struct ** stats;
+    struct adios_index_characteristics_stat_struct ** stats;
 };
 
 struct adios_index_var_struct_v1
diff --git a/src/adios_dart.c b/src/adios_dart.c
index 0a7bc51..5255733 100644
--- a/src/adios_dart.c
+++ b/src/adios_dart.c
@@ -13,26 +13,29 @@
 // see if we have MPI or other tools
 #include "config.h"
 
-// mpi
-#if HAVE_MPI
-#include "mpi.h"
-#endif
-
 #include "adios.h"
 #include "adios_types.h"
 #include "adios_transport_hooks.h"
 #include "adios_internals.h"
 #include "adios_internals_mxml.h"
+#include "ds_metadata.h"
 
 #include "dart.h"
 
 /*#define DART_DO_VERSIONING  define it at configure as -DDART_DO_VERSIONING in CFLAGS */
 
+#define adios_logger(verbose_level, ...) if (adios_dart_verbose >= verbose_level) fprintf (stderr, __VA_ARGS__); 
+
+#define log_error(...) adios_logger(0, __VA_ARGS__)
+#define log_warn(...) adios_logger(1, __VA_ARGS__)
+#define log_info(...) adios_logger(2, __VA_ARGS__)
+#define log_debug(...) adios_logger(3, __VA_ARGS__)
 
 static int adios_dart_initialized = 0;
 #define MAXDARTNAMELEN 128
-static char dart_type_var_name[MAXDARTNAMELEN];
+//static char dart_type_var_name[MAXDARTNAMELEN];
 static char dart_var_name[MAXDARTNAMELEN];
+static unsigned int adios_dart_verbose = 3;
 
 struct adios_DART_data_struct
 {
@@ -41,6 +44,11 @@ struct adios_DART_data_struct
     int appid;  // from xml parameter or 1
     int time_index; // versioning in DataSpaces, start from 0
     int n_writes; // how many times adios_write has been called
+#if HAVE_MPI
+    MPI_Comm mpi_comm;
+#endif
+    int  num_of_files; // how many files do we have with this method
+    char *fnames[20];  // names of files (needed at finalize)
 };
 
 
@@ -126,8 +134,12 @@ void adios_dart_init (const char * parameters,
     p->appid = appid;
     p->time_index = 0;
     p->n_writes = 0;
+#if HAVE_MPI
+    p->mpi_comm = MPI_COMM_NULL;
+#endif
+    p->num_of_files = 0;
 
-    fprintf(stderr, "adios_dart_init: appid=%d\n", p->appid);
+    log_info ("adios_dart_init: appid=%d\n", p->appid);
    
 }
 
@@ -146,7 +158,7 @@ static void adios_dart_var_to_comm  (const char * comm_name
         {
             if (!t)
             {
-                fprintf (stderr, "communicator not provided and none "
+                log_error ("ERROR: communicator not provided and none "
                                  "listed in XML.  Defaulting to "
                                  "MPI_COMM_SELF\n"
                         );
@@ -169,7 +181,7 @@ static void adios_dart_var_to_comm  (const char * comm_name
         {
             if (!t)
             {
-                fprintf (stderr, "communicator not provided but one "
+                log_error ("ERROR: communicator not provided but one "
                                  "listed in XML.  Defaulting to "
                                  "MPI_COMM_WORLD\n"
                         );
@@ -191,7 +203,7 @@ static void adios_dart_var_to_comm  (const char * comm_name
     }
     else
     {
-        fprintf (stderr, "coordination-communication not provided. "
+        log_error ("ERROR: coordination-communication not provided. "
                          "Using MPI_COMM_WORLD instead\n"
                 );
 
@@ -209,7 +221,7 @@ int adios_dart_open (struct adios_file_struct * fd,
                                                 method->method_data;
     int num_peers = p->peers;
   
-    fprintf(stderr, "adios_dart_open: open %s, mode=%d, time_index=%d \n",
+    log_info ("adios_dart_open: open %s, mode=%d, time_index=%d \n",
                         fd->name, fd->mode, p->time_index);
 
     // connect to DART at the very first adios_open(), disconnect in adios_finalize()
@@ -226,16 +238,17 @@ int adios_dart_open (struct adios_file_struct * fd,
             MPI_Comm_rank ( group_comm, &(p->rank));
             MPI_Comm_size ( group_comm, &num_peers);
             p->peers = num_peers;
+            p->mpi_comm = group_comm;
         }
 #endif
 
-        fprintf(stderr, "adios_dart_open: rank=%d connect to DART, peers=%d, appid=%d \n",
+        log_debug ("adios_dart_open: rank=%d connect to DART, peers=%d, appid=%d \n",
                         p->rank, num_peers, p->appid);
 
         //Init the dart client
         ret = dart_init (num_peers, p->appid);
         if (ret) {
-            fprintf(stderr, "adios_dart_open: rank=%d Failed to connect to DART: err=%d,  rank=%d\n", p->rank, ret);        
+            log_error ("adios_dart_open: rank=%d Failed to connect to DART: err=%d,  rank=%d\n", p->rank, ret);        
             return ret;
         }
 
@@ -244,17 +257,17 @@ int adios_dart_open (struct adios_file_struct * fd,
         dart_peers (&(p->peers));
 #endif
 
-        fprintf(stderr, "adios_dart_open: rank=%d connected to DART: peers=%d\n", p->rank, p->peers);        
+        log_debug ("adios_dart_open: rank=%d connected to DART: peers=%d\n", p->rank, p->peers);        
     }
     globals_adios_set_dart_connected_from_writer();
    
-    if( fd->mode == adios_mode_write )
+    if (fd->mode == adios_mode_write || fd->mode == adios_mode_append)
     {
-        fprintf(stderr, "adios_dart_open: rank=%d call write lock...\n", p->rank);        
+        log_debug ("adios_dart_open: rank=%d call write lock...\n", p->rank);        
         dart_lock_on_write (fd->name);  
-        fprintf(stderr, "adios_dart_open: rank=%d got write lock\n", p->rank);        
+        log_debug ("adios_dart_open: rank=%d got write lock\n", p->rank);        
     }
-    else if( fd->mode == adios_mode_read )
+    else if (fd->mode == adios_mode_read)
     {
         dart_lock_on_read (fd->name);
     } 
@@ -266,6 +279,17 @@ enum ADIOS_FLAG adios_dart_should_buffer (struct adios_file_struct * fd
                                          ,struct adios_method_struct * method
                                          )
 {
+    
+    //if (fd->shared_buffer == adios_flag_no && fd->mode != adios_mode_read)
+    //{
+        // write the process group header
+        //adios_write_process_group_header_v1 (fd, fd->write_size_bytes);
+        //adios_write_open_vars_v1 (fd);
+    //} else {
+    //    log_warn("WARNING: %s expects that fd->shared_buffer is false\n", __func__);
+    //}
+    
+
     return adios_flag_no;  // this will take care of it
 }
 
@@ -291,17 +315,26 @@ void adios_dart_write (struct adios_file_struct * fd
     //Get two offset coordinate values
     unsigned int version;
 
-    int dims[3]={1,1,1}, lb[3]={0,0,0}, ub[3]={0,0,0}; /* lower and upper bounds for DataSpaces */
+    int dims[3]={1,1,1}, gdims[3]={0,0,0}, lb[3]={0,0,0}, ub[3]={0,0,0}; /* lower and upper bounds for DataSpaces */
+    int didx[3]; // for reordering the dimensions
     int ndims = 0;
+    int hastime = 0;
     struct adios_dimension_struct* var_dimensions = v->dimensions;
     // Calculate lower and upper bounds for each available dimension (up to 3 dims)
     while( var_dimensions && ndims < 3)
     {
         dims[ndims] = get_dim_rank_value(&(var_dimensions->dimension), group);
+        gdims[ndims] = get_dim_rank_value(&(var_dimensions->global_dimension), group);
         lb[ndims] = get_dim_rank_value(&(var_dimensions->local_offset), group);
-        ub[ndims] = lb[ndims] + dims[ndims] - 1;
+        if (dims[ndims] > 0)  {
+            ub[ndims] = lb[ndims] + dims[ndims] - 1;
+            ndims++;
+        }   else {
+            // time dimension (ldim=0 indicates this). Leave out from the dimensions.
+            //ub[ndims] = lb[ndims]; 
+            hastime = 1;
+        }
         var_dimensions = var_dimensions->next;
-        ndims++;
     }
 
 #ifdef DART_DO_VERSIONING
@@ -311,31 +344,57 @@ void adios_dart_write (struct adios_file_struct * fd
 #endif
     
     if (v->path != NULL && v->path[0] != '\0' && strcmp(v->path,"/")) 
-        snprintf(dart_var_name, MAXDARTNAMELEN, "%s/%s/%s", fd->name, v->path, v->name);
+        snprintf(dart_var_name, MAXDARTNAMELEN, "%s/%s/%s/%s", fd->name, fd->group->name, v->path, v->name);
     else 
-        snprintf(dart_var_name, MAXDARTNAMELEN, "%s/%s", fd->name, v->name);
+        snprintf(dart_var_name, MAXDARTNAMELEN, "%s/%s//%s", fd->name, fd->group->name, v->name);
+
+    //snprintf(dart_type_var_name, MAXDARTNAMELEN, "TYPE@%s", dart_var_name);
+    
+    /* non-global variables are put in space ONLY by rank = 0 process */
+    if (gdims[0] == 0 && p->rank != 0) {
+        //fprintf(stderr, "rank=%d var_name=%s is not global. Skip\n", p->rank, dart_var_name);
+        return;
+    }
 
-    snprintf(dart_type_var_name, MAXDARTNAMELEN, "TYPE@%s", dart_var_name);
     
-    /* Scalar variables are put in space ONLY by rank = 0 process */
-//    if (var_dimensions > 0 || p->rank == 0) {
+    //if (fd->shared_buffer == adios_flag_no)
+    //{
+        // var payload sent for sizing information
+        //adios_write_var_header_v1 (fd, v);
+    //}
+    
+     
+    v->write_offset = 1; // only !=0 offsets will be included in build index
+    adios_generate_var_characteristics_v1 (fd, v); // characteristics will be included in build index
+    adios_write_var_characteristics_v1 (fd, v);
     
-        fprintf(stderr, "var_name=%s, type=%s(%d) elemsize=%d, version=%d, size_x=%d, size_y=%d, size_z=%d, (%d,%d,%d), (%d,%d,%d)\n",
-                dart_var_name, adios_type_to_string_int(v->type), v->type, var_type_size, version,
-                dims[0], dims[1], dims[2], lb[0], lb[1], lb[2], ub[0], ub[1], ub[2]);
 
-        /* Put type info as T<varname>, integer in 0,0,0,0,0,0 position */
-        err = dart_put(dart_type_var_name, version, 4, 0,0,0,0,0,0, &(v->type)); 
+    log_debug ("var_name=%s, type=%s(%d) elemsize=%d, version=%d, ndims=%d, size=(%d,%d,%d), gdim=(%d,%d,%d), lb=(%d,%d,%d), ub=(%d,%d,%d)\n",
+            dart_var_name, adios_type_to_string_int(v->type), v->type, var_type_size, version, ndims,
+            dims[0], dims[1], dims[2], gdims[0], gdims[1], gdims[2], lb[0], lb[1], lb[2], ub[0], ub[1], ub[2]);
 
-        if (group->adios_host_language_fortran == adios_flag_yes || ndims == 1) {
-            /* Flip 1st and 2nd dimension for DataSpaces representation
-               for any Fortran writings and for any 1D array*/
-            dart_put(dart_var_name, version, var_type_size, lb[1], lb[0], lb[2], ub[1], ub[0], ub[2], data);
-        } else {
-            /* Keep dimension order in case of C writer of 2-3D arrays for DataSpaces representation */
-            dart_put(dart_var_name, version, var_type_size, lb[0], lb[1], lb[2], ub[0], ub[1], ub[2], data);
-        }
-//    }
+    /* non-timed scalars are written in the metadata at close(), not here */
+    if (ndims == 0 && !hastime)
+        return;
+
+    /* Put type info as T<varname>, integer in 0,0,0,0,0,0 position */
+    //err = dart_put(dart_type_var_name, version, 4, 0,0,0,0,0,0, &(v->type)); 
+
+    ds_dimension_ordering(ndims,
+            group->adios_host_language_fortran == adios_flag_yes, 
+            0 /*pack*/, didx);
+
+    dart_put(dart_var_name, version, var_type_size, 
+             lb[didx[0]], lb[didx[1]], lb[didx[2]], 
+             ub[didx[0]], ub[didx[1]], ub[didx[2]], 
+             data);
+    
+    log_debug ("var_name=%s, dimension ordering=(%d,%d,%d), gdims=(%d,%d,%d), lb=(%d,%d,%d), ub=(%d,%d,%d)\n",
+            dart_var_name, 
+            didx[0], didx[1], didx[2], 
+            gdims[didx[0]], gdims[didx[1]], gdims[didx[2]], 
+            lb[didx[0]], lb[didx[1]], lb[didx[2]], 
+            ub[didx[0]], ub[didx[1]], ub[didx[2]]);
 }
 
 void adios_dart_get_write_buffer (struct adios_file_struct * fd
@@ -368,8 +427,8 @@ void adios_dart_get_write_buffer (struct adios_file_struct * fd
         if (!*buffer)
         {
             adios_method_buffer_free (mem_allowed);
-            fprintf (stderr, "Out of memory allocating %llu bytes for %s\n"
-                    ,*size, v->name
+            log_error ("ERROR: Out of memory allocating %llu bytes for %s in %s:%s()\n"
+                    ,*size, v->name, __FILE__, __func__
                     );
             v->got_buffer = adios_flag_no;
             v->free_data = adios_flag_no;
@@ -389,10 +448,11 @@ void adios_dart_get_write_buffer (struct adios_file_struct * fd
     else
     {
         adios_method_buffer_free (mem_allowed);
-        fprintf (stderr, "OVERFLOW: Cannot allocate requested buffer of %llu "
-                         "bytes for %s\n"
+        log_error ("OVERFLOW: Cannot allocate requested buffer of %llu "
+                         "bytes for %s in %s:%s()\n"
                 ,*size
                 ,v->name
+                ,__FILE__, __func__
                 );
         *size = 0;
         *buffer = 0;
@@ -429,17 +489,379 @@ void adios_dart_read (struct adios_file_struct * fd
     //dart_unlock_on_read_();
 }
 
+/* Gather var/attr indices from all processes to rank 0 */
+static void adios_dart_gather_indices (struct adios_file_struct * fd
+                               ,struct adios_method_struct * method
+                               ,struct adios_index_process_group_struct_v1 **pg_root 
+                               ,struct adios_index_var_struct_v1 **vars_root
+                               ,struct adios_index_attribute_struct_v1 ** attrs_root
+                               )
+{
+    struct adios_DART_data_struct *p = (struct adios_DART_data_struct *)
+                                                method->method_data;
+    struct adios_index_process_group_struct_v1 * my_pg_root = 0;
+    struct adios_index_var_struct_v1 * my_vars_root = 0;
+    struct adios_index_attribute_struct_v1 * my_attrs_root = 0;
+    struct adios_index_process_group_struct_v1 * new_pg_root = 0;
+    struct adios_index_var_struct_v1 * new_vars_root = 0;
+    struct adios_index_attribute_struct_v1 * new_attrs_root = 0;
+    
+    // build local index first appending to any existing index
+    adios_build_index_v1 (fd, &my_pg_root, &my_vars_root, &my_attrs_root);
+
+    log_debug ("%s index after first build is pg=%x vars=%x attrs=%x\n", 
+                __func__, my_pg_root, my_vars_root, my_attrs_root);
+#if 0
+#if HAVE_MPI
+    // gather all on rank 0
+    if (p->mpi_comm != MPI_COMM_NULL)
+    {                                
+        if (p->rank == 0)           
+        {                            
+            int * index_sizes = malloc (4 * p->peers);
+            int * index_offsets = malloc (4 * p->peers);
+            char * recv_buffer = 0;
+            uint32_t size = 0;
+            uint32_t total_size = 0;
+            int i;
+            struct adios_bp_buffer_struct_v1 b;
+
+            MPI_Gather (&size, 1, MPI_INT
+                    ,index_sizes, 1, MPI_INT
+                    ,0, p->mpi_comm
+                    );
+
+            for (i = 0; i < p->peers; i++)
+            {
+                index_offsets [i] = total_size;
+                total_size += index_sizes [i];
+            }                    
+
+            recv_buffer = malloc (total_size);
+
+            MPI_Gatherv (&size, 0, MPI_BYTE
+                    ,recv_buffer, index_sizes, index_offsets
+                    ,MPI_BYTE, 0, p->mpi_comm
+                    );
+
+            for (i = 1; i < p->peers; i++)
+            {
+                b.buff = recv_buffer + index_offsets [i];
+                b.length = index_sizes [i];
+                b.offset = 0;
+
+                adios_parse_process_group_index_v1 (&b
+                        ,&new_pg_root
+                        );
+                adios_parse_vars_index_v1 (&b, &new_vars_root);
+                adios_parse_attributes_index_v1 (&b
+                        ,&new_attrs_root
+                        );
+                adios_merge_index_v1 (&my_pg_root
+                        ,&my_vars_root
+                        ,&my_attrs_root
+                        ,new_pg_root, new_vars_root
+                        ,new_attrs_root
+                        );
+                adios_clear_index_v1 (new_pg_root, new_vars_root, new_attrs_root);
+                new_pg_root = 0;
+                new_vars_root = 0;
+                new_attrs_root = 0;
+            }
+
+            free (recv_buffer);
+            free (index_sizes);
+            free (index_offsets);
+        }
+        else
+        {
+            char * buffer = 0; 
+            uint64_t buffer_size = 0;
+            uint64_t buffer_offset = 0;
+
+            adios_write_index_v1 (&buffer, &buffer_size, &buffer_offset
+                    ,0, my_pg_root ,my_vars_root ,my_attrs_root);
+
+            uint32_t tmp_buffer_size = (uint32_t) buffer_size;
+            MPI_Gather (&tmp_buffer_size, 1, MPI_INT, 0, 0, MPI_INT
+                    ,0, p->mpi_comm
+                    );
+            MPI_Gatherv (buffer, buffer_size, MPI_BYTE
+                    ,0, 0, 0, MPI_BYTE
+                    ,0, p->mpi_comm
+                    );
+            free (buffer);
+        }
+    }
+
+#endif
+#endif
+
+    *pg_root = my_pg_root;
+    *vars_root = my_vars_root;
+    *attrs_root = my_attrs_root;
+    log_debug ("%s index after gathering is pg=%x vars=%x attrs=%x\n", 
+                __func__, my_pg_root, my_vars_root, my_attrs_root);
+}
+
+static int ds_get_full_name (char * path, char * name, int maxlen,
+                            /*OUT*/char * out)
+{
+    int len;
+    // make full name
+    if (!path || !path[0] || !strcmp (path, "/")) { 
+        // no path, just name + leading /
+        len = strlen(name) + 1;
+        out[0] = '/';
+        strncpy(out+1, name, maxlen-1);
+    } else {
+        len = strlen(path);
+        strncpy(out, path, maxlen-1);  // path +
+        out[len] = '/';                         //   /  +
+        strncpy(out+len+1, name, maxlen-len-1); // name
+        len += strlen(name) + 1;
+    }
+    return len;
+}
+
+void ds_pack_group_info (struct adios_file_struct *fd
+                                  ,struct adios_method_struct * method
+                                  ,struct adios_index_var_struct_v1 *vars_root
+                                  ,struct adios_index_attribute_struct_v1 * attrs_root
+                                  ,char ** buffer, int *buffer_size, int *nvars, int *nattrs
+                                  )
+{
+    struct adios_DART_data_struct *p = (struct adios_DART_data_struct *)
+                                                method->method_data;
+    struct adios_index_var_struct_v1 * v = vars_root;
+    struct adios_index_attribute_struct_v1 * a = attrs_root;
+    int size;
+    int ndims; // whatever the type of v->characteristics->dims.count is, we write an int to buffer
+    int hastime; // true if variable has time dimension
+    uint64_t ldims[10], gdims[10]; // we can write only 3 dimensions, will drop time dim
+    *nvars = 0;
+    *nattrs = 0;
+    int didx[3]; // dimension ordering indices
+
+    log_debug ("%s entered\n", __func__);
+
+    /* First cycle: count the size of info to allocate index buffer */
+    size = 3*sizeof(int); //header for buffer: length, nvars, nattrs
+    while (v) {
+        size += 4*sizeof(int) // name len, type, hastime, number of dims 
+                + strlen(v->var_name) + strlen(v->var_path) + 1  // full path
+                + 3 * 8; // always write 3 dimensions in the index (even for scalars)
+        if (v->characteristics->dims.count == 0) {
+            // For scalars, we write the value into the index
+            if (v->type != adios_string)
+                size += adios_get_type_size(v->type, NULL);
+            else
+                size += adios_get_type_size(v->type, v->characteristics->value) + sizeof(int);
+        }
+        log_debug (" var %s/%s, size = %d\n", v->var_path, v->var_name, size);
+        (*nvars)++;
+        v = v->next;
+    }
+
+    while (a) {
+        size += sizeof(int) + strlen(a->attr_name) + strlen(a->attr_path) + 1 // name len + name
+                + sizeof(int); // type
+        if (a->type != adios_string)
+            size += adios_get_type_size(a->type, NULL);
+        else
+            size += adios_get_type_size(a->type, a->characteristics->value) + sizeof(int);
+
+        log_debug (" attr %s/%s, size = %d\n", a->attr_path, a->attr_name, size);
+        (*nattrs)++;
+        a = a->next;
+    }
+
+    *buffer = (char *) malloc (size);
+    *buffer_size = size;
+
+    /* Second cycle: fill up the buffer */
+    v = vars_root;
+    a = attrs_root;
+    char * b = *buffer;
+    int i, j, namelen;
+    char name[256];
+
+    //header for buffer: length, nvars, nattrs
+    memcpy (b, buffer_size, sizeof(int));  
+    b += sizeof(int); 
+    memcpy (b, nvars, sizeof(int));  
+    b += sizeof(int); 
+    memcpy (b, nattrs, sizeof(int));  
+    b += sizeof(int); 
+    while (v) {
+        namelen = ds_get_full_name (v->var_path, v->var_name, sizeof(name), name);
+        memcpy (b, &namelen, sizeof(int));  // length of full path
+        b += sizeof(int); 
+        memcpy (b, name, namelen);          // full path
+        b += namelen;
+        memcpy (b, &(v->type), sizeof(int)); // type 
+        b += sizeof(int); 
+        //ndims = MAX(v->characteristics->dims.count,3); // convert whatever type to int
+        //memcpy (b, &(v->characteristics->dims.count), sizeof(int)); // number of dimensions
+        log_debug("Variable %s, total dims = %d\n", name, v->characteristics->dims.count);
+        j = 0; // we can write only 3 dims, will drop the time dimension
+        hastime = 0;
+        for (i = 0; i<v->characteristics->dims.count; i++) {
+            ldims[j] = v->characteristics->dims.dims[j*3];  // ith dimension 
+            gdims[j] = v->characteristics->dims.dims[j*3+1];  // ith dimension 
+            log_debug("           , ldim = %lld gdim = %lld)\n", ldims[j], gdims[j]);
+            if (gdims[j] == 0 && ldims[j] == 1) {
+                // time dimension's global=0, local=1, skip
+                // FIXME: This is true for a local array of length 1 (not defined as global)
+                log_debug("               skip this dimension )\n");
+                hastime = 1;
+                continue;
+            }
+            j++;
+        }
+        for (i=j; i<3; i++) {
+            // fill up dimensions up to 3rd dim
+            ldims[i] = 1;
+            gdims[i] = 1;
+        }
+        ndims = (j < 3 ? j : 3); // we can have max 3 dimensions in DataSpaces
+        memcpy (b, &hastime, sizeof(int)); // has time dimension?
+        log_debug("             has time = %d (%d)\n", hastime, *(int*)b);
+        b += sizeof(int); 
+        memcpy (b, &ndims, sizeof(int)); // number of dimensions
+        log_debug("             ndims = %d (%d)\n", ndims, *(int*)b);
+        b += sizeof(int); 
+        ds_dimension_ordering(ndims, 
+                fd->group->adios_host_language_fortran == adios_flag_yes, 
+                0 /*pack*/, didx);
+        for (i = 0; i < 3; i++) {
+            if (gdims[didx[i]]) { 
+                // global variable
+                memcpy (b, &(gdims[didx[i]]), 8);  // ith dimension 
+            } else { 
+                // a local variable has no global dimensions
+                // in space, its local dimensions become the global dimensions
+                memcpy (b, &(ldims[didx[i]]), 8);  // ith dimension 
+            }
+            b += 8; 
+        }
+        if (v->characteristics->dims.count == 0) {
+            // NOTE: ndims = 0 can mean a timed scalar, which has no characteristics->value!
+            // store scalar value too
+            if (v->type != adios_string) {
+                size = adios_get_type_size(v->type, NULL);
+                memcpy (b, v->characteristics->value, size); 
+                b += size; 
+            } else {
+                size = adios_get_type_size(v->type, v->characteristics->value);
+                memcpy (b, &size, sizeof(int)); 
+                b += sizeof(int); 
+                memcpy (b, v->characteristics->value, size); 
+                b += size; 
+            }
+        }
+        v = v->next;
+    }
+
+    while (a) {
+        namelen = ds_get_full_name (a->attr_path, a->attr_name, sizeof(name), name);
+        memcpy (b, &namelen, sizeof(int));  // length of full path
+        b += sizeof(int); 
+        memcpy (b, name, namelen);          // full path
+        b += namelen;
+        memcpy (b, &(a->type), sizeof(int)); // type 
+        b += sizeof(int); 
+        // store scalar value too
+        if (a->type != adios_string) {
+            size = adios_get_type_size(a->type, NULL);
+            memcpy (b, &(a->characteristics->value), size); 
+            b += size; 
+        } else {
+            size = adios_get_type_size(a->type, a->characteristics->value);
+            memcpy (b, &size, sizeof(int)); 
+            b += sizeof(int); 
+            memcpy (b, a->characteristics->value, size); 
+            b += size; 
+        }
+        a = a->next;
+    }
+
+    // sanity check
+    if ( (int)(b-*buffer) > *buffer_size) {
+        log_error ("ERROR in %s. Calculated group index buffer size as %d, but filled after that with %d bytes\n",
+            __func__, *buffer_size, (int)(b-*buffer));
+    }
+    // written buffer might be shorter than calculated since we skip time dimensions.
+    // set the correct size now
+    *buffer_size = (int)(b-*buffer);
+    memcpy (*buffer, buffer_size, sizeof(int));  
+
+    
+    log_debug("   %s: buffer length = %d, content:\n", __func__, *buffer_size);
+    b = *buffer;
+    for (i=0; i<*buffer_size; i+=16) {
+        for (j=0; j<4; j++) {
+            log_debug("%3.3d %3.3d %3.3d %3.3d    ", b[i+4*j], b[i+4*j+1], b[i+4*j+2], b[i+4*j+3]);
+        }
+        log_debug("\n");
+    }
+    
+
+    log_debug ("%s exit\n", __func__);
+}
+
+/* FIXME: put this function into ds_metadata.c */
+/* buff is allocated and must be freed after use */
+void ds_pack_file_info (int time, int nvars, int nattrs, int group_index_len, char * groupname, 
+                    /*OUT*/char **buf, /*OUT*/int *buf_len)
+{
+    *buf_len = 128;
+    *buf = (char *) malloc (*buf_len);
+
+    char *b = *buf;
+    int namelen = strlen(groupname);
+    memcpy (b, buf_len, sizeof(int));  /* 0-: length of this buffer */
+    b += sizeof(int);
+    memcpy (b, &time, sizeof(int));  /* 4-: time */
+    b += sizeof(int); 
+    memcpy (b, &nvars, sizeof(int));  /* 8-: number of variables */
+    b += sizeof(int);
+    memcpy (b, &nattrs, sizeof(int));  /* 12-: number of attributes */
+    b += sizeof(int);
+    memcpy (b, &group_index_len, sizeof(int));  /* 16-: length of group index*/
+    b += sizeof(int);
+    memcpy (b, &namelen, sizeof(int));  /* 20-: length of group name */
+    b += sizeof(int);
+    memcpy (b, groupname, namelen);  /* 24-: group name */
+    b[namelen] = 0;
+}
+
 void adios_dart_close (struct adios_file_struct * fd
                       ,struct adios_method_struct * method
                       )
 {
-    //TODO
     struct adios_DART_data_struct *p = (struct adios_DART_data_struct *)
                                                 method->method_data;
+    struct adios_index_process_group_struct_v1 * pg_root;
+    struct adios_index_var_struct_v1 * vars_root;
+    struct adios_index_attribute_struct_v1 * attrs_root;
+    struct adios_attribute_struct * a = fd->group->attributes;
+    int lb[3], ub[3], didx[3]; // for reordering DS dimensions
 
-    if( fd->mode == adios_mode_write )
+    if (fd->mode == adios_mode_write || fd->mode == adios_mode_append)
     {
+        // finalize variable info in fd buffer, next we call build_index
+        while (a) {
+            a->write_offset = 1; // only attributes with !=0 offset will be included in build index
+            a=a->next;
+        }
+
+        //adios_write_close_vars_v1 (fd);
+        /* Gather var/attr indices from all processes to rank 0 */
+        adios_dart_gather_indices (fd, method, &pg_root, &vars_root ,&attrs_root);
+
         if (p->rank == 0) {
+
             /* Write two adios specific variables with the name of the file and name of the group into the space */
             /* ADIOS Read API fopen() checks these variables to see if writing already happened */
             unsigned int version;
@@ -448,18 +870,65 @@ void adios_dart_close (struct adios_file_struct * fd
 #else
             version = 0;              /* Update/overwrite data in DataSpaces */
 #endif
-            snprintf(dart_var_name, MAXDARTNAMELEN, "FILE@%s", fd->name);
-            printf("%s: put %s = %d into space\n", __func__, dart_var_name, p->time_index);
-            dart_put(dart_var_name, version, 4, 0, 0, 0, 0, 0, 0, &(p->time_index)); 
 
-            snprintf(dart_var_name, MAXDARTNAMELEN, "GROUP@%s", fd->group->name);
-            printf("%s: put %s = %d into space\n", __func__, dart_var_name, p->time_index);
-            dart_put(dart_var_name, version, 4, 0, 0, 0, 0, 0, 0, &(p->time_index)); 
+            /* Make metadata from indices */
+            char * indexbuf;
+            int    indexlen;
+            int    nvars, nattrs;
+            ds_pack_group_info (fd, method, vars_root, attrs_root, 
+                                   &indexbuf, &indexlen, &nvars, &nattrs);
+
+            
+            /* Put GROUP at fn/gn header into space */
+            snprintf(dart_var_name, MAXDARTNAMELEN, "GROUP@%s/%s", fd->name, fd->group->name);
+            log_debug ("%s: put %s with buf len %d into space\n", __func__, dart_var_name, indexlen);
+            ub[0] = indexlen-1; ub[1] = 0; ub[2] = 0;
+            ds_dimension_ordering(1, 0, 0, didx); // C ordering of 1D array into DS
+            dart_put(dart_var_name, version, 1,    0, 0, 0, /* lb 0..2 */
+                     ub[didx[0]], ub[didx[1]], ub[didx[2]],  indexbuf); 
+
+            /* Create and put FILE at fn header into space */
+            char * file_info_buf; /* store FILE at fn's group list */
+            int    file_info_buf_len; /* = 128 currently */
+            snprintf (dart_var_name, MAXDARTNAMELEN, "FILE@%s", fd->name);
+            ds_pack_file_info (p->time_index, nvars, nattrs, indexlen, fd->group->name, 
+                               &file_info_buf, &file_info_buf_len);
+            log_debug ("%s: put %s = buflen=%d time=%d nvars=%d nattr=%d index=%d name=%d:%s into space\n",
+                __func__, dart_var_name, 
+                *(int*)file_info_buf, *(int*)(file_info_buf+4), 
+                *(int*)(file_info_buf+8), *(int*)(file_info_buf+12),
+                *(int*)(file_info_buf+16), *(int*)(file_info_buf+20),
+                file_info_buf+24);
+            /* Flip 1st and 2nd dimension for DataSpaces representation for a 1D array*/
+            ub[0] = file_info_buf_len-1; ub[1] = 0; ub[2] = 0;
+            ds_dimension_ordering(1, 0, 0, didx); // C ordering of 1D array into DS
+            dart_put(dart_var_name, version, 1,    0, 0, 0, /* lb 0..2 */
+                     ub[didx[0]], ub[didx[1]], ub[didx[2]], file_info_buf); 
+
+            free (indexbuf);
+
+            // remember this filename for finalize
+            int i;
+            for (i=0; i<p->num_of_files; i++) {
+                if (!strcmp(fd->name, p->fnames[i]))
+                    break;
+            }
+            if (i == p->num_of_files) {
+                if (p->num_of_files < 20) {
+                    p->fnames[ p->num_of_files ] = strdup(fd->name);
+                    p->num_of_files++;
+                } else {
+                    log_error ("%s: Max 20 files can be written by one application using the DART method\n",__func__);
+                }
+            }
         }
 
-        printf("%s: call dart_put_sync()\n", __func__);
+        // free allocated index lists
+        adios_clear_index_v1 (pg_root, vars_root, attrs_root);
+
+        log_debug("%s: call dart_put_sync()\n", __func__);
         dart_put_sync();
-        printf("%s: call dart_unlock_on_write(%s)\n", __func__, fd->name);
+        log_debug("%s: call dart_unlock_on_write(%s)\n", __func__, fd->name);
         dart_unlock_on_write(fd->name);
     }
     else if( fd->mode == adios_mode_read )
@@ -471,21 +940,37 @@ void adios_dart_close (struct adios_file_struct * fd
     p->time_index++;
 
 
-    printf("%s: exit\n", __func__);
+    log_info ("%s: exit\n", __func__);
 }
 
 void adios_dart_finalize (int mype, struct adios_method_struct * method)
 {
     struct adios_DART_data_struct *p = (struct adios_DART_data_struct *)
-                                                method->method_data;
+        method->method_data;
+    int i;
+    char dart_var_name[MAXDARTNAMELEN];
+
+    if (p->rank == 0) {
+        // tell the readers which files are finalized
+        //dart_lock_on_write("CLOSE");
+        for (i=0; i<p->num_of_files; i++) {
+            /* Put CLOSED at fn into space. Indicates that this file will not be extended anymore. */
+            snprintf(dart_var_name, MAXDARTNAMELEN, "CLOSED@%s", p->fnames[i]);
+            log_debug ("%s: put %s with %d bytes into the space\n", __func__, dart_var_name, sizeof(int));
+            dart_put(dart_var_name, 0, sizeof(int),    0, 0, 0,    0, 0, 0, &i); 
+            free (p->fnames[i]);
+        }
+        //dart_put_sync();
+        //dart_unlock_on_write("CLOSE");
+    }
 
     // disconnect from dart if we are connected from writer but not anymore from reader
     if (globals_adios_is_dart_connected_from_writer() && 
-        !globals_adios_is_dart_connected_from_both())
+            !globals_adios_is_dart_connected_from_both())
     {
-        printf("%s: call dart_barrier(), rank=%d\n", __func__,mype);
+        log_debug ("%s: call dart_barrier(), rank=%d\n", __func__,mype);
         dart_barrier();
-        printf("%s: call dart_finalize(), rank=%d\n", __func__,mype);
+        log_debug ("%s: call dart_finalize(), rank=%d\n", __func__,mype);
         dart_finalize();
 
     }
@@ -493,7 +978,7 @@ void adios_dart_finalize (int mype, struct adios_method_struct * method)
 
     adios_dart_initialized = 0;
 
-    printf("%s: exit\n", __func__);
+    log_info("%s: exit\n", __func__);
 }
 
 void adios_dart_end_iteration (struct adios_method_struct * method)
diff --git a/src/adios_datatap.c b/src/adios_datatap.c
index eba8f34..6535938 100644
--- a/src/adios_datatap.c
+++ b/src/adios_datatap.c
@@ -7,7 +7,6 @@
 #include <string.h>
 #include <ffs.h>
 #include <atl.h>
-#include <mpi.h>
 #include "adios.h"
 #include "adios_internals.h"
 #include "adios_transport_hooks.h"
diff --git a/src/adios_dimes.c b/src/adios_dimes.c
index 9bcb2de..71fe6d5 100644
--- a/src/adios_dimes.c
+++ b/src/adios_dimes.c
@@ -13,11 +13,6 @@
 // see if we have MPI or other tools
 #include "config.h"
 
-// mpi
-#if HAVE_MPI
-#include "mpi.h"
-#endif
-
 #include "adios.h"
 #include "adios_types.h"
 #include "adios_transport_hooks.h"
diff --git a/src/adios_error.c b/src/adios_error.c
index 711281b..b6a335d 100644
--- a/src/adios_error.c
+++ b/src/adios_error.c
@@ -29,7 +29,7 @@ const char *adios_get_last_errmsg (void)
     return aerr; 
 }
 
-void error (enum ADIOS_ERRCODES errno, char *fmt, ...) 
+void adios_error (enum ADIOS_ERRCODES errno, char *fmt, ...) 
 {
     va_list ap;
     adios_errno = (int)errno;
@@ -38,7 +38,7 @@ void error (enum ADIOS_ERRCODES errno, char *fmt, ...)
     va_end(ap);
 }
 
-void error_at_line (enum ADIOS_ERRCODES errno, const char* filename, unsigned int linenum, char *fmt, ...)
+void adios_error_at_line (enum ADIOS_ERRCODES errno, const char* filename, unsigned int linenum, char *fmt, ...)
 {
     va_list ap;
     adios_errno = (int)errno;
diff --git a/src/adios_error.h b/src/adios_error.h
index a136918..13dae1d 100644
--- a/src/adios_error.h
+++ b/src/adios_error.h
@@ -29,11 +29,14 @@ enum ADIOS_ERRCODES {
     ,err_invalid_read_method
     ,err_connection_failed
     ,err_out_of_bound
+    ,err_operation_not_supported
+    ,err_end_of_file    // stream: fopen() returns if reached end of stream
+    ,err_too_many_files  // DART allows for using only a fixed number of different filenames
     ,err_unspecified
 };
 
-void error (enum ADIOS_ERRCODES errno, char *fmt, ...);
-void error_at_line (enum ADIOS_ERRCODES errno, const char* filename, unsigned int linenum, char *fmt, ...);
+void adios_error (enum ADIOS_ERRCODES errno, char *fmt, ...);
+void adios_error_at_line (enum ADIOS_ERRCODES errno, const char* filename, unsigned int linenum, char *fmt, ...);
 
 const char* adios_get_last_errmsg (void);
 
diff --git a/src/adios_internals.c b/src/adios_internals.c
index 4daca6c..fe5447d 100644
--- a/src/adios_internals.c
+++ b/src/adios_internals.c
@@ -21,8 +21,12 @@
 #include "adios_internals.h"
 #include "adios_bp_v1.h"
 
-static struct adios_method_list_struct * adios_methods = 0;
-static struct adios_group_list_struct * adios_groups = 0;
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
+
+extern struct adios_method_list_struct * adios_methods;
+extern struct adios_group_list_struct * adios_groups;
 
 int adios_int_is_var (const char * temp) // 1 == yes, 0 == no
 {
@@ -1128,6 +1132,7 @@ int adios_common_declare_group (int64_t * id, const char * name
                                ,const char * coordination_comm
                                ,const char * coordination_var
                                ,const char * time_index_name
+                               ,enum ADIOS_FLAG stats
                                )
 {
     struct adios_group_struct * g = (struct adios_group_struct *)
@@ -1146,6 +1151,7 @@ int adios_common_declare_group (int64_t * id, const char * name
     g->group_comm = (coordination_comm ? strdup (coordination_comm) : 0L);
     g->time_index_name = (time_index_name ? strdup (time_index_name) : 0L);
     g->time_index = 0;
+    g->stats_on = stats;
     g->process_id = 0;
     g->methods = 0;
     g->mesh = 0;
@@ -1497,26 +1503,30 @@ int adios_common_define_var (int64_t group_id, const char * name
     v->stats = 0;
     v->bitmap = 0;
 
-    // '1' at the bit location of stat id in adios_bp_v1.h, enables calculation of statistic.
-    for (i = 0; i < ADIOS_STAT_LENGTH; i++)
-        v->bitmap |= (1 << i);
+    // Q.L. - Check whether stats are disabled or not
+    if (t->stats_on == adios_flag_yes)
+    {
+        // '1' at the bit location of stat id in adios_bp_v1.h, enables calculation of statistic.
+        for (i = 0; i < ADIOS_STAT_LENGTH; i++)
+            v->bitmap |= (1 << i);
 
-    // Default values for histogram not yet implemented. Disabling it.
-    v->bitmap ^= (1 << adios_statistic_hist);
+        // Default values for histogram not yet implemented. Disabling it.
+        v->bitmap ^= (1 << adios_statistic_hist);
 
-    // For complex numbers, the set of statistics occur thrice: stat[0] - magnitude, stat[1] - real, stat[2] - imaginary
-    if (v->type == adios_complex || v->type == adios_double_complex)
-    {
-        uint8_t c;
-        v->stats = malloc (3 * sizeof(struct adios_stat_struct *));
+        // For complex numbers, the set of statistics occur thrice: stat[0] - magnitude, stat[1] - real, stat[2] - imaginary
+        if (v->type == adios_complex || v->type == adios_double_complex)
+        {
+            uint8_t c;
+            v->stats = malloc (3 * sizeof(struct adios_stat_struct *));
 
-        for (c = 0; c < 3; c ++)
-            v->stats[c] = calloc (ADIOS_STAT_LENGTH, sizeof(struct adios_stat_struct));
-    }
-    else
-    {
-        v->stats = malloc (sizeof(struct adios_stat_struct *));
-        v->stats[0] = calloc (ADIOS_STAT_LENGTH, sizeof(struct adios_stat_struct));
+            for (c = 0; c < 3; c ++)
+                v->stats[c] = calloc (ADIOS_STAT_LENGTH, sizeof(struct adios_stat_struct));
+        }
+        else
+        {
+            v->stats = malloc (sizeof(struct adios_stat_struct *));
+            v->stats[0] = calloc (ADIOS_STAT_LENGTH, sizeof(struct adios_stat_struct));
+        }
     }
 
     // NCSU - End of initializing stat related info
@@ -2211,7 +2221,7 @@ void adios_sort_index_v1 (struct adios_index_process_group_struct_v1 ** p1
                     uint16_t t_var_id;
                     void * t_value;
                     uint64_t t_payload_offset;   // beginning of the var or attr payload
-                    char * t_file_name;
+                    uint32_t t_file_index;
                     uint32_t t_time_index;
 
                     uint32_t t_bitmap;
@@ -2224,7 +2234,7 @@ void adios_sort_index_v1 (struct adios_index_process_group_struct_v1 ** p1
                     t_var_id = v1_temp->characteristics[j].var_id;
                     t_value = v1_temp->characteristics[j].value;
                     t_payload_offset = v1_temp->characteristics[j].payload_offset;
-                    t_file_name = v1_temp->characteristics[j].file_name;
+                    t_file_index = v1_temp->characteristics[j].file_index;
                     t_time_index = v1_temp->characteristics[j].time_index;
                     t_bitmap = v1_temp->characteristics[j].bitmap;
                     t_stats = v1_temp->characteristics[j].stats;
@@ -2235,7 +2245,7 @@ void adios_sort_index_v1 (struct adios_index_process_group_struct_v1 ** p1
                     v1_temp->characteristics[j].var_id = v1_temp->characteristics[j + 1].var_id;
                     v1_temp->characteristics[j].value = v1_temp->characteristics[j + 1].value;
                     v1_temp->characteristics[j].payload_offset = v1_temp->characteristics[j + 1].payload_offset;
-                    v1_temp->characteristics[j].file_name = v1_temp->characteristics[j + 1].file_name;
+                    v1_temp->characteristics[j].file_index = v1_temp->characteristics[j + 1].file_index;
                     v1_temp->characteristics[j].time_index = v1_temp->characteristics[j + 1].time_index;
                     v1_temp->characteristics[j].bitmap = v1_temp->characteristics[j + 1].bitmap;
                     v1_temp->characteristics[j].stats = v1_temp->characteristics[j + 1].stats;
@@ -2246,7 +2256,7 @@ void adios_sort_index_v1 (struct adios_index_process_group_struct_v1 ** p1
                     v1_temp->characteristics[j + 1].var_id = t_var_id;
                     v1_temp->characteristics[j + 1].value = t_value;
                     v1_temp->characteristics[j + 1].payload_offset = t_payload_offset;
-                    v1_temp->characteristics[j + 1].file_name = t_file_name;
+                    v1_temp->characteristics[j + 1].file_index = t_file_index;
                     v1_temp->characteristics[j + 1].time_index = t_time_index;
                     v1_temp->characteristics[j + 1].bitmap = t_bitmap;
                     v1_temp->characteristics[j + 1].stats = t_stats;
@@ -2386,7 +2396,10 @@ static void adios_clear_attributes_index_v1
                 free (root->characteristics [i].stats);
             }
 
+            if (root->characteristics [i].value)
+                free (root->characteristics [i].value);
         }
+    
         if (root->characteristics)
             free (root->characteristics);
 
@@ -2761,7 +2774,7 @@ void adios_build_index_v1 (struct adios_file_struct * fd
                             + adios_calc_var_overhead_v1 (old_var)
                             - strlen (old_var->path)  // take out the length of path defined in XML
                             + strlen (v->path); // add length of the actual, current path of this var
-            v_index->characteristics [0].file_name = (fd->subfile_name ? strdup (fd->subfile_name) : 0L);
+            v_index->characteristics [0].file_index = fd->subfile_index;
             v_index->characteristics [0].time_index = g_item->time_index;
 
             v_index->characteristics [0].value = 0;
@@ -2917,7 +2930,7 @@ void adios_build_index_v1 (struct adios_file_struct * fd
 
             a_index->characteristics [0].offset = a->write_offset;
             a_index->characteristics [0].payload_offset = a->write_offset + adios_calc_attribute_overhead_v1 (a);
-            a_index->characteristics [0].file_name = (fd->subfile_name ? strdup (fd->subfile_name) : 0L);
+            a_index->characteristics [0].file_index = fd->subfile_index;
             a_index->characteristics [0].time_index = 0;
 
             // NCSU -,Initializing stat related info in attribute index
@@ -3154,28 +3167,20 @@ int adios_write_index_v1 (char ** buffer
             var_size += 8;
             characteristic_set_length += 8;
 
-            // add a file name characteristic for all vars
-            if (vars_root->characteristics [i].file_name)
-            {
-                characteristic_set_count++;
-                flag = (uint8_t) adios_characteristic_file_name;
-                buffer_write (buffer, buffer_size, buffer_offset, &flag, 1);
-                index_size += 1;
-                var_size += 1;
-                characteristic_set_length += 1;
-
-                len = strlen (vars_root->characteristics [i].file_name);
-                buffer_write (buffer, buffer_size, buffer_offset, &len, 2);
-                index_size += 2;
-                var_size += 2;
+            // add a file index characteristic for all vars
+            characteristic_set_count++;
+            flag = (uint8_t) adios_characteristic_file_index;
+            buffer_write (buffer, buffer_size, buffer_offset, &flag, 1);
+            index_size += 1;
+            var_size += 1;
+            characteristic_set_length += 1;
 
-                buffer_write (buffer, buffer_size, buffer_offset
-                             ,vars_root->characteristics [i].file_name, len
-                             );
-                index_size += len;
-                var_size += len;
-                characteristic_set_length += len;
-            }
+            buffer_write (buffer, buffer_size, buffer_offset
+                         ,&vars_root->characteristics [i].file_index, 4
+                         );
+            index_size += 4;
+            var_size += 4;
+            characteristic_set_length += 4;
 
             // add a time index characteristic for all vars
             characteristic_set_count++;
@@ -3509,28 +3514,20 @@ int adios_write_index_v1 (char ** buffer
             attr_size += 8;
             characteristic_set_length += 8;
 
-            // add a file name characteristic for all attrs
-            if (attrs_root->characteristics [i].file_name)
-            {
-                characteristic_set_count++;
-                flag = (uint8_t) adios_characteristic_file_name;
-                buffer_write (buffer, buffer_size, buffer_offset, &flag, 1);
-                index_size += 1;
-                attr_size += 1;
-                characteristic_set_length += 1;
-
-                len = strlen (attrs_root->characteristics [i].file_name);
-                buffer_write (buffer, buffer_size, buffer_offset, &len, 2);
-                index_size += 2;
-                attr_size += 2;
+            // add a file index characteristic for all attrs
+            characteristic_set_count++;
+            flag = (uint8_t) adios_characteristic_file_index;
+            buffer_write (buffer, buffer_size, buffer_offset, &flag, 1);
+            index_size += 1;
+            attr_size += 1;
+            characteristic_set_length += 1;
 
-                buffer_write (buffer, buffer_size, buffer_offset
-                             ,attrs_root->characteristics [i].file_name, len
-                             );
-                index_size += len;
-                attr_size += len;
-                characteristic_set_length += len;
-            }
+            buffer_write (buffer, buffer_size, buffer_offset
+                         ,&attrs_root->characteristics [i].file_index, 4
+                         );
+            index_size += 4;
+            attr_size += 4;
+            characteristic_set_length += 4;
 
             // add a time index characteristic for all attrs
             characteristic_set_count++;
diff --git a/src/adios_internals.h b/src/adios_internals.h
index ebdadd0..b95a3c5 100644
--- a/src/adios_internals.h
+++ b/src/adios_internals.h
@@ -140,6 +140,7 @@ struct adios_group_struct
     char * group_by;
     char * time_index_name;
     uint32_t time_index;
+    enum ADIOS_FLAG stats_on;
     uint32_t process_id;
 
     struct adios_method_list_struct * methods;
@@ -157,7 +158,7 @@ struct adios_group_list_struct
 struct adios_file_struct
 {
     char * name;
-    char * subfile_name;
+    uint32_t subfile_index; // needs to be set in ADIOS method if generates subfiles
     struct adios_group_struct * group;
     enum ADIOS_METHOD_MODE mode;
     uint64_t data_size;
@@ -410,6 +411,7 @@ int adios_common_declare_group (int64_t * id, const char * name
                                ,const char * coordination_comm
                                ,const char * coordination_var
                                ,const char * time_index
+                               ,enum ADIOS_FLAG stats
                                );
 
 int adios_common_define_var (int64_t group_id, const char * name
@@ -516,6 +518,7 @@ int adios_int_is_num (char * temp); // 1 == yes, 0 == no
 extern "C" {
 #endif
 
+#if 1
 /* LIST */
 typedef struct ListElmt_
 {
@@ -554,6 +557,8 @@ int queue_dequeue (Queue * queue, void ** data);
 #define queue_peek(queue) ((queue)->head == NULL ? NULL : (queue)->head->data)
 #define queue_size list_size
 
+#endif /* 0 */
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/adios_internals_mxml.c b/src/adios_internals_mxml.c
index 2e9bb1d..3166696 100644
--- a/src/adios_internals_mxml.c
+++ b/src/adios_internals_mxml.c
@@ -28,10 +28,17 @@
 #include "adios_internals_mxml.h"
 #include "buffer.h"
 
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
+
 static enum ADIOS_FLAG adios_host_language_fortran = adios_flag_yes;
 
-static struct adios_method_list_struct * adios_methods = 0;
-static struct adios_group_list_struct * adios_groups = 0;
+struct adios_method_list_struct * adios_methods = 0;
+struct adios_group_list_struct * adios_groups = 0;
+
+//extern struct adios_method_list_struct * adios_methods;
+//extern struct adios_group_list_struct * adios_groups;
 
 struct adios_transport_struct * adios_transports = 0;
 static int adios_transports_initialized = 0;
@@ -1955,10 +1962,11 @@ static int parseGroup (mxml_node_t * node)
     const char * coordination_var = 0;
     const char * host_language = 0;
     const char * time_index_name = 0;
+    const char * stats = 0;
 
     int64_t      ptr_new_group;
     struct adios_group_struct * new_group;
-    enum ADIOS_FLAG host_language_fortran = adios_flag_yes;
+    enum ADIOS_FLAG host_language_fortran = adios_flag_yes, enable_stats = adios_flag_yes;
     int i;
 
     for (i = 0; i < node->value.element.num_attrs; i++)
@@ -1975,6 +1983,7 @@ static int parseGroup (mxml_node_t * node)
         GET_ATTR("coordination-var",attr,coordination_var,"adios-group")
         GET_ATTR("host-language",attr,host_language,"adios-group")
         GET_ATTR("time-index",attr,time_index_name,"adios-group")
+        GET_ATTR("stats",attr,stats,"adios-group")
         fprintf (stderr, "config.xml: unknown attribute '%s' on %s "
                          "(ignored)\n"
                 ,attr->name
@@ -2016,6 +2025,29 @@ static int parseGroup (mxml_node_t * node)
         }
     }
 
+    if (!stats)
+    {
+        enable_stats = adios_flag_yes;
+    }
+    else
+    {
+        if (!strcasecmp (stats, "On"))
+        {
+            enable_stats = adios_flag_yes;
+        }
+        else if (!strcasecmp (stats, "Off"))
+        {
+            enable_stats = adios_flag_no;
+        }
+        else
+        {
+            fprintf (stderr, "config.xml, invalid stats %s"
+                    ,stats
+                    );
+            return 0;
+        }
+    }
+
 // fix the bgp bugs 
 /*
     adios_common_declare_group ((int64_t *) &new_group, datagroup_name
@@ -2026,6 +2058,7 @@ static int parseGroup (mxml_node_t * node)
     adios_common_declare_group (&ptr_new_group, datagroup_name
                                ,host_language_fortran, coordination_comm
                                ,coordination_var, time_index_name
+                               ,enable_stats
                                );
      new_group = (struct adios_group_struct *)ptr_new_group;
 
@@ -2701,7 +2734,12 @@ static int parseBuffer (mxml_node_t * node)
 
         if (adios_buffer_alloc_when_get() == ADIOS_BUFFER_ALLOC_NOW)
         {
+
+// Do not attempt to allocate the buffer when this is being called from adios_lint
+#ifndef _INTERNAL
             return adios_set_buffer_size ();
+#endif
+
         }
     }
 
@@ -3256,6 +3294,7 @@ void adios_cleanup ()
 						}
 						j ++;
 					}
+					free (adios_groups->group->vars->stats[c]);
 				}
 
                 free (adios_groups->group->vars->stats);
diff --git a/src/adios_mpi.c b/src/adios_mpi.c
index 10d1414..08f640d 100644
--- a/src/adios_mpi.c
+++ b/src/adios_mpi.c
@@ -19,7 +19,6 @@
 #include <sys/ioctl.h>
 #include <assert.h>
 
-// mpi
 #include "mpi.h"
 
 // xml parser
@@ -30,6 +29,9 @@
 #include "adios_bp_v1.h"
 #include "adios_internals.h"
 #include "buffer.h"
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
 
 static int adios_mpi_initialized = 0;
 
@@ -525,7 +527,7 @@ adios_mpi_build_file_offset(struct adios_MPI_data_struct *md,
                                     + last_offset;
 #endif
             MPI_Scatter (offsets, 1, MPI_LONG_LONG
-                        ,offsets, 1, MPI_LONG_LONG
+                        ,MPI_IN_PLACE, 1, MPI_LONG_LONG
                         ,0, md->group_comm
                         );
             fd->base_offset = offsets [0];
@@ -538,11 +540,11 @@ adios_mpi_build_file_offset(struct adios_MPI_data_struct *md,
             offset[0] = fd->write_size_bytes;
 
             MPI_Gather (offset, 1, MPI_LONG_LONG
-                       ,offset, 1, MPI_LONG_LONG
+                       ,0, 0, 0
                        ,0, md->group_comm
                        );
 
-            MPI_Scatter (offset, 1, MPI_LONG_LONG
+            MPI_Scatter (0, 0, 0
                         ,offset, 1, MPI_LONG_LONG
                         ,0, md->group_comm
                         );
@@ -756,7 +758,7 @@ enum ADIOS_FLAG adios_mpi_should_buffer (struct adios_file_struct * fd
                                   ,fd->group->name, md->old_pg_root
                                   );
                     MPI_Scatter (offsets, 3, MPI_LONG_LONG
-                                ,offsets, 3, MPI_LONG_LONG
+                                ,MPI_IN_PLACE, 3, MPI_LONG_LONG
                                 ,0, md->group_comm
                                 );
                     md->b.read_pg_offset = offsets [0];
@@ -768,7 +770,7 @@ enum ADIOS_FLAG adios_mpi_should_buffer (struct adios_file_struct * fd
                     MPI_Offset offset [3];
                     offset [0] = offset [1] = offset [2] = 0;
 
-                    MPI_Scatter (offset, 3, MPI_LONG_LONG
+                    MPI_Scatter (0, 0, 0
                                 ,offset, 3, MPI_LONG_LONG
                                 ,0, md->group_comm
                                 );
diff --git a/src/adios_mpi_amr.c b/src/adios_mpi_amr.c
index 8155694..061cd8b 100644
--- a/src/adios_mpi_amr.c
+++ b/src/adios_mpi_amr.c
@@ -24,19 +24,16 @@
 #include "adios_internals.h"
 #include "buffer.h"
 
+enum ADIOS_MPI_AMR_IO_TYPE
+{
+    ADIOS_MPI_AMR_IO_NONE = 0,
+    ADIOS_MPI_AMR_IO_AG   = 1, // simple all to one aggregation
+    ADIOS_MPI_AMR_IO_BG   = 2, // Brigade aggregation
+};
+
 static int adios_mpi_amr_initialized = 0;
-static int * g_is_aggregator = 0;
-static int g_num_aggregators = 0;
-static int g_merging_pgs = 0;
-static int g_color1 = 0;
-static int g_color2 = 0;
-static MPI_Offset * g_offsets= 0;
-static pthread_t g_t, g_t1;
-
-static struct adios_MPI_thread_data_open open_thread_data1;
-static struct adios_MPI_thread_data_open open_thread_data2;
-
-#define is_aggregator(rank)  g_is_aggregator[rank]
+
+#define is_aggregator(rank)  md->g_is_aggregator[rank]
 #define FREE(v) \
   if (v)        \
   {             \
@@ -48,6 +45,9 @@ static struct adios_MPI_thread_data_open open_thread_data2;
 #define ATTR_COUNT_SIZE  2
 #define ATTR_LEN_SIZE    8
 #define MAX_AGG_BUF      704643072
+#define DEFAULT_NUM_OST  672
+#define DEFAULT_STRIPE_COUNT 1
+#define DEFAULT_STRIPE_SIZE  1024*1024
 
 struct adios_MPI_data_struct
 {
@@ -72,14 +72,26 @@ struct adios_MPI_data_struct
     uint64_t vars_header_size;
 
     uint64_t striping_unit;  // file system stripe size
-    uint64_t block_unit;
+
+    int * g_is_aggregator;
+    int g_num_aggregators;
+    int g_merging_pgs;
+    int g_num_ost;
+    int g_threading;
+    int g_color1;
+    int g_color2;
+    MPI_Offset * g_offsets;
+    int * g_ost_skipping_list;
+    pthread_t g_sot;
+    pthread_t g_mot;
+    pthread_t g_swt; // subfile open thread, metadata file open thread, subfile write thread
+    struct adios_MPI_thread_data_open * open_thread_data;
+    enum ADIOS_MPI_AMR_IO_TYPE g_io_type;
 };
 
 struct adios_MPI_thread_data_open
 {
-    MPI_File * fh;
-    char * name;
-    uint64_t * striping_unit;
+    struct adios_MPI_data_struct * md;
     char * parameters;
 };
 
@@ -89,114 +101,8 @@ struct adios_MPI_thread_data_write
     uint64_t * base_offset;
     void * aggr_buff;
     int * total_data_size;
-    uint64_t * block_unit;
 };
 
-#if COLLECT_METRICS
-// see adios_adaptive_finalize for what each represents
-struct timeval t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16, t17, t18, t19, t20, t21, t22, t23, t24, t25;
-
-// Subtract the `struct timeval' values X and Y,
-// storing the result in RESULT.
-// Return 1 if the difference is negative, otherwise 0.
-static int timeval_subtract (struct timeval * result
-                            ,struct timeval * x, struct timeval * y
-                            )
-{
-  // Perform the carry for the later subtraction by updating y.
-  if (x->tv_usec < y->tv_usec)
-  {
-    int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
-    y->tv_usec -= 1000000 * nsec;
-    y->tv_sec += nsec;
-  }
-  if (x->tv_usec - y->tv_usec > 1000000)
-  {
-    int nsec = (x->tv_usec - y->tv_usec) / 1000000;
-    y->tv_usec += 1000000 * nsec;
-    y->tv_sec -= nsec;
-  }
-
-  // Compute the time remaining to wait.
-  // tv_usec is certainly positive.
-  result->tv_sec = x->tv_sec - y->tv_sec;
-  result->tv_usec = x->tv_usec - y->tv_usec;
-
-  // Return 1 if result is negative.
-  return x->tv_sec < y->tv_sec;
-}
-
-static
-void print_metrics (struct adios_MPI_data_struct * md, int iteration)
-{
-    struct timeval diff;
-    if (md->rank == 0)
-    {
-        timeval_subtract (&diff, &t2, &t1);
-        printf ("cc\t%2d\tFile create (stripe setup):\t%02d.%06d\n"
-               ,iteration, diff.tv_sec, diff.tv_usec);
-        
-        timeval_subtract (&diff, &t6, &t5);
-        printf ("dd\t%2d\tMass file open:\t%02d.%06d\n"
-               ,iteration, diff.tv_sec, diff.tv_usec);
-        
-        timeval_subtract (&diff, &t17, &t16);
-        printf ("ee\t%2d\tBuild file offsets:\t%02d.%06d\n"
-               ,iteration, diff.tv_sec, diff.tv_usec);
-    }
-    if (md->rank == md->size - 1)
-    {   
-        timeval_subtract (&diff, &t10, &t9);
-        printf ("ff\t%2d\tGlobal index creation:\t%02d.%06d\n"
-               ,iteration, diff.tv_sec, diff.tv_usec);
-        
-        timeval_subtract (&diff, &t8, &t7);
-        printf ("gg\t%2d\tAll writes complete (w/ local index):\t%02d.%06d\n"
-               ,iteration, diff.tv_sec, diff.tv_usec);
-        
-        timeval_subtract (&diff, &t11, &t0);
-        printf ("hh\t%2d\tTotal time:\t%02d.%06d\n"
-               ,iteration, diff.tv_sec, diff.tv_usec);
-    }
-    
-    timeval_subtract (&diff, &t13, &t12);
-    printf ("ii\t%2d\tLocal index creation:\t%6d\t%02d.%06d\n"
-           ,iteration, md->rank, diff.tv_sec, diff.tv_usec);
-    
-    timeval_subtract (&diff, &t22, &t21);
-    printf ("kk\t%2d\tshould buffer time:\t%6d\t%02d.%06d\n"
-           ,iteration, md->rank, diff.tv_sec, diff.tv_usec);
-    
-    timeval_subtract (&diff, &t19, &t23);
-    printf ("ll\t%2d\tclose startup time:\t%6d\t%02d.%06d\n"
-           ,iteration, md->rank, diff.tv_sec, diff.tv_usec);
-    
-    timeval_subtract (&diff, &t19, &t0);
-    printf ("mm\t%2d\tsetup time:\t%6d\t%02d.%06d\n"
-           ,iteration, md->rank, diff.tv_sec, diff.tv_usec);
-    
-    timeval_subtract (&diff, &t14, &t20);
-    printf ("nn\t%2d\tcleanup time:\t%6d\t%02d.%06d\n"
-           ,iteration, md->rank, diff.tv_sec, diff.tv_usec);
-    
-    timeval_subtract (&diff, &t21, &t0);
-    printf ("oo\t%2d\topen->should_buffer time:\t%6d\t%02d.%06d\n"
-           ,iteration, md->rank, diff.tv_sec, diff.tv_usec);
-    
-    timeval_subtract (&diff, &t24, &t21);
-    printf ("pp\t%2d\tshould_buffer->write1 time:\t%6d\t%02d.%06d\n"
-           ,iteration, md->rank, diff.tv_sec, diff.tv_usec);
-    
-    timeval_subtract (&diff, &t25, &t24);
-    printf ("qq1\t%2d\twrite1->write2 time:\t%6d\t%02d.%06d\n"
-           ,iteration, md->rank, diff.tv_sec, diff.tv_usec);
-    
-    timeval_subtract (&diff, &t23, &t25);
-    printf ("qq2\t%2d\twrite2->close start time:\t%6d\t%02d.%06d\n"
-           ,iteration, md->rank, diff.tv_sec, diff.tv_usec);
-}
-#endif
-
 #if defined(__APPLE__)
 #       include <sys/param.h>
 #       include <sys/mount.h>
@@ -234,6 +140,9 @@ struct lov_user_md {                 // LOV EA user data (host-endian)
         uint16_t lmm_stripe_offset;  // starting stripe offset in lmm_objects
         struct lov_user_ost_data  lmm_objects[0]; // per-stripe data
 } __attribute__((packed));
+struct obd_uuid {
+        char uuid[40];
+};
 
 static void trim_spaces (char * str)
 {
@@ -251,20 +160,78 @@ static void trim_spaces (char * str)
 
 }
 
+int * allocOSTList (int n_ost)
+{
+    int * ost_list = (int *) malloc (n_ost * sizeof (int));
+
+    if (ost_list == 0)
+    {   
+        fprintf (stderr, "can not malloc");
+        return 0;
+    }
+    memset (ost_list, 0, n_ost * sizeof (int));
+
+    return ost_list;
+}
+
+/* Parse the XML transport parameter to get the list of OST's to skip */
+int * parseOSTSkipping (int * ost_list, char * str, int n_ost)
+{
+    char * p = 0, * dash = 0;
+    char n[16];
+    int ost_id1, ost_id2, i;
+
+    if (ost_list == 0)
+    {
+        fprintf (stderr, "Pointer ost_list is null.\n");
+        return 0;
+    }
+
+    p = strtok (str, ",");
+    while (p)
+    {
+        dash = strchr (p, '-');
+        if (!dash)
+        {
+            ost_id1 = atoi (p);
+            ost_id2 = ost_id1;
+        }
+        else
+        {
+            strncpy (n, p, dash - p);
+            n[dash - p] = '\0';
+            ost_id1 = atoi (n);
+  
+            strncpy (n, dash + 1, strlen (dash + 1));
+            n[strlen (dash + 1)] = '\0';
+            ost_id2 = atoi (n);
+        }
+
+        for (i = ost_id1; i <= ost_id2; i++)
+        {
+            ost_list[i] = 1;
+        }
+          
+        p = strtok (NULL, ",");
+    }
+
+    return ost_list;
+}
+
 static void
-adios_mpi_amr_set_striping_unit(MPI_File fh, char *filename, char *parameters)
+//adios_mpi_amr_set_striping_unit(MPI_File fh, char *filename, char *parameters)
+adios_mpi_amr_set_striping_unit(struct adios_MPI_data_struct * md, char *parameters)
 {
+    MPI_File fh = md->fh;
+    char * filename = md->subfile_name;
     struct statfs fsbuf;
     int err = 0, flag;
     uint64_t striping_unit = 0;
-    uint64_t block_unit = 0;
     uint16_t striping_count = 0;
     char     value[64], *temp_string, *p_count,*p_size;
+    int fd, old_mask, perm, n_ost_skipping, n_ost, n, i;
     MPI_Info info_used;
 
-//#ifndef ADIOS_LUSTRE
-//    return 0;  // disable stripe-size I/O for non-Lustre file system
-//#else
     temp_string = (char *) malloc (strlen (parameters) + 1);
     strcpy (temp_string, parameters);
     trim_spaces (temp_string);
@@ -272,15 +239,17 @@ adios_mpi_amr_set_striping_unit(MPI_File fh, char *filename, char *parameters)
     if (p_count = strstr (temp_string, "stripe_count"))
     {
         char * p = strchr (p_count, '=');
-        char * q = strtok (p, ",");
+        char * q = strtok (p, ";");
         if (!q)
             striping_count = atoi (q + 1);
         else
             striping_count = atoi (p + 1);
     }
-
-    if (striping_count <= 0)
-        striping_count = 4;
+    else
+    {
+        // By default, set stripe count to 1 to maximize concurrency.
+        striping_count = DEFAULT_STRIPE_COUNT;
+    }
 
     strcpy (temp_string, parameters);
     trim_spaces (temp_string);
@@ -288,36 +257,20 @@ adios_mpi_amr_set_striping_unit(MPI_File fh, char *filename, char *parameters)
     if (p_size = strstr (temp_string, "stripe_size"))
     {
         char * p = strchr (p_size, '=');
-        char * q = strtok (p, ",");
+        char * q = strtok (p, ";");
         if (!q)
             striping_unit = atoi(q + 1);
         else
             striping_unit = atoi(p + 1);
     }
-
-    if (striping_unit <= 0)
-        striping_unit = 1048576;
-
-    strcpy (temp_string, parameters);
-    trim_spaces (temp_string);
-
-    if (p_size = strstr (temp_string, "block_size"))
+    else
     {
-        char * p = strchr (p_size, '=');
-        char * q = strtok (p, ",");
-        if (!q)
-            block_unit = atoi(q + 1);
-        else
-            block_unit = atoi(p + 1);
+        //stripe size shouldn't matter here. Simply set it to 1 MB here. 
+        striping_unit = DEFAULT_STRIPE_SIZE;
     }
 
-    if (block_unit <= 0)
-        block_unit = 1048576;
-
     free (temp_string);
 
-    int fd, old_mask, perm;
-
     old_mask = umask(022);
     umask(old_mask);
     perm = old_mask ^ 0666;
@@ -329,7 +282,40 @@ adios_mpi_amr_set_striping_unit(MPI_File fh, char *filename, char *parameters)
         lum.lmm_pattern = 0;
         lum.lmm_stripe_size = striping_unit;
         lum.lmm_stripe_count = striping_count;
-        lum.lmm_stripe_offset = g_color1 % 672;
+
+        // calculate the # of ost's to skip
+        n_ost_skipping = 0;
+        for (i = 0; i < md->g_num_ost; i++)
+        {
+            if (md->g_ost_skipping_list[i] == 1)
+            {
+                n_ost_skipping++;
+            }
+        }
+
+        // the actual # of ost that can be used
+        n_ost = md->g_num_ost - n_ost_skipping;
+        if (n_ost <= 0)
+        {
+            fprintf (stderr, "No OST to use. Set num_ost=NNN in the adios config xml file.\n");
+            return;
+        }
+
+        i = 0;
+        n = 0;
+        while (i < md->g_num_ost)
+        {
+            if (md->g_ost_skipping_list[i] == 0)
+            {
+                n++;
+                if (n - 1 == md->g_color1 % n_ost)
+                    break;
+            }
+            
+            i++;
+        }
+
+        lum.lmm_stripe_offset = i;
         ioctl (fd, LL_IOC_LOV_SETSTRIPE
               ,(void *) &lum
               );
@@ -337,93 +323,142 @@ adios_mpi_amr_set_striping_unit(MPI_File fh, char *filename, char *parameters)
         if (err == 0 && lum.lmm_stripe_size > 0) {
             striping_unit = lum.lmm_stripe_size;
         }
+
         close(fd);
     }
     else
         printf("Warning: open failed on file %s %s.\n",filename,strerror(errno));
-//#endif
 }
 
 static void
-adios_mpi_amr_set_block_unit(uint64_t *block_unit, char *parameters)
+adios_mpi_amr_set_aggregation_parameters(char * parameters, struct adios_MPI_data_struct * md)
 {
-    char *temp_string, *p_count,*p_size;
+    int err = 0, flag, i, aggr_group_size, remain, index;
+    int nproc = md->size, rank = md->rank;
+    char value[64], *temp_string, *p_count,*p_size;
 
     temp_string = (char *) malloc (strlen (parameters) + 1);
+
+    // set up the number of OST to use
     strcpy (temp_string, parameters);
     trim_spaces (temp_string);
 
-    if (p_size = strstr (temp_string, "block_size"))
+    if (p_size = strstr (temp_string, "num_ost"))
     {
         char * p = strchr (p_size, '=');
-        char * q = strtok (p, ",");
+        char * q = strtok (p, ";");
         if (!q)
-            *block_unit = atoi(q + 1);
+            md->g_num_ost = atoi(q + 1);
         else
-            *block_unit = atoi(p + 1);
+            md->g_num_ost = atoi(p + 1);
+    }
+    else
+    {
     }
 
-    if (*block_unit <= 0)
-        *block_unit = 1048576;
+    strcpy (temp_string, parameters);
+    trim_spaces (temp_string);
 
-    free (temp_string);
-}
+    // set up # of aggregators
+    if (p_size = strstr (temp_string, "num_aggregators"))
+    {
+        char * p = strchr (p_size, '=');
+        char * q = strtok (p, ";");
+        if (!q)
+            md->g_num_aggregators = atoi(q + 1);
+        else
+            md->g_num_aggregators = atoi(p + 1);
+    }
+    else
+    {
+        if (nproc <= md->g_num_ost)
+        {
+            md->g_num_aggregators = nproc;
+        }
+        else
+        {
+            md->g_num_aggregators = md->g_num_ost;
+        }
+    }
 
-static void
-adios_mpi_amr_set_aggregation_parameters(char * parameters, int nproc, int rank)
-{
-    int err = 0, flag, i, aggr_group_size, remain, index;
-    char value[64], *temp_string, *p_count,*p_size;
+    // set up whether to thread IO ops
+    strcpy (temp_string, parameters);
+    trim_spaces (temp_string);
 
-    temp_string = (char *) malloc (strlen (parameters) + 1);
+    if (p_size = strstr (temp_string, "threading"))
+    {
+        char * p = strchr (p_size, '=');
+        char * q = strtok (p, ";");
+        if (!q)
+            md->g_threading = atoi(q + 1);
+        else
+            md->g_threading = atoi(p + 1);
+    }
+    else
+    {
+        // by default, threading is disabled.
+        md->g_threading = 0;
+    }
+
+    // set up which ost's to skip
     strcpy (temp_string, parameters);
     trim_spaces (temp_string);
 
-    if (p_size = strstr (temp_string, "num_aggregators"))
+    md->g_ost_skipping_list = allocOSTList (md->g_num_ost);
+
+    if (p_size = strstr (temp_string, "osts_to_skip"))
     {
         char * p = strchr (p_size, '=');
-        char * q = strtok (p, ",");
+        char * q = strtok (p, ";");
+
         if (!q)
-            g_num_aggregators = atoi(q + 1);
+            md->g_ost_skipping_list = parseOSTSkipping (md->g_ost_skipping_list, q + 1, md->g_num_ost);
         else
-            g_num_aggregators = atoi(p + 1);
+            md->g_ost_skipping_list = parseOSTSkipping (md->g_ost_skipping_list, p + 1, md->g_num_ost);
     }
 
+    // set up which ost's to skip
     strcpy (temp_string, parameters);
     trim_spaces (temp_string);
 
-    if (p_size = strstr (temp_string, "merging_pgs"))
+    if (p_size = strstr (temp_string, "aggregation_type"))
     {
         char * p = strchr (p_size, '=');
-        char * q = strtok (p, ",");
+        char * q = strtok (p, ";");
+
         if (!q)
-            g_merging_pgs = atoi(q + 1);
+            md->g_io_type = atoi (q + 1);
         else
-            g_merging_pgs = atoi(p + 1);
+            md->g_io_type = atoi (p + 1);
+    }
+    else
+    {
+        // by default, use BG
+        md->g_io_type = ADIOS_MPI_AMR_IO_BG;
     }
 
     free (temp_string);
 
-    if (g_num_aggregators > nproc || g_num_aggregators <= 0)
+    if (md->g_num_aggregators > nproc || md->g_num_aggregators <= 0)
     {
-        g_num_aggregators = nproc;  //no aggregation
+        md->g_num_aggregators = nproc;  //no aggregation
     }
 
-    g_is_aggregator = (int *) malloc (nproc * sizeof(int));
-    if (g_is_aggregator == 0)
+    md->g_is_aggregator = (int *) malloc (nproc * sizeof(int));
+    if (md->g_is_aggregator == 0)
     {
         fprintf (stderr, "can not malloc\n");
         return;
     }
-    memset (g_is_aggregator, 0, nproc * sizeof(int));
+    memset (md->g_is_aggregator, 0, nproc * sizeof(int));
 
-    aggr_group_size = nproc / g_num_aggregators;
-    remain = nproc - (int) aggr_group_size * g_num_aggregators;
+    aggr_group_size = nproc / md->g_num_aggregators;
+    remain = nproc - (int) aggr_group_size * md->g_num_aggregators;
 
     index = 0;
-    for (i = 0; i < g_num_aggregators; i++)
+    for (i = 0; i < md->g_num_aggregators; i++)
     {
-        g_is_aggregator[index] = 1;
+        md->g_is_aggregator[index] = 1;
 
         if (i < remain)
         {
@@ -437,28 +472,28 @@ adios_mpi_amr_set_aggregation_parameters(char * parameters, int nproc, int rank)
 
     if (remain == 0)
     {
-        g_color1 = rank / aggr_group_size;
-        g_color2 = rank % aggr_group_size;
+        md->g_color1 = rank / aggr_group_size;
+        md->g_color2 = rank % aggr_group_size;
     }
     else
     {
         if (rank < (aggr_group_size + 1) * remain)
         {
-            g_color1 = rank / (aggr_group_size + 1);
-            g_color2 = rank % (aggr_group_size + 1);
+            md->g_color1 = rank / (aggr_group_size + 1);
+            md->g_color2 = rank % (aggr_group_size + 1);
         }
         else
         {
-            g_color1 = remain + (rank - (aggr_group_size + 1) * remain) / aggr_group_size;
-            g_color2 = (rank - (aggr_group_size + 1) * remain)% aggr_group_size;
+            md->g_color1 = remain + (rank - (aggr_group_size + 1) * remain) / aggr_group_size;
+            md->g_color2 = (rank - (aggr_group_size + 1) * remain)% aggr_group_size;
         }
     }
 }
 
 static void adios_mpi_amr_buffer_write (char ** buffer, uint64_t * buffer_size
-                         ,uint64_t * buffer_offset
-                         ,const void * data, uint64_t size
-                         )
+                                       ,uint64_t * buffer_offset
+                                       ,const void * data, uint64_t size
+                                       )
 {
     if (*buffer_offset + size > *buffer_size || *buffer == 0)
     {
@@ -490,10 +525,6 @@ adios_mpi_amr_get_striping_unit(MPI_File fh, char *filename)
     char     value[64];
     MPI_Info info_used;
 
-#if COLLECT_METRICS
-    gettimeofday (&t1, NULL);
-#endif
-
     // get striping_unit from MPI hint if it has
     MPI_File_get_info(fh, &info_used);
     MPI_Info_get(info_used, "striping_unit", 63, value, &flag);
@@ -529,23 +560,24 @@ adios_mpi_amr_get_striping_unit(MPI_File fh, char *filename)
             printf("Warning: open failed on file %s %s.\n",filename,strerror(errno));
     }
 
-#if COLLECT_METRICS         
-    gettimeofday (&t2, NULL);
-#endif
     // set the file striping size
     return striping_unit;
 }
 
 static uint64_t
-adios_mpi_amr_striping_unit_write(MPI_File    fh
-                                  ,MPI_Offset  offset
-                                  ,void       *buf
-                                  ,uint64_t   len
-                                  ,uint64_t   block_unit
-                                  )
+adios_mpi_amr_striping_unit_write(MPI_File   fh
+                                 ,MPI_Offset offset
+                                 ,void       *buf
+                                 ,uint64_t   len
+                                 )
 {
     uint64_t err = -1;
     MPI_Status status;
+    uint64_t total_written = 0;
+    uint64_t to_write = len;
+    int write_len = 0;
+    int count;
+    char * buf_ptr = buf;
 
     if (len == 0)
         return 0;
@@ -555,51 +587,20 @@ adios_mpi_amr_striping_unit_write(MPI_File    fh
     else
         MPI_File_seek (fh, offset, MPI_SEEK_SET);
 
-    if (block_unit > 0)
+    while (total_written < len)
     {
-        MPI_Offset  rem_off = offset;
-        uint64_t    rem_size = len;
-        char       *buf_ptr = buf;
-
-        err = 0;
-        while (rem_size > 0)
-        {
-            uint64_t rem_unit  = block_unit - rem_off % block_unit;
-            int write_len = (rem_unit < rem_size) ? rem_unit : rem_size;
-            int ret_len;
-
-            MPI_File_write (fh, buf_ptr, write_len, MPI_BYTE, &status);
-            MPI_Get_count(&status, MPI_BYTE, &ret_len);
-            if (ret_len < 0) {err = ret_len; break;}
-            err += ret_len;
-            if (ret_len != write_len) break;
-            buf_ptr  += write_len;
-            rem_off  += write_len;
-            rem_size -= write_len;
-        }
-    }
-    else
-    {
-        uint64_t total_written = 0;
-        uint64_t to_write = len;
-        int write_len = 0;
-        int count;
-        char * buf_ptr = buf;
-        while (total_written < len)
+        write_len = (to_write > INT32_MAX) ? INT32_MAX : to_write;
+        MPI_File_write (fh, buf_ptr, write_len, MPI_BYTE, &status);
+        MPI_Get_count(&status, MPI_BYTE, &count);
+        if (count != write_len)
         {
-            write_len = (to_write > INT32_MAX) ? INT32_MAX : to_write;
-            MPI_File_write (fh, buf_ptr, write_len, MPI_BYTE, &status);
-            MPI_Get_count(&status, MPI_BYTE, &count);
-            if (count != write_len)
-            {
-                err = count;
-                break;
-            }
-            total_written += count;
-            buf_ptr += count;
-            to_write -= count;
-            err = total_written;
+            err = count;
+            break;
         }
+        total_written += count;
+        buf_ptr += count;
+        to_write -= count;
+        err = total_written;
     }
 
     return err;
@@ -650,10 +651,10 @@ void adios_mpi_amr_append_var (struct adios_file_struct * fd, struct adios_var_s
 }
 
 void adios_mpi_amr_add_offset (uint64_t var_offset_to_add
-                               ,uint64_t attr_offset_to_add
-                               ,struct adios_index_var_struct_v1 * vars_root
-                               ,struct adios_index_attribute_struct_v1 * attrs_root
-                               )
+                              ,uint64_t attr_offset_to_add
+                              ,struct adios_index_var_struct_v1 * vars_root
+                              ,struct adios_index_attribute_struct_v1 * attrs_root
+                              )
 {
     while (vars_root)
     {
@@ -729,23 +730,6 @@ void adios_mpi_amr_build_global_index_v1 (char * fname
 }
 
 
-int adios_mpi_amr_calc_aggregator_index (int rank)
-{
-    int j = rank - 1;
-
-    if (is_aggregator (rank))
-        return rank;
-
-    while (j > -1)
-    {
-        if (is_aggregator (j))
-            break;
-        j--;
-    }
-
-    return j;
-}
-
 void * adios_mpi_amr_do_mkdir (void * param)
 {
     struct adios_file_struct * fd = (struct adios_file_struct *) param;
@@ -764,22 +748,26 @@ void * adios_mpi_amr_do_open_thread (void * param)
 {
     struct adios_MPI_thread_data_open * td = (struct adios_MPI_thread_data_open *) param;
 
-    unlink (td->name);
+    unlink (td->md->subfile_name);
     if (td->parameters)
     {
+/*
         adios_mpi_amr_set_striping_unit (*td->fh
-                                         ,td->name
-                                         ,td->parameters
-                                         );
+                                        ,td->name
+                                        ,td->parameters
+                                        );
+*/
+        adios_mpi_amr_set_striping_unit (td->md, td->parameters);
+
     }
 
-    MPI_File_open (MPI_COMM_SELF, td->name
+    MPI_File_open (MPI_COMM_SELF, td->md->subfile_name
                   ,MPI_MODE_WRONLY | MPI_MODE_CREATE
                   ,MPI_INFO_NULL
-                  ,td->fh
+                  ,&td->md->fh
                   );
 
-    *td->striping_unit = adios_mpi_amr_get_striping_unit (*td->fh, td->name);
+    td->md->striping_unit = adios_mpi_amr_get_striping_unit (td->md->fh, td->md->subfile_name);
  
     return NULL;
 }
@@ -794,7 +782,7 @@ void * adios_mpi_amr_do_write_thread (void * param)
                               ,*(td->base_offset)
                               ,td->aggr_buff
                               ,*(td->total_data_size)
-                              ,*(td->block_unit));
+                              );
 
     if (count != *(td->total_data_size))
     {
@@ -924,6 +912,18 @@ void adios_mpi_amr_init (const char * parameters
     md->vars_start = 0;
     md->vars_header_size = 0;
 
+    md->g_is_aggregator = 0;
+    md->g_num_aggregators = 0;
+    md->g_merging_pgs = 0;
+    md->g_num_ost = 0;
+    md->g_threading = 0;
+    md->g_color1 = 0;
+    md->g_color2 = 0;
+    md->g_offsets = 0;
+    md->g_ost_skipping_list = 0;
+    md->open_thread_data = 0;
+    md->g_io_type = ADIOS_MPI_AMR_IO_BG;
+
     adios_buffer_struct_init (&md->b);
 }
 
@@ -972,8 +972,8 @@ void build_offsets (struct adios_bp_buffer_struct_v1 * b
 }
 
 enum ADIOS_FLAG adios_mpi_amr_should_buffer (struct adios_file_struct * fd
-                                             ,struct adios_method_struct * method
-                                             )
+                                            ,struct adios_method_struct * method
+                                            )
 {
     int i;
     struct adios_MPI_data_struct * md = (struct adios_MPI_data_struct *)
@@ -988,7 +988,6 @@ enum ADIOS_FLAG adios_mpi_amr_should_buffer (struct adios_file_struct * fd
     int next;
     uint16_t flag;
 
-
     name = malloc (strlen (method->base_path) + strlen (fd->name) + 1);
     sprintf (name, "%s%s", method->base_path, fd->name);
 
@@ -1019,232 +1018,106 @@ enum ADIOS_FLAG adios_mpi_amr_should_buffer (struct adios_file_struct * fd
     {
         case adios_mode_read:
         {
-            if (md->group_comm == MPI_COMM_NULL || md->rank == 0)
+            fprintf (stderr, "Read mode is not supported in MPI_AMR method.\n");
+            break;
+        }
+
+        case adios_mode_write:
+        {
+            if (md->rank == 0)
             {
-                err = MPI_File_open (MPI_COMM_SELF, name, MPI_MODE_RDONLY
-                                    ,MPI_INFO_NULL, &md->fh
-                                    );
-                if (err != MPI_SUCCESS)
-                {
-                    char e [MPI_MAX_ERROR_STRING];
-                    int len = 0;
-                    memset (e, 0, MPI_MAX_ERROR_STRING);
-                    MPI_Error_string (err, e, &len);
-                    fprintf (stderr, "MPI open read failed for %s: '%s'\n"
-                            ,name, e
-                            );
-                    free (name);
+                struct lov_user_md lum;
+                struct obd_uuid uuids[1024], * uuidp;
+                int f, rc;
 
-                    return adios_flag_no;
+                // open metadata file
+                unlink (fd->name);
+
+                f = open(fd->name, O_CREAT | O_RDWR | O_LOV_DELAY_CREATE, 0644);
+                if (f == -1)
+                {
+                    fprintf (stderr,"open() failed: %s\n", strerror(errno));
+                    return -1;
                 }
 
-                MPI_Offset file_size;
-                MPI_File_get_size (md->fh, &file_size);
-                md->b.file_size = file_size;
+                lum.lmm_magic = LOV_USER_MAGIC;
+                lum.lmm_pattern = 0;
+                lum.lmm_stripe_size = DEFAULT_STRIPE_SIZE;
+                lum.lmm_stripe_count = 1;
+                lum.lmm_stripe_offset = -1;
+
+                ioctl (f, LL_IOC_LOV_SETSTRIPE ,(void *) &lum);
+#ifdef HAVE_LUSTRE
+                md->g_num_ost = 1024;
+                rc = llapi_lov_get_uuids(f, uuids, &md->g_num_ost);
+                if (rc != 0)
+                {
+                    fprintf (stderr, "get uuids failed: %s\n"
+                            ,strerror(errno)
+                            );
+                }
+#endif
+                close (f);
 
-                adios_init_buffer_read_version (&md->b);
-                MPI_File_seek (md->fh, md->b.file_size - md->b.length
-                              ,MPI_SEEK_SET
-                              );
-                MPI_File_read (md->fh, md->b.buff, md->b.length, MPI_BYTE
-                              ,&md->status
+                MPI_File_open (MPI_COMM_SELF, fd->name
+                              ,MPI_MODE_WRONLY | MPI_MODE_CREATE
+                              ,MPI_INFO_NULL
+                              ,&md->mfh
                               );
-                adios_parse_version (&md->b, &md->b.version);
 
-                adios_init_buffer_read_index_offsets (&md->b);
-                // already in the buffer
-                adios_parse_index_offsets_v1 (&md->b);
+                adios_mpi_amr_do_mkdir (fd);
+            }
 
-                adios_init_buffer_read_process_group_index (&md->b);
-                MPI_File_seek (md->fh, md->b.pg_index_offset
-                              ,MPI_SEEK_SET
-                              );
-                MPI_File_read (md->fh, md->b.buff, md->b.pg_size, MPI_BYTE
-                              ,&md->status
-                              );
-                adios_parse_process_group_index_v1 (&md->b
-                                                   ,&md->old_pg_root
-                                                   );
+            MPI_Bcast (&md->g_num_ost, 1, MPI_INT, 0, md->group_comm);
+          
+            fd->base_offset = 0;
+            fd->pg_start_in_file = 0;
+            adios_mpi_amr_set_aggregation_parameters (method->parameters, md);
 
-#if 1
-                adios_init_buffer_read_vars_index (&md->b);
-                MPI_File_seek (md->fh, md->b.vars_index_offset
-                              ,MPI_SEEK_SET
-                              );
-                MPI_File_read (md->fh, md->b.buff, md->b.vars_size, MPI_BYTE
-                              ,&md->status
-                              );
-                adios_parse_vars_index_v1 (&md->b, &md->old_vars_root);
+            // Check if fd->name contains path
+            if (ch = strrchr (fd->name, '/'))
+            {
+                name_no_path = malloc (strlen (ch + 1) + 1); 
+                strcpy (name_no_path, ch + 1); 
+            }
+            else
+            {
+                name_no_path = malloc (strlen (fd->name) + 1);
+                strcpy (name_no_path, fd->name);
+            }
 
-                adios_init_buffer_read_attributes_index (&md->b);
-                MPI_File_seek (md->fh, md->b.attrs_index_offset
-                              ,MPI_SEEK_SET
-                              );
-                MPI_File_read (md->fh, md->b.buff, md->b.attrs_size, MPI_BYTE
-                              ,&md->status
-                              );
-                adios_parse_attributes_index_v1 (&md->b, &md->old_attrs_root);
-#endif
+            name = realloc (name, strlen (fd->name) + 5 + strlen (method->base_path) + strlen (name_no_path) + 1 + 10 + 1);
+            // create the subfile name, e.g. restart.bp.1
+            // 1 for '.' + 10 for subfile index + 1 for '\0'
+            sprintf (name, "%s%s%s%s.%d", fd->name, ".dir/", method->base_path, name_no_path, md->g_color1);
+            md->subfile_name = strdup (name);
+            fd->subfile_index = (uint32_t)md->g_color1;
 
-                fd->base_offset = md->b.end_of_pgs;
-            }
+            free (name_no_path);
 
-            if (   md->group_comm != MPI_COMM_NULL
-                && md->group_comm != MPI_COMM_SELF
-               )
+            if (is_aggregator(md->rank))
             {
-                if (md->rank == 0)
+                if (fd->shared_buffer == adios_flag_yes)
                 {
-                    MPI_Offset * offsets = malloc (  sizeof (MPI_Offset)
-                                                   * md->size * 3
-                                                  );
-                    memset (offsets, 0, sizeof (MPI_Offset) * md->size * 3);
+                    if (is_aggregator (md->rank))
+                    {
+                        // open subfiles
+                        md->open_thread_data = (struct adios_MPI_thread_data_open *) malloc (sizeof (struct adios_MPI_thread_data_open));
+                        md->open_thread_data->md = md;
+                        md->open_thread_data->parameters = method->parameters;
 
-                    // go through the pg index to build the offsets array
-                    build_offsets (&md->b, offsets, md->size
-                                  ,fd->group->name, md->old_pg_root
-                                  );
-                    MPI_Scatter (offsets, 3, MPI_LONG_LONG
-                                ,offsets, 3, MPI_LONG_LONG
-                                ,0, md->group_comm
-                                );
-                    md->b.read_pg_offset = offsets [0];
-                    md->b.read_pg_size = offsets [1];
-                    free (offsets);
-                }
-                else
-                {
-                    MPI_Offset offset [3];
-                    offset [0] = offset [1] = offset [2] = 0;
-
-                    MPI_Scatter (offset, 3, MPI_LONG_LONG
-                                ,offset, 3, MPI_LONG_LONG
-                                ,0, md->group_comm
-                                );
-
-                    md->b.read_pg_offset = offset [0];
-                    md->b.read_pg_size = offset [1];
-                    md->b.version = offset [2];
-                }
-            }
-
-            // cascade the opens to avoid trashing the metadata server
-            if (previous == -1)
-            {
-                // note rank 0 is already open
-                // don't open it again here
-
-                if (next != -1)
-                {
-                    MPI_Isend (&sig, 1, MPI_INTEGER, next, current
-                              ,md->group_comm, &md->req
-                              );
-                }
-            }
-            else
-            {
-                MPI_Recv (&sig, 1, MPI_INTEGER, previous, previous
-                         ,md->group_comm, &md->status
-                         );
-                if (next != -1)
-                {
-                    MPI_Isend (&sig, 1, MPI_INTEGER, next, current
-                              ,md->group_comm, &md->req
-                              );
-                }
-                err = MPI_File_open (MPI_COMM_SELF, name
-                                    ,MPI_MODE_RDONLY
-                                    ,MPI_INFO_NULL
-                                    ,&md->fh
-                                    );
-            }
-
-            if (err != MPI_SUCCESS)
-            {
-                char e [MPI_MAX_ERROR_STRING];
-                int len = 0;
-                memset (e, 0, MPI_MAX_ERROR_STRING);
-                MPI_Error_string (err, e, &len);
-                fprintf (stderr, "MPI open write failed for %s: '%s'\n"
-                        ,name, e
-                        );
-                free (name);
-
-                return adios_flag_no;
-            }
-
-            break;
-        }
-
-        case adios_mode_write:
-        {
-            if (md->rank == 0)
-            {
-                adios_mpi_amr_do_mkdir (fd);
-            }
-
-            MPI_Barrier (md->group_comm);
-
-            fd->base_offset = 0;
-            fd->pg_start_in_file = 0;
-            adios_mpi_amr_set_aggregation_parameters (method->parameters
-                                                      ,md->size
-                                                      ,md->rank
-                                                      );
-            adios_mpi_amr_set_block_unit (&md->block_unit, method->parameters);
-
-            // Check if fd->name contains path
-            if (ch = strrchr (fd->name, '/'))
-            {
-                name_no_path = malloc (strlen (ch + 1) + 1); 
-                strcpy (name_no_path, ch + 1); 
-            }
-            else
-            {
-                name_no_path = malloc (strlen (fd->name) + 1);
-                strcpy (name_no_path, fd->name);
-            }
-
-            name = realloc (name, strlen (fd->name) + 5 + strlen (method->base_path) + strlen (name_no_path) + 1 + 10 + 1);
-            // create the subfile name, e.g. restart.bp.1
-            // 1 for '.' + 10 for subfile index + 1 for '\0'
-            sprintf (name, "%s%s%s%s.%d", fd->name, ".dir/", method->base_path, name_no_path, g_color1);
-            md->subfile_name = strdup (name);
-            fd->subfile_name = strdup (name);
-
-            free (name_no_path);
-
-            if (is_aggregator(md->rank))
-            {
-                if (fd->shared_buffer == adios_flag_yes)
-                {
-                    if (is_aggregator (md->rank))
-                    {
-                        // open subfiles
-                        open_thread_data1.fh = &md->fh;
-                        open_thread_data1.name = md->subfile_name;
-                        open_thread_data1.striping_unit = &md->striping_unit;
-                        open_thread_data1.parameters = method->parameters;
-
-                        pthread_create (&g_t, NULL
-                                       ,adios_mpi_amr_do_open_thread
-                                       ,(void *) &open_thread_data1
-                                       );
-
-                        // open metadata file
-                        if (md->rank == 0)
-                        {
-                            open_thread_data2.fh = &md->mfh;
-                            open_thread_data2.name = fd->name;
-                            open_thread_data2.striping_unit = &md->striping_unit;
-                            open_thread_data2.parameters = method->parameters;
-
-                            pthread_create (&g_t1, NULL
-                                           ,adios_mpi_amr_do_open_thread
-                                           ,(void *) &open_thread_data2
-                                           );
-                        }
-                    }
+                        if (md->g_threading)
+                        {
+                            pthread_create (&md->g_sot, NULL
+                                           ,adios_mpi_amr_do_open_thread
+                                           ,(void *) md->open_thread_data
+                                           );
+                        }
+                        else
+                        {
+                            adios_mpi_amr_do_open_thread ((void *) md->open_thread_data);
+                        }
+                    }
                 }
 
                 if (fd->shared_buffer == adios_flag_no)
@@ -1257,10 +1130,7 @@ enum ADIOS_FLAG adios_mpi_amr_should_buffer (struct adios_file_struct * fd
 
                     if (method->parameters)
                     {
-                        adios_mpi_amr_set_striping_unit (md->fh
-                                                         ,name
-                                                         ,method->parameters
-                                                         );
+                        adios_mpi_amr_set_striping_unit (md, method->parameters);
                     }
 
                     err = MPI_File_open (MPI_COMM_SELF, name
@@ -1475,7 +1345,7 @@ enum ADIOS_FLAG adios_mpi_amr_should_buffer (struct adios_file_struct * fd
                     else
                         offsets [0] = fd->write_size_bytes;
 
-                    MPI_Gather (offsets, 1, MPI_LONG_LONG
+                    MPI_Gather (MPI_IN_PLACE, 1, MPI_LONG_LONG
                                ,offsets, 1, MPI_LONG_LONG
                                ,0, md->group_comm
                                );
@@ -1491,7 +1361,7 @@ enum ADIOS_FLAG adios_mpi_amr_should_buffer (struct adios_file_struct * fd
                     md->b.pg_index_offset =   offsets [md->size - 1]
                                             + last_offset;
                     MPI_Scatter (offsets, 1, MPI_LONG_LONG
-                                ,offsets, 1, MPI_LONG_LONG
+                                ,MPI_IN_PLACE, 1, MPI_LONG_LONG
                                 ,0, md->group_comm
                                 );
                     fd->base_offset = offsets [0];
@@ -1509,11 +1379,11 @@ enum ADIOS_FLAG adios_mpi_amr_should_buffer (struct adios_file_struct * fd
 
 
                     MPI_Gather (&offset, 1, MPI_LONG_LONG
-                               ,&offset, 1, MPI_LONG_LONG
+                               ,0, 0, 0
                                ,0, md->group_comm
                                );
 
-                    MPI_Scatter (&offset, 1, MPI_LONG_LONG
+                    MPI_Scatter (0, 0, 0
                                 ,&offset, 1, MPI_LONG_LONG
                                 ,0, md->group_comm
                                 );
@@ -1554,7 +1424,6 @@ enum ADIOS_FLAG adios_mpi_amr_should_buffer (struct adios_file_struct * fd
                                  ,fd->base_offset
                                  ,fd->buffer
                                  ,fd->bytes_written
-                                 ,md->block_unit
                                  );
             if (count != fd->bytes_written)
             {
@@ -1620,7 +1489,7 @@ void adios_mpi_amr_write (struct adios_file_struct * fd
         adios_write_var_header_v1 (fd, v);
         adios_write_var_payload_v1 (fd, v);
 
-        MPI_Comm_split (md->group_comm, g_color1, md->rank, &new_comm);
+        MPI_Comm_split (md->group_comm, md->g_color1, md->rank, &new_comm);
         MPI_Comm_rank (new_comm, &new_rank);
         MPI_Comm_size (new_comm, &new_group_size);
 
@@ -1665,7 +1534,6 @@ void adios_mpi_amr_write (struct adios_file_struct * fd
                           ,-1
                           ,aggr_buff
                           ,total_size
-                          ,md->block_unit
                           );
             if (count != total_size)
             {
@@ -1804,106 +1672,788 @@ static void adios_mpi_amr_do_read (struct adios_file_struct * fd
 
             uint64_t i;
 
-            adios_init_buffer_read_process_group (&md->b);
-            MPI_File_seek (md->fh, md->b.read_pg_offset
-                          ,MPI_SEEK_SET
-                          );
-            MPI_File_read (md->fh, md->b.buff, md->b.read_pg_size, MPI_BYTE
-                          ,&md->status
-                          );
-            adios_parse_process_group_header_v1 (&md->b, &pg_header);
+            adios_init_buffer_read_process_group (&md->b);
+            MPI_File_seek (md->fh, md->b.read_pg_offset
+                          ,MPI_SEEK_SET
+                          );
+            MPI_File_read (md->fh, md->b.buff, md->b.read_pg_size, MPI_BYTE
+                          ,&md->status
+                          );
+            adios_parse_process_group_header_v1 (&md->b, &pg_header);
+
+            adios_parse_vars_header_v1 (&md->b, &vars_header);
+
+            for (i = 0; i < vars_header.count; i++)
+            {
+                memset (&var_payload, 0
+                       ,sizeof (struct adios_var_payload_struct_v1)
+                       );
+                adios_parse_var_data_header_v1 (&md->b, &var_header);
+
+                struct adios_var_struct * v1 = v;
+                while (v1)
+                {
+                    if (   strcasecmp (var_header.name, v1->name)
+                        || strcasecmp (var_header.path, v1->path)
+                       )
+                    {
+                        v1 = v1->next;
+                    }
+                    else
+                    {
+                        break;
+                    }
+                }
+
+                if (v1)
+                {
+                    var_payload.payload = v1->data;
+                    adios_parse_var_data_payload_v1 (&md->b, &var_header
+                                                    ,&var_payload
+                                                    ,v1->data_size
+                                                    );
+                }
+                else
+                {
+                    printf ("MPI read: skipping name: %s path: %s\n"
+                           ,var_header.name, var_header.path
+                           );
+                    adios_parse_var_data_payload_v1 (&md->b, &var_header
+                                                    ,NULL, 0
+                                                    );
+                }
+
+                adios_clear_var_header_v1 (&var_header);
+            }
+
+#if 1
+            adios_parse_attributes_header_v1 (&md->b, &attrs_header);
+
+            for (i = 0; i < attrs_header.count; i++)
+            {
+                adios_parse_attribute_v1 (&md->b, &attribute);
+                adios_clear_attribute_v1 (&attribute);
+            }
+#endif
+            adios_clear_process_group_header_v1 (&pg_header);
+
+            break;
+        }
+
+        default:
+            fprintf (stderr, "MPI read: file version unknown: %u\n"
+                    ,md->b.version
+                    );
+            return;
+    }
+
+    adios_buffer_struct_clear (&md->b);
+}
+
+static
+uint32_t adios_mpi_amr_calculate_attributes_size (struct adios_file_struct * fd)
+{
+    uint32_t overhead = 0;
+    struct adios_attribute_struct * a = fd->group->attributes;
+
+    overhead += 2; // attributes count
+    overhead += 8; // attributes length
+
+    while (a)
+    {
+        overhead += adios_calc_attribute_overhead_v1 (a);
+
+        a = a->next;
+    }
+
+    return overhead;
+}
+
+void adios_mpi_amr_bg_close (struct adios_file_struct * fd
+                            ,struct adios_method_struct * method
+                            )
+{
+    struct adios_MPI_data_struct * md = (struct adios_MPI_data_struct *)
+                                                 method->method_data;
+    struct adios_attribute_struct * a = fd->group->attributes;
+
+    struct adios_index_process_group_struct_v1 * new_pg_root = 0;
+    struct adios_index_var_struct_v1 * new_vars_root = 0;
+    struct adios_index_attribute_struct_v1 * new_attrs_root = 0;
+
+    switch (fd->mode)
+    {
+        case adios_mode_read:
+        case adios_mode_append:
+        {
+            fprintf (stderr, "Only \"w\" is supported by MPI_AMR Brigade IO\n");
+            break;
+        }
+        case adios_mode_write:
+        {
+            char * buffer = 0;
+            uint64_t buffer_size = 0;
+            uint64_t buffer_offset = 0;
+            uint64_t index_start = md->b.pg_index_offset, index_start1;
+            int * pg_sizes = 0, * disp = 0, * sendbuf = 0, * recvbuf = 0, * attr_sizes = 0;
+            void * aggr_buff = 0, * recv_buff = 0;
+            struct adios_MPI_thread_data_write write_thread_data;
+            int i, new_rank, new_group_size, new_rank2, new_group_size2, max_data_size = 0, total_data_size = 0, total_data_size1 = 0;
+            MPI_Comm new_comm, new_comm2;
+
+            MPI_Comm_split (md->group_comm, md->g_color1, md->rank, &new_comm);
+            MPI_Comm_rank (new_comm, &new_rank);
+            MPI_Comm_size (new_comm, &new_group_size);
+
+            MPI_Comm_split (md->group_comm, md->g_color2, md->rank, &new_comm2);
+            MPI_Comm_rank (new_comm2, &new_rank2);
+            MPI_Comm_size (new_comm2, &new_group_size2);
+
+            if (fd->shared_buffer == adios_flag_no)
+            {
+                MPI_Offset new_off;
+                // set it up so that it will start at 0, but have correct sizes
+                MPI_File_get_position (md->fh, &new_off);
+                fd->offset = fd->base_offset - md->vars_start;
+                fd->vars_start = 0;
+                fd->buffer_size = 0;
+                adios_write_close_vars_v1 (fd);
+                // fd->vars_start gets updated with the size written
+
+                uint64_t count;
+                if (is_aggregator(md->rank))
+                {
+                    count = adios_mpi_amr_striping_unit_write(
+                                   md->fh
+                                  ,md->vars_start
+                                  ,fd->buffer
+                                  ,md->vars_header_size
+                                  );
+                    if (count != md->vars_header_size)
+                    {
+                        fprintf (stderr, "d:MPI method tried to write %llu, "
+                                         "only wrote %d\n"
+                                ,md->vars_header_size
+                                ,count
+                                );
+                    }
+                }
+                fd->offset = 0;
+                fd->bytes_written = 0;
+                adios_shared_buffer_free (&md->b);
+
+                adios_write_open_attributes_v1 (fd);
+                md->vars_start = new_off;
+                md->vars_header_size = fd->offset;
+
+                MPI_File_seek (md->fh, new_off + md->vars_header_size
+                              ,MPI_SEEK_SET
+                              ); // go back to end, but after attr header
+
+                fd->base_offset += fd->offset;  // add size of header
+                fd->offset = 0;
+                fd->bytes_written = 0;
+
+                while (a)
+                {
+                    adios_write_attribute_v1 (fd, a);
+
+                    int bytes_written[new_group_size];
+                    int disp[new_group_size];
+                    int total_size = 0;
+                    void * aggr_buff;
+
+                    MPI_Gather (&fd->bytes_written, 1, MPI_INT
+                               ,bytes_written, 1, MPI_INT
+                               ,0, new_comm
+                               );
+
+                    disp[0] = 0;
+                    for (i = 1; i < new_group_size; i++)
+                    {
+                        disp[i] = disp[i - 1] + bytes_written[i - 1];
+                    }
+                    total_size += disp[new_group_size - 1]
+                                + bytes_written[new_group_size - 1];
+
+                    if (is_aggregator(md->rank))
+                    {
+                        aggr_buff = malloc (total_size);
+                        if (aggr_buff == 0)
+                        {
+                            fprintf (stderr, "Can not alloc aggregation buffer.\n"
+                                             "Need to increase the number of aggregators.\n"
+                                    );
+                            return;
+                        }
+                    }
+
+                    MPI_Gatherv (fd->buffer, fd->bytes_written, MPI_BYTE
+                                ,aggr_buff, bytes_written, disp, MPI_BYTE
+                                ,0, new_comm);
+
+                    if (is_aggregator (md->rank))
+                    {
+                        count = adios_mpi_amr_striping_unit_write(
+                                          md->fh,
+                                          -1,
+                                          aggr_buff, //fd->buffer,
+                                          total_size //fd->bytes_written,
+                                          );
+                        if (count != total_size)
+                        {
+                            fprintf (stderr, "e:MPI method tried to write %llu, "
+                                             "only wrote %llu\n"
+                                     ,fd->bytes_written
+                                     ,count
+                                     );
+                        }
+                    }
+
+                    // Broadcast new offsets to all processors in the communicator.
+                    uint64_t new_offsets[new_group_size];
+
+                    if (is_aggregator (md->rank))
+                    {
+                        new_offsets[0] = a->write_offset;
+                        for (i = 1; i < new_group_size; i++)
+                        {
+                            new_offsets[i] = new_offsets[i - 1] + bytes_written[i - 1];
+                        }
+                    }
+
+                    MPI_Bcast (new_offsets, new_group_size, MPI_LONG_LONG, 0, new_comm);
+                    a->write_offset = new_offsets[new_rank];
+
+                    fd->base_offset += count;
+                    fd->offset = 0;
+                    fd->bytes_written = 0;
+                    adios_shared_buffer_free (&md->b);
+
+                    a = a->next;
+                }
+
+                // set it up so that it will start at 0, but have correct sizes
+                fd->offset = fd->base_offset - md->vars_start;
+                fd->vars_start = 0;
+                fd->buffer_size = 0;
+                adios_write_close_attributes_v1 (fd);
+
+                // fd->vars_start gets updated with the size written
+                if (is_aggregator(md->rank))
+                {
+                    *(uint16_t *)fd->buffer = *(uint16_t *)fd->buffer * new_group_size;
+                    count = adios_mpi_amr_striping_unit_write(
+                                  md->fh,
+                                  md->vars_start,
+                                  fd->buffer,
+                                  md->vars_header_size
+                                  );
+                    if (count != md->vars_header_size)
+                    {
+                        fprintf (stderr, "f:MPI method tried to write %llu, "
+                                         "only wrote %llu\n"
+                                ,md->vars_header_size
+                                ,count
+                                );
+                    }
+                }
+
+                fd->offset = 0;
+                fd->bytes_written = 0;
+
+                MPI_File_seek (md->fh, fd->base_offset, MPI_SEEK_SET);
+            }
+
+            // if not merge PG's on the aggregator side
+            if (fd->shared_buffer == adios_flag_yes && !md->g_merging_pgs)
+            {
+                //printf ("do not merge pg\n");
+                struct adios_bp_buffer_struct_v1 b;
+                struct adios_process_group_header_struct_v1 pg_header;
+                struct adios_vars_header_struct_v1 vars_header;
+                int pg_size, header_size;
+                uint64_t vars_count_offset;
+                MPI_Request request;
+                MPI_Status status;
+
+                pg_size = fd->bytes_written;
+
+                pg_sizes = (int *) malloc (new_group_size * 4);
+                disp = (int *) malloc (new_group_size * 4);
+                if (pg_sizes == 0 || disp == 0)
+                {
+                    fprintf (stderr, "can not malloc\n");
+                    return;
+                }
+
+                MPI_Allgather (&pg_size, 1, MPI_INT
+                              ,pg_sizes, 1, MPI_INT
+                              ,new_comm);
+
+                disp[0] = 0;
+                max_data_size = pg_size;
+
+                for (i = 1; i < new_group_size; i++)
+                {
+                    disp[i] = disp[i - 1] + pg_sizes[i - 1];
+                    max_data_size = (pg_sizes[i] > max_data_size) ? pg_sizes[i] : max_data_size;
+                }
+
+                if (is_aggregator (md->rank))
+                {
+                    if (2 * max_data_size > MAX_AGG_BUF)
+                    {
+                        fprintf (stderr, "Warning: The max allowed aggregation buffer is %llu bytes.\n"
+                                "But this ADIOS method needs extra %llu bytes for aggregation\n"
+                                ,MAX_AGG_BUF, 2 * max_data_size);
+                    }
+
+                    aggr_buff = malloc (max_data_size);
+                    recv_buff = malloc (max_data_size);
+                    if (aggr_buff == 0 || recv_buff == 0)
+                    {
+                        fprintf (stderr, "Can not alloc %d bytes for aggregation buffer.\n"
+                                ,max_data_size);
+                        return;
+                    }
+                }
+                else
+                {
+                    if (max_data_size > MAX_AGG_BUF)
+                    {
+                        fprintf (stderr, "The max allowed aggregation buffer is %llu.\n"
+                                ,MAX_AGG_BUF);
+                    }
+
+                    recv_buff = malloc (max_data_size);
+                    if (recv_buff == 0)
+                    {
+                        fprintf (stderr, "Can not alloc %d bytes for aggregation buffer.\n"
+                                ,max_data_size);
+                        return;
+                    }
+                }
+
+                total_data_size = disp[new_group_size - 1]
+                                + pg_sizes[new_group_size - 1];
+
+                if (is_aggregator (md->rank))
+                {
+                    if (md->g_threading)
+                    {
+                        pthread_join (md->g_sot, NULL);
+                    }
+
+                    index_start1 = 0;
+                    for (i = 0; i < new_group_size; i++)
+                    {
+                        if (i + 1 < new_group_size)
+                        {
+                            MPI_Irecv (recv_buff, pg_sizes[i + 1], MPI_BYTE, new_rank + 1
+                                      ,0, new_comm, &request);
+                        }
+
+                        write_thread_data.fh = &md->fh;
+                        write_thread_data.base_offset = &index_start1;
+                        write_thread_data.aggr_buff = (i == 0) ? fd->buffer : aggr_buff;
+                        write_thread_data.total_data_size = &pg_sizes[i];
+
+                        // This write call is not threaded
+                        adios_mpi_amr_do_write_thread ((void *) &write_thread_data);
+
+                        index_start1 += pg_sizes[i];
+
+                        if (i + 1 < new_group_size)
+                        {
+                            MPI_Wait (&request, &status);
+                            memcpy (aggr_buff, recv_buff, pg_sizes[i + 1]);
+                        }
+                    }
+                }
+                else
+                {
+                    if (new_rank == new_group_size - 1)
+                    {
+                        MPI_Send (fd->buffer, pg_size, MPI_BYTE, new_rank - 1
+                                 ,0, new_comm);
+                    }
+                    else
+                    {
+                        for (i = new_rank + 1; i < new_group_size; i++)
+                        {
+                            // Recv data from upstream rank
+                            MPI_Irecv (recv_buff, pg_sizes[i], MPI_BYTE, new_rank + 1
+                                      ,0, new_comm, &request);
+
+                            if (i == new_rank + 1)
+                                // Send my data to downstream rank
+                                MPI_Send (fd->buffer, pg_size, MPI_BYTE, new_rank - 1
+                                         ,0, new_comm);
+
+                            MPI_Wait (&request, &status);
+                            // Send it to downstream rank
+                            MPI_Send (recv_buff, pg_sizes[i], MPI_BYTE, new_rank - 1
+                                     ,0, new_comm);
+                        }
+                    }
+                }
+
+                FREE (aggr_buff);
+                FREE (recv_buff);
+            }
+
+            // build index appending to any existing index
+            adios_build_index_v1 (fd, &md->old_pg_root, &md->old_vars_root
+                                 ,&md->old_attrs_root
+                                 );
+
+            if (fd->shared_buffer == adios_flag_yes && !md->g_merging_pgs)
+            {
+                if (!is_aggregator(md->rank))
+                {
+                    uint64_t var_offset_to_add = 0, attr_offset_to_add = 0;
+                    uint64_t var_base_offset = 0, attr_base_offset = 0;
+
+                    // change to relative offset
+                    if (md->old_vars_root)
+                    {
+                        var_base_offset = md->old_vars_root->characteristics [0].offset;
+                    }
+
+                    if (md->old_attrs_root)
+                    {
+                        attr_base_offset = md->old_attrs_root->characteristics [0].offset;
+                    }
+
+                    for (i = 0; i < new_rank; i++)
+                    {
+                        attr_offset_to_add += pg_sizes[i];
+                        var_offset_to_add += pg_sizes[i];
+                    }
+
+                    adios_mpi_amr_add_offset (var_offset_to_add
+                                             ,attr_offset_to_add
+                                             ,md->old_vars_root
+                                             ,md->old_attrs_root
+                                             );
+                }
+
+                // pg_sizes, disp are no longer needed from this point on.
+                FREE (pg_sizes);
+                FREE (disp);
+            }
+
+            // if collective, gather the indexes from the rest and call
+            if (md->group_comm != MPI_COMM_NULL)
+            {
+                // Collect index from all MPI processors
+                if (is_aggregator (md->rank))
+                {
+                    int * index_sizes = malloc (4 * new_group_size);
+                    int * index_offsets = malloc (4 * new_group_size);
+                    char * recv_buffer = 0;
+                    uint32_t size = 0, total_size = 0;
+                    int i;
+
+                    MPI_Gather (&size, 1, MPI_INT
+                               ,index_sizes, 1, MPI_INT
+                               ,0, new_comm
+                               );
+
+                    for (i = 0; i < new_group_size; i++)
+                    {
+                        index_offsets [i] = total_size;
+                        total_size += index_sizes [i];
+                    }
+
+                    recv_buffer = malloc (total_size);
+
+                    MPI_Gatherv (&size, 0, MPI_BYTE
+                                ,recv_buffer, index_sizes, index_offsets
+                                ,MPI_BYTE, 0, new_comm
+                                );
+
+                    char * buffer_save = md->b.buff;
+                    uint64_t buffer_size_save = md->b.length;
+                    uint64_t offset_save = md->b.offset;
+
+                    for (i = 1; i < new_group_size; i++)
+                    {
+                        md->b.buff = recv_buffer + index_offsets [i];
+                        md->b.length = index_sizes [i];
+                        md->b.offset = 0;
+
+                        adios_parse_process_group_index_v1 (&md->b
+                                                           ,&new_pg_root
+                                                           );
+                        adios_parse_vars_index_v1 (&md->b, &new_vars_root);
+                        adios_parse_attributes_index_v1 (&md->b
+                                                        ,&new_attrs_root
+                                                        );
+                        if (md->g_merging_pgs)
+                            new_pg_root = 0;
+
+                        adios_merge_index_v1 (&md->old_pg_root
+                                             ,&md->old_vars_root
+                                             ,&md->old_attrs_root
+                                             ,new_pg_root, new_vars_root
+                                             ,new_attrs_root
+                                             );
+                        new_pg_root = 0;
+                        new_vars_root = 0;
+                        new_attrs_root = 0;
+                    }
+
+                    md->b.buff = buffer_save;
+                    md->b.length = buffer_size_save;
+                    md->b.offset = offset_save;
+
+                    free (recv_buffer);
+                    free (index_sizes);
+                    free (index_offsets);
+                }
+                else
+                {
+                    adios_write_index_v1 (&buffer, &buffer_size, &buffer_offset
+                                         ,0, md->old_pg_root
+                                         ,md->old_vars_root
+                                         ,md->old_attrs_root
+                                         );
+
+                    MPI_Gather (&buffer_size, 1, MPI_INT, 0, 0, MPI_INT
+                               ,0, new_comm
+                               );
+                    MPI_Gatherv (buffer, buffer_size, MPI_BYTE
+                                ,0, 0, 0, MPI_BYTE
+                                ,0, new_comm
+                                );
+                }
+            }
+
+            // write out indexes in each subfile
+            if (is_aggregator (md->rank))
+            {
+                uint32_t flag = 0;
+                index_start = total_data_size;
+
+                adios_write_index_v1 (&buffer, &buffer_size
+                                     ,&buffer_offset, index_start
+                                     ,md->old_pg_root
+                                     ,md->old_vars_root
+                                     ,md->old_attrs_root
+                                     );
+
+                adios_write_version_flag_v1 (&buffer, &buffer_size, &buffer_offset, flag);
+
+                if (fd->shared_buffer == adios_flag_yes)
+                {
+                    index_start = -1;
+                    total_data_size1 = buffer_offset;
+
+                    write_thread_data.fh = &md->fh;
+                    write_thread_data.base_offset = &index_start;
+                    write_thread_data.aggr_buff = buffer;
+                    write_thread_data.total_data_size = &total_data_size1;
+
+                    if (md->g_threading)
+                    {
+                        pthread_create (&md->g_swt, NULL
+                                       ,adios_mpi_amr_do_write_thread
+                                       ,(void *) &write_thread_data
+                                       );
+                    }
+                    else
+                    {
+                        adios_mpi_amr_do_write_thread ((void *) &write_thread_data); 
+                    }
+                }
+            }
+
+            // collect index among aggregators
+            if (is_aggregator (md->rank))
+            {
+                if (md->rank == 0)
+                {
+                    int * index_sizes = malloc (4 * new_group_size2);
+                    int * index_offsets = malloc (4 * new_group_size2);
+                    char * recv_buffer = 0;
+                    uint32_t size = 0, total_size = 0;
+
+                    MPI_Gather (&size, 1, MPI_INT
+                               ,index_sizes, 1, MPI_INT
+                               ,0, new_comm2
+                               );
+
+                    for (i = 0; i < new_group_size2; i++)
+                    {
+                        index_offsets [i] = total_size;
+                        total_size += index_sizes [i];
+                    }
+
+                    recv_buffer = malloc (total_size);
+
+                    MPI_Gatherv (&size, 0, MPI_BYTE
+                                ,recv_buffer, index_sizes, index_offsets
+                                ,MPI_BYTE, 0, new_comm2
+                                );
+
+                    char * buffer_save = md->b.buff;
+                    uint64_t buffer_size_save = md->b.length;
+                    uint64_t offset_save = md->b.offset;
+
+                    for (i = 1; i < new_group_size2; i++)
+                    {
+                        md->b.buff = recv_buffer + index_offsets [i];
+                        md->b.length = index_sizes [i];
+                        md->b.offset = 0;
+
+                        adios_parse_process_group_index_v1 (&md->b
+                                                           ,&new_pg_root
+                                                           );
+                        adios_parse_vars_index_v1 (&md->b, &new_vars_root);
+                        adios_parse_attributes_index_v1 (&md->b
+                                                        ,&new_attrs_root
+                                                        );
+
+                        adios_merge_index_v1 (&md->old_pg_root
+                                             ,&md->old_vars_root
+                                             ,&md->old_attrs_root
+                                             ,new_pg_root, new_vars_root
+                                             ,new_attrs_root
+                                             );
+                        new_pg_root = 0;
+                        new_vars_root = 0;
+                        new_attrs_root = 0;
+                    }
+
+                    md->b.buff = buffer_save;
+                    md->b.length = buffer_size_save;
+                    md->b.offset = offset_save;
+
+                    free (recv_buffer);
+                    free (index_sizes);
+                    free (index_offsets);
+                }
+                else
+                {
+                    char * buffer2 = 0;
+                    uint64_t buffer_size2 = 0;
+                    uint64_t buffer_offset2 = 0;
 
-            adios_parse_vars_header_v1 (&md->b, &vars_header);
+                    adios_write_index_v1 (&buffer2, &buffer_size2, &buffer_offset2
+                                         ,0, md->old_pg_root
+                                         ,md->old_vars_root
+                                         ,md->old_attrs_root
+                                         );
 
-            for (i = 0; i < vars_header.count; i++)
-            {
-                memset (&var_payload, 0
-                       ,sizeof (struct adios_var_payload_struct_v1)
-                       );
-                adios_parse_var_data_header_v1 (&md->b, &var_header);
+                    MPI_Gather (&buffer_size2, 1, MPI_INT
+                               ,0, 0, MPI_INT
+                               ,0, new_comm2
+                               );
+                    MPI_Gatherv (buffer2, buffer_size2, MPI_BYTE
+                                ,0, 0, 0, MPI_BYTE
+                                ,0, new_comm2
+                                );
 
-                struct adios_var_struct * v1 = v;
-                while (v1)
-                {
-                    if (   strcasecmp (var_header.name, v1->name)
-                        || strcasecmp (var_header.path, v1->path)
-                       )
-                    {
-                        v1 = v1->next;
-                    }
-                    else
+                    if (buffer2)
                     {
-                        break;
+                        free (buffer2);
+                        buffer2 = 0;
+                        buffer_size2 = 0;
+                        buffer_offset2 = 0;
                     }
                 }
+            }
 
-                if (v1)
+            // write out the metadata file from rank 0
+            if (md->rank == 0)
+            {
+                MPI_File m_file;
+                char * global_index_buffer = 0;
+                uint64_t global_index_buffer_size = 0;
+                uint64_t global_index_buffer_offset = 0;
+                uint64_t global_index_start = 0;
+                uint16_t flag = 0;
+
+                adios_write_index_v1 (&global_index_buffer, &global_index_buffer_size
+                                     ,&global_index_buffer_offset, global_index_start
+                                     ,md->old_pg_root, md->old_vars_root, md->old_attrs_root
+                                     );
+
+                flag |= ADIOS_VERSION_HAVE_SUBFILE;
+
+                adios_write_version_flag_v1 (&global_index_buffer
+                                            ,&global_index_buffer_size
+                                            ,&global_index_buffer_offset
+                                            ,flag
+                                            );
+
+                if (md->g_threading)
                 {
-                    var_payload.payload = v1->data;
-                    adios_parse_var_data_payload_v1 (&md->b, &var_header
-                                                    ,&var_payload
-                                                    ,v1->data_size
-                                                    );
+                    pthread_join (md->g_mot, NULL);
                 }
-                else
+
+                adios_mpi_amr_striping_unit_write(
+                                  md->mfh,
+                                  -1,
+                                  global_index_buffer,
+                                  global_index_buffer_offset
+                                  );
+
+                if (global_index_buffer)
                 {
-                    printf ("MPI read: skipping name: %s path: %s\n"
-                           ,var_header.name, var_header.path
-                           );
-                    adios_parse_var_data_payload_v1 (&md->b, &var_header
-                                                    ,NULL, 0
-                                                    );
+                    free (global_index_buffer);
+                    global_index_buffer = 0;
+                    global_index_buffer_size = 0;
+                    global_index_buffer_offset = 0;
                 }
-
-                adios_clear_var_header_v1 (&var_header);
             }
 
-#if 1
-            adios_parse_attributes_header_v1 (&md->b, &attrs_header);
-
-            for (i = 0; i < attrs_header.count; i++)
+            if (is_aggregator (md->rank))
             {
-                adios_parse_attribute_v1 (&md->b, &attribute);
-                adios_clear_attribute_v1 (&attribute);
-            }
-#endif
-            adios_clear_process_group_header_v1 (&pg_header);
-
-            break;
-        }
+                if (md->g_threading)
+                {
+                    pthread_join (md->g_swt, NULL);
+                }
 
-        default:
-            fprintf (stderr, "MPI read: file version unknown: %u\n"
-                    ,md->b.version
-                    );
-            return;
-    }
+                FREE (aggr_buff);
+            }
 
-    adios_buffer_struct_clear (&md->b);
-}
+            FREE (buffer);
+            buffer_size = 0;
+            buffer_offset = 0;
 
-static
-uint32_t adios_mpi_amr_calculate_attributes_size (struct adios_file_struct * fd)
-{
-    uint32_t overhead = 0;
-    struct adios_attribute_struct * a = fd->group->attributes;
+            adios_clear_index_v1 (new_pg_root, new_vars_root, new_attrs_root);
+            adios_clear_index_v1 (md->old_pg_root, md->old_vars_root
+                                 ,md->old_attrs_root
+                                 );
+            new_pg_root = 0;
+            new_vars_root = 0;
+            new_attrs_root = 0;
+            md->old_pg_root = 0;
+            md->old_vars_root = 0;
+            md->old_attrs_root = 0;
 
-    overhead += 2; // attributes count
-    overhead += 8; // attributes length
+            md->g_num_aggregators = 0;
+            md->g_color1 = 0;
+            md->g_color2 = 0;
 
-    while (a)
-    {
-        overhead += adios_calc_attribute_overhead_v1 (a);
+            FREE (md->subfile_name);
+            FREE (md->g_is_aggregator);
+            FREE (md->g_offsets);
+            FREE (md->open_thread_data);
+        }
 
-        a = a->next;
+        break;
     }
 
-    return overhead;
+    return;
 }
 
-void adios_mpi_amr_close (struct adios_file_struct * fd
-                     ,struct adios_method_struct * method
-                     )
+void adios_mpi_amr_ag_close (struct adios_file_struct * fd
+                            ,struct adios_method_struct * method
+                            )
 {
     struct adios_MPI_data_struct * md = (struct adios_MPI_data_struct *)
                                                  method->method_data;
@@ -1937,18 +2487,15 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
             uint64_t index_start = md->b.pg_index_offset, index_start1;
             int * pg_sizes = 0, * disp = 0, * sendbuf = 0, * recvbuf = 0, * attr_sizes = 0;
             void * aggr_buff = 0;
-            //pthread_t t, t1;
-            //struct adios_MPI_thread_data_open open_thread_data1;
-            //struct adios_MPI_thread_data_open open_thread_data2;
             struct adios_MPI_thread_data_write write_thread_data;
             int i, new_rank, new_group_size, new_rank2, new_group_size2, total_data_size = 0, total_data_size1 = 0;;
             MPI_Comm new_comm, new_comm2;
 
-            MPI_Comm_split (md->group_comm, g_color1, md->rank, &new_comm);
+            MPI_Comm_split (md->group_comm, md->g_color1, md->rank, &new_comm);
             MPI_Comm_rank (new_comm, &new_rank);
             MPI_Comm_size (new_comm, &new_group_size);
 
-            MPI_Comm_split (md->group_comm, g_color2, md->rank, &new_comm2);
+            MPI_Comm_split (md->group_comm, md->g_color2, md->rank, &new_comm2);
             MPI_Comm_rank (new_comm2, &new_rank2);
             MPI_Comm_size (new_comm2, &new_group_size2);
 
@@ -1971,7 +2518,6 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
                                   ,md->vars_start
                                   ,fd->buffer
                                   ,md->vars_header_size
-                                  ,md->block_unit
                                   );
                     if (count != md->vars_header_size)
                     {
@@ -2042,8 +2588,8 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
                                           md->fh,
                                           -1,
                                           aggr_buff, //fd->buffer,
-                                          total_size, //fd->bytes_written,
-                                          md->block_unit);
+                                          total_size //fd->bytes_written,
+                                          );
                         if (count != total_size)
                         {
                             fprintf (stderr, "e:MPI method tried to write %llu, "
@@ -2091,8 +2637,8 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
                                   md->fh,
                                   md->vars_start,
                                   fd->buffer,
-                                  md->vars_header_size,
-                                  md->block_unit);
+                                  md->vars_header_size
+                                  );
                     if (count != md->vars_header_size)
                     {
                         fprintf (stderr, "f:MPI method tried to write %llu, "
@@ -2110,7 +2656,7 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
             }
 
             // if not merge PG's on the aggregator side
-            if (fd->shared_buffer == adios_flag_yes && !g_merging_pgs)
+            if (fd->shared_buffer == adios_flag_yes && !md->g_merging_pgs)
             {
                 //printf ("do not merge pg\n");
                 struct adios_bp_buffer_struct_v1 b;
@@ -2127,36 +2673,7 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
                     fprintf (stderr, "can not malloc\n");
                     return;
                 }
-//moved to adios_group_size
-#if 0
-                if (is_aggregator (md->rank))
-                {
-                    // open subfiles
-                    open_thread_data1.fh = &md->fh;
-                    open_thread_data1.name = md->subfile_name;
-                    open_thread_data1.striping_unit = &md->striping_unit;
-                    open_thread_data1.parameters = method->parameters;
 
-                    pthread_create (&t, NULL
-                                   ,adios_mpi_amr_do_open_thread
-                                   ,(void *) &open_thread_data1
-                                   );
-
-                    // open metadata file
-                    if (md->rank == 0)
-                    {
-                        open_thread_data2.fh = &md->mfh;
-                        open_thread_data2.name = fd->name;
-                        open_thread_data2.striping_unit = &md->striping_unit;
-                        open_thread_data2.parameters = method->parameters;
-
-                        pthread_create (&t1, NULL
-                                       ,adios_mpi_amr_do_open_thread
-                                       ,(void *) &open_thread_data2
-                                       );
-                    }
-                }
-#endif
                 MPI_Allgather (&pg_size, 1, MPI_INT
                               ,pg_sizes, 1, MPI_INT
                               ,new_comm);
@@ -2176,7 +2693,6 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
                         fprintf (stderr, "The max allowed aggregation buffer is %llu.\n"
                                          "Need to increase the number of aggregators.\n"
                                 ,MAX_AGG_BUF);
-                        return;
                     }
                     aggr_buff = malloc (total_data_size);
                     if (aggr_buff == 0)
@@ -2197,9 +2713,9 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
             }
 
             // Merge PG's on the aggregator side
-            if (fd->shared_buffer == adios_flag_yes && g_merging_pgs)
+            if (fd->shared_buffer == adios_flag_yes && md->g_merging_pgs)
             {
-                printf ("do merge pg\n");
+                fprintf (stderr, "Merging pg is not supported yet\n");
                 // Merge PG's on the aggregator side
                 struct adios_bp_buffer_struct_v1 b;
                 struct adios_process_group_header_struct_v1 pg_header;
@@ -2261,34 +2777,6 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
                 sendbuf[0] = pg_size;
                 sendbuf[1] = attr_size + SHIM_FOOTER_SIZE;
 
-//moved to adios_group_size
-#if 0
-                if (is_aggregator (md->rank))
-                {
-                    open_thread_data1.fh = &md->fh;
-                    open_thread_data1.name = md->subfile_name;
-                    open_thread_data1.striping_unit = &md->striping_unit;
-                    open_thread_data1.parameters = method->parameters;
-
-                    pthread_create (&t, NULL
-                                   ,adios_mpi_amr_do_open_thread
-                                   ,(void *) &open_thread_data1
-                                   );
-
-                    if (md->rank == 0)
-                    {
-                        open_thread_data2.fh = &md->mfh;
-                        open_thread_data2.name = fd->name;
-                        open_thread_data2.striping_unit = &md->striping_unit;
-                        open_thread_data2.parameters = method->parameters;
-
-                        pthread_create (&t1, NULL
-                                       ,adios_mpi_amr_do_open_thread
-                                       ,(void *) &open_thread_data2
-                                       );
-                    }
-                }
-#endif
                 MPI_Allgather (sendbuf, 2, MPI_INT
                               ,recvbuf, 2, MPI_INT
                               ,new_comm);
@@ -2421,7 +2909,6 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
                     write_thread_data.base_offset = &fd->base_offset;
                     write_thread_data.aggr_buff = aggr_buff;
                     write_thread_data.total_data_size = &total_data_size;
-                    write_thread_data.block_unit = &md->block_unit;
  
                     pthread_create (&t, NULL
                                    ,adios_mpi_amr_do_write_thread
@@ -2456,7 +2943,7 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
                                  ,&md->old_attrs_root
                                  );
 
-            if (fd->shared_buffer == adios_flag_yes && !g_merging_pgs)
+            if (fd->shared_buffer == adios_flag_yes && !md->g_merging_pgs)
             {
                 if (!is_aggregator(md->rank))
                 {
@@ -2499,7 +2986,7 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
                 free (disp);
             }
 
-            if (fd->shared_buffer == adios_flag_yes && g_merging_pgs)
+            if (fd->shared_buffer == adios_flag_yes && md->g_merging_pgs)
             {
                 if (!is_aggregator(md->rank))
                 {
@@ -2594,7 +3081,7 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
                         adios_parse_attributes_index_v1 (&md->b
                                                         ,&new_attrs_root
                                                         );
-                        if (g_merging_pgs)
+                        if (md->g_merging_pgs)
                             new_pg_root = 0;
 
                         adios_merge_index_v1 (&md->old_pg_root
@@ -2662,11 +3149,14 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
 
                 if (fd->shared_buffer == adios_flag_yes)
                 {
-#if 1
                     aggr_buff = realloc (aggr_buff, total_data_size + buffer_offset);
                     memcpy (aggr_buff + total_data_size, buffer, buffer_offset); 
 
-                    pthread_join (g_t, NULL);
+                    // Waiting for the subfile to open if pthread is enabled
+                    if (md->g_threading)
+                    {
+                        pthread_join (md->g_sot, NULL);
+                    }
 
                     index_start1 = 0;
                     total_data_size1 = total_data_size + buffer_offset;
@@ -2675,21 +3165,19 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
                     write_thread_data.base_offset = &index_start1;
                     write_thread_data.aggr_buff = aggr_buff;
                     write_thread_data.total_data_size = &total_data_size1;
-                    write_thread_data.block_unit = &md->block_unit;
 
-#endif
-
-#if 0
-                    write_thread_data.fh = &md->fh;
-                    write_thread_data.base_offset = &index_start;
-                    write_thread_data.aggr_buff = buffer;
-                    write_thread_data.total_data_size = &buffer_offset;
-                    write_thread_data.block_unit = &md->block_unit;
-#endif
-                    pthread_create (&g_t, NULL
-                                   ,adios_mpi_amr_do_write_thread
-                                   ,(void *) &write_thread_data
-                                   );
+                    // Threading the write so that we can overlap write with index collection.
+                    if (md->g_threading)
+                    {
+                        pthread_create (&md->g_swt, NULL
+                                       ,adios_mpi_amr_do_write_thread
+                                       ,(void *) &write_thread_data
+                                       );
+                    }
+                    else
+                    {
+                        adios_mpi_amr_do_write_thread ((void *) &write_thread_data);
+                    }
                 }
 #if 0
                 adios_mpi_amr_striping_unit_write(
@@ -2833,24 +3321,19 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
                               ,MPI_INFO_NULL, &m_file
                               );
 #endif
-                pthread_join (g_t1, NULL);
-                adios_mpi_amr_striping_unit_write(
-                                  md->mfh,
-                                  -1,
-                                  global_index_buffer,
-                                  global_index_buffer_offset,
-                                  md->block_unit);
+                // Waiting for metadata file to open
+                if (md->g_threading)
+                {
+                    pthread_join (md->g_mot, NULL);
+                }
 
-#if 0
                 adios_mpi_amr_striping_unit_write(
-                                  m_file,
+                                  md->mfh,
                                   -1,
                                   global_index_buffer,
-                                  global_index_buffer_offset,
-                                  md->block_unit);
+                                  global_index_buffer_offset
+                                  );
 
-                MPI_File_close (&m_file);
-#endif
                 if (global_index_buffer)
                 {
                     free (global_index_buffer);
@@ -2862,7 +3345,11 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
 
             if (is_aggregator (md->rank))
             {
-                pthread_join (g_t, NULL);
+                if (md->g_threading)
+                {
+                    pthread_join (md->g_swt, NULL);
+                }
+
                 FREE (aggr_buff);
             }
             FREE (buffer);
@@ -2880,14 +3367,15 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
             md->old_vars_root = 0;
             md->old_attrs_root = 0;
 
-            g_num_aggregators = 0;
-            g_color1 = 0;
-            g_color2 = 0;
+            md->g_num_aggregators = 0;
+            md->g_color1 = 0;
+            md->g_color2 = 0;
 
             FREE (md->subfile_name);
-            FREE (g_is_aggregator);
-            FREE (g_offsets);
-
+            FREE (md->g_is_aggregator);
+            FREE (md->g_ost_skipping_list);
+            FREE (md->g_offsets);
+            FREE (md->open_thread_data);
             break;
         }
 
@@ -2913,8 +3401,8 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
                                   md->fh,
                                   md->vars_start,
                                   fd->buffer,
-                                  md->vars_header_size,
-                                  md->block_unit);
+                                  md->vars_header_size
+                                  );
                 if (count != md->vars_header_size)
                 {
                     fprintf (stderr, "d:MPI method tried to write %llu, "
@@ -2944,8 +3432,8 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
                                   md->fh,
                                   -1,
                                   fd->buffer,
-                                  fd->bytes_written,
-                                  md->block_unit);
+                                  fd->bytes_written
+                                  );
                     if (count != fd->bytes_written)
                     {
                         fprintf (stderr, "e:MPI method tried to write %llu, "
@@ -2972,8 +3460,8 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
                                   md->fh,
                                   md->vars_start,
                                   fd->buffer,
-                                  md->vars_header_size,
-                                  md->block_unit);
+                                  md->vars_header_size
+                                  );
                 if (count != md->vars_header_size)
                 {
                     fprintf (stderr, "f:MPI method tried to write %llu, "
@@ -3080,8 +3568,8 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
                                   md->fh,
                                   fd->base_offset,
                                   fd->buffer,
-                                  fd->bytes_written,
-                                  md->block_unit);
+                                  fd->bytes_written
+                                  );
             }
 
             if (md->rank == 0)
@@ -3104,8 +3592,8 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
                                   md->fh,
                                   md->b.pg_index_offset,
                                   buffer,
-                                  buffer_offset,
-                                  md->block_unit);
+                                  buffer_offset
+                                  );
             }
 
             free (buffer);
@@ -3156,9 +3644,27 @@ void adios_mpi_amr_close (struct adios_file_struct * fd
     md->old_pg_root = 0;
     md->old_vars_root = 0;
     md->old_attrs_root = 0;
-#if COLLECT_METRICS
-    print_metrics (md, iteration++);
-#endif
+}
+
+void adios_mpi_amr_close (struct adios_file_struct * fd
+                     ,struct adios_method_struct * method
+                     )
+{
+    struct adios_MPI_data_struct * md = (struct adios_MPI_data_struct *)
+                                                 method->method_data;
+    if (md->g_io_type == ADIOS_MPI_AMR_IO_AG)
+    {
+        adios_mpi_amr_ag_close (fd, method);
+    }
+    else if (md->g_io_type == ADIOS_MPI_AMR_IO_BG)
+    {
+        adios_mpi_amr_bg_close (fd, method);
+    }
+    else
+    {
+        fprintf (stderr, "unknown I/O type. Only MPI_AMR_AGGREGATION and MPI_AMR_BRIGADE are supported\n");
+        return;
+    }
 }
 
 void adios_mpi_amr_finalize (int mype, struct adios_method_struct * method)
diff --git a/src/adios_mpi_lustre.c b/src/adios_mpi_lustre.c
index 866c9f0..f233fc2 100644
--- a/src/adios_mpi_lustre.c
+++ b/src/adios_mpi_lustre.c
@@ -193,6 +193,9 @@ struct lov_user_md {                 // LOV EA user data (host-endian)
         uint16_t lmm_stripe_offset;  // starting stripe offset in lmm_objects
         struct lov_user_ost_data  lmm_objects[0]; // per-stripe data
 } __attribute__((packed));
+struct obd_uuid {
+        char uuid[40];
+};
 
 static void trim_spaces (char * str)
 {
@@ -211,20 +214,45 @@ static void trim_spaces (char * str)
 }
 
 static void
-adios_mpi_lustre_set_striping_unit(MPI_File fh, char *filename, char *parameters)
+adios_mpi_lustre_set_striping_unit(char *filename, char *parameters, struct adios_MPI_data_struct * md)
 {
+    MPI_File fh = md->fh;
+    int nproc = md->size;
     struct statfs fsbuf;
     int err = 0, flag;
-    uint64_t striping_unit = 0;
+//    uint64_t striping_unit = 0;
     uint64_t block_unit = 0;
     uint16_t striping_count = 0;
     uint16_t stripe_offset = -1;
     char     value[64], *temp_string, *p_count,*p_size;
     MPI_Info info_used;
 
-//#ifndef ADIOS_LUSTRE
-//    return 0;  // disable stripe-size I/O for non-Lustre file system
-//#else
+    int fd, old_mask, perm, num_ost, rc;
+    struct lov_user_md lum;
+    struct obd_uuid uuids[1024], * uuidp;
+
+    old_mask = umask(022);
+    umask(old_mask);
+    perm = old_mask ^ 0666;
+
+    fd =  open(filename, O_RDONLY | O_CREAT | O_LOV_DELAY_CREATE, perm);
+    if (fd == -1)
+        return;
+
+#ifdef HAVE_LUSTRE
+    // To get the number of ost's in the system
+    num_ost = 1024;
+    rc = llapi_lov_get_uuids(fd, uuids, &num_ost);
+    if (rc != 0)
+    {   
+        fprintf (stderr, "get uuids failed: %s\n"
+                       ,strerror(errno)
+                );
+    }
+#else
+    num_ost = 0;
+#endif
+
     temp_string = (char *) malloc (strlen (parameters) + 1);
     strcpy (temp_string, parameters);
     trim_spaces (temp_string);
@@ -238,9 +266,14 @@ adios_mpi_lustre_set_striping_unit(MPI_File fh, char *filename, char *parameters
         else
             striping_count = atoi (p + 1);
     }
-
-    if (striping_count <= 0)
+    else
+    {
+#ifdef HAVE_LUSTRE
+        striping_count = (nproc > num_ost ? -1 : nproc);
+#else
         striping_count = 4;
+#endif
+    }
 
     strcpy (temp_string, parameters);
     trim_spaces (temp_string);
@@ -250,13 +283,15 @@ adios_mpi_lustre_set_striping_unit(MPI_File fh, char *filename, char *parameters
         char * p = strchr (p_size, '=');
         char * q = strtok (p, ",");
         if (!q)
-            striping_unit = atoi(q + 1);
+            md->striping_unit = atoi(q + 1);
         else
-            striping_unit = atoi(p + 1);
+            md->striping_unit = atoi(p + 1);
+    }
+    else
+    {
+        if (md->striping_unit <= 0)
+            md->striping_unit = 1048576;
     }
-
-    if (striping_unit <= 0)
-        striping_unit = 1048576;
 
     strcpy (temp_string, parameters);
     trim_spaces (temp_string);
@@ -270,9 +305,11 @@ adios_mpi_lustre_set_striping_unit(MPI_File fh, char *filename, char *parameters
         else
             stripe_offset = atoi (p + 1);
     }
-
-    if (stripe_offset < -1)
+    else
+    {
+        // let Lustre manage stripe offset
         stripe_offset = -1;
+    }
 
     strcpy (temp_string, parameters);
     trim_spaces (temp_string);
@@ -286,24 +323,19 @@ adios_mpi_lustre_set_striping_unit(MPI_File fh, char *filename, char *parameters
         else
             block_unit = atoi(p + 1);
     }
-
-    if (block_unit <= 0)
-        block_unit = 1048576;
+    else
+    {
+        // set block_unit to 0 to make one large write
+        block_unit = 0;
+    }
 
     free (temp_string);
 
-    int fd, old_mask, perm;
-
-    old_mask = umask(022);
-    umask(old_mask);
-    perm = old_mask ^ 0666;
-
-    fd =  open(filename, O_RDONLY | O_CREAT | O_LOV_DELAY_CREATE, perm);
     if (fd != -1) {
         struct lov_user_md lum;
         lum.lmm_magic = LOV_USER_MAGIC;
         lum.lmm_pattern = 0;
-        lum.lmm_stripe_size = striping_unit;
+        lum.lmm_stripe_size = md->striping_unit;
         lum.lmm_stripe_count = striping_count;
         lum.lmm_stripe_offset = stripe_offset;
         ioctl (fd, LL_IOC_LOV_SETSTRIPE
@@ -311,7 +343,7 @@ adios_mpi_lustre_set_striping_unit(MPI_File fh, char *filename, char *parameters
               );
 
         if (err == 0 && lum.lmm_stripe_size > 0) {
-            striping_unit = lum.lmm_stripe_size;
+            md->striping_unit = lum.lmm_stripe_size;
         }
         close(fd);
     }
@@ -382,6 +414,7 @@ adios_mpi_lustre_get_striping_unit(MPI_File fh, char *filename)
         fd =  open(filename, O_RDONLY, perm);
         if (fd != -1) {
             struct lov_user_md lum;
+            memset (&lum, 0, sizeof(struct lov_user_md));
             lum.lmm_magic = LOV_USER_MAGIC;
             err = ioctl(fd, LL_IOC_LOV_GETSTRIPE, (void *) &lum);
             if (err == 0 && lum.lmm_stripe_size > 0) {
@@ -403,9 +436,10 @@ adios_mpi_lustre_get_striping_unit(MPI_File fh, char *filename)
 static uint64_t
 adios_mpi_lustre_striping_unit_write(MPI_File    fh,
                               MPI_Offset  offset,
-                              void       *buf,
-                              uint64_t   len,
-                              uint64_t   block_unit)
+                              void        *buf,
+                              uint64_t    len,
+                              uint64_t    block_unit 
+                              )
 {
     uint64_t err = -1;
     MPI_Status status;
@@ -442,9 +476,6 @@ printf("adios_mpi_lustre_striping_unit_write offset=%12lld len=%12d\n",offset,wr
         }
     }
     else {
-#ifdef _WKL_CHECK_STRIPE_IO
-printf("adios_mpi_lustre_striping_unit_write offset=%12lld len=%12d\n",offset,len);
-#endif
         uint64_t total_written = 0;
         uint64_t to_write = len;
         int write_len = 0;
@@ -585,6 +616,8 @@ void adios_mpi_lustre_init (const char * parameters
     md->old_attrs_root = 0;
     md->vars_start = 0;
     md->vars_header_size = 0;
+    md->striping_unit = 0;
+    md->block_unit = 0;
 
     adios_buffer_struct_init (&md->b);
 }
@@ -680,6 +713,8 @@ enum ADIOS_FLAG adios_mpi_lustre_should_buffer (struct adios_file_struct * fd
 
     fd->base_offset = 0;
 
+#define LUSTRE_STRIPE_UNIT 65536
+
     switch (fd->mode)
     {
         case adios_mode_read:
@@ -770,7 +805,7 @@ enum ADIOS_FLAG adios_mpi_lustre_should_buffer (struct adios_file_struct * fd
                                   ,fd->group->name, md->old_pg_root
                                   );
                     MPI_Scatter (offsets, 3, MPI_LONG_LONG
-                                ,offsets, 3, MPI_LONG_LONG
+                                ,MPI_IN_PLACE, 3, MPI_LONG_LONG
                                 ,0, md->group_comm
                                 );
                     md->b.read_pg_offset = offsets [0];
@@ -782,7 +817,7 @@ enum ADIOS_FLAG adios_mpi_lustre_should_buffer (struct adios_file_struct * fd
                     MPI_Offset offset [3];
                     offset [0] = offset [1] = offset [2] = 0;
 
-                    MPI_Scatter (offset, 3, MPI_LONG_LONG
+                    MPI_Scatter (0, 0, 0
                                 ,offset, 3, MPI_LONG_LONG
                                 ,0, md->group_comm
                                 );
@@ -848,70 +883,7 @@ enum ADIOS_FLAG adios_mpi_lustre_should_buffer (struct adios_file_struct * fd
 #if COLLECT_METRICS                     
             gettimeofday (&t16, NULL);
 #endif
-            // cascade the opens to avoid trashing the metadata server
-            if (previous == -1)
-            {
-                unlink (name);  // make sure clean
-
-                if (method->parameters)
-                    adios_mpi_lustre_set_striping_unit (md->fh 
-                                                        ,name
-                                                        ,method->parameters);
-                adios_mpi_lustre_set_block_unit (&md->block_unit, method->parameters);
-
-                err = MPI_File_open (MPI_COMM_SELF, name
-                                    ,MPI_MODE_WRONLY | MPI_MODE_CREATE
-                                    ,MPI_INFO_NULL
-                                    ,&md->fh
-                                    );
-
-                md->striping_unit = adios_mpi_lustre_get_striping_unit(md->fh, name);
-
-                if (next != -1)
-                {
-                    MPI_Isend (&flag, 1, MPI_INT, next, current
-                              ,md->group_comm, &md->req
-                              );
-                }
-            }
-            else
-            {
-                MPI_Recv (&flag, 1, MPI_INT, previous, previous
-                         ,md->group_comm, &md->status
-                         );
-                if (next != -1)
-                {
-                    MPI_Isend (&flag, 1, MPI_INT, next, current
-                              ,md->group_comm, &md->req
-                              );
-                }
-
-                adios_mpi_lustre_set_block_unit (&md->block_unit, method->parameters);
-                err = MPI_File_open (MPI_COMM_SELF, name
-                                    ,MPI_MODE_WRONLY
-                                    ,MPI_INFO_NULL
-                                    ,&md->fh
-                                    );
-                md->striping_unit = adios_mpi_lustre_get_striping_unit(md->fh, name);
-            }
 
-            if (err != MPI_SUCCESS)
-            {
-                char e [MPI_MAX_ERROR_STRING];
-                int len = 0;
-                memset (e, 0, MPI_MAX_ERROR_STRING);
-                MPI_Error_string (err, e, &len);
-                fprintf (stderr, "MPI open write failed for %s: '%s'\n"
-                        ,name, e
-                        );
-                free (name);
-
-                return adios_flag_no;
-            }
-
-#if COLLECT_METRICS
-            gettimeofday (&t17, NULL);
-#endif
             if (md->group_comm != MPI_COMM_NULL)
             {
                 if (md->rank == 0)
@@ -920,13 +892,14 @@ enum ADIOS_FLAG adios_mpi_lustre_should_buffer (struct adios_file_struct * fd
                                                    * md->size
                                                   );
 
-                    if (fd->write_size_bytes % md->striping_unit)
-                        offsets [0] =  (fd->write_size_bytes / md->striping_unit + 1)
-                                     * md->striping_unit;
+                    // round up to LUSTRE_STRIPE_UNIT (64KB)
+                    if (fd->write_size_bytes % LUSTRE_STRIPE_UNIT)
+                        offsets [0] =  (fd->write_size_bytes / LUSTRE_STRIPE_UNIT + 1)
+                                     * LUSTRE_STRIPE_UNIT;
                     else
                         offsets [0] = fd->write_size_bytes;
 
-                    MPI_Gather (offsets, 1, MPI_LONG_LONG
+                    MPI_Gather (MPI_IN_PLACE, 1, MPI_LONG_LONG
                                ,offsets, 1, MPI_LONG_LONG
                                ,0, md->group_comm
                                );
@@ -939,10 +912,17 @@ enum ADIOS_FLAG adios_mpi_lustre_should_buffer (struct adios_file_struct * fd
                         offsets [i] = offsets [i - 1] + last_offset;
                         last_offset = this_offset;
                     }
+                    // How to handle that each processor has varying amount of data??
+                    md->striping_unit = offsets[1] - offsets[0];
+                    if (md->striping_unit > 4 * 1024 * 1024 * 1024L)
+                    {
+                        md->striping_unit = 4 * 1024 * 1024 * 1024L;
+                    }
+
                     md->b.pg_index_offset =   offsets [md->size - 1]
                                             + last_offset;
                     MPI_Scatter (offsets, 1, MPI_LONG_LONG
-                                ,offsets, 1, MPI_LONG_LONG
+                                ,MPI_IN_PLACE, 1, MPI_LONG_LONG
                                 ,0, md->group_comm
                                 );
                     fd->base_offset = offsets [0];
@@ -952,18 +932,18 @@ enum ADIOS_FLAG adios_mpi_lustre_should_buffer (struct adios_file_struct * fd
                 else
                 {
                     MPI_Offset offset;
-                    if (fd->write_size_bytes % md->striping_unit)
-                        offset =  (fd->write_size_bytes / md->striping_unit + 1)
-                                  * md->striping_unit;
+                    if (fd->write_size_bytes % LUSTRE_STRIPE_UNIT)
+                        offset =  (fd->write_size_bytes / LUSTRE_STRIPE_UNIT + 1)
+                                  * LUSTRE_STRIPE_UNIT;
                     else
                         offset = fd->write_size_bytes;
 
                     MPI_Gather (&offset, 1, MPI_LONG_LONG
-                               ,&offset, 1, MPI_LONG_LONG
+                               ,0, 0, 0
                                ,0, md->group_comm
                                );
 
-                    MPI_Scatter (&offset, 1, MPI_LONG_LONG
+                    MPI_Scatter (0, 0, 0
                                 ,&offset, 1, MPI_LONG_LONG
                                 ,0, md->group_comm
                                 );
@@ -979,6 +959,68 @@ enum ADIOS_FLAG adios_mpi_lustre_should_buffer (struct adios_file_struct * fd
 #if COLLECT_METRICS
             gettimeofday (&t6, NULL);
 #endif
+            // cascade the opens to avoid trashing the metadata server
+            if (previous == -1)
+            {
+                unlink (name);  // make sure clean
+
+                if (method->parameters)
+                {
+                    adios_mpi_lustre_set_striping_unit (name
+                                                       ,method->parameters
+                                                       ,md);
+                }
+                adios_mpi_lustre_set_block_unit (&md->block_unit, method->parameters);
+
+                err = MPI_File_open (MPI_COMM_SELF, name
+                                    ,MPI_MODE_WRONLY | MPI_MODE_CREATE
+                                    ,MPI_INFO_NULL
+                                    ,&md->fh
+                                    );
+
+                md->striping_unit = adios_mpi_lustre_get_striping_unit(md->fh, name);
+
+                if (next != -1)
+                {
+                    MPI_Isend (&flag, 1, MPI_INT, next, current
+                              ,md->group_comm, &md->req
+                              );
+                }
+            }
+            else
+            {
+                MPI_Recv (&flag, 1, MPI_INT, previous, previous
+                         ,md->group_comm, &md->status
+                         );
+                if (next != -1)
+                {
+                    MPI_Isend (&flag, 1, MPI_INT, next, current
+                              ,md->group_comm, &md->req
+                              );
+                }
+
+                adios_mpi_lustre_set_block_unit (&md->block_unit, method->parameters);
+                err = MPI_File_open (MPI_COMM_SELF, name
+                                    ,MPI_MODE_WRONLY
+                                    ,MPI_INFO_NULL
+                                    ,&md->fh
+                                    );
+                md->striping_unit = adios_mpi_lustre_get_striping_unit(md->fh, name);
+            }
+
+            if (err != MPI_SUCCESS)
+            {
+                char e [MPI_MAX_ERROR_STRING];
+                int len = 0;
+                memset (e, 0, MPI_MAX_ERROR_STRING);
+                MPI_Error_string (err, e, &len);
+                fprintf (stderr, "MPI open write failed for %s: '%s'\n"
+                        ,name, e
+                        );
+                free (name);
+
+                return adios_flag_no;
+            }
 
             break;
         }
@@ -1091,7 +1133,7 @@ enum ADIOS_FLAG adios_mpi_lustre_should_buffer (struct adios_file_struct * fd
                 fd->base_offset = 0;
                 fd->pg_start_in_file = 0;
             }
-
+#if 0
             // cascade the opens to avoid trashing the metadata server
             if (previous == -1)
             {
@@ -1144,7 +1186,7 @@ enum ADIOS_FLAG adios_mpi_lustre_should_buffer (struct adios_file_struct * fd
 
                 return adios_flag_no;
             }
-
+#endif
             if (md->group_comm != MPI_COMM_NULL)
             {
                 if (md->rank == 0)
@@ -1153,13 +1195,13 @@ enum ADIOS_FLAG adios_mpi_lustre_should_buffer (struct adios_file_struct * fd
                                                    * md->size
                                                   );
 
-                    if (fd->write_size_bytes % md->striping_unit)
-                        offsets [0] =  (fd->write_size_bytes / md->striping_unit + 1)
-                                     * md->striping_unit;
+                    if (fd->write_size_bytes % LUSTRE_STRIPE_UNIT)
+                        offsets [0] =  (fd->write_size_bytes / LUSTRE_STRIPE_UNIT + 1)
+                                     * LUSTRE_STRIPE_UNIT;
                     else
                         offsets [0] = fd->write_size_bytes;
 
-                    MPI_Gather (offsets, 1, MPI_LONG_LONG
+                    MPI_Gather (MPI_IN_PLACE, 1, MPI_LONG_LONG
                                ,offsets, 1, MPI_LONG_LONG
                                ,0, md->group_comm
                                );
@@ -1175,7 +1217,7 @@ enum ADIOS_FLAG adios_mpi_lustre_should_buffer (struct adios_file_struct * fd
                     md->b.pg_index_offset =   offsets [md->size - 1]
                                             + last_offset;
                     MPI_Scatter (offsets, 1, MPI_LONG_LONG
-                                ,offsets, 1, MPI_LONG_LONG
+                                ,MPI_IN_PLACE, 1, MPI_LONG_LONG
                                 ,0, md->group_comm
                                 );
                     fd->base_offset = offsets [0];
@@ -1185,19 +1227,19 @@ enum ADIOS_FLAG adios_mpi_lustre_should_buffer (struct adios_file_struct * fd
                 else
                 {
                     MPI_Offset offset;
-                    if (fd->write_size_bytes % md->striping_unit)
-                        offset =  (fd->write_size_bytes / md->striping_unit + 1)
-                                     * md->striping_unit;
+                    if (fd->write_size_bytes % LUSTRE_STRIPE_UNIT)
+                        offset =  (fd->write_size_bytes / LUSTRE_STRIPE_UNIT + 1)
+                                     * LUSTRE_STRIPE_UNIT;
                     else
                         offset = fd->write_size_bytes;
 
 
                     MPI_Gather (&offset, 1, MPI_LONG_LONG
-                               ,&offset, 1, MPI_LONG_LONG
+                               ,0, 0, 0
                                ,0, md->group_comm
                                );
 
-                    MPI_Scatter (&offset, 1, MPI_LONG_LONG
+                    MPI_Scatter (0, 0, 0
                                 ,&offset, 1, MPI_LONG_LONG
                                 ,0, md->group_comm
                                 );
@@ -1210,6 +1252,59 @@ enum ADIOS_FLAG adios_mpi_lustre_should_buffer (struct adios_file_struct * fd
                 md->b.pg_index_offset = fd->write_size_bytes;
             }
 
+            // cascade the opens to avoid trashing the metadata server
+            if (previous == -1)
+            {   
+                // we know it exists, because we created it if it didn't
+                // when reading the old file so can just open wronly
+                // but adding the create for consistency with write mode
+                // so it is easier to merge write/append later
+                err = MPI_File_open (MPI_COMM_SELF, name
+                                    ,MPI_MODE_WRONLY | MPI_MODE_CREATE
+                                    ,MPI_INFO_NULL
+                                    ,&md->fh
+                                    );
+                md->striping_unit = adios_mpi_lustre_get_striping_unit(md->fh, name);
+                if (next != -1)
+                {   
+                    MPI_Isend (&flag, 1, MPI_INT, next, current
+                              ,md->group_comm, &md->req
+                              );
+                }
+            }
+            else
+            {   
+                MPI_Recv (&flag, 1, MPI_INT, previous, previous
+                         ,md->group_comm, &md->status
+                         );
+                if (next != -1)
+                {   
+                    MPI_Isend (&flag, 1, MPI_INT, next, current
+                              ,md->group_comm, &md->req
+                              );
+                }
+                err = MPI_File_open (MPI_COMM_SELF, name
+                                    ,MPI_MODE_WRONLY
+                                    ,MPI_INFO_NULL
+                                    ,&md->fh
+                                    );
+                md->striping_unit = adios_mpi_lustre_get_striping_unit(md->fh, name);
+            }
+
+            if (err != MPI_SUCCESS)
+            {
+                char e [MPI_MAX_ERROR_STRING];
+                int len = 0;
+                memset (e, 0, MPI_MAX_ERROR_STRING);
+                MPI_Error_string (err, e, &len);
+                fprintf (stderr, "MPI open write failed for %s: '%s'\n"
+                        ,name, e
+                        );
+                free (name);
+
+                return adios_flag_no;
+            }
+
             break;
         }
 
diff --git a/src/adios_nc4.c b/src/adios_nc4.c
index ec248e2..4c16652 100644
--- a/src/adios_nc4.c
+++ b/src/adios_nc4.c
@@ -930,7 +930,7 @@ static int write_header(
 
     getNC4TypeId(pvar->type, &nc4_type_id, fortran_flag);
     if(nc4_type_id <= 0) {
-        fprintf(stderr, "NC4 ERROR in getH5TypeId in write_var\n");
+        fprintf(stderr, "NC4 ERROR in getH5TypeId in write_header\n");
         return_code=-2;
         goto escape;
     }
@@ -946,20 +946,20 @@ static int write_header(
                 sprintf(str_var_dimname, "%s_dim", fullname);
                 Func_Timer("defdim", rc = nc_def_dim(ncid, str_var_dimname, strlen((char *)pvar->data)+1, &str_var_dimid););
                 if (rc != NC_NOERR) {
-                    fprintf(stderr, "NC4 ERROR defining string variable(%s) dim in write_var, rc=%d\n", fullname, rc);
+                    fprintf(stderr, "NC4 ERROR defining string variable(%s) dim in write_header, rc=%d\n", fullname, rc);
                     return_code=-2;
                     goto escape;
                 }
                 Func_Timer("defvar", rc = nc_def_var(ncid, fullname, nc4_type_id, 1, &str_var_dimid, &nc4_varid););
                 if (rc != NC_NOERR) {
-                    fprintf(stderr, "NC4 ERROR defining string variable(%s) in write_var, rc=%d\n", fullname, rc);
+                    fprintf(stderr, "NC4 ERROR defining string variable(%s) in write_header, rc=%d\n", fullname, rc);
                     return_code=-2;
                     goto escape;
                 }
             } else {
                 Func_Timer("defvar", rc = nc_def_var(ncid, fullname, nc4_type_id, 0, NULL, &nc4_varid););
                 if (rc != NC_NOERR) {
-                    fprintf(stderr, "NC4 ERROR defining scalar variable(%s) in write_var, rc=%d\n", fullname, rc);
+                    fprintf(stderr, "NC4 ERROR defining scalar variable(%s) in write_header, rc=%d\n", fullname, rc);
                     return_code=-2;
                     goto escape;
                 }
@@ -985,7 +985,7 @@ static int write_header(
     if (rc == NC_ENOTVAR) {
         var_exists=adios_flag_no;
     } else if (rc != NC_NOERR) {
-        fprintf(stderr, "NC4 ERROR checking existence of variable(%s) in write_var, rc=%d\n", fullname, rc);
+        fprintf(stderr, "NC4 ERROR checking existence of variable(%s) in write_header, rc=%d\n", fullname, rc);
         return_code=-2;
         goto escape;
     }
@@ -1002,12 +1002,12 @@ static int write_header(
                 if (rc == NC_EBADDIM) {
                     Func_Timer("defdim", rc = nc_def_dim(ncid, deciphered_dims.nc4_local_dimnames[i], deciphered_dims.nc4_localdims[i], &deciphered_dims.nc4_local_dimids[i]););
                     if (rc != NC_NOERR) {
-                        fprintf(stderr, "NC4 ERROR defining array dimension(%s) in write_var, rc=%d\n", deciphered_dims.nc4_local_dimnames[i], rc);
+                        fprintf(stderr, "NC4 ERROR defining array dimension(%s) in write_header, rc=%d\n", deciphered_dims.nc4_local_dimnames[i], rc);
                         return_code=-2;
                         goto escape;
                     }
                 } else if (rc != NC_NOERR) {
-                    fprintf(stderr, "NC4 ERROR inquiring about dimension(%s) for array variable(%s) in write_var, rc=%d\n", deciphered_dims.nc4_local_dimnames[i], fullname, rc);
+                    fprintf(stderr, "NC4 ERROR inquiring about dimension(%s) for array variable(%s) in write_header, rc=%d\n", deciphered_dims.nc4_local_dimnames[i], fullname, rc);
                     return_code=-2;
                     goto escape;
                 }
@@ -1017,12 +1017,12 @@ static int write_header(
                 if (rc == NC_EBADDIM) {
                     Func_Timer("defdim", rc = nc_def_dim(ncid, deciphered_dims.nc4_global_dimnames[i], deciphered_dims.nc4_globaldims[i], &deciphered_dims.nc4_global_dimids[i]););
                     if (rc != NC_NOERR) {
-                        fprintf(stderr, "NC4 ERROR defining array dimension(%s) in write_var, rc=%d\n", deciphered_dims.nc4_global_dimnames[i], rc);
+                        fprintf(stderr, "NC4 ERROR defining array dimension(%s) in write_header, rc=%d\n", deciphered_dims.nc4_global_dimnames[i], rc);
                         return_code=-2;
                         goto escape;
                     }
                 } else if (rc != NC_NOERR) {
-                    fprintf(stderr, "NC4 ERROR inquiring about dimension(%s) for array variable(%s) in write_var, rc=%d\n", deciphered_dims.nc4_global_dimnames[i], fullname, rc);
+                    fprintf(stderr, "NC4 ERROR inquiring about dimension(%s) for array variable(%s) in write_header, rc=%d\n", deciphered_dims.nc4_global_dimnames[i], fullname, rc);
                     return_code=-2;
                     goto escape;
                 }
@@ -1030,21 +1030,21 @@ static int write_header(
             if (deciphered_dims.has_globaldims == adios_flag_yes) {
                 Func_Timer("defvar", rc = nc_def_var(ncid, fullname, nc4_type_id, deciphered_dims.global_dim_count, deciphered_dims.nc4_global_dimids, &nc4_varid););
                 if (rc != NC_NOERR) {
-                    fprintf(stderr, "NC4 ERROR defining array variable(%s) with global dims in write_var, rc=%d\n", fullname, rc);
+                    fprintf(stderr, "NC4 ERROR defining array variable(%s) with global dims in write_header, rc=%d\n", fullname, rc);
                     return_code=-2;
                     goto escape;
                 }
             } else {
                 Func_Timer("defvar", rc = nc_def_var(ncid, fullname, nc4_type_id, deciphered_dims.local_dim_count, deciphered_dims.nc4_local_dimids, &nc4_varid););
                 if (rc != NC_NOERR) {
-                    fprintf(stderr, "NC4 ERROR defining array variable(%s) with local dims in write_var, rc=%d\n", fullname, rc);
+                    fprintf(stderr, "NC4 ERROR defining array variable(%s) with local dims in write_header, rc=%d\n", fullname, rc);
                     return_code=-2;
                     goto escape;
                 }
             }
         }
 
-        if (DEBUG>3) printf("got varid(%d) for grp_id(%d).variable(%s) in write_attribute, rc=%d\n", nc4_varid, ncid, fullname, rc);
+        if (DEBUG>3) printf("got varid(%d) for grp_id(%d).variable(%s) in write_header, rc=%d\n", nc4_varid, ncid, fullname, rc);
         if (DEBUG>3) printf("sizeof(size_t)==%d\n", sizeof(size_t));
 
         /* end writing array with fixed dimensions */
@@ -1066,12 +1066,12 @@ static int write_header(
                     if (DEBUG>3) printf("def dim name=%s, size=%d\n", deciphered_dims.nc4_global_dimnames[i], deciphered_dims.nc4_globaldims[i]);
                     Func_Timer("defdim", rc = nc_def_dim(ncid, deciphered_dims.nc4_global_dimnames[i], deciphered_dims.nc4_globaldims[i], &deciphered_dims.nc4_global_dimids[i]););
                     if (rc != NC_NOERR) {
-                        fprintf(stderr, "NC4 ERROR defining array dimension(%s) in write_var, rc=%d\n", deciphered_dims.nc4_global_dimnames[i], rc);
+                        fprintf(stderr, "NC4 ERROR defining array dimension(%s) in write_header, rc=%d\n", deciphered_dims.nc4_global_dimnames[i], rc);
                         return_code=-2;
                         goto escape;
                     }
                 } else if (rc != NC_NOERR) {
-                    fprintf(stderr, "NC4 ERROR inquiring about dimension(%s) for array variable(%s) in write_var, rc=%d\n", deciphered_dims.nc4_global_dimnames[i], fullname, rc);
+                    fprintf(stderr, "NC4 ERROR inquiring about dimension(%s) for array variable(%s) in write_header, rc=%d\n", deciphered_dims.nc4_global_dimnames[i], fullname, rc);
                     return_code=-2;
                     goto escape;
                 }
@@ -1083,12 +1083,12 @@ static int write_header(
                     if (DEBUG>3) printf("def dim name=%s, size=%d\n", deciphered_dims.nc4_local_dimnames[i], deciphered_dims.nc4_localdims[i]);
                     Func_Timer("defdim", rc = nc_def_dim(ncid, deciphered_dims.nc4_local_dimnames[i], deciphered_dims.nc4_localdims[i], &deciphered_dims.nc4_local_dimids[i]););
                     if (rc != NC_NOERR) {
-                        fprintf(stderr, "NC4 ERROR defining array dimension(%s) in write_var, rc=%d\n", deciphered_dims.nc4_global_dimnames[i], rc);
+                        fprintf(stderr, "NC4 ERROR defining array dimension(%s) in write_header, rc=%d\n", deciphered_dims.nc4_global_dimnames[i], rc);
                         return_code=-2;
                         goto escape;
                     }
                 } else if (rc != NC_NOERR) {
-                    fprintf(stderr, "NC4 ERROR inquiring about dimension(%s) for array variable(%s) in write_var, rc=%d\n", deciphered_dims.nc4_global_dimnames[i], fullname, rc);
+                    fprintf(stderr, "NC4 ERROR inquiring about dimension(%s) for array variable(%s) in write_header, rc=%d\n", deciphered_dims.nc4_global_dimnames[i], fullname, rc);
                     return_code=-2;
                     goto escape;
                 }
@@ -1096,7 +1096,7 @@ static int write_header(
 
             Func_Timer("defvar", rc = nc_def_var(ncid, fullname, nc4_type_id, deciphered_dims.local_dim_count, deciphered_dims.nc4_global_dimids, &nc4_varid););
             if (rc != NC_NOERR) {
-                fprintf(stderr, "NC4 ERROR defining array variable(%s) in write_var, rc=%d\n", fullname, rc);
+                fprintf(stderr, "NC4 ERROR defining array variable(%s) in write_header, rc=%d\n", fullname, rc);
                 return_code=-2;
                 goto escape;
             }
@@ -1225,7 +1225,7 @@ static int write_var(
             goto escape;
         }
 
-        if (DEBUG>3) printf("got varid(%d) for grp_id(%d).variable(%s) in write_attribute, rc=%d\n", nc4_varid, ncid, fullname, rc);
+        if (DEBUG>3) printf("got varid(%d) for grp_id(%d).variable(%s) in write_var, rc=%d\n", nc4_varid, ncid, fullname, rc);
         if (DEBUG>3) printf("sizeof(size_t)==%d\n", sizeof(size_t));
 
 //		Func_Timer("putvars", rc = nc_put_vars(ncid, nc4_varid, deciphered_dims.nc4_offsets, deciphered_dims.nc4_localdims, deciphered_dims.nc4_strides, pvar->data););
diff --git a/src/adios_nssi.c b/src/adios_nssi.c
index 24713b7..1231a1f 100644
--- a/src/adios_nssi.c
+++ b/src/adios_nssi.c
@@ -63,6 +63,7 @@ struct adios_nssi_method_data_struct
 {
     nssi_request start_calc_req;
     int          has_outstanding_req;
+    int          default_svc_index;  /* service to use when there is no open file (eg. finalize) */
 };
 
 /* Need a struct to encapsulate var offset info.
@@ -115,6 +116,7 @@ static List open_file_list;
 ///////////////////////////
 static int adios_nssi_initialized = 0;
 
+static char *job_id=NULL;
 static int global_rank=-1;
 static int global_size=-1;
 static nssi_service *svcs;
@@ -562,7 +564,7 @@ static void create_offset_list_for_var(
     }
 }
 
-static int gen_dim_list(
+static int gen_ldim_list(
         struct adios_group_struct *group,
         struct adios_var_struct *pvar_root,
         struct adios_attribute_struct *patt_root)
@@ -600,7 +602,7 @@ static int gen_dim_list(
     }
 }
 
-static void create_dim_list_for_var(
+static void create_ldim_list_for_var(
         struct adios_var_struct *v,
         struct adios_group_struct *group,
         struct adios_var_struct *pvar_root,
@@ -662,6 +664,68 @@ static void create_dim_list_for_var(
     }
 }
 
+static void create_gdim_list_for_var(
+        struct adios_var_struct *v,
+        struct adios_group_struct *group,
+        struct adios_var_struct *pvar_root,
+        struct adios_attribute_struct *patt_root,
+        u_int *dim_count,
+        struct adios_var **dim_values)
+{
+    struct adios_dimension_struct *dims;
+    char dim_name[255];
+
+    *dim_count=0;
+    *dim_values=NULL;
+
+    if ((v) && (v->dimensions)) {
+        int global_dim_count=0;
+        dims=v->dimensions;
+        while (dims) {
+            if (dims->dimension.time_index == adios_flag_yes) {
+                dims = dims->next;
+                continue;
+            }
+            parse_dimension_name(group, pvar_root, patt_root, &dims->global_dimension, dim_name);
+            global_dim_count++;
+            dims = dims->next;
+        }
+
+        *dim_count=global_dim_count;
+        *dim_values=calloc(global_dim_count, sizeof(struct adios_var));
+
+        dims=v->dimensions;
+        int dim_idx=0;
+        while (dims) {
+            if (dims->dimension.time_index == adios_flag_yes) {
+                dims = dims->next;
+                continue;
+            }
+            parse_dimension_name(group, pvar_root, patt_root, &dims->global_dimension, dim_name);
+            if (dim_name[0] == '\0') {
+                sprintf(dim_name, "%s_%s_dim_%d", /*v->path*/"", v->name, dim_idx);
+                (*dim_values)[dim_idx].is_anonymous=TRUE;
+            }
+            (*dim_values)[dim_idx].vpath=strdup(v->path);
+            (*dim_values)[dim_idx].vname=strdup(dim_name);
+//            struct var_dim *vd=var_dim_find("", dim_name);
+//            memcpy(&(args->dims.dims_val[dim_idx].vdata), vd->dvalue, vd->dsize);
+//            args->dims.dims_val[dim_idx].vdatasize=vd->dsize;
+            uint64_t value=0;
+            parse_dimension_size(group, pvar_root, patt_root, &dims->global_dimension, &value);
+            memcpy(&((*dim_values)[dim_idx].vdata), &value, 4);
+            (*dim_values)[dim_idx].vdatasize=4;
+            if (DEBUG>3) printf("create: dim_name(%s) dvalue(%lu)\n", dim_name, value);
+            if (global_rank==0) {
+                if (DEBUG>3) printf(":o(%d)", value);
+            }
+
+            dim_idx++;
+            dims = dims->next;
+        }
+    }
+}
+
 static int read_var(
         struct adios_nssi_file_data_struct *file_data,
         struct adios_group_struct *group,
@@ -675,7 +739,8 @@ static int read_var(
     adios_read_args args;
     adios_read_res  res;
 
-    memset(&args, 0, sizeof(adios_read_args));
+    memset(&args, 0, sizeof(args));
+    memset(&res, 0, sizeof(res));
     args.fd    = file_data->fd;
     args.max_read = pvar->data_size;
     args.vpath = strdup(pvar->path);
@@ -690,8 +755,10 @@ static int read_var(
 
     args.offsets.offsets_len=0;
     args.offsets.offsets_val=NULL;
-    args.dims.dims_len=0;
-    args.dims.dims_val=NULL;
+    args.ldims.ldims_len=0;
+    args.ldims.ldims_val=NULL;
+    args.gdims.gdims_len=0;
+    args.gdims.gdims_val=NULL;
     if (pvar->dimensions) {
         create_offset_list_for_var(
                  pvar,
@@ -700,13 +767,20 @@ static int read_var(
                  group->attributes,
                  &args.offsets.offsets_len,
                  &args.offsets.offsets_val);
-        create_dim_list_for_var(
+        create_ldim_list_for_var(
+                 pvar,
+                 group,
+                 group->vars,
+                 group->attributes,
+                 &args.ldims.ldims_len,
+                 &args.ldims.ldims_val);
+        create_gdim_list_for_var(
                  pvar,
                  group,
                  group->vars,
                  group->attributes,
-                 &args.dims.dims_len,
-                 &args.dims.dims_val);
+                 &args.gdims.gdims_len,
+                 &args.gdims.gdims_val);
      }
 
     Func_Timer("ADIOS_READ_OP",
@@ -729,11 +803,16 @@ static int read_var(
             free(args.offsets.offsets_val[i].vname);
         }
         free(args.offsets.offsets_val);
-        for (i=0;i<args.dims.dims_len;i++) {
-            free(args.dims.dims_val[i].vpath);
-            free(args.dims.dims_val[i].vname);
+        for (i=0;i<args.ldims.ldims_len;i++) {
+            free(args.ldims.ldims_val[i].vpath);
+            free(args.ldims.ldims_val[i].vname);
+        }
+        free(args.ldims.ldims_val);
+        for (i=0;i<args.gdims.gdims_len;i++) {
+            free(args.gdims.gdims_val[i].vpath);
+            free(args.gdims.gdims_val[i].vname);
         }
-        free(args.dims.dims_val);
+        free(args.gdims.gdims_val);
     }
 
     return return_code;
@@ -756,7 +835,8 @@ static int write_var(
 
 //    var_offset_printall();
 
-    memset(&args, 0, sizeof(adios_write_args));
+    memset(&args, 0, sizeof(args));
+    memset(&res, 0, sizeof(res));
     args.fd    = file_data->fd;
     args.vpath = strdup(pvar->path);
     args.vname = strdup(pvar->name);
@@ -770,8 +850,10 @@ static int write_var(
     args.writer_rank=file_data->rank;
     args.offsets.offsets_len=0;
     args.offsets.offsets_val=NULL;
-    args.dims.dims_len=0;
-    args.dims.dims_val=NULL;
+    args.ldims.ldims_len=0;
+    args.ldims.ldims_val=NULL;
+    args.gdims.gdims_len=0;
+    args.gdims.gdims_val=NULL;
     if (pvar->dimensions) {
         create_offset_list_for_var(
                  pvar,
@@ -780,13 +862,20 @@ static int write_var(
                  group->attributes,
                  &args.offsets.offsets_len,
                  &args.offsets.offsets_val);
-        create_dim_list_for_var(
+        create_ldim_list_for_var(
+                 pvar,
+                 group,
+                 group->vars,
+                 group->attributes,
+                 &args.ldims.ldims_len,
+                 &args.ldims.ldims_val);
+        create_gdim_list_for_var(
                  pvar,
                  group,
                  group->vars,
                  group->attributes,
-                 &args.dims.dims_len,
-                 &args.dims.dims_val);
+                 &args.gdims.gdims_len,
+                 &args.gdims.gdims_val);
      }
 
     Func_Timer("ADIOS_WRITE_OP",
@@ -814,11 +903,16 @@ static int write_var(
             free(args.offsets.offsets_val[i].vname);
         }
         free(args.offsets.offsets_val);
-        for (i=0;i<args.dims.dims_len;i++) {
-            free(args.dims.dims_val[i].vpath);
-            free(args.dims.dims_val[i].vname);
+        for (i=0;i<args.ldims.ldims_len;i++) {
+            free(args.ldims.ldims_val[i].vpath);
+            free(args.ldims.ldims_val[i].vname);
         }
-        free(args.dims.dims_val);
+        free(args.ldims.ldims_val);
+        for (i=0;i<args.gdims.gdims_len;i++) {
+            free(args.gdims.gdims_val[i].vpath);
+            free(args.gdims.gdims_val[i].vname);
+        }
+        free(args.gdims.gdims_val);
     }
 
     return return_code;
@@ -889,6 +983,7 @@ void adios_nssi_init(
     NSSI_REGISTER_CLIENT_STUB(ADIOS_START_CALC_OP, adios_start_calc_args, void, void);
     NSSI_REGISTER_CLIENT_STUB(ADIOS_STOP_CALC_OP, adios_stop_calc_args, void, void);
     NSSI_REGISTER_CLIENT_STUB(ADIOS_CLOSE_OP, adios_close_args, void, void);
+    NSSI_REGISTER_CLIENT_STUB(ADIOS_FINALIZE_OP, adios_finalize_args, void, void);
 
     list_init(&open_file_list, open_file_free);
     list_init(&var_offset_list, var_offset_free);
@@ -896,6 +991,7 @@ void adios_nssi_init(
 
     private = malloc(sizeof(struct adios_nssi_method_data_struct));
     private->has_outstanding_req=FALSE;
+    private->default_svc_index=-1;
     method->method_data = private;
 
     parse_nssi_config(getenv("ADIOS_NSSI_CONFIG_FILE"), &nssi_cfg);
@@ -919,13 +1015,14 @@ enum ADIOS_FLAG adios_nssi_should_buffer(
 
     of=open_file_find(method->base_path, f->name);
     if (of == NULL) {
-        fprintf(stderr, "file is not open.  FAIL.");
+        fprintf(stderr, "file is not open.  FAIL.\n");
         return adios_flag_no;
     }
     file_data=of->file_data;
 
     if (DEBUG>3) printf("rank(%d) enter adios_nssi_should_buffer (write_size_bytes=%lu)\n", global_rank, f->write_size_bytes);
 
+    memset(&args, 0, sizeof(args));
     args.fd = file_data->fd;
     MPI_Reduce(
             &f->write_size_bytes,
@@ -971,6 +1068,7 @@ int adios_nssi_open(
 
     struct open_file *of=NULL;
     struct adios_nssi_file_data_struct *file_data=NULL;
+    struct adios_nssi_method_data_struct *private=(struct adios_nssi_method_data_struct *)method->method_data;
 
     if (DEBUG>3) printf("rank(%d) enter adios_nssi_open\n", global_rank);
 
@@ -980,7 +1078,7 @@ int adios_nssi_open(
         file_data->fd         = -1;
         file_data->group_comm = MPI_COMM_NULL;
         file_data->size       = 0;
-        file_data->rank       = -1;
+        file_data->rank       = 0;
 
         file_data->comm = NULL;
 
@@ -1036,6 +1134,9 @@ int adios_nssi_open(
             file_data->svc_index = file_data->rank/(file_data->size/nssi_cfg.num_servers);
         }
     }
+    if (private->default_svc_index == -1) {
+        private->default_svc_index=file_data->svc_index;
+    }
 
     /* create a new communicator for just those clients, who share a default service. */
     if (DEBUG>3) printf("global_rank(%d): adios_nssi_open: before MPI_Comm_split\n", global_rank);
@@ -1067,16 +1168,67 @@ int adios_nssi_open(
     }
 
 
+    if (job_id==NULL) {
+        if (file_data->rank==0) {
+            job_id = getenv("PBS_JOBID");
+            if (job_id == NULL) {
+                fprintf(stderr, "adios_nssi_open: unable to determine job id.  defaulting id to \"UNKNOWN_JOB_ID\".\n");
+                job_id = strdup("UNKNOWN_JOB_ID");
+            } else {
+                int len=strlen(job_id)+36+1;
+                job_id=calloc(len,1);
+
+                struct uuid_st;
+                extern int uuid_create   (      struct uuid_st **_uuid);
+                extern int uuid_destroy  (      struct uuid_st  *_uuid);
+                extern int uuid_make     (      struct uuid_st  *_uuid, unsigned int _mode, ...);
+                extern int uuid_export   (const struct uuid_st  *_uuid, unsigned int _fmt,       void **_data_ptr, size_t *_data_len);
+
+                struct uuid_st *uuid;
+                char *uuid_str=NULL;
+                uuid_create(&uuid);
+                uuid_make(uuid, 1);
+                uuid_export(uuid, 1, &uuid_str, NULL);
+                uuid_destroy(uuid);
+
+                sprintf(job_id, "%s.%s", getenv("PBS_JOBID"), uuid_str);
+
+                free(uuid_str);
+
+                MPI_Bcast (job_id, len, MPI_BYTE, 0, file_data->group_comm);
+            }
+        } else {
+            job_id = getenv("PBS_JOBID");
+            if (job_id == NULL) {
+                fprintf(stderr, "adios_nssi_open: unable to determine job id.  defaulting id to \"UNKNOWN_JOB_ID\".\n");
+                job_id = strdup("UNKNOWN_JOB_ID");
+            } else {
+                int len=strlen(job_id)+36+1;
+                job_id=calloc(len,1);
+
+                MPI_Bcast (job_id, len, MPI_BYTE, 0, file_data->group_comm);
+            }
+        }
+    }
+
+    fprintf(stderr, "adios_nssi_open: job_id=%s\n", job_id);
+
+
+
+
     gen_offset_list(
             f->group,
             f->group->vars,
             f->group->attributes);
-    gen_dim_list(
+    gen_ldim_list(
             f->group,
             f->group->vars,
             f->group->attributes);
     var_offset_printall();
 
+    memset(&args, 0, sizeof(args));
+    memset(&res, 0, sizeof(res));
+    args.client_id = strdup(job_id);
     args.fname = malloc(sizeof(char) * (strlen(method->base_path) + strlen(f->name) + 1));
     sprintf(args.fname, "%s%s", method->base_path, f->name);
     args.gname = strdup(method->group->name);
@@ -1143,6 +1295,7 @@ void adios_nssi_start_calculation(
 
         if (of->has_outstanding_req == FALSE) {
             if (file_data->collective_op_rank == 0) {
+                memset(&args, 0, sizeof(args));
                 args.fd = file_data->fd;
                 Func_Timer("ADIOS_START_CALC_OP",
                         rc = nssi_call_rpc(&svcs[file_data->svc_index],
@@ -1268,6 +1421,7 @@ void adios_nssi_stop_calculation(
         myrank=file_data->rank;
 
         if (file_data->collective_op_rank == 0) {
+            memset(&args, 0, sizeof(args));
             args.fd = file_data->fd;
             Func_Timer("ADIOS_STOP_CALC_OP",
                     rc = nssi_call_rpc_sync(&svcs[file_data->svc_index],
@@ -1408,7 +1562,6 @@ void adios_nssi_close(
     struct adios_attribute_struct * a = f->group->attributes;
     int myrank;
 
-    adios_start_calc_args start_calc_args;
     adios_close_args close_args;
 
     struct open_file *of=NULL;
@@ -1448,23 +1601,10 @@ void adios_nssi_close(
         }
     }
 
-//    if (file_data->collective_op_rank == 0) {
-//        start_calc_args.fd = file_data->fd;
-//        Func_Timer("ADIOS_START_CALC_OP",
-//                rc = nssi_call_rpc_sync(&svcs[file_data->svc_index],
-//                ADIOS_START_CALC_OP,
-//                &start_calc_args,
-//                NULL,
-//                0,
-//                NULL););
-//        if (rc != NSSI_OK) {
-//            //log_error(adios_nssi_debug_level, "unable to call remote adios_read");
-//        }
-//    }
-
 //    // make sure all clients have finsihed I/O before closing
 //    MPI_Barrier(file_data->group_comm);
     if (file_data->collective_op_rank == 0) {
+        memset(&close_args, 0, sizeof(close_args));
         close_args.fname = malloc(sizeof(char) * (strlen(method->base_path) + strlen(f->name) + 1));
         sprintf(close_args.fname, "%s%s", method->base_path, f->name);
         close_args.fd = file_data->fd;
@@ -1500,62 +1640,31 @@ void adios_nssi_finalize(
 {
     int rc=NSSI_OK;
     int myrank;
+    adios_finalize_args finalize_args;
+    struct adios_nssi_method_data_struct *private=(struct adios_nssi_method_data_struct *)method->method_data;
 
     if (DEBUG>3) printf("rank(%d) enter adios_nssi_finalize\n", global_rank);
 
-//    adios_close_args close_args;
-//
-//    ListElmt *of_elmt;
-////    ListElmt *req_elmt;
-//    struct open_file *of=NULL;
-//    struct adios_nssi_file_data_struct *file_data=NULL;
-////    nssi_request *req;
-//
-//    of_elmt = list_head(&open_file_list);
-//    while(of_elmt) {
-//        of = list_data(of_elmt);
-//        if (of == NULL) {
-//            fprintf(stderr, "file is not open.  FAIL.");
-//            return;
-//        }
-//        file_data=of->file_data;
-//        myrank=file_data->rank;
-//
-////        req_elmt = list_head(&(of->outstanding_reqs));
-////        while(req_elmt) {
-////        	req = list_data(req_elmt);
-////        	if (req == NULL) {
-////        		fprintf(stderr, "file is not open.  FAIL.");
-////        		return;
-////        	}
-////
-////        	req_elmt = list_next(req_elmt);
-////        }
-//
-//        if (file_data->collective_op_rank == 0) {
-//            close_args.fname = malloc(sizeof(char) * (strlen(of->fpath) + strlen(of->fname) + 1));
-//            sprintf(close_args.fname, "%s%s", of->fpath, of->fname);
-//            close_args.fd = file_data->fd;
-//            Func_Timer("ADIOS_CLOSE_OP",
-//                    rc = nssi_call_rpc_sync(&svcs[file_data->svc_index],
-//                    ADIOS_CLOSE_OP,
-//                    &close_args,
-//                    NULL,
-//                    0,
-//                    NULL););
-//            if (rc != NSSI_OK) {
-//                //log_error(adios_nssi_debug_level, "unable to call remote adios_read");
-//            }
-//            free(close_args.fname);
-//        }
-//
-//        file_data->group_comm = MPI_COMM_NULL;
-//        file_data->fd = -1;
-//        file_data->rank = -1;
-//        file_data->size = 0;
-//
-//        of_elmt = list_next(of_elmt);
-//    }
+    if (global_rank == 0) {
+        if (job_id==NULL) {
+            if (DEBUG>2) fprintf(stderr, "adios_nssi_finalize - adios_nssi_open was never called.  skipping finalize.\n");
+        } else {
+            memset(&finalize_args, 0, sizeof(finalize_args));
+            finalize_args.client_id = strdup(job_id);
+            if (DEBUG>3) printf("rank(%d) sending ADIOS_FINALIZE_OP\n", myrank);
+            Func_Timer("ADIOS_FINALIZE_OP",
+                    rc = nssi_call_rpc_sync(&svcs[private->default_svc_index],
+                            ADIOS_FINALIZE_OP,
+                            &finalize_args,
+                            NULL,
+                            0,
+                            NULL););
+            if (rc != NSSI_OK) {
+                fprintf(stderr, "NSSI ERROR: ADIOS_FINALIZE_OP failed\n");
+            }
+            free(finalize_args.client_id);
+        }
+    }
 
     free_nssi_config(&nssi_cfg);
 
diff --git a/src/adios_nssi_args.x b/src/adios_nssi_args.x
index d7241ed..2aa5116 100644
--- a/src/adios_nssi_args.x
+++ b/src/adios_nssi_args.x
@@ -31,7 +31,13 @@ enum adios_opcode {
     ADIOS_END_ITER_OP,
     ADIOS_START_CALC_OP,
     ADIOS_STOP_CALC_OP,
-    ADIOS_CLOSE_OP
+    ADIOS_CLOSE_OP,
+    ADIOS_FINALIZE_OP,
+
+    ADIOS_READ_FOPEN_OP,
+    ADIOS_READ_FCLOSE_OP,
+    ADIOS_READ_GET_VARTYPE_SIZE_OP,
+    ADIOS_READ_READ_VAR_OP
 };
 
 
@@ -64,6 +70,7 @@ const ADIOS_DIM_MAX = 16;
  * Argument structure for adios_open
  */
 struct adios_open_args {
+    string          client_id<ADIOS_PATH_MAX>;
     string          gname<ADIOS_PATH_MAX>;
     string          fname<ADIOS_PATH_MAX>;
     adios_open_mode mode;
@@ -103,7 +110,8 @@ struct adios_read_args {
     uint64_t max_read;
     uint16_t is_scalar;
     struct adios_var offsets<ADIOS_DIM_MAX>;
-    struct adios_var dims<ADIOS_DIM_MAX>;
+    struct adios_var ldims<ADIOS_DIM_MAX>;
+    struct adios_var gdims<ADIOS_DIM_MAX>;
 };
 
 /**
@@ -125,7 +133,8 @@ struct adios_write_args {
     uint16_t is_scalar;
     int64_t  writer_rank;
     struct adios_var offsets<ADIOS_DIM_MAX>;
-    struct adios_var dims<ADIOS_DIM_MAX>;
+    struct adios_var ldims<ADIOS_DIM_MAX>;
+    struct adios_var gdims<ADIOS_DIM_MAX>;
 };
 
 /**
@@ -163,3 +172,79 @@ struct adios_close_args {
     string  fname<ADIOS_PATH_MAX>;
     int64_t fd;
 };
+
+/**
+ * Marshalled arguments for adios_finalize
+ */
+struct adios_finalize_args {
+    string client_id<ADIOS_PATH_MAX>;
+};
+
+
+/**
+ * Argument structure for adios_read_fopen
+ */
+struct adios_read_fopen_args {
+    string client_id<ADIOS_PATH_MAX>;
+    string gname<ADIOS_PATH_MAX>;
+    string fname<ADIOS_PATH_MAX>;
+    uint64_t requested_timestep;
+};
+
+/**
+ * Structure for adios_read_fopen result
+ */
+struct adios_read_fopen_res {
+    int64_t fd;
+};
+
+/**
+ * Marshaled arguments for adios_read
+ */
+struct adios_read_read_var_args {
+    int64_t  fd;
+    string   client_id<ADIOS_PATH_MAX>;
+    uint64_t open_timestep;
+    string   vpath<ADIOS_PATH_MAX>;
+    string   vname<ADIOS_PATH_MAX>;
+    uint64_t max_read;
+    uint16_t is_scalar;
+
+    uint64_t offsets[3];
+    uint64_t counts[3];
+};
+
+/**
+ * Marshaled arguments for adios_read result
+ */
+struct adios_read_read_var_res {
+    uint64_t bytes_read;
+};
+
+/**
+ * Marshaled arguments for adios_read
+ */
+struct adios_read_get_vartype_size_args {
+    int64_t  fd;
+    string   client_id<ADIOS_PATH_MAX>;
+    uint64_t open_timestep;
+    string   vpath<ADIOS_PATH_MAX>;
+    string   vname<ADIOS_PATH_MAX>;
+};
+
+/**
+ * Marshaled arguments for adios_read result
+ */
+struct adios_read_get_vartype_size_res {
+    uint64_t vartype_size;
+};
+
+/**
+ * Marshalled arguments for adios_fclose
+ */
+struct adios_read_fclose_args {
+    int64_t  fd;
+    uint64_t open_timestep;
+    string   client_id<ADIOS_PATH_MAX>;
+    string   fname<ADIOS_PATH_MAX>;
+};
diff --git a/src/adios_posix.c b/src/adios_posix.c
index 8df9081..57e7d3e 100644
--- a/src/adios_posix.c
+++ b/src/adios_posix.c
@@ -17,10 +17,6 @@
 // see if we have MPI or other tools
 #include "config.h"
 
-// mpi
-#if HAVE_MPI
-#include "mpi.h"
-#endif
 
 // xml parser
 #include <mxml.h>
@@ -259,7 +255,7 @@ int adios_posix_open (struct adios_file_struct * fd
         mdfile_name = 0;
     }
 
-    fd->subfile_name = strdup (subfile_name);
+    fd->subfile_index = p->rank;
 
     struct stat s;
     if (stat (subfile_name, &s) == 0)
@@ -1112,7 +1108,9 @@ void adios_posix_close (struct adios_file_struct * fd
                 }
                 else
                 {
-                    MPI_Gather (&buffer_size, 1, MPI_INT
+					// Added this explicit cast to avoid truncation of low-order bytes on BGP
+					int i_buffer_size = (int) buffer_size;
+                    MPI_Gather (&i_buffer_size, 1, MPI_INT
                                ,0, 0, MPI_INT
                                ,0, p->group_comm
                                );
diff --git a/src/adios_posix1.c b/src/adios_posix1.c
index 574c59a..316290c 100644
--- a/src/adios_posix1.c
+++ b/src/adios_posix1.c
@@ -17,11 +17,6 @@
 // see if we have MPI or other tools
 #include "config.h"
 
-// mpi
-#if HAVE_MPI
-#include "mpi.h"
-#endif
-
 // xml parser
 #include <mxml.h>
 
@@ -86,7 +81,11 @@ int adios_posix1_open (struct adios_file_struct * fd
     {
         case adios_mode_read:
         {
-            p->b.f = open (name, O_RDONLY | O_LARGEFILE);
+            p->b.f = open (name, O_RDONLY
+#ifndef __APPLE__
+| O_LARGEFILE
+#endif
+);
             if (p->b.f == -1)
             {
                 fprintf (stderr, "ADIOS POSIX1: file not found: %s\n", fd->name);
@@ -103,7 +102,10 @@ int adios_posix1_open (struct adios_file_struct * fd
 
         case adios_mode_write:
         {
-            p->b.f = open (name, O_WRONLY | O_CREAT | O_TRUNC | O_LARGEFILE
+            p->b.f = open (name, O_WRONLY | O_CREAT | O_TRUNC
+#ifndef __APPLE__
+| O_LARGEFILE
+#endif
                             ,  S_IRUSR | S_IWUSR
                              | S_IRGRP | S_IWGRP
                              | S_IROTH | S_IWOTH
@@ -128,11 +130,18 @@ int adios_posix1_open (struct adios_file_struct * fd
         case adios_mode_append:
         {
             int old_file = 1;
-            p->b.f = open (name, O_RDWR | O_LARGEFILE);
+            p->b.f = open (name, O_RDWR
+#ifndef __APPLE__
+| O_LARGEFILE
+#endif
+);
             if (p->b.f == -1)
             {
                 old_file = 0;
-                p->b.f = open (name,  O_WRONLY | O_CREAT | O_LARGEFILE
+                p->b.f = open (name,  O_WRONLY | O_CREAT
+#ifndef __APPLE__
+| O_LARGEFILE
+#endif
                                 ,  S_IRUSR | S_IWUSR
                                  | S_IRGRP | S_IWGRP
                                  | S_IROTH | S_IWOTH
diff --git a/src/adios_read.c b/src/adios_read.c
index 71c6b96..4b6ebb9 100644
--- a/src/adios_read.c
+++ b/src/adios_read.c
@@ -102,6 +102,16 @@ int64_t adios_read_var (ADIOS_GROUP * gp, const char * varname,
     return common_read_read_var (gp, varname, start, count, data);
 }
 
+int64_t adios_read_local_var (ADIOS_GROUP    * gp,
+                              const char     * varname,
+                              int            idx,
+                              const uint64_t * start,
+                              const uint64_t * count,
+                              void           * data)
+{
+    return common_read_read_local_var (gp, varname, idx, start, count, data);
+}
+
 int64_t adios_read_var_byid (ADIOS_GROUP    * gp,
                              int              varid,
                              const uint64_t  * start,
diff --git a/src/adios_read.h b/src/adios_read.h
index 20ad78b..83e87bf 100644
--- a/src/adios_read.h
+++ b/src/adios_read.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * ADIOS is freely available under the terms of the BSD license described
  * in the COPYING file in the top level directory of this source distribution.
  *
@@ -6,7 +6,7 @@
  */
 
 /*
- *   Read C API for ADIOS BP format files 
+ *   Read C API for ADIOS BP format files
  */
 #ifndef __ADIOS_READ_H__
 #define __ADIOS_READ_H__
@@ -49,6 +49,10 @@ typedef struct {
         int      attrs_count;       /* Number of attributes in this adios group                */
         char     ** attr_namelist;  /* Attribute names in a char* array                        */
         ADIOS_FILE * fp;            /* pointer to the parent ADIOS_FILE struct                 */
+        /* streaming API: */
+        int      timestep;          /* The current (only) timestep */
+        int      lasttimestep;      /* The currently available latest timestep in the stream   */
+
 } ADIOS_GROUP;
 
 /* NCSU - Added more statistics to be returned to the end user */
@@ -59,6 +63,7 @@ typedef struct {
         int        ndim;            /* number of dimensions, 0 for scalars                            */
         uint64_t * dims;            /* size of each dimension                                         */
         int        timedim;         /* -1: variable has no timesteps in file, >=0: which dimension is time     */
+        int        characteristics_count; /* number of characteristic                                 */
         void     * value;           /* value of a scalar variable, NULL for array.                    */
         void     * gmin;            /* minimum value in an array variable, = value for a scalar       */
         void     * gmax;            /* maximum value of an array variable (over all timesteps)        */
@@ -68,32 +73,35 @@ typedef struct {
         void     ** maxs;           /* maximum per each timestep (array of timestep elements)         */
         double   ** avgs;           /* average per each timestep (array of timestep elements)         */
         double   ** std_devs;       /* standard deviation per each timestep (array of timestep elements)         */
-		struct ADIOS_HIST			/* Histogram */
-		{
-			uint32_t num_breaks;
-			double max;
-			double min;
-			double *breaks;
-			uint32_t **frequenciess;
-			uint32_t *gfrequencies;
-		} *hist;
+        struct ADIOS_HIST			/* Histogram */
+        {
+            uint32_t num_breaks;
+            double max;
+            double min;
+            double *breaks;
+            uint32_t **frequenciess;
+            uint32_t *gfrequencies;
+        } *hist;
 } ADIOS_VARINFO;
 
 /* The list of the available read methods */
 enum ADIOS_READ_METHOD {
-         ADIOS_READ_METHOD_BP     = 0    /* Read from ADIOS BP file (written by POSIX, MPI etc methods) */
-        ,ADIOS_READ_METHOD_HDF5   = 1    /* Read from HDF5 file (written by PHDF5 method)               */
-        ,ADIOS_READ_METHOD_DART   = 2    /* Read from memory written by DART method                     */
-        ,ADIOS_READ_METHOD_DIMES  = 3    /* Read from memory written by DIMES method                    */
+         ADIOS_READ_METHOD_BP         = 0    /* Read from ADIOS BP file (written by POSIX, MPI etc methods) */
+        ,ADIOS_READ_METHOD_BP_STAGED  = 1    /* Read from ADIOS BP file (written by POSIX, MPI_AMR etc methods) */
+        ,ADIOS_READ_METHOD_HDF5       = 2    /* Read from HDF5 file (written by PHDF5 method)               */
+        ,ADIOS_READ_METHOD_DART       = 3    /* Read from memory written by DART method                     */
+        ,ADIOS_READ_METHOD_DIMES      = 4    /* Read from memory written by DIMES method                    */
+        ,ADIOS_READ_METHOD_NSSI       = 5    /* Read from memory written by NSSI method                     */
+        ,ADIOS_READ_METHOD_DATATAP    = 6    /* Read from memory written by DATATAP method                  */
 };
 
 #ifndef __INCLUDED_FROM_FORTRAN_API__
 
 /** Functions that return a pointer to some data structures (fopen, gopen), return NULL
-    on error and set adios_errno to a non-zero value and writes an error string.  
-    You have direct access to that string so you can print it. 
-    Do not write anything into it, please. 
-    Only the last error message is always available. 
+    on error and set adios_errno to a non-zero value and writes an error string.
+    You have direct access to that string so you can print it.
+    Do not write anything into it, please.
+    Only the last error message is always available.
 */
 extern int adios_errno;
 const char *adios_errmsg();
@@ -105,11 +113,23 @@ const char *adios_errmsg();
  */
 int adios_set_read_method (enum ADIOS_READ_METHOD method);
 
+/** Set the application's ID for adios_read_init()
+ *  when using a staging method (DART, DIMES, NSSI or DATATAP).
+ *  The ID should be unique for each application accessing the staging area
+ *  IN:  id   a number unique for this application
+ *  RETURN:       0 if accepted, <0 on error
+ *  It is optional to use it before calling adios_init. Default is 1. 
+ *  It has no effect for file based methods.
+ *  Note: this function is defined both in adios.h and adios_read.h so that
+ *  writing-only and reading-only applications can both use it.
+ */
+int adios_set_application_id (int id);
+
 /** Initialize and finalize the read method.
  *  This is needed for the DART method only and only if multiple fopen()...fclose() cycles
- *  are used. In such a case, init/finalize will perform the connection/disconnection to 
- *  the DART server once. 
- *  For other methods, these functions do nothing. 
+ *  are used. In such a case, init/finalize will perform the connection/disconnection to
+ *  the DART server once.
+ *  For other methods, these functions do nothing.
  */
 int adios_read_init(MPI_Comm comm);
 int adios_read_finalize();
@@ -117,14 +137,14 @@ int adios_read_finalize();
 /** Open an adios file.
  *  IN:  fname    pathname of file to be opened
  *       comm     the MPI communicator of all processes that want to read data from the file
- *                 if compile with -D_NOMPI, pass any integer here. 
+ *                 if compile with -D_NOMPI, pass any integer here.
  *  RETURN:       pointer to an ADIOS_FILE struct, NULL on error (sets adios_errno)
  */
 ADIOS_FILE * adios_fopen (const char * fname, MPI_Comm comm);
 
 /** Close an adios file.
  *  It will free the content of the underlying data structures and the fp pointer itself.
- *  IN:   fp       pointer to an ADIOS_FILE struct 
+ *  IN:   fp       pointer to an ADIOS_FILE struct
  *  RETURN: 0 OK, !=0 on error (also sets adios_errno)
  */
 int adios_fclose (ADIOS_FILE *fp);
@@ -135,21 +155,21 @@ int adios_fclose (ADIOS_FILE *fp);
 void adios_reset_dimension_order (ADIOS_FILE *fp, int is_fortran);
 
 
-/** Open an adios group. Usually there is one adios group in a file, 
- *  but there can be more than one. 
+/** Open an adios group. Usually there is one adios group in a file,
+ *  but there can be more than one.
  *  IN:  fp       pointer to an (opened) ADIOS_FILE struct
  *       grpname  name of the group
  *  RETURN:       pointer to an ADIOS_GROUP struct, NULL on error (sets adios_errno)
  */
 ADIOS_GROUP * adios_gopen (ADIOS_FILE *fp, const char * grpname);
 
-/** Open a group by index 
+/** Open a group by index
  *       grpid    index of group (0..fp->groups_count-1)
  *                in fp->group_namelist of ADIOS_FILE struct
  */
 ADIOS_GROUP * adios_gopen_byid (ADIOS_FILE *fp, int grpid);
 
-/** Close an adios group. 
+/** Close an adios group.
  *  To free the data structures allocated at gopen, you need to call this function
  *  IN:  gp       pointer to an (opened) ADIOS_GROUP struct
  *  RETURN: 0 OK, !=0 on error (also sets adios_errno)
@@ -160,7 +180,7 @@ int adios_gclose (ADIOS_GROUP *gp);
 /** Inquiry about one variable in a group.
  *  This function does not read anything from the file but processes info
  *  already in memory after fopen and gopen.
- *  It allocates memory for the ADIOS_VARINFO struct and content, so 
+ *  It allocates memory for the ADIOS_VARINFO struct and content, so
  *  you need to free resources later with adios_free_varinfo().
  *
  *  IN:  gp       pointer to an (opened) ADIOS_GROUP struct
@@ -182,7 +202,7 @@ ADIOS_VARINFO * adios_inq_var_byid (ADIOS_GROUP *gp, int varid);
 void adios_free_varinfo (ADIOS_VARINFO *cp);
 
 /** Read a variable (slice) from the file.
- *  You need to allocate the memory for the data. 
+ *  You need to allocate the memory for the data.
  *  IN:  gp        pointer to an (opened) ADIOS_GROUP struct
  *       varname   name of the variable
  *       start     array of offsets to start reading in each dimension
@@ -190,31 +210,51 @@ void adios_free_varinfo (ADIOS_VARINFO *cp);
  *  OUT: data      data of the variable
  *  RETURN: the number of bytes read, <0 on error, sets adios_errno too
  */
-int64_t adios_read_var (ADIOS_GROUP    * gp, 
-                        const char     * varname, 
+int64_t adios_read_var (ADIOS_GROUP    * gp,
+                        const char     * varname,
                         const uint64_t * start,
-                        const uint64_t * count, 
+                        const uint64_t * count,
                         void           * data);
 
-/** Read a variable by index 
+/** Read a local variable from the file. This function is for reading BP only.
+ *  To read a global variable, you should use adios_read_var() instead.
+ *  You need to allocate memory for the data.
+ *  IN:  gp        pointer to an (opened) ADIOS_GROUP struct
+ *       varname   name of the variable
+ *       idx       which local variable to read in. For example, if variable NX
+                   is dumped out by every processor, this idx denotes which copy of NX
+                   you want to read in. The NX dumped out by rank 0 will have idx 0.
+ *       start     array of offsets to start reading in each dimension
+ *       count     number of data elements to read in each dimension
+ *  OUT: data      data of the variable
+ *  RETURN: the number of bytes read, <0 on error, sets adios_errno too
+ */
+int64_t adios_read_local_var (ADIOS_GROUP    * gp,
+                              const char     * varname,
+                              int            idx,
+                              const uint64_t * start,
+                              const uint64_t * count,
+                              void           * data);
+
+/** Read a variable by index
  *       varid    index of variable (0..gp->vars_count-1)
  *                in gp->vars_namelist of ADIOS_GROUP struct
  */
 int64_t adios_read_var_byid (ADIOS_GROUP * gp, int varid,
-                             const uint64_t * start, const uint64_t * count, 
+                             const uint64_t * start, const uint64_t * count,
                              void * data);
 
 /** Get an attribute in a group.
  *  This function does not read anything from the file but processes info
  *  already in memory after fopen and gopen.
  *  The memory for the data is allocated within the library.
- *  You can use free() to free the memory after use. 
+ *  You can use free() to free the memory after use.
  *
  *  IN:  gp       pointer to an (opened) ADIOS_GROUP struct
  *       attrname name of the attribute
  *  OUT: type     adios type of attribute (see enum ADIOS_DATATYPES in adios_types.h)
  *       size     memory size of value (n+1 for a string of n characters)
- *       data     pointer to the value. You need to cast it afterward according to the type. 
+ *       data     pointer to the value. You need to cast it afterward according to the type.
  *  RETURN: 0 OK, error: set and return adios_errno
  */
 int adios_get_attr (ADIOS_GROUP           * gp,
@@ -223,12 +263,12 @@ int adios_get_attr (ADIOS_GROUP           * gp,
                     int                   * size,
                     void                 ** data);
 
-/** Convenience function to get an attribute by name 
+/** Convenience function to get an attribute by name
  *       attrid   index of attribute (0..gp->attrs_count-1)
  *                in gp->attr_namelist of ADIOS_GROUP struct
  */
-int adios_get_attr_byid (ADIOS_GROUP * gp, int attrid, enum ADIOS_DATATYPES * type, 
-                         int * size, void ** data); 
+int adios_get_attr_byid (ADIOS_GROUP * gp, int attrid, enum ADIOS_DATATYPES * type,
+                         int * size, void ** data);
 
 /** Return the name of an adios type */
 const char * adios_type_to_string (enum ADIOS_DATATYPES type);
@@ -237,7 +277,7 @@ const char * adios_type_to_string (enum ADIOS_DATATYPES type);
  *  If the type is adios_string, and the second argument is
  *  the string itself, it returns strlen(data)+1.
  *  For other types, it does not care about data and returns
- *  the size occupied by one element. 
+ *  the size occupied by one element.
  */
 int adios_type_size(enum ADIOS_DATATYPES type, void *data);
 
diff --git a/src/adios_read_hooks.c b/src/adios_read_hooks.c
index 30c98ce..9f434a5 100644
--- a/src/adios_read_hooks.c
+++ b/src/adios_read_hooks.c
@@ -1,4 +1,4 @@
-/* 
+/*
  * ADIOS is freely available under the terms of the BSD license described
  * in the COPYING file in the top level directory of this source distribution.
  *
@@ -25,9 +25,10 @@ if (!strcasecmp (buf,b)) \
 (*t) [b].adios_inq_var_fn = adios_read_##a##_inq_var; \
 (*t) [b].adios_inq_var_byid_fn = adios_read_##a##_inq_var_byid; \
 (*t) [b].adios_read_var_fn = adios_read_##a##_read_var; \
+(*t) [b].adios_read_local_var_fn = adios_read_##a##_read_local_var; \
 (*t) [b].adios_read_var_byid_fn = adios_read_##a##_read_var_byid; \
 (*t) [b].adios_get_attr_fn = adios_read_##a##_get_attr; \
-(*t) [b].adios_get_attr_byid_fn = adios_read_##a##_get_attr_byid; 
+(*t) [b].adios_get_attr_byid_fn = adios_read_##a##_get_attr_byid;
 
 void adios_read_hooks_init (struct adios_read_hooks_struct ** t)
 {
@@ -39,7 +40,9 @@ void adios_read_hooks_init (struct adios_read_hooks_struct ** t)
                calloc (ADIOS_READ_METHOD_COUNT, sizeof (struct adios_read_hooks_struct));
 
         ASSIGN_FNS(bp,ADIOS_READ_METHOD_BP)
-
+#ifndef __MPI_DUMMY_H__
+        ASSIGN_FNS(bp_staged,ADIOS_READ_METHOD_BP_STAGED)
+#endif
 #if HAVE_DART
         ASSIGN_FNS(dart,ADIOS_READ_METHOD_DART)
 #endif
@@ -52,6 +55,14 @@ void adios_read_hooks_init (struct adios_read_hooks_struct ** t)
         //ASSIGN_FNS(hdf5,ADIOS_READ_METHOD_HDF5)
 #endif
 
+#if HAVE_NSSI
+        ASSIGN_FNS(nssi,ADIOS_READ_METHOD_NSSI)
+#endif
+
+#if HAVE_DATATAP
+        ASSIGN_FNS(datatap,ADIOS_READ_METHOD_DATATAP)
+#endif
+
         //printf("%s: adios_read_hooks = %x\n",__func__,*t);
         did_init = 1;
     }
diff --git a/src/adios_read_hooks.h b/src/adios_read_hooks.h
index 86910a4..640855b 100644
--- a/src/adios_read_hooks.h
+++ b/src/adios_read_hooks.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * ADIOS is freely available under the terms of the BSD license described
  * in the COPYING file in the top level directory of this source distribution.
  *
@@ -25,6 +25,7 @@ int adios_read_##a##_gclose (ADIOS_GROUP *gp); \
 ADIOS_VARINFO * adios_read_##a##_inq_var (ADIOS_GROUP *gp, const char * varname); \
 ADIOS_VARINFO * adios_read_##a##_inq_var_byid (ADIOS_GROUP *gp, int varid); \
 int64_t adios_read_##a##_read_var (ADIOS_GROUP * gp, const char * varname, const uint64_t * start, const uint64_t * count, void * data); \
+int64_t adios_read_##a##_read_local_var (ADIOS_GROUP * gp, const char * varname, int idx, const uint64_t * start, const uint64_t * count, void * data); \
 int64_t adios_read_##a##_read_var_byid (ADIOS_GROUP * gp, int varid, const uint64_t * start, const uint64_t * count, void * data); \
 int adios_read_##a##_get_attr (ADIOS_GROUP * gp, const char * attrname, enum ADIOS_DATATYPES * type, int * size, void ** data); \
 int adios_read_##a##_get_attr_byid (ADIOS_GROUP * gp, int attrid, enum ADIOS_DATATYPES * type, int * size, void ** data); \
@@ -39,10 +40,11 @@ void adios_read_##a##_reset_dimension_order (ADIOS_FILE *fp, int is_fortran); \
 //////////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////////
 
-#define ADIOS_READ_METHOD_COUNT 4
+#define ADIOS_READ_METHOD_COUNT 7
 
 // forward declare the functions (or dummies for internals use)
 FORWARD_DECLARE(bp)
+FORWARD_DECLARE(bp_staged)
 FORWARD_DECLARE(hdf5)
 #if HAVE_DART
 FORWARD_DECLARE(dart)
@@ -50,25 +52,32 @@ FORWARD_DECLARE(dart)
 #if HAVE_DIMES
 FORWARD_DECLARE(dimes)
 #endif
+#if HAVE_NSSI
+FORWARD_DECLARE(nssi)
+#endif
+#if HAVE_NSSI
+FORWARD_DECLARE(datatap)
+#endif
 
 
-typedef int (* ADIOS_INIT_FN) (MPI_Comm comm); 
-typedef int (* ADIOS_FINALIZE_FN) (); 
-typedef ADIOS_FILE * (* ADIOS_FOPEN_FN) (const char * fname, MPI_Comm comm); 
-typedef int (* ADIOS_FCLOSE_FN) (ADIOS_FILE *fp); 
-typedef ADIOS_GROUP * (* ADIOS_GOPEN_FN) (ADIOS_FILE *fp, const char * grpname); 
-typedef ADIOS_GROUP * (* ADIOS_GOPEN_BYID_FN) (ADIOS_FILE *fp, int grpid); 
-typedef int (* ADIOS_GCLOSE_FN) (ADIOS_GROUP *gp); 
-typedef ADIOS_VARINFO * (* ADIOS_INQ_VAR_FN) (ADIOS_GROUP *gp, const char * varname); 
-typedef ADIOS_VARINFO * (* ADIOS_INQ_VAR_BYID_FN) (ADIOS_GROUP *gp, int varid); 
-typedef int64_t (* ADIOS_READ_VAR_FN) (ADIOS_GROUP * gp, const char * varname, const uint64_t * start, const uint64_t * count, void * data); 
-typedef int64_t (* ADIOS_READ_VAR_BYID_FN) (ADIOS_GROUP * gp, int varid, const uint64_t * start, const uint64_t * count, void * data); 
-typedef int (* ADIOS_GET_ATTR_FN) (ADIOS_GROUP * gp, const char * attrname, enum ADIOS_DATATYPES * type, int * size, void ** data); 
-typedef int (* ADIOS_GET_ATTR_BYID_FN) (ADIOS_GROUP * gp, int attrid, enum ADIOS_DATATYPES * type, int * size, void ** data); 
-typedef void (* ADIOS_RESET_DIMENSION_ORDER_FN) (); 
+typedef int (* ADIOS_INIT_FN) (MPI_Comm comm);
+typedef int (* ADIOS_FINALIZE_FN) ();
+typedef ADIOS_FILE * (* ADIOS_FOPEN_FN) (const char * fname, MPI_Comm comm);
+typedef int (* ADIOS_FCLOSE_FN) (ADIOS_FILE *fp);
+typedef ADIOS_GROUP * (* ADIOS_GOPEN_FN) (ADIOS_FILE *fp, const char * grpname);
+typedef ADIOS_GROUP * (* ADIOS_GOPEN_BYID_FN) (ADIOS_FILE *fp, int grpid);
+typedef int (* ADIOS_GCLOSE_FN) (ADIOS_GROUP *gp);
+typedef ADIOS_VARINFO * (* ADIOS_INQ_VAR_FN) (ADIOS_GROUP *gp, const char * varname);
+typedef ADIOS_VARINFO * (* ADIOS_INQ_VAR_BYID_FN) (ADIOS_GROUP *gp, int varid);
+typedef int64_t (* ADIOS_READ_VAR_FN) (ADIOS_GROUP * gp, const char * varname, const uint64_t * start, const uint64_t * count, void * data);
+typedef int64_t (* ADIOS_READ_LOCAL_VAR_FN) (ADIOS_GROUP * gp, const char * varname, int idx, const uint64_t * start, const uint64_t * count, void * data);
+typedef int64_t (* ADIOS_READ_VAR_BYID_FN) (ADIOS_GROUP * gp, int varid, const uint64_t * start, const uint64_t * count, void * data);
+typedef int (* ADIOS_GET_ATTR_FN) (ADIOS_GROUP * gp, const char * attrname, enum ADIOS_DATATYPES * type, int * size, void ** data);
+typedef int (* ADIOS_GET_ATTR_BYID_FN) (ADIOS_GROUP * gp, int attrid, enum ADIOS_DATATYPES * type, int * size, void ** data);
+typedef void (* ADIOS_RESET_DIMENSION_ORDER_FN) ();
 
 struct adios_read_hooks_struct
-{   
+{
     ADIOS_INIT_FN           adios_init_fn;
     ADIOS_FINALIZE_FN       adios_finalize_fn;
     ADIOS_FOPEN_FN          adios_fopen_fn;
@@ -79,6 +88,7 @@ struct adios_read_hooks_struct
     ADIOS_INQ_VAR_FN        adios_inq_var_fn;
     ADIOS_INQ_VAR_BYID_FN   adios_inq_var_byid_fn;
     ADIOS_READ_VAR_FN       adios_read_var_fn;
+    ADIOS_READ_LOCAL_VAR_FN adios_read_local_var_fn;
     ADIOS_READ_VAR_BYID_FN  adios_read_var_byid_fn;
     ADIOS_GET_ATTR_FN       adios_get_attr_fn;
     ADIOS_GET_ATTR_BYID_FN  adios_get_attr_byid_fn;
diff --git a/src/adios_transport_hooks.c b/src/adios_transport_hooks.c
index b4b4702..fee982f 100644
--- a/src/adios_transport_hooks.c
+++ b/src/adios_transport_hooks.c
@@ -7,7 +7,7 @@
 
 #include "config.h"
 
-#ifdef _NOMPI
+#ifdef _INTERNAL
     /* Sequential processes can use the library compiled with -D_NOMPI */
 #   define ADIOS_EMPTY_TRANSPORTS
 #else
@@ -41,54 +41,62 @@ void adios_init_transports (struct adios_transport_struct ** t)
     *t = (struct adios_transport_struct *)
            calloc (ADIOS_METHOD_COUNT, sizeof (struct adios_transport_struct));
 
-#ifndef NO_RESEARCH_TRANSPORTS
+#ifndef ADIOS_EMPTY_TRANSPORTS
+
+#  ifndef NO_RESEARCH_TRANSPORTS
     ASSIGN_FNS(adaptive,ADIOS_METHOD_ADAPTIVE)
-#endif
+#  endif
 
-#if HAVE_MPI
+#  ifndef _NOMPI
+
+#    if HAVE_MPI
     ASSIGN_FNS(mpi,ADIOS_METHOD_MPI)
     ASSIGN_FNS(mpi_lustre,ADIOS_METHOD_MPI_LUSTRE)
     ASSIGN_FNS(mpi_amr,ADIOS_METHOD_MPI_AMR)
-#ifndef NO_RESEARCH_TRANSPORTS
+#      ifndef NO_RESEARCH_TRANSPORTS
     ASSIGN_FNS(mpi_stripe,ADIOS_METHOD_MPI_STRIPE)
     ASSIGN_FNS(mpi_cio,ADIOS_METHOD_MPI_CIO)
     ASSIGN_FNS(mpi_stagger,ADIOS_METHOD_MPI_STAGGER)
     ASSIGN_FNS(mpi_aggregate,ADIOS_METHOD_MPI_AGG)
     ASSIGN_FNS(mpi_amr1,ADIOS_METHOD_MPI_AMR1)
-#endif
-#endif
+#      endif
+#    endif
 
-#if NO_DATATAP == 0
+#    if HAVE_PHDF5
+    ASSIGN_FNS(phdf5,ADIOS_METHOD_PHDF5)
+#    endif
+
+#    if HAVE_NC4PAR
+    ASSIGN_FNS(nc4,ADIOS_METHOD_NC4)
+#    endif
+
+#    if HAVE_NSSI
+    ASSIGN_FNS(nssi,ADIOS_METHOD_NSSI_STAGING)
+    ASSIGN_FNS(nssi_filter,ADIOS_METHOD_NSSI_FILTER)
+#    endif
+
+#  endif /* _NOMPI */
+
+#  if NO_DATATAP == 0
     ASSIGN_FNS(datatap,ADIOS_METHOD_DATATAP)
-#endif
+#  endif
 
     ASSIGN_FNS(posix,ADIOS_METHOD_POSIX)
     ASSIGN_FNS(posix1,ADIOS_METHOD_POSIX1)
 
-#if HAVE_DART
+#  if HAVE_DART
     ASSIGN_FNS(dart,ADIOS_METHOD_DART)
-#endif
+#  endif
 
-#if HAVE_DIMES
+#  if HAVE_DIMES
 ASSIGN_FNS(dimes,ADIOS_METHOD_DIMES)
-#endif
-
-#if HAVE_PHDF5
-    ASSIGN_FNS(phdf5,ADIOS_METHOD_PHDF5)
-#endif
+#  endif
 
-#if HAVE_NC4PAR
-    ASSIGN_FNS(nc4,ADIOS_METHOD_NC4)
-#endif
-
-#if HAVE_NSSI
-    ASSIGN_FNS(nssi,ADIOS_METHOD_NSSI_STAGING)
-    ASSIGN_FNS(nssi_filter,ADIOS_METHOD_NSSI_FILTER)
-#endif
-
-#ifndef NO_RESEARCH_TRANSPORTS
+#  ifndef NO_RESEARCH_TRANSPORTS
     ASSIGN_FNS(provenance,ADIOS_METHOD_PROVENANCE)
-#endif
+#  endif
+
+#endif /* ADIOS_EMPTY_TRANSPORTS */
 }
 
 int adios_parse_method (const char * buf, enum ADIOS_IO_METHOD * method
diff --git a/src/adios_transport_hooks.h b/src/adios_transport_hooks.h
index 798c903..702fe46 100644
--- a/src/adios_transport_hooks.h
+++ b/src/adios_transport_hooks.h
@@ -12,9 +12,7 @@
 #include <stdint.h>
 #include <string.h>
 
-// this is defined in the lint program to get empty implementations
-#ifdef ADIOS_EMPTY_TRANSPORTS
-#define FORWARD_DECLARE(a) \
+#define FORWARD_DECLARE_EMPTY(a) \
 void adios_##a##_init (const char * parameters \
                       ,struct adios_method_struct * method \
                       ) {} \
@@ -48,7 +46,11 @@ void adios_##a##_finalize (int mype, struct adios_method_struct * method) {} \
 void adios_##a##_end_iteration (struct adios_method_struct * method) {} \
 void adios_##a##_start_calculation (struct adios_method_struct * method) {} \
 void adios_##a##_stop_calculation (struct adios_method_struct * method) {}
-#else
+
+//#ifdef ADIOS_EMPTY_TRANSPORTS
+// this is defined in the lint program to get empty implementations
+//#define FORWARD_DECLARE(a) FORWARD_DECLARE_EMPTY(a) \
+//#else
 #define FORWARD_DECLARE(a) \
 void adios_##a##_init (const char * parameters \
                       ,struct adios_method_struct * method \
@@ -83,7 +85,7 @@ void adios_##a##_finalize (int mype, struct adios_method_struct * method); \
 void adios_##a##_end_iteration (struct adios_method_struct * method); \
 void adios_##a##_start_calculation (struct adios_method_struct * method); \
 void adios_##a##_stop_calculation (struct adios_method_struct * method);
-#endif
+//#endif
 
 ///////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////////
@@ -127,7 +129,8 @@ enum ADIOS_IO_METHOD {ADIOS_METHOD_UNKNOWN     = -2
 };
 
 // forward declare the functions (or dummies for internals use)
-FORWARD_DECLARE(mpi)
+#if !defined(_NOMPI) || !defined (ADIOS_EMPTY_TRANSPORTS)
+     FORWARD_DECLARE(mpi)
      FORWARD_DECLARE(mpi_lustre)
      FORWARD_DECLARE(mpi_cio)
      FORWARD_DECLARE(mpi_stripe)
@@ -135,17 +138,27 @@ FORWARD_DECLARE(mpi)
      FORWARD_DECLARE(mpi_aggregate)
      FORWARD_DECLARE(mpi_amr)
      FORWARD_DECLARE(mpi_amr1)
-     FORWARD_DECLARE(datatap)
-     FORWARD_DECLARE(posix)
-     FORWARD_DECLARE(posix1)
-     FORWARD_DECLARE(provenance)
      FORWARD_DECLARE(phdf5)
      FORWARD_DECLARE(nc4)
      FORWARD_DECLARE(nssi)
      FORWARD_DECLARE(nssi_filter)
+#endif
+
+#ifdef ADIOS_EMPTY_TRANSPORTS
+     FORWARD_DECLARE_EMPTY(datatap)
+     FORWARD_DECLARE_EMPTY(posix)
+     FORWARD_DECLARE_EMPTY(posix1)
+     FORWARD_DECLARE_EMPTY(provenance)
+     FORWARD_DECLARE_EMPTY(adaptive)
+#else
+     FORWARD_DECLARE(datatap)
+     FORWARD_DECLARE(posix)
+     FORWARD_DECLARE(posix1)
+     FORWARD_DECLARE(provenance)
      FORWARD_DECLARE(adaptive)
+#endif
 
-#if HAVE_DART
+#if defined(HAVE_DART) && !defined(ADIOS_EMPTY_TRANSPORTS) 
 FORWARD_DECLARE(dart)
 #endif
 
diff --git a/src/adiosf.c b/src/adiosf.c
index 94ca1ab..9c41836 100644
--- a/src/adiosf.c
+++ b/src/adiosf.c
@@ -179,6 +179,43 @@ void FC_FUNC_(adios_write, adios_WRITE)
         v->data = 0;
     }
 
+    // Q.L. 10-2010. To fix a memory leak problem.
+    if (v->stats)
+    {   
+        int j, idx;
+        int c, count = 1;
+
+        if (v->type == adios_complex || v->type == adios_double_complex)
+            count = 3;
+
+        for (c = 0; c < count; c ++)
+        {   
+            j = idx = 0;
+            while (v->bitmap >> j)
+            {   
+                if (v->bitmap >> j & 1)
+                {   
+                    if (j == adios_statistic_hist)
+                    {   
+                        struct adios_index_characteristics_hist_struct * hist =
+                            (struct adios_index_characteristics_hist_struct *) v->stats[c][idx].data;
+                        free (hist->breaks);
+                        free (hist->frequencies);
+                        free (hist);
+                        v->stats[c][idx].data = 0;
+                    }
+                    else
+                    {   
+                        free (v->stats[c][idx].data);
+                        v->stats[c][idx].data = 0;
+                    }
+                    idx ++;
+                }
+                j ++;
+            }
+        }
+    }
+
     if (v->dimensions)
     {
         v->data = var;
@@ -359,8 +396,8 @@ void FC_FUNC_(adios_close, adios_CLOSE) (int64_t * fd_p, int * err)
 // group a list of vars into a composite group
 void FC_FUNC_(adios_declare_group, adios_DECLARE_GROUP) 
     (int64_t * id, const char * name
-    ,const char * time_index, int * err
-    ,int name_size, int time_index_size
+    ,const char * time_index, enum ADIOS_FLAG stats
+    ,int * err, int name_size, int time_index_size
     )
 {
     char * buf1 = 0;
@@ -370,7 +407,7 @@ void FC_FUNC_(adios_declare_group, adios_DECLARE_GROUP)
     buf2 = futils_fstr_to_cstr (time_index, time_index_size);
 
     if (buf1 != 0 && buf2 != 0) {
-        *err = adios_common_declare_group (id, buf1, adios_flag_yes, "", "", buf2);
+        *err = adios_common_declare_group (id, buf1, adios_flag_yes, "", "", buf2, stats);
         free (buf1);
         free (buf2);
         if (*err == 1) {
diff --git a/src/adiosf_read.c b/src/adiosf_read.c
index f564354..4241327 100644
--- a/src/adiosf_read.c
+++ b/src/adiosf_read.c
@@ -183,6 +183,8 @@ void FC_FUNC_(adios_inq_group, ADIOS_INQ_GROUP)
         (int64_t * gp, 
          void    * vnamelist, 
          void    * anamelist,
+         int     * timestep,
+         int     * lasttimestep,
          int     * err, 
          int       vnamelist_len, 
          int       anamelist_len) 
@@ -196,6 +198,8 @@ void FC_FUNC_(adios_inq_group, ADIOS_INQ_GROUP)
         for (i=0;i<agp->attrs_count;i++) {
             futils_cstr_to_fstr( agp->attr_namelist[i], (char *)anamelist+i*anamelist_len, anamelist_len);
         } 
+        *timestep = agp->timestep;
+        *lasttimestep = agp->lasttimestep;
         *err = 0;
     } else {
         *err = 1;
@@ -261,6 +265,30 @@ void FC_FUNC_(adios_read_var, ADIOS_READ_VAR)
         fprintf(stderr, "Error: %s\n", adios_get_last_errmsg());
 }
 
+void FC_FUNC_(adios_read_local_var, ADIOS_READ_LOCAL_VAR)
+        (int64_t  * gp,
+         char     * varname,
+         int      * idx,
+         uint64_t * start,
+         uint64_t * count,
+         void     * data,
+         int64_t  * read_bytes,
+         int varname_len)
+{
+    ADIOS_GROUP *agp = (ADIOS_GROUP *) *gp;
+    char *varstr;
+    int i;
+    varstr = futils_fstr_to_cstr(varname, varname_len);
+    if (varstr != NULL) {
+        *read_bytes = common_read_read_local_var (agp, varstr, *idx, start, count, data);
+        free(varstr);
+    } else {
+        *read_bytes = -adios_errno;
+    }
+    if (*read_bytes < 0)
+        fprintf(stderr, "Error: %s\n", adios_get_last_errmsg());
+}
+
 /* Specific function for each data type */
 void FC_FUNC_(adios_read_var_int1, ADIOS_READ_VAR_INT1) (int64_t * gp, char * varname, uint64_t * start, uint64_t * count, void * data, int64_t * read_bytes, int varname_len) { FC_FUNC_(adios_read_var, ADIOS_READ_VAR) (gp, varname, start, count, data, read_bytes, varname_len); }
 void FC_FUNC_(adios_read_var_int2, ADIOS_READ_VAR_INT2) (int64_t * gp, char * varname, uint64_t * start, uint64_t * count, void * data, int64_t * read_bytes, int varname_len) { FC_FUNC_(adios_read_var, ADIOS_READ_VAR) (gp, varname, start, count, data, read_bytes, varname_len); }
diff --git a/src/bp_types.h b/src/bp_types.h
index 3bacf82..cf6d761 100644
--- a/src/bp_types.h
+++ b/src/bp_types.h
@@ -42,8 +42,19 @@ struct bp_minifooter {
 	uint64_t file_size;
 } __attribute__((__packed__));
 
+struct BP_file_handle
+{
+    uint32_t file_index;
+    MPI_File fh;
+    struct BP_file_handle * next;
+};
+
+typedef struct BP_file_handle BP_file_handle_list;
+
 struct BP_FILE {
     MPI_File mpi_fh;
+    char * fname; // Main file name is needed to calculate subfile names
+    BP_file_handle_list * sfh; // This list links all the subfiles handle together
     MPI_Comm comm;
     struct adios_bp_buffer_struct_v1 * b;
     struct bp_index_pg_struct_v1 * pgs_root;
@@ -54,6 +65,7 @@ struct BP_FILE {
     struct BP_GROUP_ATTR * gattr_h;
     uint32_t tidx_start;
     uint32_t tidx_stop;
+    void * priv;
 };
 
 struct BP_GROUP_VAR {
diff --git a/src/bp_utils.c b/src/bp_utils.c
index f70dc44..8e66b20 100644
--- a/src/bp_utils.c
+++ b/src/bp_utils.c
@@ -53,7 +53,7 @@ void bp_alloc_aligned (struct adios_bp_buffer_struct_v1 * b, uint64_t size)
     b->allocated_buff_ptr =  malloc (size + BYTE_ALIGN - 1);
     if (!b->allocated_buff_ptr)
     {
-        error( err_no_memory, "Cannot allocate %llu bytes\n", size);
+        adios_error ( err_no_memory, "Cannot allocate %llu bytes\n", size);
 
         b->buff = NULL;
         b->length = 0;
@@ -74,7 +74,7 @@ void bp_realloc_aligned (struct adios_bp_buffer_struct_v1 * b
                                     );
     if (!b->allocated_buff_ptr)
     {
-        error( err_no_memory, "Cannot allocate %llu bytes\n", size);
+        adios_error ( err_no_memory, "Cannot allocate %llu bytes\n", size);
 
         b->buff = NULL;
         b->length = 0;
@@ -107,7 +107,7 @@ int bp_read_open (const char * filename,
         int len = 0;
         memset (e, 0, MPI_MAX_ERROR_STRING);
         MPI_Error_string (err, e, &len);
-        error(err_MPI_open_error, "MPI open failed for %s: '%s'\n", filename, e);
+        adios_error (err_MPI_open_error, "MPI open failed for %s: '%s'\n", filename, e);
         return adios_flag_no;
     }
 
@@ -131,7 +131,7 @@ int bp_read_minifooter (struct BP_FILE * bp_struct)
     if (!b->buff) {
         bp_alloc_aligned (b, MINIFOOTER_SIZE);
         if (!b->buff) {
-            error (err_no_memory, "could not allocate %d bytes\n", MINIFOOTER_SIZE);
+            adios_error (err_no_memory, "could not allocate %d bytes\n", MINIFOOTER_SIZE);
             return 1;
         }
         memset (b->buff, 0, MINIFOOTER_SIZE);
@@ -542,8 +542,8 @@ int bp_parse_attrs (struct BP_FILE * fh)
                         BUFREAD64(b, (*root)->characteristics [j].payload_offset)
                         break;
 
-                    case adios_characteristic_file_name:
-                        (*root)->characteristics [j].file_name = bp_read_data_from_buffer(b, adios_string);
+                    case adios_characteristic_file_index:
+                        BUFREAD32(b, (*root)->characteristics [j].file_index);
                         break;
 
                     case adios_characteristic_time_index:
@@ -917,8 +917,8 @@ int bp_parse_characteristics (struct adios_bp_buffer_struct_v1 * b,
             BUFREAD64(b, (*root)->characteristics [j].payload_offset)
             break;
 
-        case adios_characteristic_file_name:
-            (*root)->characteristics [j].file_name = bp_read_data_from_buffer(b, adios_string);
+        case adios_characteristic_file_index:
+            BUFREAD32(b, (*root)->characteristics [j].file_index)
             break;
 
         case adios_characteristic_time_index:
diff --git a/src/common_adios.c b/src/common_adios.c
index 80f1853..ed20228 100644
--- a/src/common_adios.c
+++ b/src/common_adios.c
@@ -21,6 +21,10 @@
 #include "adios_internals_mxml.h"
 #include "buffer.h"
 
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
+
 extern struct adios_transport_struct * adios_transports;
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -107,7 +111,7 @@ int common_adios_open (int64_t * fd, const char * group_name
                 }
 
     fd_p->name = strdup (name);
-    fd_p->subfile_name = 0;
+    fd_p->subfile_index = -1; // subfile index is by default -1
     fd_p->group = g;
     fd_p->mode = mode;
     fd_p->data_size = 0;
@@ -691,11 +695,6 @@ int common_adios_close (int64_t fd_p)
         free (fd->name);
         fd->name = 0;
     }
-    if (fd->subfile_name)
-    {
-        free (fd->subfile_name);
-        fd->subfile_name = 0;
-    }
 
     free ((void *) fd_p);
 
diff --git a/src/common_read.c b/src/common_read.c
index 93c19d2..37bc362 100644
--- a/src/common_read.c
+++ b/src/common_read.c
@@ -36,7 +36,7 @@ int common_read_set_read_method(enum ADIOS_READ_METHOD method)
 {
     int retval = 0;
     if ((int)method < 0 || (int)method >= ADIOS_READ_METHOD_COUNT) {
-        error(err_invalid_read_method, "Invalid read method (=%d) passed to adios_set_read_method().", (int)method);
+        adios_error (err_invalid_read_method, "Invalid read method (=%d) passed to adios_set_read_method().", (int)method);
         retval = -err_invalid_read_method;
     } else {
         selected_method = method;
@@ -86,8 +86,9 @@ int common_read_fclose (ADIOS_FILE *fp)
     if (fp) {
         internals = (struct common_read_internals_struct *) fp->internal_data;
         retval = internals->read_hooks[internals->method].adios_fclose_fn (fp);
+        free (internals);
     } else {
-        error( err_invalid_file_pointer, "Invalid file pointer at adios_fclose()");
+        adios_error ( err_invalid_file_pointer, "Invalid file pointer at adios_fclose()");
         retval = -err_invalid_file_pointer;
     }
     return retval;
@@ -102,7 +103,7 @@ void common_read_reset_dimension_order (ADIOS_FILE *fp, int is_fortran)
         internals = (struct common_read_internals_struct *) fp->internal_data;
         internals->read_hooks[internals->method].adios_reset_dimension_order_fn (fp);
     } else {
-        error( err_invalid_file_pointer, "Invalid file pointer at adios_reset_dimension_order()");
+        adios_error ( err_invalid_file_pointer, "Invalid file pointer at adios_reset_dimension_order()");
     }
 }
 
@@ -116,7 +117,7 @@ ADIOS_GROUP * common_read_gopen (ADIOS_FILE *fp, const char * grpname)
         internals = (struct common_read_internals_struct *) fp->internal_data;
         retval = internals->read_hooks[internals->method].adios_gopen_fn (fp, grpname);
     } else {
-        error( err_invalid_file_pointer, "Invalid file pointer at adios_gopen()");
+        adios_error ( err_invalid_file_pointer, "Invalid file pointer at adios_gopen()");
         retval = NULL;
     }
     return retval;
@@ -132,7 +133,7 @@ ADIOS_GROUP * common_read_gopen_byid (ADIOS_FILE *fp, int grpid)
         internals = (struct common_read_internals_struct *) fp->internal_data;
         retval = internals->read_hooks[internals->method].adios_gopen_byid_fn (fp, grpid);
     } else {
-        error( err_invalid_file_pointer, "Invalid file pointer at adios_gopen()");
+        adios_error ( err_invalid_file_pointer, "Invalid file pointer at adios_gopen()");
         retval = NULL;
     }
     //printf("%s: gp=%x, gp->fp=%x, gp->gh=%x\n",__func__, retval, retval->fp, retval->gh);
@@ -150,7 +151,7 @@ int common_read_gclose (ADIOS_GROUP *gp)
         internals = (struct common_read_internals_struct *) gp->fp->internal_data;
         retval = internals->read_hooks[internals->method].adios_gclose_fn (gp);
     } else {
-        error(err_invalid_group_struct, "Null pointer passed as group to adios_gclose()");
+        adios_error (err_invalid_group_struct, "Null pointer passed as group to adios_gclose()");
         retval = -err_invalid_group_struct;
     }
     return retval;
@@ -167,7 +168,7 @@ int common_read_get_attr (ADIOS_GROUP * gp, const char * attrname, enum ADIOS_DA
         internals = (struct common_read_internals_struct *) gp->fp->internal_data;
         retval = internals->read_hooks[internals->method].adios_get_attr_fn (gp, attrname, type, size, data);
     } else {
-        error(err_invalid_group_struct, "Null pointer passed as group to adios_get_attr()");
+        adios_error (err_invalid_group_struct, "Null pointer passed as group to adios_get_attr()");
         retval = -err_invalid_group_struct;
     }
     return retval;
@@ -184,7 +185,7 @@ int common_read_get_attr_byid (ADIOS_GROUP * gp, int attrid,
         internals = (struct common_read_internals_struct *) gp->fp->internal_data;
         retval = internals->read_hooks[internals->method].adios_get_attr_byid_fn (gp, attrid, type, size, data);
     } else {
-        error(err_invalid_group_struct, "Null pointer passed as group to adios_get_attr_byid()");
+        adios_error (err_invalid_group_struct, "Null pointer passed as group to adios_get_attr_byid()");
         retval = -err_invalid_group_struct;
     }
     return retval;
@@ -200,7 +201,7 @@ ADIOS_VARINFO * common_read_inq_var (ADIOS_GROUP *gp, const char * varname)
         internals = (struct common_read_internals_struct *) gp->fp->internal_data;
         retval = internals->read_hooks[internals->method].adios_inq_var_fn (gp, varname);
     } else {
-        error(err_invalid_group_struct, "Null pointer passed as group to adios_inq_var_byid()");
+        adios_error (err_invalid_group_struct, "Null pointer passed as group to adios_inq_var_byid()");
         retval = NULL;
     }
     return retval;
@@ -216,7 +217,7 @@ ADIOS_VARINFO * common_read_inq_var_byid (ADIOS_GROUP *gp, int varid)
         internals = (struct common_read_internals_struct *) gp->fp->internal_data;
         retval = internals->read_hooks[internals->method].adios_inq_var_byid_fn (gp, varid);
     } else {
-        error(err_invalid_group_struct, "Null pointer passed as group to adios_inq_var_byid()");
+        adios_error (err_invalid_group_struct, "Null pointer passed as group to adios_inq_var_byid()");
         retval = NULL;
     }
     return retval;
@@ -248,7 +249,28 @@ int64_t common_read_read_var (ADIOS_GROUP * gp, const char * varname,
         internals = (struct common_read_internals_struct *) gp->fp->internal_data;
         retval = internals->read_hooks[internals->method].adios_read_var_fn (gp, varname, start, count, data);
     } else {
-        error(err_invalid_group_struct, "Null pointer passed as group to adios_read_var()");
+        adios_error (err_invalid_group_struct, "Null pointer passed as group to adios_read_var()");
+        retval = -err_invalid_group_struct;
+    }
+    return retval;
+}
+
+int64_t common_read_read_local_var (ADIOS_GROUP    * gp,
+                                    const char     * varname,
+                                    int            idx,
+                                    const uint64_t * start,
+                                    const uint64_t * count,
+                                    void           * data)
+{
+    struct common_read_internals_struct * internals;
+    int64_t retval;
+
+    adios_errno = 0;
+    if (gp) {
+        internals = (struct common_read_internals_struct *) gp->fp->internal_data;
+        retval = internals->read_hooks[internals->method].adios_read_local_var_fn (gp, varname, idx, start, count, data);
+    } else {
+        adios_error (err_invalid_group_struct, "Null pointer passed as group to adios_read_local_var()");
         retval = -err_invalid_group_struct;
     }
     return retval;
@@ -268,7 +290,7 @@ int64_t common_read_read_var_byid (ADIOS_GROUP    * gp,
         internals = (struct common_read_internals_struct *) gp->fp->internal_data;
         retval = internals->read_hooks[internals->method].adios_read_var_byid_fn (gp, varid, start, count, data);
     } else {
-        error(err_invalid_group_struct, "Null pointer passed as group to adios_read_var_byid()");
+        adios_error (err_invalid_group_struct, "Null pointer passed as group to adios_read_var_byid()");
         retval = -err_invalid_group_struct;
     }
     return retval;
diff --git a/src/common_read.h b/src/common_read.h
index f9b44e3..21f88ac 100644
--- a/src/common_read.h
+++ b/src/common_read.h
@@ -39,7 +39,12 @@ int64_t common_read_read_var (ADIOS_GROUP    * gp,
                         const uint64_t * start,
                         const uint64_t * count, 
                         void           * data);
-
+int64_t common_read_read_local_var (ADIOS_GROUP    * gp,
+                                    const char     * varname,
+                                    int            idx,
+                                    const uint64_t * start,
+                                    const uint64_t * count,
+                                    void           * data);
 int64_t common_read_read_var_byid (ADIOS_GROUP * gp, int varid,
                              const uint64_t * start, const uint64_t * count, 
                              void * data);
diff --git a/src/ds_metadata.h b/src/ds_metadata.h
new file mode 100644
index 0000000..c5c4050
--- /dev/null
+++ b/src/ds_metadata.h
@@ -0,0 +1,109 @@
+/* 
+ * ADIOS is freely available under the terms of the BSD license described
+ * in the COPYING file in the top level directory of this source distribution.
+ *
+ * Copyright (c) 2008 - 2009.  UT-BATTELLE, LLC. All rights reserved.
+ */
+
+/*
+ *  Metadata (index) for DART and DIMES methods
+ * 
+ *  Data structures to store the index (aka footer for BP format) that can be
+ *  put into DataSpaces to describe the variables/attributes there
+ */
+#ifndef __SPACES_INDEX_H__
+#define __SPACES_INDEX_H__
+
+#include <stdint.h>
+#include "adios_types.h"
+#include "adios_read.h"
+
+
+/* functions currently defined in adios_dart.c and read_dart.c */
+
+/* Tell the DataSpaces order of dimensions for a 1-3 dim array written from Fortran or C.
+   unpack=1: the reverse of packing (to retrieve the original order).
+   didx should be an int [3] array in any case.
+ */
+void ds_dimension_ordering(int ndims, int is_app_fortran, int unpack, int *didx);
+
+void ds_pack_file_info (int time, int nvars, int nattrs, int group_index_len, char * groupname,
+                        /*OUT*/char **buf, /*OUT*/int *buf_len);
+
+//ADIOS_FILE * ds_unpack_file_info (char * buf, int buf_len,
+//                                  /* OUT */ struct adios_read_dart_data_struct * ds)
+
+void ds_pack_group_info (struct adios_file_struct *fd
+        ,struct adios_method_struct * method
+        ,struct adios_index_var_struct_v1 *vars_root
+        ,struct adios_index_attribute_struct_v1 * attrs_root
+        ,char ** buffer, int *buffer_size, int *nvars, int *nattrs
+        );
+
+//ADIOS_GROUP * ds_unpack_group_info (char * buf, struct adios_read_dart_group_struct * group);
+
+
+/***********************
+  FILE info buffer: 
+
+SI = sizeof(int) = 4
+
+CURRENT structure
+        128 fix bytes, 1 group
+        bytes   content
+         SI      = length of this buffer (=128 bytes fixed right now)
+         SI      = time index
+         SI      = number of variables in file (actually in the group)
+         SI      = number of attributes in file (actually in the group)
+         SI      = length of group index (in GROUP at fn/gn variable)
+         SI      = N length of name  
+         N      = group name (no \0)
+GOAL structure (needs read from space before writing)
+        bytes   content
+         SI      = length of this buffer (=128 bytes fixed right now)
+         SI      = time index
+         SI      = number of variables in file 
+         SI      = number of attributes in file
+         SI      = G number of groups
+    G*  ( 
+         SI      = length of group index (in GROUP at fn/gn variable)
+         SI      = N length of name 
+         N      = group name (no \0)
+        )
+*/
+
+
+/*********************
+  GROUP info buffer:
+
+   SI = sizeof(int) = 4
+
+   Size = N bytes, N is found in FILE buffer
+        bytes   content
+         SI      = length of this buffer  (=N above)
+         SI      = NV number of variables in file (actually in the group)
+         SI      = NA number of attributes in file (actually in the group)
+    NV*(
+         SI      = L length of name  
+         L      = variable name (includes path) (no \0)
+         SI      = type of variable
+         SI      = has time dimension (0 or 1) (time dim is not stored)
+         SI      = D number of dimensions
+      D*(
+         8      = ith dimension
+        )
+         K      = value of scalar variable (if D = 0), K is according to type
+                  string represented as (SI bytes for len, then string w/o \0) 
+       )
+    NA*(
+         SI      = L length of name  
+         L      = attribute name (includes path) (no \0)
+         SI      = type of attribute
+         K      = value of attribute, K is according to type
+                  string represented as (SI bytes for len, then string w/o \0) 
+       )
+
+*/
+
+
+#endif
diff --git a/src/futils.c b/src/futils.c
index 75519a8..aa9fd44 100644
--- a/src/futils.c
+++ b/src/futils.c
@@ -41,7 +41,7 @@ char * futils_fstr_to_cstr(const char * fs, int flen)
         clen--;
     cs = (char*) malloc ((size_t) (clen + 1));
     if (cs == NULL) {
-        error( err_no_memory, "ERROR: Cannot allocate %d bytes for a C string in ADIOS API", clen+1);
+        adios_error (err_no_memory, "ERROR: Cannot allocate %d bytes for a C string in ADIOS API", clen+1);
         return NULL;
     }
     strncpy (cs, fs, clen);
diff --git a/src/globals.c b/src/globals.c
index ec56ab7..961d9fc 100644
--- a/src/globals.c
+++ b/src/globals.c
@@ -137,3 +137,61 @@ int  globals_adios_is_dimes_connected_from_both()
 }
 #endif
 
+#if NO_DATATAP == 0
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#define OPLEN 2
+static char OP[OPLEN] = { '(', ')' };
+static char *OP_REP[OPLEN] = { "_PPLT_", "_PPRT_" };
+
+char *getFixedName(char *name)
+{
+    char *tempname = (char *) malloc(sizeof(char) * 255);
+    snprintf(tempname, 255, "%s\0", name);
+    char *oldname = strdup(name);
+    char *loc = NULL;
+    int i;
+
+    do
+    {
+        for (i = 0; i < OPLEN; i++)
+        {
+    //checking operator OP[i]
+            loc = strchr(oldname, OP[i]);
+            if (loc == NULL)
+                continue;
+            *loc = 0;
+            snprintf(tempname, 255, "%s%s%s\0", oldname, OP_REP[i], &loc[1]);
+            free(oldname);
+            oldname = strdup(tempname);
+        }
+    }
+    while (loc != NULL);
+    free(oldname);
+
+fprintf(stderr, "im here %s %s %s:%d\n", name, tempname, __FILE__,__LINE__);
+    return tempname;
+}
+
+char *get_full_path_name(char *name, char *path)
+{
+    char *full_pathname = (char *) malloc(strlen(name)+strlen(path)+2);
+    if(!full_pathname) {
+        fprintf(stderr, "cannot allocate memory. %s:%d\n", __FILE__,__LINE__);
+        return NULL;
+    }
+    if (!strcmp (path, "/")) {
+        sprintf (full_pathname, "/%s\0", name);
+    }
+    else {
+        sprintf (full_pathname, "%s/%s\0", path, name);
+    }
+fprintf(stderr, "im here %s %s %s %s:%d\n", name, path, full_pathname,__FILE__,__LINE__);
+    return full_pathname;
+}
+
+#endif
+
diff --git a/src/globals.h b/src/globals.h
index 593a047..8fcece8 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -52,4 +52,11 @@ int  globals_adios_is_dimes_connected_from_writer();
 int  globals_adios_is_dimes_connected_from_both();
 #endif
 
+#if NO_DATATAP == 0
+
+char *getFixedName(char *name);
+char *get_full_path_name(char *name, char *path);
+
+#endif
+
 #endif  /*__GLOBALS_H__*/
diff --git a/src/mpidummy.c b/src/mpidummy.c
index aa30c76..5b0b508 100644
--- a/src/mpidummy.c
+++ b/src/mpidummy.c
@@ -31,6 +31,14 @@ int MPI_Init(int *argc, char ***argv)
     return MPI_SUCCESS; 
 }
 
+int MPI_Finalize() 
+{ 
+    mpierrmsg[0] = '\0'; 
+    return MPI_SUCCESS; 
+}
+
+int MPI_Comm_split ( MPI_Comm comm, int color, int key, MPI_Comm *comm_out ) {return MPI_SUCCESS;}
+
 int MPI_Barrier(MPI_Comm comm) { return MPI_SUCCESS; }
 int MPI_Bcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm) { return MPI_SUCCESS; }
 
diff --git a/src/mpidummy.h b/src/mpidummy.h
index 741bcfc..8157cdc 100644
--- a/src/mpidummy.h
+++ b/src/mpidummy.h
@@ -1,4 +1,4 @@
-/* 
+/*
  * ADIOS is freely available under the terms of the BSD license described
  * in the COPYING file in the top level directory of this source distribution.
  *
@@ -35,11 +35,17 @@ typedef int MPI_Fint;
 #define MPI_BYTE                    1          /* I need the size of the type here */
 #define MPI_INFO_NULL               NULL
 
+#define MPI_COMM_NULL               0
 #define MPI_COMM_WORLD              1
+#define MPI_COMM_SELF               2
 
 #define MPI_INT                     1
 
+#define MPI_ANY_SOURCE              0
+#define MPI_ANY_TAG                 0
+
 int MPI_Init(int *argc, char ***argv);
+int MPI_Finalize();
 
 int MPI_Barrier(MPI_Comm comm);
 int MPI_Bcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm);
@@ -57,6 +63,7 @@ int MPI_File_seek(MPI_File fh, MPI_Offset offset, int whence);
 
 int MPI_Get_count(MPI_Status *status, MPI_Datatype datatype, int *count);
 int MPI_Error_string(int errorcode, char *string, int *resultlen);
+int MPI_Comm_split ( MPI_Comm comm, int color, int key, MPI_Comm *comm_out );
 
 
 #endif
diff --git a/src/nssi_coupling_server.cpp b/src/nssi_coupling_server.cpp
new file mode 100644
index 0000000..0e8cadc
--- /dev/null
+++ b/src/nssi_coupling_server.cpp
@@ -0,0 +1,1703 @@
+/**  @file main.c
+ *
+ *   @brief Driver for the LWFS name server.
+ *
+ *   @author Ron Oldfield (raoldfi\@sandia.gov).
+ *   $Revision: 1264 $.
+ *   $Date: 2007-02-27 15:30:26 -0700 (Tue, 27 Feb 2007) $.
+ */
+
+
+#ifndef __STDC_CONSTANT_MACROS
+#define __STDC_CONSTANT_MACROS
+#endif
+
+#include "config.h"
+
+#include <unistd.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+
+#include "adios.h"
+
+#ifdef HAVE_NSSI
+#ifdef HAVE_PORTALS
+#include "nssi_ptls.h"
+#endif
+#ifdef HAVE_INFINIBAND
+#include "nssi_ib.h"
+#endif
+#include "nssi_server.h"
+#include "nssi_logger.h"
+
+#include "adios_nssi_args.h"
+#include "adios_nssi_config.h"
+#endif
+
+#include "io_timer.h"
+
+#include <mpi.h>
+#include <algorithm>
+#include <map>
+#include <list>
+
+using namespace std;
+
+
+
+#ifdef __LIBCATAMOUNT__
+#define ntohs(value) 0
+#endif
+
+
+static int global_rank=-1;
+static int DEBUG=0;
+
+
+struct var_details_t {
+    char var_path[ADIOS_PATH_MAX];
+    char var_name[ADIOS_PATH_MAX];
+    int  ndims;
+    int8_t is_scalar;
+
+    uint64_t  cache_offset; /* offset into the timestep cache_buffer where the var data can be found */
+    char     *cache_ptr;    /* address of var data (== cache_buffer+cache_offset) */
+    uint64_t  len;          /* var data length in bytes */
+    uint64_t  num_elements; /* number of datatype elements in buf (len/atype_size) */
+
+    enum ADIOS_DATATYPES atype; /* adios type of data in buf*/
+    int32_t              atype_size;
+
+    char    **offset_path;
+    char    **offset_name;
+    uint64_t *offset;     /* starting corner (eg. 0,0,0 is the origin of a cube) */
+    char    **count_path;
+    char    **count_name;
+    uint64_t *count;      /* num elements in each dimension (eg. 3,3,3 is a cube of size 3) */
+    char    **global_path;
+    char    **global_name;
+    uint64_t *global;      /* num elements in each dimension (eg. 3,3,3 is a cube of size 3) */
+
+    var_details_t() {
+        var_path[0]='\0';
+        var_name[0]='\0';
+        is_scalar=TRUE;
+        ndims=0;
+        cache_offset=0;
+        cache_ptr=NULL;
+        len=0;
+        num_elements=0;
+        atype=adios_unknown;
+        atype_size=0;
+        offset_path=NULL;
+        offset_name=NULL;
+        offset=NULL;
+        count_path=NULL;
+        count_name=NULL;
+        count=NULL;
+        global_path=NULL;
+        global_name=NULL;
+        global=NULL;
+    }
+};
+struct var_details_lt
+{
+    bool operator()(const char* vn1, const char* vn2) const
+    {
+        if (DEBUG>2) printf("var_details_lt(vn1=%s ; vn2=%s)\n",
+                vn1, vn2);
+
+        if (strcmp(vn1, vn2) <0) return TRUE;
+
+        return FALSE;
+    }
+};
+
+/* Map of variable details */
+typedef map<char*, var_details_t*, var_details_lt> var_details_map_t;
+typedef map<char*, var_details_t*, var_details_lt>::iterator var_details_map_iterator_t;
+typedef pair<char*, var_details_t*> var_details_map_pair_t;
+static pthread_mutex_t var_details_map_mutex=PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+static pthread_cond_t  var_details_map_cond =PTHREAD_COND_INITIALIZER;
+
+typedef list<char*> var_details_list_t;
+typedef list<char*>::iterator var_details_list_iterator_t;
+
+
+struct file_timestep_t {
+    int32_t  timestep;
+    int8_t   is_complete;
+    int8_t   is_locked;
+    uint64_t group_size;
+    char    *cache_buffer;
+    int64_t  cache_size;
+    int64_t  bytes_left;
+
+    var_details_map_t vars_map;
+    var_details_list_t vars_list;
+
+    file_timestep_t(int32_t ts) {
+        timestep=ts;
+        is_complete=FALSE;
+        is_locked=FALSE;
+        group_size=0;
+        cache_buffer=NULL;
+        cache_size=0;
+    }
+};
+
+/* list of timesteps */
+typedef list<file_timestep_t*> file_timestep_list_t;
+typedef list<file_timestep_t*>::iterator file_timestep_list_iterator_t;
+static pthread_mutex_t file_timestep_list_mutex=PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+static pthread_cond_t  file_timestep_list_cond =PTHREAD_COND_INITIALIZER;
+
+
+/* Need a struct to encapsulate open file info.
+ */
+struct open_file {
+    char    writer_id[ADIOS_PATH_MAX];
+    char    reader_id[ADIOS_PATH_MAX];
+    char    gname[ADIOS_PATH_MAX];
+    char    ofname[ADIOS_PATH_MAX];
+    char    omode[2];
+    int64_t ofdesc;
+    int8_t  is_open;
+    int64_t current_timestep;
+    int64_t last_written_timestep;
+    file_timestep_list_t timesteps;
+
+    open_file(const char *name) {
+        strcpy(ofname, name);
+        ofdesc=-1;
+        current_timestep=0;
+        last_written_timestep=0;
+        is_open=FALSE;
+    }
+    open_file(const char *name, const int64_t desc) {
+        strcpy(ofname, name);
+        ofdesc=desc;
+        current_timestep=0;
+        last_written_timestep=0;
+        is_open=FALSE;
+    }
+};
+struct open_file_lt
+{
+    bool operator()(const char* ofn1, const char* ofn2) const
+    {
+        if (DEBUG>2) printf("open_file_lt(ofn1=%s ; ofn2=%s)\n",
+                ofn1, ofn2);
+
+        if (strcmp(ofn1, ofn2) <0) return TRUE;
+
+        return FALSE;
+    }
+};
+
+/* Map of open files */
+static map<char*, open_file*, open_file_lt> open_file_map;
+typedef map<char*, open_file*, open_file_lt>::iterator open_file_map_iterator_t;
+typedef pair<char*, open_file*> open_file_map_pair_t;
+
+
+static map<int64_t, open_file*> open_filedesc_map;
+typedef map<int64_t, open_file*>::iterator open_filedesc_map_iterator_t;
+typedef pair<int64_t, open_file*> open_filedesc_map_pair_t;
+
+
+static pthread_mutex_t open_file_map_mutex=PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+static pthread_cond_t  open_file_map_cond =PTHREAD_COND_INITIALIZER;
+
+
+
+/* -------------------- PRIVATE FUNCTIONS ---------- */
+
+void open_file_printall(char *prefix)
+{
+    open_file *of=NULL;
+    open_file_map_iterator_t iter=open_file_map.begin();
+    while (iter != open_file_map.end()) {
+        char *key=iter->first;
+        of=iter->second;
+        if (DEBUG>5) printf("%s: myrank(%d): open_file(key=%s ; of=%p ; of->ofname=%s ; of->ofdesc=%ld)\n",
+                prefix, global_rank, key, of, of->ofname, of->ofdesc);
+
+        iter++;
+    }
+}
+
+open_file *open_file_add(char *fname)
+{
+    open_file *of=NULL;
+
+    if (DEBUG>2) printf("open_file_add(fname=%s)\n",
+            fname);
+
+    char *key=strdup(fname);
+
+    of = new open_file(fname);
+    of->ofdesc = (int64_t)of;
+    open_file_map[key]=of;
+    open_filedesc_map[of->ofdesc]=of;
+
+    open_file_printall("open_file_add");
+
+    return(of);
+}
+open_file *open_file_get(char *fname)
+{
+    open_file *of=NULL;
+
+    open_file_printall("open_file_get(by fname)");
+
+    open_file_map_iterator_t iter=open_file_map.find(fname);
+    if (iter != open_file_map.end()) {
+        of=iter->second;
+    }
+
+    return(of);
+}
+open_file *open_file_get(int64_t fd)
+{
+    open_file *of=NULL;
+
+    open_file_printall("open_file_get(by fd)");
+
+    open_filedesc_map_iterator_t iter=open_filedesc_map.find(fd);
+    if (iter != open_filedesc_map.end()) {
+        of=iter->second;
+    }
+
+    return(of);
+}
+void open_file_del(char *fname)
+{
+    open_file *of=open_file_get(fname);
+
+    if (of!=NULL) {
+        open_filedesc_map.erase(of->ofdesc);
+    }
+
+    open_file_map.erase(fname);
+}
+
+file_timestep_t *timestep_get_current(open_file *of)
+{
+    file_timestep_t *ts=NULL;
+    file_timestep_list_iterator_t iter=of->timesteps.begin();
+    for(;iter != of->timesteps.end();iter++) {
+        if ((*iter)->timestep == of->current_timestep) {
+            ts=*iter;
+            break;
+        }
+    }
+    return(ts);
+}
+file_timestep_t *timestep_get(open_file *of, uint64_t ts_num)
+{
+    file_timestep_t *ts=NULL;
+    file_timestep_list_iterator_t iter=of->timesteps.begin();
+    for(;iter != of->timesteps.end();iter++) {
+        if ((*iter)->timestep == ts_num) {
+            ts=*iter;
+            break;
+        }
+    }
+    return(ts);
+}
+
+void var_details_add(struct open_file *of, var_details_t *vd)
+{
+    file_timestep_t *ts=NULL;
+    ts = timestep_get_current(of);
+
+    char *key=strdup(vd->var_name);
+
+    ts->vars_map[key]=vd;
+    ts->vars_list.push_back(key);
+}
+var_details_t *var_details_get(struct open_file *of, char *vname)
+{
+    file_timestep_t *ts=NULL;
+    var_details_t *vd=NULL;
+
+    ts = timestep_get_current(of);
+    var_details_map_iterator_t iter=ts->vars_map.find(vname);
+    if (iter != ts->vars_map.end()) {
+        vd=iter->second;
+    }
+
+    return(vd);
+}
+var_details_t *var_details_get(struct open_file *of, uint64_t ts_num, char *vname)
+{
+    file_timestep_t *ts=NULL;
+    var_details_t *vd=NULL;
+
+    ts = timestep_get(of, ts_num);
+    var_details_map_iterator_t iter=ts->vars_map.find(vname);
+    if (iter != ts->vars_map.end()) {
+        vd=iter->second;
+    }
+
+    return(vd);
+}
+void var_details_del(struct open_file *of, char *vname)
+{
+    file_timestep_t *ts=NULL;
+    ts = timestep_get_current(of);
+    ts->vars_map.erase(vname);
+}
+
+
+
+int grank, gsize;
+
+MPI_Comm comm_self=MPI_COMM_SELF;
+MPI_Comm comm_world=MPI_COMM_WORLD;
+
+
+/**
+ * The next 3 utility functions are lifted from IOR.
+ */
+/******************************************************************************/
+/*
+ * Extract key/value pair from hint string.
+ */
+
+void
+ExtractHint(char * settingVal,
+            char * valueVal,
+            char * hintString)
+{
+    char * settingPtr,
+         * valuePtr,
+         * tmpPtr1,
+         * tmpPtr2;
+
+    settingPtr = (char *)strtok(hintString, "=");
+    valuePtr = (char *)strtok(NULL, " \t\r\n");
+    tmpPtr1 = settingPtr;
+    tmpPtr2 = (char *)strstr(settingPtr, "MPIIO_HINT__");
+    if (tmpPtr1 == tmpPtr2) {
+        settingPtr += strlen("MPIIO_HINT__");
+    }
+    strcpy(settingVal, settingPtr);
+    strcpy(valueVal, valuePtr);
+} /* ExtractHint() */
+
+
+/******************************************************************************/
+/*
+ * Set hints for MPIIO, HDF5, or NCMPI.
+ */
+#define MAX_HINT_STR 1024
+void
+SetHints(MPI_Info * mpiHints, char * hintsFileName)
+{
+    char           hintString[MAX_HINT_STR],
+                   settingVal[MAX_HINT_STR],
+                   valueVal[MAX_HINT_STR];
+    extern char ** environ;
+    int            i;
+    FILE         * fd;
+
+    /*
+     * This routine checks for hints from the environment and/or from the
+     * hints files.  The hints are of the form:
+     * 'MPIIO_HINT__<hint>=<value>', <hint> is the full name of the hint
+     * to be set, and <value> is the hint value.
+     * E.g., 'setenv MPIIO_HINT__panfs_concurrent_write 1'
+     * or 'MPIIO_HINT__panfs_concurrent_write=1' in the hints file.
+     */
+    MPI_Info_create(mpiHints);
+
+    /* get hints from environment */
+    for (i = 0; environ[i] != NULL; i++) {
+        /* if this is an IOR_HINT, pass the hint to the info object */
+        if (strncmp(environ[i], "MPIIO_HINT", strlen("MPIIO_HINT")) == 0) {
+            strcpy(hintString, environ[i]);
+            ExtractHint(settingVal, valueVal, hintString);
+            MPI_Info_set(*mpiHints, settingVal, valueVal);
+        }
+    }
+
+    /* get hints from hints file */
+    if (strcmp(hintsFileName, "") != 0) {
+
+        /* open the hint file */
+        fd = fopen(hintsFileName, "r");
+        if (fd == NULL) {
+            printf("cannot open hints file\n");
+        } else {
+            /* iterate over hints file */
+            while(fgets(hintString, MAX_HINT_STR, fd) != NULL) {
+                if (strncmp(hintString, "MPIIO_HINT", strlen("MPIIO_HINT")) == 0) {
+                    ExtractHint(settingVal, valueVal, hintString);
+                    MPI_Info_set(*mpiHints, settingVal, valueVal);
+                }
+            }
+            /* close the hints files */
+            if (fclose(fd) != 0) printf("cannot close hints file\n");
+        }
+    }
+} /* SetHints() */
+
+
+/******************************************************************************/
+/*
+ * Show all hints (key/value pairs) in an MPI_Info object.
+ */
+
+void ShowHints(MPI_Info * mpiHints)
+{
+    char key[MPI_MAX_INFO_VAL],
+         value[MPI_MAX_INFO_VAL];
+    int  flag,
+         i,
+         nkeys;
+
+    MPI_Info_get_nkeys(*mpiHints, &nkeys);
+
+    for (i = 0; i < nkeys; i++) {
+        MPI_Info_get_nthkey(*mpiHints, i, key);
+        MPI_Info_get(*mpiHints, key, MPI_MAX_INFO_VAL-1, value, &flag);
+        printf("mpiHint[%d]: %s = %s\n", i, key, value);
+    }
+} /* ShowHints() */
+
+
+int32_t getTypeSize(
+        enum ADIOS_DATATYPES type,
+        void *val)
+{
+    switch (type)
+    {
+    case adios_byte:
+    case adios_unsigned_byte:
+        return 1;
+
+    case adios_string:
+        return strlen ((char *) val);
+
+    case adios_short:
+    case adios_unsigned_short:
+        return 2;
+
+    case adios_integer:
+    case adios_unsigned_integer:
+        return 4;
+
+    case adios_real:
+        return 4;
+
+    case adios_long:
+    case adios_unsigned_long:
+        return 8;
+
+    case adios_double:
+        return 8;
+
+    case adios_long_double:
+        return 16;
+
+    case adios_complex:
+        return 2 * 4;
+
+    case adios_double_complex:
+        return 2 * 8;
+
+    default:
+        return -1;
+    }
+}
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int adios_nssi_filter_is_anon_dim(
+        int fd,
+        const char *dimname);
+extern void adios_nssi_filter_set_anon_dim(
+        int fd,
+        const char *dimname,
+        const uint64_t dimvalue);
+
+#ifdef __cplusplus
+}
+#endif
+int write_cache(const char *client_id, int8_t free_memory)
+{
+    int rc=0;
+
+    int timestamps_written=0;
+
+    if (DEBUG>2) printf("myrank(%d): enter write_cache(client_id=%s)\n", grank, client_id);
+
+
+    open_file_map_iterator_t of_iter=open_file_map.begin();
+    for(;of_iter != open_file_map.end();of_iter++) {
+        open_file *of=of_iter->second;
+
+        if ((client_id != NULL) && (strcmp(client_id, of->writer_id)) != 0) {
+            fprintf(stdout, "flusher != writer - file(%s) client_id(%s) writer_id(%s)\n", of->ofname, client_id, of->writer_id);
+            continue;
+        }
+
+        int64_t fd;
+        if (DEBUG>3) printf("start adios_open\n");
+        if (DEBUG>3) printf("adios_open: using MPI_COMM_WORLD\n");
+        Func_Timer("adios_open", rc = adios_open(&fd, of->gname, of->ofname, of->omode, &comm_world););
+        if (rc != 0) {
+            printf("Error opening file \"%s\": %d\n", of->ofname, rc);
+        }
+        if (DEBUG>3) printf("end adios_open\n");
+
+        file_timestep_list_iterator_t ts_iter=of->timesteps.begin();
+        while(ts_iter != of->timesteps.end()) {
+            var_details_t *vd=NULL;
+
+            file_timestep_t *ts=*ts_iter;
+
+            fprintf(stdout, "timestep - file(%s) timestep(%ld) is_locked(%d) is_complete(%d)\n",
+                    of->ofname, ts->timestep, ts->is_locked, ts->is_complete);
+            if (ts->is_locked == TRUE) {
+                /* a reader has this timestep locked */
+                fprintf(stdout, "timestep is locked - file(%s) timestep(%ld) reader_id(%s)\n", of->ofname, ts->timestep, of->reader_id);
+//                break;
+            }
+            if (ts->is_complete == FALSE) {
+                /* the writer has not finished this timestep */
+                fprintf(stdout, "timestep is NOT complete - file(%s) timestep(%ld)\n", of->ofname, ts->timestep);
+                break;
+            }
+
+            uint64_t total_size=0;
+            Func_Timer("adios_group_size", rc = adios_group_size(fd, ts->group_size, &total_size););
+            if (rc != 0) {
+                printf("adios_group_size failed: %d\n", rc);
+            }
+
+            var_details_list_iterator_t vd_list_iter=ts->vars_list.begin();
+            for(;vd_list_iter != ts->vars_list.end();vd_list_iter++) {
+                var_details_map_iterator_t vd_iter=ts->vars_map.find(*vd_list_iter);
+                if (vd_iter == ts->vars_map.end()) {
+                    fprintf(stdout, "couldn't find vname(%s) in the vd map\n", *vd_list_iter);
+                    continue;
+                }
+
+                vd = vd_iter->second;
+
+                if (!vd->is_scalar) {
+                    for(int i=0;i<vd->ndims;i++) {
+                        vd->offset[i]=0;
+                        if (DEBUG>3) printf("writing offset myrank(%d) vd(%d) vpath(%s) vname(%s) opath(%s) oname(%s) odata(%lu)\n",
+                                grank, i, vd->var_path, vd->var_name, vd->offset_path[i], vd->offset_name[i], vd->offset[i]);
+                        if (adios_nssi_filter_is_anon_dim(fd, vd->offset_name[i]) == TRUE) {
+                            if (DEBUG>2) printf("server_rank(%d) writing anon dim vname(%s)\n", global_rank, vd->offset_name[i]);
+                            adios_nssi_filter_set_anon_dim(fd, vd->offset_name[i], vd->offset[i]);
+                        } else {
+                            if (DEBUG>2) printf("server_rank(%d) writing aggregated offset vname(%s)\n", global_rank, vd->offset_name[i]);
+                            Func_Timer("adios_set_path_var", adios_set_path_var(fd, vd->offset_path[i], vd->offset_name[i]););
+                            Func_Timer("adios_write", adios_write(fd, vd->offset_name[i], &(vd->offset[i])););
+                        }
+                    }
+                    for(int i=0;i<vd->ndims;i++) {
+                        if (DEBUG>3) printf("writing count myrank(%d) vd(%d) vpath(%s) vname(%s) dpath(%s) dname(%s) ddata(%lu)\n",
+                                grank, i, vd->var_path, vd->var_name, vd->count_path[i], vd->count_name[i], vd->global[i]);
+                        if (adios_nssi_filter_is_anon_dim(fd, vd->count_name[i]) == TRUE) {
+                            if (DEBUG>2) printf("server_rank(%d) writing anon dim vname(%s)\n", global_rank, vd->count_name[i]);
+                            adios_nssi_filter_set_anon_dim(fd, vd->count_name[i], vd->global[i]);
+                        } else {
+                            if (DEBUG>2) printf("server_rank(%d) writing aggregated dim vname(%s)\n", global_rank, vd->global_name[i]);
+                            Func_Timer("adios_set_path_var", adios_set_path_var(fd, vd->count_path[i], vd->count_name[i]););
+                            Func_Timer("adios_write", adios_write(fd, vd->count_name[i], &(vd->global[i])););
+                        }
+                    }
+                }
+
+                if (DEBUG>3) printf("writing array myrank(%d) fd(%ld) vname(%s) vdata(%lu)\n", grank, fd, vd->var_name, *(uint64_t*)vd->cache_ptr);
+                if (DEBUG>2) printf("server_rank(%d) writing aggregated array vname(%s)\n", global_rank, vd->var_name);
+                Func_Timer("adios_set_path_var", adios_set_path_var(fd, vd->var_path, vd->var_name););
+                Func_Timer("adios_write", adios_write(fd, vd->var_name, vd->cache_ptr););
+            }
+
+            if ((free_memory==TRUE) && (ts->is_locked == FALSE)) {
+                /* release resources associated with the timestep */
+                var_details_map_iterator_t vd_iter=ts->vars_map.begin();
+                while(vd_iter != ts->vars_map.end()) {
+                    char *key=vd_iter->first;
+
+                    vd = vd_iter->second;
+                    for(int i=0;i<vd->ndims;i++) {
+                        if (vd->global_path != NULL) free(vd->global_path[i]);
+                        if (vd->global_name != NULL) free(vd->global_name[i]);
+                        if (vd->count_path != NULL) free(vd->count_path[i]);
+                        if (vd->count_name != NULL) free(vd->count_name[i]);
+                        if (vd->offset_path != NULL) free(vd->offset_path[i]);
+                        if (vd->offset_name != NULL) free(vd->offset_name[i]);
+                    }
+                    if (vd->global_path != NULL) free(vd->global_path);
+                    if (vd->global_name!= NULL) free(vd->global_name);
+                    if (vd->global != NULL) free(vd->global);
+                    if (vd->count_path != NULL) free(vd->count_path);
+                    if (vd->count_name != NULL) free(vd->count_name);
+                    if (vd->count != NULL) free(vd->count);
+                    if (vd->offset_path != NULL) free(vd->offset_path);
+                    if (vd->offset_name != NULL) free(vd->offset_name);
+                    if (vd->offset != NULL) free(vd->offset);
+
+                    ts->vars_map.erase(vd_iter++);
+
+                    free(key);
+                }
+                if (ts->cache_buffer != NULL) free(ts->cache_buffer);
+
+                ts->vars_list.clear();
+
+                delete ts;
+            }
+
+            timestamps_written++;
+            of->last_written_timestep=ts->timestep;
+
+            if ((free_memory==TRUE) && (ts->is_locked == FALSE)) {
+                of->timesteps.erase(ts_iter++);
+            } else {
+                ts_iter++;
+            }
+        }
+
+        Func_Timer("adios_close", adios_close(fd););
+    }
+
+    if (DEBUG>2) printf("myrank(%d): exit write_cache(client_id=%s)\n", grank, client_id);
+
+    return(timestamps_written);
+}
+
+/* -------------------- SERVER-SIDE STUBS ---------- */
+
+
+/**
+ * @brief Open a netcdf dataset.
+ *
+ * Open an ADIOS dataset.
+ */
+int nssi_coupling_open_stub(
+        const unsigned long request_id,
+        const nssi_remote_pid *caller,
+        const adios_open_args *args,
+        const nssi_rma *data_addr,
+        const nssi_rma *res_addr)
+{
+    int rc = 0;
+    char omode[2];
+    adios_open_res res;  /* this is what we send back to the client */
+    MPI_Info mpiHints = MPI_INFO_NULL;
+    int64_t fd=-1;
+    open_file *of=NULL;
+
+    memset(&res, 0, sizeof(res));
+
+    if (DEBUG>2) printf("myrank(%d): enter nssi_coupling_open_stub(%s, %d)\n", grank, args->fname, args->mode);
+
+//    SetHints(&mpiHints, "");
+//    ShowHints(&mpiHints);
+
+    of = open_file_get(args->fname);
+    if (DEBUG>3) printf("myrank(%d): nssi_coupling_open_stub(%s, %d)\n", grank, args->fname, args->mode);
+    if (of == NULL) {
+        of=open_file_add(args->fname);
+
+        strcpy(of->writer_id, args->client_id);
+        strcpy(of->gname, args->gname);
+    }
+    if (of->is_open == FALSE) {
+        of->omode[0]='\0';
+        of->omode[1]='\0';
+        switch(args->mode) {
+        case ADIOS_MODE_READ:
+            of->omode[0]='r';
+            break;
+        case ADIOS_MODE_WRITE:
+            of->omode[0]='w';
+            break;
+        case ADIOS_MODE_APPEND:
+            of->omode[0]='a';
+            break;
+        case ADIOS_MODE_UPDATE:
+            of->omode[0]='u';
+            break;
+        default:
+            break;
+        }
+        of->current_timestep++;
+        file_timestep_t *ts=new file_timestep_t(of->current_timestep);
+        of->timesteps.push_back(ts);
+
+        of->is_open=TRUE;
+    }
+
+    if (DEBUG>2) printf("myrank(%d): exit nssi_coupling_open_stub(%s, %d): fd=%ld, fd=%p\n", grank, args->fname, args->mode, of->ofdesc, of->ofdesc);
+
+    res.fd=of->ofdesc;
+
+cleanup:
+    /* send the ncid and return code back to client */
+    rc = nssi_send_result(caller, request_id, rc, &res, res_addr);
+
+    return rc;
+}
+
+int flush_unlocked_timesteps(void)
+{
+    return(write_cache(NULL, TRUE));
+}
+
+int nssi_coupling_group_size_stub(
+        const unsigned long request_id,
+        const nssi_remote_pid *caller,
+        const adios_group_size_args *args,
+        const nssi_rma *data_addr,
+        const nssi_rma *res_addr)
+{
+    int rc = 0;
+    uint64_t total_size=0;
+    open_file *of=NULL;
+
+    if (DEBUG>2) printf("myrank(%d): enter nssi_coupling_group_size_stub(fd=%ld, pg_size=%ld)\n", grank, args->fd, args->data_size);
+
+    of=open_file_get(args->fd);
+    if (of == NULL) {
+        printf("nssi_coupling_group_size_stub failed: file not open(fd=%ld)\n", args->fd);
+        rc=-1;
+    } else {
+        file_timestep_t *current_ts=timestep_get_current(of);
+        if (current_ts == NULL) {
+            printf("nssi_coupling_group_size_stub failed: could not get current timestep(fd=%ld)\n", args->fd);
+            rc=-1;
+        } else {
+            if (DEBUG>2) printf("myrank(%d): creating timestep cache (of=%p ; ts=%p ; timestep=%d)\n",
+                    grank, of, current_ts, current_ts->timestep);
+
+            current_ts->group_size=args->data_size;
+            current_ts->cache_size=args->data_size;
+            current_ts->bytes_left=args->data_size;
+            current_ts->cache_buffer=(char *)malloc(args->data_size);
+            while(current_ts->cache_buffer == NULL) {
+                // insufficient memory to start a new timestep.  check if there are unlocked timesteps to flush.
+                if (flush_unlocked_timesteps() == FALSE) {
+                    // there are no timesteps to flush.  fail.
+                    rc=-1;
+                    break;
+                }
+                // retry
+                current_ts->cache_buffer=(char *)malloc(args->data_size);
+            }
+            if (DEBUG>2) printf("myrank(%d): timestep cache (of=%p ; ts=%p ; timestep=%d ; cache_size=%ld ; buffer=%p)\n",
+                    grank, of, current_ts, current_ts->timestep, current_ts->cache_size, current_ts->cache_buffer);
+        }
+    }
+
+    /* send result to client */
+    rc = nssi_send_result(caller, request_id, rc, NULL, res_addr);
+
+    if (DEBUG>2) printf("myrank(%d): exit nssi_coupling_group_size_stub(%ld)\n", grank, args->fd);
+
+    return rc;
+}
+
+int nssi_coupling_close_stub(
+        const unsigned long request_id,
+        const nssi_remote_pid *caller,
+        const adios_close_args *args,
+        const nssi_rma *data_addr,
+        const nssi_rma *res_addr)
+{
+    int rc = 0;
+    open_file *of=NULL;
+
+    if (DEBUG>2) printf("myrank(%d): enter nssi_coupling_close_stub(%ld, %s)\n", grank, args->fd, args->fname);
+
+    of=open_file_get(args->fd);
+    if (of == NULL) {
+        printf("nssi_coupling_close_stub failed: file not open(fd=%ld)\n", args->fd);
+        rc=-1;
+    } else {
+        file_timestep_t *current_ts=timestep_get_current(of);
+        if (current_ts == NULL) {
+            printf("nssi_coupling_close_stub failed: could not get current timestep(fd=%ld)\n", args->fd);
+            rc=-1;
+        } else {
+            current_ts->is_complete=TRUE;
+        }
+
+        of->is_open=FALSE;
+    }
+
+    /* send result to client */
+    rc = nssi_send_result(caller, request_id, rc, NULL, res_addr);
+
+    if (DEBUG>2) printf("myrank(%d): exit nssi_coupling_close_stub(%ld, %s)\n", grank, args->fd, args->fname);
+
+    return rc;
+}
+
+int nssi_coupling_read_stub(
+        const unsigned long request_id,
+        const nssi_remote_pid *caller,
+        const adios_read_args *args,
+        const nssi_rma *data_addr,
+        const nssi_rma *res_addr)
+{
+    int rc = 0;
+
+    if (DEBUG>2) printf("myrank(%d): enter nssi_coupling_read_stub(%ld)\n", grank, args->fd);
+
+    // ENOTSUP - use read API
+
+    if (DEBUG>2) printf("myrank(%d): exit nssi_coupling_read_stub(%ld)\n", grank, args->fd);
+
+    return rc;
+}
+
+static void recursive_copy_chunk_in(char *src,
+                                    var_details_t *vd,
+                                    uint64_t src_offset,
+                                    uint64_t dst_offset,
+                                    uint64_t *src_index,
+                                    uint64_t *dst_index,
+                                    int current_dim)
+{
+    uint64_t my_src_offset=0;
+    uint64_t my_dst_offset=0;
+
+    if (current_dim < vd->ndims-1) {
+        for (int i=0;i<vd->count[current_dim];i++) {
+            my_src_offset = src_index[current_dim];
+            my_dst_offset = dst_index[current_dim];
+//            if (DEBUG > 3) printf("src_offset[%d](%lu)\n", current_dim, vd->offset[current_dim]);
+            my_dst_offset += (vd->offset[current_dim] * vd->atype_size);
+            for (int j=current_dim+1;j<vd->ndims;j++) {
+                my_src_offset *= vd->count[j];
+                my_dst_offset *= vd->global[j];
+            }
+
+            src_index[current_dim+1]=0;
+            dst_index[current_dim+1]=0;
+            recursive_copy_chunk_in(src, vd, src_offset+my_src_offset, dst_offset+my_dst_offset,
+                                    src_index, dst_index, current_dim+1);
+            src_index[current_dim] += vd->atype_size;
+            dst_index[current_dim] += vd->atype_size;
+        }
+    } else {
+        dst_offset += (vd->offset[current_dim] * vd->atype_size);
+        memcpy(vd->cache_ptr + dst_offset,
+               src + src_offset,
+               vd->count[current_dim]*vd->atype_size);
+    }
+}
+
+static void copy_chunk_in(char *src,
+                          var_details_t *vd)
+{
+    uint64_t *src_index=(uint64_t *)calloc(vd->ndims, sizeof(uint64_t));
+    uint64_t *dst_index=(uint64_t*)calloc(vd->ndims, sizeof(uint64_t));
+    uint64_t src_offset=0;
+    uint64_t dst_offset=0;
+    int current_dim=0;
+
+    memset(src_index, 0, vd->ndims*sizeof(uint64_t));
+    memset(dst_index, 0, vd->ndims*sizeof(uint64_t));
+    recursive_copy_chunk_in(src, vd, src_offset, dst_offset, src_index, dst_index, current_dim);
+
+    free(src_index);
+    free(dst_index);
+}
+
+static void recursive_copy_chunk_out(char *dst,
+                                     var_details_t *vd,
+                                     uint64_t dst_offset,
+                                     uint64_t src_offset,
+                                     uint64_t *dst_index,
+                                     uint64_t *src_index,
+                                     int current_dim)
+{
+    uint64_t my_dst_offset=0;
+    uint64_t my_src_offset=0;
+
+    if (current_dim < vd->ndims-1) {
+        for (int i=0;i<vd->count[current_dim];i++) {
+            my_dst_offset = dst_index[current_dim];
+            my_src_offset = src_index[current_dim];
+//            if (DEBUG > 3) printf("dst_offset[%d](%lu)\n", current_dim, vd->offset[current_dim]);
+            my_src_offset += (vd->offset[current_dim] * vd->atype_size);
+            for (int j=current_dim+1;j<vd->ndims;j++) {
+                my_dst_offset *= vd->count[j];
+                my_src_offset *= vd->global[j];
+            }
+
+            dst_index[current_dim+1]=0;
+            src_index[current_dim+1]=0;
+            recursive_copy_chunk_out(dst, vd, dst_offset+my_dst_offset, src_offset+my_src_offset,
+                                     dst_index, src_index, current_dim+1);
+            dst_index[current_dim] += vd->atype_size;
+            src_index[current_dim] += vd->atype_size;
+        }
+    } else {
+        src_offset += (vd->offset[current_dim] * vd->atype_size);
+        memcpy(dst + dst_offset,
+               vd->cache_ptr + src_offset,
+               vd->count[current_dim]*vd->atype_size);
+    }
+}
+
+static void copy_chunk_out(char *dst,
+                           var_details_t *vd)
+{
+    uint64_t *dst_index=(uint64_t *)calloc(vd->ndims, sizeof(uint64_t));
+    uint64_t *src_index=(uint64_t*)calloc(vd->ndims, sizeof(uint64_t));
+    uint64_t dst_offset=0;
+    uint64_t src_offset=0;
+    int current_dim=0;
+
+    memset(dst_index, 0, vd->ndims*sizeof(uint64_t));
+    memset(src_index, 0, vd->ndims*sizeof(uint64_t));
+    recursive_copy_chunk_out(dst, vd, dst_offset, src_offset, dst_index, src_index, current_dim);
+
+    free(dst_index);
+    free(src_index);
+}
+
+int nssi_coupling_write_stub(
+        const unsigned long request_id,
+        const nssi_remote_pid *caller,
+        const adios_write_args *args,
+        const nssi_rma *data_addr,
+        const nssi_rma *res_addr)
+{
+    int rc = 0;
+    adios_write_res res;
+    char vpathname[ADIOS_PATH_MAX];
+    int pathlen;
+    char *v=NULL;
+    int i=0;
+
+    if (DEBUG>2) printf("myrank(%d): enter nssi_coupling_write_stub(fd=%ld, vsize=%ld)\n", grank, args->fd, args->vsize);
+
+    open_file *of=open_file_get(args->fd);
+    file_timestep_t *ts=timestep_get_current(of);
+
+    if (DEBUG>2) printf("myrank(%d): timestep cache (of=%p ; ts=%p ; timestep=%d ; cache_size=%ld ; bytes_left=%ld ; buffer=%p)\n",
+            grank, of, ts, ts->timestep, ts->cache_size, ts->bytes_left, ts->cache_buffer);
+
+    v=(char *)malloc(args->vsize);
+
+    Func_Timer("nssi_get_data", rc = nssi_get_data(caller, v, args->vsize, data_addr););
+    if (rc != NSSI_OK) {
+        printf("Could not get var data on client\n");
+        goto cleanup;
+    }
+
+    if (DEBUG>3) printf("server_rank(%d) vname(%s) vsize(%ld) is_scalar(%d) writer_rank(%ld)\n",
+            global_rank, args->vname, args->vsize, args->is_scalar, args->writer_rank);
+
+    if (!args->is_scalar) {
+        if (DEBUG>2) printf("server_rank(%d) caching non-scalar vname(%s) vsize(%ld)\n", global_rank, args->vname, args->vsize);
+        if (DEBUG>3) printf("allocated v(%p), len(%ld)\n", v, args->vsize);
+
+        uint64_t write_offset=1;
+        uint64_t write_size=1;
+        var_details_t *vd=NULL;
+
+        vd = var_details_get(of, args->vname);
+        if (vd == NULL) {
+            if (DEBUG>3) printf("************\nvar_details NOT found for %s\n************\n", args->vname);
+
+            vd = new var_details_t;
+
+            vd->is_scalar=FALSE;
+
+//            vd->fd = args->fd;
+            strcpy(vd->var_path, args->vpath);
+            strcpy(vd->var_name, args->vname);
+            vd->ndims = args->offsets.offsets_len;
+
+            vd->num_elements = 1;
+            vd->global_path = (char **)calloc(args->gdims.gdims_len, sizeof(char *));
+            vd->global_name = (char **)calloc(args->gdims.gdims_len, sizeof(char *));
+            vd->global  = (uint64_t *)calloc(args->gdims.gdims_len, sizeof(uint64_t));;
+            for (int i=0;i<args->gdims.gdims_len;i++) {
+                vd->global_path[i] = strdup(args->gdims.gdims_val[i].vpath);
+                vd->global_name[i] = strdup(args->gdims.gdims_val[i].vname);
+                vd->global[i] = args->gdims.gdims_val[i].vdata;
+
+                vd->num_elements *= args->gdims.gdims_val[i].vdata;
+            }
+
+            vd->offset_path = (char **)calloc(args->offsets.offsets_len, sizeof(char *));
+            vd->offset_name = (char **)calloc(args->offsets.offsets_len, sizeof(char *));
+            vd->offset = (uint64_t *)calloc(args->offsets.offsets_len, sizeof(uint64_t));
+            for (int i=0;i<args->offsets.offsets_len;i++) {
+                vd->offset_path[i] = strdup(args->offsets.offsets_val[i].vpath);
+                vd->offset_name[i] = strdup(args->offsets.offsets_val[i].vname);
+                vd->offset[i] = args->offsets.offsets_val[i].vdata;
+            }
+
+            vd->count_path = (char **)calloc(args->ldims.ldims_len, sizeof(char *));
+            vd->count_name = (char **)calloc(args->ldims.ldims_len, sizeof(char *));
+            vd->count  = (uint64_t *)calloc(args->ldims.ldims_len, sizeof(uint64_t));;
+            for (int i=0;i<args->ldims.ldims_len;i++) {
+                vd->count_path[i] = strdup(args->ldims.ldims_val[i].vpath);
+                vd->count_name[i] = strdup(args->ldims.ldims_val[i].vname);
+                vd->count[i] = args->ldims.ldims_val[i].vdata;
+            }
+
+            vd->atype      = (enum ADIOS_DATATYPES)args->atype;
+            vd->atype_size = getTypeSize(vd->atype, v);
+            vd->len        = vd->num_elements * vd->atype_size;
+
+            vd->cache_offset = ts->cache_size-ts->bytes_left;
+            vd->cache_ptr    = ts->cache_buffer+vd->cache_offset;
+
+            ts->bytes_left  -= vd->len;
+
+            var_details_add(of, vd);
+
+            if (DEBUG > 3) printf("********** ts->cache_size(%lu)-ts->bytes_left(%lu)==vd->cache_offset(%lu)\n",
+                     ts->cache_size, ts->bytes_left, vd->cache_offset);
+            if (DEBUG > 3) printf("********** vd->num_elements(%lu)*vd->atype_size(%u)==vd->len(%lu)\n",
+                     vd->num_elements, vd->atype_size, vd->len);
+        }
+
+        if (DEBUG > 3) printf("********** ts->cache_size(%lu) ;  vd->cache_offset(%lu) ; vd->cache_buffer(%p) ; vd->cache_ptr(%p)\n",
+                 ts->cache_size, vd->cache_offset, ts->cache_buffer, vd->cache_ptr);
+
+        for (int i=0;i<args->offsets.offsets_len;i++) {
+            vd->offset[i] = args->offsets.offsets_val[i].vdata;
+            write_offset *= args->offsets.offsets_val[i].vdata;
+
+            if (DEBUG > 3) printf("********** var_name(%s) ;  vd->offset[%d](%lu)\n",
+                     vd->var_name, i, vd->offset[i]);
+        }
+        write_offset *= vd->atype_size;
+
+        for (int i=0;i<args->ldims.ldims_len;i++) {
+            vd->count[i] = args->ldims.ldims_val[i].vdata;
+            write_size *= args->ldims.ldims_val[i].vdata;
+
+            if (DEBUG > 3) printf("********** var_name(%s) ;  vd->count[%d](%lu)\n",
+                     vd->var_name, i, vd->count[i]);
+        }
+        write_size *= vd->atype_size;
+
+        /* sanity checks */
+        if (write_size != args->vsize) {
+            printf("write size conflict: write_size(%lu) != args->vsize(%lu)\n",
+                    write_size, args->vsize);
+        }
+        if (write_offset+write_size > vd->len) {
+            printf("variable overflow: write_offset(%lu)+write_size(%lu)=(%lu) > vd->len(%lu)\n",
+                    write_offset, write_size, write_offset+write_size, vd->len);
+        }
+        if (vd->cache_offset+write_size > ts->cache_size) {
+            printf("cache overflow: vd->cache_offset(%lu)+write_size(%lu)=(%lu) > ts->cache_size(%lu)\n",
+                    vd->cache_offset, write_size, vd->cache_offset+write_size, ts->cache_size);
+            abort();
+        }
+
+        if (DEBUG > 3) printf("********** write_size(%lu) ;  write_offset(%lu)\n",
+                 write_size, write_offset);
+
+        copy_chunk_in(v, vd);
+
+    } else {
+        if (DEBUG>2) printf("server_rank(%d) writing scalar vname(%s) vsize(%ld)\n", global_rank, args->vname, args->vsize);
+
+        uint64_t write_offset=1;
+        uint64_t write_size=1;
+        var_details_t *vd=NULL;
+
+        vd = var_details_get(of, args->vname);
+        if (vd == NULL) {
+            if (DEBUG>3) printf("************\nvar_details NOT found for %s\n************\n", args->vname);
+
+            vd = new var_details_t;
+
+            vd->is_scalar=TRUE;
+
+//            vd->fd = args->fd;
+            strcpy(vd->var_path, args->vpath);
+            strcpy(vd->var_name, args->vname);
+
+            vd->ndims = 0;
+            vd->num_elements = 1;
+
+            vd->atype      = (enum ADIOS_DATATYPES)args->atype;
+            vd->atype_size = getTypeSize(vd->atype, v);
+            vd->len        = vd->num_elements * vd->atype_size;
+
+            vd->cache_offset = ts->cache_size-ts->bytes_left;
+            vd->cache_ptr    = ts->cache_buffer+vd->cache_offset;
+
+            ts->bytes_left  -= vd->len;
+
+            var_details_add(of, vd);
+        }
+
+        write_offset = 0;
+        write_size   = vd->atype_size;
+
+        /* sanity checks */
+        if (write_size != args->vsize) {
+            printf("write size conflict: write_size(%lu) != args->vsize(%lu)\n",
+                    write_size, args->vsize);
+        }
+        if (write_offset+write_size > vd->len) {
+            printf("variable overflow: write_offset(%lu)+write_size(%lu)=(%lu) > vd->len(%lu)\n",
+                    write_offset, write_size, write_offset+write_size, vd->len);
+        }
+        if (vd->cache_offset+write_size > ts->cache_size) {
+            printf("cache overflow: vd->cache_offset(%lu)+write_size(%lu)=(%lu) > ts->cache_size(%lu)\n",
+                    vd->cache_offset, write_size, vd->cache_offset+write_size, ts->cache_size);
+        }
+
+        memcpy(vd->cache_ptr+write_offset, v, write_size);
+
+    }
+
+    free(v);
+
+    res.bytes_written=args->vsize;
+
+cleanup:
+
+    /* send result to client */
+    rc = nssi_send_result(caller, request_id, rc, &res, res_addr);
+
+    if (DEBUG>2) printf("myrank(%d): exit nssi_coupling_write_stub(fd=%ld, vsize=%ld)\n", grank, args->fd, args->vsize);
+
+    return rc;
+}
+
+int nssi_coupling_start_calc_stub(
+        const unsigned long request_id,
+        const nssi_remote_pid *caller,
+        const adios_start_calc_args *args,
+        const nssi_rma *data_addr,
+        const nssi_rma *res_addr)
+{
+    int rc = 0;
+
+    if (DEBUG>2) printf("myrank(%d): enter nssi_coupling_start_calc_stub(%ld)\n", grank, args->fd);
+
+    /* send result to client */
+    rc = nssi_send_result(caller, request_id, rc, NULL, res_addr);
+
+    if (DEBUG>2) printf("myrank(%d): exit nssi_coupling_start_calc_stub(%ld)\n", grank, args->fd);
+
+    return rc;
+}
+
+int nssi_coupling_stop_calc_stub(
+        const unsigned long request_id,
+        const nssi_remote_pid *caller,
+        const adios_stop_calc_args *args,
+        const nssi_rma *data_addr,
+        const nssi_rma *res_addr)
+{
+    int rc = 0;
+
+    if (DEBUG>2) printf("myrank(%d): enter nssi_coupling_stop_calc_stub(%ld)\n", grank, args->fd);
+
+
+    /* send result to client */
+    rc = nssi_send_result(caller, request_id, rc, NULL, res_addr);
+
+    if (DEBUG>2) printf("myrank(%d): exit nssi_coupling_stop_calc_stub(%ld)\n", grank, args->fd);
+
+    return rc;
+}
+
+int nssi_coupling_end_iter_stub(
+        const unsigned long request_id,
+        const nssi_remote_pid *caller,
+        const adios_end_iter_args *args,
+        const nssi_rma *data_addr,
+        const nssi_rma *res_addr)
+{
+    int rc = 0;
+
+    if (DEBUG>2) printf("myrank(%d): enter nssi_coupling_end_iter_stub(%ld)\n", grank, args->fd);
+
+
+    /* send result to client */
+    rc = nssi_send_result(caller, request_id, rc, NULL, res_addr);
+
+    if (DEBUG>2) printf("myrank(%d): exit nssi_coupling_end_iter_stub(%ld)\n", grank, args->fd);
+
+    return rc;
+}
+
+int nssi_coupling_finalize_stub(
+        const unsigned long request_id,
+        const nssi_remote_pid *caller,
+        const adios_finalize_args *args,
+        const nssi_rma *data_addr,
+        const nssi_rma *res_addr)
+{
+    int rc = 0;
+
+    if (DEBUG>2) printf("myrank(%d): enter nssi_coupling_finalize_stub(%s)\n", grank, args->client_id);
+
+
+//    write_cache(args->client_id);
+
+
+    /* send result to client */
+    rc = nssi_send_result(caller, request_id, rc, NULL, res_addr);
+
+    if (DEBUG>2) printf("myrank(%d): exit nssi_coupling_finalize_stub(%s)\n", grank, args->client_id);
+
+    return rc;
+}
+
+/**
+ * @brief Open a netcdf dataset.
+ *
+ * Open an ADIOS dataset.
+ */
+int nssi_coupling_read_fopen_stub(
+        const unsigned long request_id,
+        const nssi_remote_pid *caller,
+        const adios_read_fopen_args *args,
+        const nssi_rma *data_addr,
+        const nssi_rma *res_addr)
+{
+    int rc = 0;
+    char omode[2];
+    adios_open_res res;  /* this is what we send back to the client */
+    MPI_Info mpiHints = MPI_INFO_NULL;
+    int64_t fd=-1;
+    open_file *of=NULL;
+
+    memset(&res, 0, sizeof(res));
+
+    if (DEBUG>2) printf("myrank(%d): enter nssi_coupling_read_fopen_stub(%s, %d)\n", grank, args->fname, args->requested_timestep);
+
+//    SetHints(&mpiHints, "");
+//    ShowHints(&mpiHints);
+
+    of = open_file_get(args->fname);
+    if (DEBUG>3) printf("myrank(%d): nssi_coupling_read_fopen_stub(%s, %d)\n", grank, args->fname, args->requested_timestep);
+    if (of == NULL) {
+        res.fd=-1; /* the requested file is not currently in core.  out of core not supported.  return error. */
+        goto cleanup;
+    }
+
+    file_timestep_t *ts=timestep_get(of, args->requested_timestep);
+    if (ts == NULL) {
+        res.fd=-1; /* the requested timestep is not currently in core.  out of core not supported.  return error. */
+        goto cleanup;
+    } else {
+        if ((ts->is_complete==TRUE) && (ts->is_locked==FALSE)) {
+            strcpy(of->reader_id, args->client_id);
+            ts->is_locked=TRUE;
+            if (DEBUG>3) printf("nssi_coupling_read_fopen_stub(%s, %d): timestep is complete and locked\n", grank, args->fname, args->requested_timestep, of->ofdesc, of->ofdesc);
+        }
+    }
+
+    res.fd=of->ofdesc;
+
+cleanup:
+    if (DEBUG>2) printf("myrank(%d): exit nssi_coupling_read_fopen_stub(%s, %d): fd=%ld\n", grank, args->fname, args->requested_timestep, res.fd);
+
+    /* send the ncid and return code back to client */
+    rc = nssi_send_result(caller, request_id, rc, &res, res_addr);
+
+    return rc;
+}
+
+int nssi_coupling_read_fclose_stub(
+        const unsigned long request_id,
+        const nssi_remote_pid *caller,
+        const adios_read_fclose_args *args,
+        const nssi_rma *data_addr,
+        const nssi_rma *res_addr)
+{
+    int rc = 0;
+    open_file *of=NULL;
+
+    if (DEBUG>2) printf("myrank(%d): enter nssi_coupling_read_fclose_stub(%ld, %s)\n", grank, args->fd, args->fname);
+
+    of=open_file_get(args->fd);
+    if (of == NULL) {
+        printf("nssi_coupling_read_fclose_stub failed: file not open(fd=%ld)\n", args->fd);
+        rc=-1;
+    } else {
+        file_timestep_t *ts=timestep_get(of, args->open_timestep);
+        if (ts == NULL) {
+            printf("nssi_coupling_read_fclose_stub failed: could not find timestep(fd=%ld, ts_num=%lu)\n", args->fd, args->open_timestep);
+            rc=-1;
+        } else {
+            if(strcmp(of->reader_id, args->client_id) == 0) {
+                of->reader_id[0]='\0';
+                ts->is_locked=FALSE;
+            } else {
+                printf("nssi_coupling_read_fclose_stub failed: timestep(fd=%ld, ts_num=%lu) fopen by different client (me=%s,opener=%s)\n",
+                        args->fd, args->open_timestep, args->client_id, of->reader_id);
+                rc=-1;
+            }
+        }
+    }
+
+    /* send result to client */
+    rc = nssi_send_result(caller, request_id, rc, NULL, res_addr);
+
+    if (DEBUG>2) printf("myrank(%d): exit nssi_coupling_read_fclose_stub(%ld, %s)\n", grank, args->fd, args->fname);
+
+    return rc;
+}
+
+int nssi_coupling_read_get_vartype_size_stub(
+        const unsigned long request_id,
+        const nssi_remote_pid *caller,
+        const adios_read_get_vartype_size_args *args,
+        const nssi_rma *data_addr,
+        const nssi_rma *res_addr)
+{
+    int rc = 0;
+    open_file *of=NULL;
+    adios_read_get_vartype_size_res res;
+
+    if (DEBUG>2) printf("myrank(%d): enter nssi_coupling_read_get_vartype_size_stub(%ld)\n", grank, args->fd);
+
+    of=open_file_get(args->fd);
+    if (of == NULL) {
+        printf("nssi_coupling_read_get_vartype_size_stub failed: file not open(fd=%ld)\n", args->fd);
+        rc=-1;
+    } else {
+        file_timestep_t *ts=timestep_get(of, args->open_timestep);
+        if (ts == NULL) {
+            printf("nssi_coupling_read_get_vartype_size_stub failed: could not find timestep(fd=%ld, ts_num=%lu)\n",
+                    args->fd, args->open_timestep);
+            rc=-1;
+        } else {
+            if ((strcmp(of->reader_id, args->client_id) == 0) && (ts->is_locked==TRUE)) {
+                var_details_t *vd=var_details_get(of, args->open_timestep, args->vname);
+                if (vd == NULL) {
+                    printf("nssi_coupling_read_get_vartype_size_stub failed: could not find variable(fd=%ld, ts_num=%lu, varname=%s)\n",
+                            args->fd, args->open_timestep, args->vname);
+                    rc=-1;
+                } else {
+                    res.vartype_size=vd->atype_size;
+                }
+            } else {
+                printf("nssi_coupling_read_get_vartype_size_stub failed: timestep(fd=%ld, ts_num=%lu) fopen by different client (me=%s,opener=%s)\n",
+                        args->fd, args->open_timestep, args->client_id, of->reader_id);
+                rc=-1;
+            }
+        }
+    }
+
+    /* send result to client */
+    rc = nssi_send_result(caller, request_id, rc, &res, res_addr);
+
+    if (DEBUG>2) printf("myrank(%d): exit nssi_coupling_read_get_vartype_size_stub(fd=%ld res.vartype_size=%lu)\n",
+            grank, args->fd, res.vartype_size);
+
+    return rc;
+}
+
+int nssi_coupling_read_read_var_stub(
+        const unsigned long request_id,
+        const nssi_remote_pid *caller,
+        const adios_read_read_var_args *args,
+        const nssi_rma *data_addr,
+        const nssi_rma *res_addr)
+{
+    int rc = 0;
+    open_file *of=NULL;
+    adios_read_read_var_res res;
+
+    char *v=NULL;
+
+    res.bytes_read=-1;
+
+    if (DEBUG>2) printf("myrank(%d): enter nssi_coupling_read_read_var_stub(%ld)\n", grank, args->fd);
+
+    of=open_file_get(args->fd);
+    if (of == NULL) {
+        printf("nssi_coupling_read_read_var_stub failed: file not open(fd=%ld)\n", args->fd);
+        rc=-1;
+    } else {
+        file_timestep_t *ts=timestep_get(of, args->open_timestep);
+        if (ts == NULL) {
+            printf("nssi_coupling_read_read_var_stub failed: could not find timestep(fd=%ld, ts_num=%lu)\n", args->fd, args->open_timestep);
+            rc=-1;
+        } else {
+            if ((strcmp(of->reader_id, args->client_id) == 0) && (ts->is_locked==TRUE)) {
+                uint64_t read_size=1;
+                var_details_t *vd=var_details_get(of, args->open_timestep, args->vname);
+
+                for (int i=0;i<vd->ndims;i++) {
+                    vd->offset[i] = args->offsets[i];
+
+                    if (DEBUG > 3) printf("********** var_name(%s) ;  vd->offset[%d](%lu)\n",
+                             vd->var_name, i, vd->offset[i]);
+                }
+                for (int i=0;i<vd->ndims;i++) {
+                    vd->count[i] = args->counts[i];
+                    read_size *= args->counts[i];
+
+                    if (DEBUG > 3) printf("********** var_name(%s) ;  vd->count[%d](%lu) ;  vd->globals[%d](%lu)\n",
+                             vd->var_name, i, vd->count[i], i, vd->global[i]);
+                }
+                int8_t is_scalar=FALSE;
+                if (read_size==1) {
+                    is_scalar=TRUE;
+                }
+                read_size *= vd->atype_size;
+
+                /* sanity checks */
+                if (read_size != args->max_read) {
+                    printf("read size conflict: read_size(%lu) != args->max_read(%lu)\n",
+                            read_size, args->max_read);
+                }
+                if (vd->cache_offset+read_size > ts->cache_size) {
+                    printf("cache overflow: vd->cache_offset(%lu)+read_size(%lu)=(%lu) > ts->cache_size(%lu)\n",
+                            vd->cache_offset, read_size, vd->cache_offset+read_size, ts->cache_size);
+                    abort();
+                }
+
+                if (DEBUG > 3) printf("********** read_size(%lu)\n", read_size);
+
+                v=(char*)malloc(read_size);
+                if (is_scalar==TRUE) {
+                    memcpy(v, vd->cache_ptr, read_size);
+                } else {
+                    copy_chunk_out(v, vd);
+                }
+
+                Func_Timer("nssi_put_data", rc = nssi_put_data(caller, v, read_size, data_addr, -1););
+                if (rc != NSSI_OK) {
+                    printf("Could not put var data on client\n");
+                    goto cleanup;
+                }
+
+                res.bytes_read=read_size;
+
+            } else {
+                printf("nssi_coupling_read_read_var_stub failed: timestep(fd=%ld, ts_num=%lu) fopen by different client (me=%s,opener=%s)\n",
+                        args->fd, args->open_timestep, args->client_id, of->reader_id);
+                rc=-1;
+            }
+        }
+    }
+
+cleanup:
+    /* send result to client */
+    rc = nssi_send_result(caller, request_id, rc, &res, res_addr);
+
+    if (v) free(v);
+
+    if (DEBUG>2) printf("myrank(%d): exit nssi_coupling_read_read_var_stub(%ld)\n", grank, args->fd);
+
+    return rc;
+}
+
+/* -------- END SERVER-SIDE STUBS -------------- */
+
+int nssi_coupling_server_init(const char *adios_config_file)
+{
+    int rc=NSSI_OK;
+
+    if (DEBUG>3) printf("start adios_init(%s)\n", adios_config_file);
+    rc = adios_init(adios_config_file);
+    if (rc != 1) {
+        printf("adios_init() failed: %d\n", rc);
+        return(-1);
+    }
+    if (DEBUG>3) printf("end adios_init(%s)\n", adios_config_file);
+
+
+    /* register server stubs */
+    NSSI_REGISTER_SERVER_STUB(ADIOS_OPEN_OP,       nssi_coupling_open_stub,       adios_open_args,       adios_open_res);
+    NSSI_REGISTER_SERVER_STUB(ADIOS_GROUP_SIZE_OP, nssi_coupling_group_size_stub, adios_group_size_args, void);
+    NSSI_REGISTER_SERVER_STUB(ADIOS_READ_OP,       nssi_coupling_read_stub,       adios_read_args,       adios_read_res);
+    NSSI_REGISTER_SERVER_STUB(ADIOS_WRITE_OP,      nssi_coupling_write_stub,      adios_write_args,      adios_write_res);
+    NSSI_REGISTER_SERVER_STUB(ADIOS_END_ITER_OP,   nssi_coupling_end_iter_stub,   adios_end_iter_args,   void);
+    NSSI_REGISTER_SERVER_STUB(ADIOS_START_CALC_OP, nssi_coupling_start_calc_stub, adios_start_calc_args, void);
+    NSSI_REGISTER_SERVER_STUB(ADIOS_STOP_CALC_OP,  nssi_coupling_stop_calc_stub,  adios_stop_calc_args,  void);
+    NSSI_REGISTER_SERVER_STUB(ADIOS_CLOSE_OP,      nssi_coupling_close_stub,      adios_close_args,      void);
+    NSSI_REGISTER_SERVER_STUB(ADIOS_FINALIZE_OP,   nssi_coupling_finalize_stub,   adios_finalize_args,   void);
+
+    NSSI_REGISTER_SERVER_STUB(ADIOS_READ_FOPEN_OP,            nssi_coupling_read_fopen_stub,            adios_read_fopen_args,            adios_read_fopen_res);
+    NSSI_REGISTER_SERVER_STUB(ADIOS_READ_FCLOSE_OP,           nssi_coupling_read_fclose_stub,           adios_read_fclose_args,           void);
+    NSSI_REGISTER_SERVER_STUB(ADIOS_READ_GET_VARTYPE_SIZE_OP, nssi_coupling_read_get_vartype_size_stub, adios_read_get_vartype_size_args, adios_read_get_vartype_size_res);
+    NSSI_REGISTER_SERVER_STUB(ADIOS_READ_READ_VAR_OP,         nssi_coupling_read_read_var_stub,         adios_read_read_var_args,         adios_read_read_var_res);
+
+    return 0;
+}
+
+
+
+static void generate_contact_info(nssi_remote_pid *myid)
+{
+    nssi_remote_pid *all_pids=NULL;
+    int rank, np;
+    char contact_path[1024];
+
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    //printf("rank (%d)\n", rank);
+
+    if (rank==0) {
+        MPI_Comm_size(MPI_COMM_WORLD, &np);
+        all_pids=(nssi_remote_pid *)malloc(np*sizeof(nssi_remote_pid));
+    }
+    MPI_Gather(myid, sizeof(nssi_remote_pid), MPI_BYTE,
+               all_pids, sizeof(nssi_remote_pid), MPI_BYTE,
+               0, MPI_COMM_WORLD);
+    if (rank==0) {
+        char *contact_file=getenv("ADIOS_NSSI_CONTACT_INFO");
+        if (contact_file==NULL) {
+            printf("ADIOS_NSSI_CONTACT_INFO env var is undefined.\n");
+            free(all_pids);
+            return;
+        }
+//        sprintf(contact_path, "%s.%04d", contact_file, rank);
+        sprintf(contact_path, "%s.tmp", contact_file);
+        if (DEBUG>3) printf("creating temp contact file (%s)\n", contact_path);
+        FILE *f=fopen(contact_path, "w");
+        if (f==NULL) {
+            perror("fopen");
+        }
+        for (int i=0;i<np;i++) {
+            fprintf(f, "%u@%u@%s@%u\n",
+                    all_pids[i].nid, all_pids[i].pid,
+                    all_pids[i].hostname, (unsigned int)ntohs(all_pids[i].port));
+        }
+//        fprintf(f, "%u@%u@%s@%u\n",
+//                myid->nid, myid->pid,
+//                myid->hostname, (unsigned int)ntohs(myid->port));
+        fclose(f);
+        if (DEBUG>3) printf("renaming temp contact file (%s) to contact file (%s)\n", contact_path, contact_file);
+        rename(contact_path, contact_file);
+        free(all_pids);
+    }
+    MPI_Barrier(MPI_COMM_WORLD);
+}
+
+
+/**
+ * @brief The LWFS xfer-server.
+ */
+int main(int argc, char **argv)
+{
+    int rc = NSSI_OK;
+
+    nssi_service nssi_svc;
+//    log_level debug_level;
+    char logfile[1024];
+    int rank, np;
+
+    MPI_Init(&argc, &argv);
+    MPI_Comm_rank(MPI_COMM_WORLD, &global_rank);
+    MPI_Comm_rank(MPI_COMM_WORLD, &rank);
+    MPI_Comm_size(MPI_COMM_WORLD, &np);
+    grank=rank;
+    gsize=np;
+
+    /* options that can be overriden by the command-line */
+    bool daemon_flag = false;
+    int verbose = 5;  /* default debug_level */
+    int num_threads = 0;
+    int server_pid = 128;   /* process ID of the server */
+    int server_port = 7728; /* TCP port of the server */
+
+    memset(&nssi_svc, 0, sizeof(nssi_service));
+
+    /* initialize and enable logging */
+//    if (args_info.logfile_arg != NULL) {
+//        sprintf(logfile, "%s.%04d", "nssi_coupling_server.log", rank);
+//        logger_init((log_level)verbose, logfile);
+//    } else {
+//        logger_init((log_level)verbose, NULL);
+//    }
+//    netcdf_debug_level=(log_level)(log_level)args_info.verbose_arg;
+//    debug_level = (log_level)args_info.verbose_arg;
+
+//    logger_init((log_level)verbose, NULL);
+
+    if (daemon_flag) {
+        nssi_daemonize();
+    }
+
+#ifdef HAVE_PORTALS
+    nssi_ptl_init(PTL_IFACE_SERVER, server_pid);
+    rc = nssi_rpc_init(NSSI_RPC_PTL, NSSI_RPC_XDR);
+    if (rc != NSSI_OK) {
+        printf("could not init rpc: %s\n",
+                nssi_err_str(rc));
+        return rc;
+    }
+    nssi_remote_pid myid;
+    memset(&myid, 0, sizeof(nssi_remote_pid));
+    nssi_ptl_get_id(&myid);
+    generate_contact_info(&myid);
+#endif
+#ifdef HAVE_INFINIBAND
+    memset(&nssi_svc.req_addr.match_id, 0, sizeof(nssi_remote_pid));
+    strcpy(nssi_svc.req_addr.match_id.hostname, args_info.server_addr_arg);
+    nssi_svc.req_addr.match_id.port = args_info.server_port_arg;
+
+    nssi_ib_init(&nssi_svc);
+    rc = nssi_rpc_init(NSSI_RPC_IB, NSSI_RPC_XDR);
+    if (rc != NSSI_OK) {
+        printf("could not init rpc: %s\n",
+                nssi_err_str(rc));
+        return rc;
+    }
+    generate_contact_info(&nssi_svc.req_addr.match_id);
+#endif
+
+    if (DEBUG>3) printf("Initialize staging service\n");
+
+    /* initialize the lwfs service */
+    rc = nssi_service_init(0, NSSI_SHORT_REQUEST_SIZE, &nssi_svc);
+    if (rc != NSSI_OK) {
+        printf("could not init nssi_svc: %s\n",
+                nssi_err_str(rc));
+        return -1;
+    }
+
+    /* initialize staging service */
+    rc = nssi_coupling_server_init(argv[1]);
+
+    /* start processing requests */
+    nssi_svc.max_reqs = -1;
+    rc = nssi_service_start(&nssi_svc, num_threads);
+    if (rc != NSSI_OK) {
+        printf("exited nssi_svc: %s\n",
+                nssi_err_str(rc));
+    }
+
+    flush_unlocked_timesteps();
+
+    adios_finalize(rank);
+
+    /* shutdown the nssi_svc */
+    if (DEBUG>3) printf("shutting down service library\n");
+    nssi_service_fini(&nssi_svc);
+
+    nssi_rpc_fini();
+
+    MPI_Finalize();
+
+    return rc;
+}
diff --git a/src/nssi_staging_server.cpp b/src/nssi_staging_server.cpp
index 55c391f..69ce74f 100644
--- a/src/nssi_staging_server.cpp
+++ b/src/nssi_staging_server.cpp
@@ -468,11 +468,11 @@ int nssi_staging_read_stub(
         Func_Timer("adios_set_path_var", adios_set_path_var(args->fd, args->offsets.offsets_val[i].vpath, args->offsets.offsets_val[i].vname););
         Func_Timer("adios_read", adios_read(args->fd, args->offsets.offsets_val[i].vname, odata, 8););
     }
-    for (int i=0;i<args->dims.dims_len;i++) {
+    for (int i=0;i<args->ldims.ldims_len;i++) {
         uint64_t *ddata=(uint64_t *)malloc(sizeof(uint8_t));
-        *ddata = args->dims.dims_val[i].vdata;
-        Func_Timer("adios_set_path_var", adios_set_path_var(args->fd, args->dims.dims_val[i].vpath, args->dims.dims_val[i].vname););
-        Func_Timer("adios_read", adios_read(args->fd, args->dims.dims_val[i].vname, ddata, 8););
+        *ddata = args->ldims.ldims_val[i].vdata;
+        Func_Timer("adios_set_path_var", adios_set_path_var(args->fd, args->ldims.ldims_val[i].vpath, args->ldims.ldims_val[i].vname););
+        Func_Timer("adios_read", adios_read(args->fd, args->ldims.ldims_val[i].vname, ddata, 8););
     }
 
     v=(char *)calloc(args->max_read, 1);
@@ -543,8 +543,8 @@ int nssi_staging_write_stub(
         chunk->atype = (enum ADIOS_DATATYPES)args->atype;
         chunk->len   = args->vsize;
         chunk->num_elements = 1;
-        for (int i=0;i<args->dims.dims_len;i++) {
-            chunk->num_elements *= args->dims.dims_val[i].vdata;
+        for (int i=0;i<args->ldims.ldims_len;i++) {
+            chunk->num_elements *= args->ldims.ldims_val[i].vdata;
         }
         chunk->offset_path = (char **)calloc(args->offsets.offsets_len, sizeof(char *));
         chunk->offset_name = (char **)calloc(args->offsets.offsets_len, sizeof(char *));
@@ -554,13 +554,13 @@ int nssi_staging_write_stub(
             chunk->offset_name[i] = strdup(args->offsets.offsets_val[i].vname);
             chunk->offset[i] = args->offsets.offsets_val[i].vdata;
         }
-        chunk->count_path = (char **)calloc(args->dims.dims_len, sizeof(char *));
-        chunk->count_name = (char **)calloc(args->dims.dims_len, sizeof(char *));
-        chunk->count  = (uint64_t *)calloc(args->dims.dims_len, sizeof(uint64_t));;
-        for (int i=0;i<args->dims.dims_len;i++) {
-            chunk->count_path[i] = strdup(args->dims.dims_val[i].vpath);
-            chunk->count_name[i] = strdup(args->dims.dims_val[i].vname);
-            chunk->count[i] = args->dims.dims_val[i].vdata;
+        chunk->count_path = (char **)calloc(args->ldims.ldims_len, sizeof(char *));
+        chunk->count_name = (char **)calloc(args->ldims.ldims_len, sizeof(char *));
+        chunk->count  = (uint64_t *)calloc(args->ldims.ldims_len, sizeof(uint64_t));;
+        for (int i=0;i<args->ldims.ldims_len;i++) {
+            chunk->count_path[i] = strdup(args->ldims.ldims_val[i].vpath);
+            chunk->count_name[i] = strdup(args->ldims.ldims_val[i].vname);
+            chunk->count[i] = args->ldims.ldims_val[i].vdata;
         }
         add_chunk(chunk);
 
@@ -645,6 +645,31 @@ int nssi_staging_end_iter_stub(
     return rc;
 }
 
+int nssi_staging_finalize_stub(
+        const unsigned long request_id,
+        const nssi_remote_pid *caller,
+        const adios_finalize_args *args,
+        const nssi_rma *data_addr,
+        const nssi_rma *res_addr)
+{
+    int rc = 0;
+
+    if (DEBUG>2) printf("myrank(%d): enter nssi_staging_finalize_stub(%s)\n", grank, args->client_id);
+
+    /*
+     *
+     * do nothing
+     *
+     */
+
+    /* send result to client */
+    rc = nssi_send_result(caller, request_id, rc, NULL, res_addr);
+
+    if (DEBUG>2) printf("myrank(%d): exit nssi_staging_finalize_stub(%s)\n", grank, args->client_id);
+
+    return rc;
+}
+
 /* -------- END SERVER-SIDE STUBS -------------- */
 
 int nssi_staging_server_init(const char *adios_config_file)
@@ -669,6 +694,7 @@ int nssi_staging_server_init(const char *adios_config_file)
     NSSI_REGISTER_SERVER_STUB(ADIOS_START_CALC_OP, nssi_staging_start_calc_stub, adios_start_calc_args, void);
     NSSI_REGISTER_SERVER_STUB(ADIOS_STOP_CALC_OP, nssi_staging_stop_calc_stub, adios_stop_calc_args, void);
     NSSI_REGISTER_SERVER_STUB(ADIOS_CLOSE_OP, nssi_staging_close_stub, adios_close_args, void);
+    NSSI_REGISTER_SERVER_STUB(ADIOS_FINALIZE_OP, nssi_staging_finalize_stub, adios_finalize_args, void);
 
     return 0;
 }
diff --git a/src/read_bp.c b/src/read_bp.c
index c8e05ac..b0e9a41 100644
--- a/src/read_bp.c
+++ b/src/read_bp.c
@@ -26,6 +26,47 @@
 #include "dmalloc.h"
 #endif
 
+MPI_File * get_BP_file_handle(struct BP_file_handle * l, uint32_t file_index)
+{
+    if (!l)
+        return 0;
+
+    while (l)
+    {
+        if (l->file_index == file_index)
+            return &l->fh;
+
+        l = l->next;
+    }
+
+    return 0;
+}
+
+void add_BP_file_handle (struct BP_file_handle ** l, struct BP_file_handle * n)
+{
+    if (!n)
+        return;
+
+    n->next = *l;
+    *l = n;
+}
+
+
+void close_all_BP_files (struct BP_file_handle * l)
+{
+    struct BP_file_handle * n;
+
+    while (l)
+    {
+        n = l->next;
+
+        MPI_File_close (&l->fh);
+        free (l);
+
+        l = n;
+    }
+}
+
 /* Return 0: if file is little endian, 1 if file is big endian 
  * We know if it is different from the current system, so here
  * we determine the current endianness and report accordingly.
@@ -60,22 +101,25 @@ ADIOS_FILE * adios_read_bp_fopen (const char * fname, MPI_Comm comm)
     adios_errno = 0;
     fh = (struct BP_FILE *) malloc (sizeof (struct BP_FILE));
     if (!fh) {
-        error( err_no_memory, "Cannot allocate memory for file info.");
+        adios_error ( err_no_memory, "Cannot allocate memory for file info.");
         return NULL;
     }
-    fh->comm =  comm;
+
+    fh->fname = (fname ? strdup (fname) : 0L);
+    fh->sfh = 0;
+    fh->comm = comm;
     fh->gvar_h = 0;
     fh->pgs_root = 0;
     fh->vars_root = 0;
     fh->attrs_root = 0;
     fh->b = malloc (sizeof (struct adios_bp_buffer_struct_v1));
     if (!fh->b) {
-        error( err_no_memory, "Cannot allocate memory for file info.");
+        adios_error ( err_no_memory, "Cannot allocate memory for file info.");
         return NULL;
     }
     fp = (ADIOS_FILE *) malloc (sizeof (ADIOS_FILE));
     if (!fp) {
-        error( err_no_memory, "Cannot allocate memory for file info.");
+        adios_error ( err_no_memory, "Cannot allocate memory for file info.");
         return NULL;
     }
 
@@ -123,7 +167,7 @@ ADIOS_FILE * adios_read_bp_fopen (const char * fname, MPI_Comm comm)
     alloc_namelist (&fp->group_namelist,fp->groups_count); 
     for (i=0;i<fp->groups_count;i++) {
         if (!fp->group_namelist[i]) {
-            error(err_no_memory, "Could not allocate buffer for %d strings in adios_fopen()", fp->groups_count);
+            adios_error (err_no_memory, "Could not allocate buffer for %d strings in adios_fopen()", fp->groups_count);
             adios_read_bp_fclose(fp);
             return NULL;
         }
@@ -165,6 +209,10 @@ int adios_read_bp_fclose (ADIOS_FILE *fp)
     adios_errno = 0;
     if (fh->mpi_fh) 
         MPI_File_close (&mpi_fh);
+
+    if (fh->sfh)
+        close_all_BP_files (fh->sfh);
+
     if (fh->b) {
         adios_posix_close_internal (fh->b);
         free(fh->b);
@@ -318,6 +366,9 @@ int adios_read_bp_fclose (ADIOS_FILE *fp)
 
         free(ah);
     }
+
+    if (fh->fname)
+        free (fh->fname);
         
     if (fh)
         free (fh);    
@@ -339,7 +390,7 @@ ADIOS_GROUP * adios_read_bp_gopen (ADIOS_FILE *fp, const char * grpname)
             break; 
     }
     if (grpid >= fh->gvar_h->group_count) {
-        error( err_invalid_group, "Invalid group name %s", grpname);
+        adios_error ( err_invalid_group, "Invalid group name %s", grpname);
         return NULL;
     }
     return adios_read_bp_gopen_byid(fp, grpid);
@@ -354,19 +405,19 @@ ADIOS_GROUP * adios_read_bp_gopen_byid (ADIOS_FILE *fp, int grpid)
 
     adios_errno = 0;
     if (grpid < 0 || grpid >= fh->gvar_h->group_count) {
-        error( err_invalid_group, "Invalid group index %d", grpid);
+        adios_error ( err_invalid_group, "Invalid group index %d", grpid);
         return NULL;
     }
 
     gh = (struct BP_GROUP *) malloc(sizeof(struct BP_GROUP));
     if (!gh) {
-        error( err_no_memory, "Could not allocate memory for group info");
+        adios_error ( err_no_memory, "Could not allocate memory for group info");
         return NULL;
     }
 
     gp = (ADIOS_GROUP *) malloc(sizeof(ADIOS_GROUP));
     if (!gp) {
-        error( err_no_memory, "Could not allocate memory for group info");
+        adios_error ( err_no_memory, "Could not allocate memory for group info");
         free(gh);
         return NULL;
     }
@@ -411,7 +462,7 @@ ADIOS_GROUP * adios_read_bp_gopen_byid (ADIOS_FILE *fp, int grpid)
     alloc_namelist (&(gp->var_namelist), gp->vars_count);
     for (i=0;i<gp->vars_count;i++) {
         if (!gp->var_namelist[i]) { 
-            error(err_no_memory, "Could not allocate buffer for %d strings in adios_gopen()", gp->vars_count);
+            adios_error (err_no_memory, "Could not allocate buffer for %d strings in adios_gopen()", gp->vars_count);
             adios_read_bp_gclose(gp);
             return NULL;
         }
@@ -423,7 +474,7 @@ ADIOS_GROUP * adios_read_bp_gopen_byid (ADIOS_FILE *fp, int grpid)
     alloc_namelist (&(gp->attr_namelist), gp->attrs_count);
     for (i=0;i<gp->attrs_count;i++) {
         if (!gp->attr_namelist[i]) {
-            error(err_no_memory, "Could not allocate buffer for %d strings in adios_gopen()", gp->vars_count);
+            adios_error (err_no_memory, "Could not allocate buffer for %d strings in adios_gopen()", gp->vars_count);
             adios_read_bp_gclose(gp);
             return NULL;
         }
@@ -441,7 +492,7 @@ int adios_read_bp_gclose (ADIOS_GROUP *gp)
 
     adios_errno = 0;
     if (!gh) {
-        error (err_invalid_group_struct, "group handle is NULL!");
+        adios_error (err_invalid_group_struct, "group handle is NULL!");
         return  err_invalid_group_struct;
     }
     else
@@ -468,11 +519,11 @@ int adios_read_bp_get_attr (ADIOS_GROUP * gp, const char * attrname, enum ADIOS_
 
     adios_errno = 0;
     if (!gp) {
-        error(err_invalid_group_struct, "Null pointer passed as group to adios_get_attr()");
+        adios_error (err_invalid_group_struct, "Null pointer passed as group to adios_get_attr()");
         return adios_errno;
     }
     if (!attrname) {
-        error(err_invalid_attrname, "Null pointer passed as attribute name to adios_get_attr()!");
+        adios_error (err_invalid_attrname, "Null pointer passed as attribute name to adios_get_attr()!");
         return adios_errno;
     }
 
@@ -489,7 +540,7 @@ int adios_read_bp_get_attr (ADIOS_GROUP * gp, const char * attrname, enum ADIOS_
             break; 
     }
     if (attrid >= gp->attrs_count) {
-        error( err_invalid_attrname, "Invalid attribute name %s", attrname);
+        adios_error ( err_invalid_attrname, "Invalid attribute name %s", attrname);
         return adios_errno;
     }
 
@@ -508,21 +559,21 @@ int adios_read_bp_get_attr_byid (ADIOS_GROUP * gp, int attrid,
 
     adios_errno = 0;
     if (!gp) {
-        error(err_invalid_group_struct, "Null pointer passed as group to adios_get_attr()");
+        adios_error (err_invalid_group_struct, "Null pointer passed as group to adios_get_attr()");
         return adios_errno;
     }
     gh = (struct BP_GROUP *) gp->gh;
     if (!gh) {
-        error(err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh group handle is NULL!");
+        adios_error (err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh group handle is NULL!");
         return adios_errno;
     }
     fh = gh->fh;
     if (!fh) {
-        error(err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh->fh file handle is NULL!");
+        adios_error (err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh->fh file handle is NULL!");
         return adios_errno;
     }
     if (attrid < 0 || attrid >= gh->attrs_count) {
-        error(err_invalid_attrid, "Invalid attribute id %d (allowed 0..%d)", attrid, gh->attrs_count);
+        adios_error (err_invalid_attrid, "Invalid attribute id %d (allowed 0..%d)", attrid, gh->attrs_count);
         return adios_errno;
     }
 
@@ -530,7 +581,7 @@ int adios_read_bp_get_attr_byid (ADIOS_GROUP * gp, int attrid,
     for (i = 0; i < attrid && attr_root; i++)
         attr_root = attr_root->next;
     if (i != attrid) {
-        error (err_corrupted_attribute, "Attribute id=%d is valid but was not found in internal data structures!",attrid);
+        adios_error (err_corrupted_attribute, "Attribute id=%d is valid but was not found in internal data structures!",attrid);
         return adios_errno; 
     }
 
@@ -568,7 +619,7 @@ int adios_read_bp_get_attr_byid (ADIOS_GROUP * gp, int attrid,
         }
 
         if (!var_root) {
-            error (err_invalid_attribute_reference, 
+            adios_error (err_invalid_attribute_reference, 
                    "Attribute %s/%s in group %s is a reference to variable ID %d, which is not found", 
                    attr_root->attr_path, attr_root->attr_name, attr_root->group_name,
                    attr_root->characteristics[0].var_id);
@@ -595,7 +646,7 @@ int adios_read_bp_get_attr_byid (ADIOS_GROUP * gp, int attrid,
                  (var_root->characteristics[0].dims.count == 1)) {
                  ; // this conversions are allowed
             } else {
-                error(err_invalid_attribute_reference, 
+                adios_error (err_invalid_attribute_reference, 
                     "Attribute %s/%s in group %s, typeid=%d is a reference to an %d-dimensional array variable "
                     "%s/%s of type %s, which is not supported in ADIOS",
                     attr_root->attr_path, attr_root->attr_name, attr_root->group_name, attr_root->type,
@@ -619,7 +670,7 @@ int adios_read_bp_get_attr_byid (ADIOS_GROUP * gp, int attrid,
             snprintf(varname, 512, "%s/%s", var_root->var_path, var_root->var_name);
             tmpdata = (char *) malloc (count+1);
             if (tmpdata == NULL) {
-                error(err_no_memory, 
+                adios_error (err_no_memory, 
                       "Cannot allocate memory of %lld bytes for reading in data for attribute %s/%s of group %s.",
                       count, attr_root->attr_path, attr_root->attr_name, attr_root->group_name);
                 return adios_errno;
@@ -629,7 +680,7 @@ int adios_read_bp_get_attr_byid (ADIOS_GROUP * gp, int attrid,
             
             if (status < 0) {
                 char *msg = strdup(adios_get_last_errmsg());
-                error((enum ADIOS_ERRCODES) status, 
+                adios_error ((enum ADIOS_ERRCODES) status, 
                       "Cannot read data of variable %s/%s for attribute %s/%s of group %s: %s",
                       var_root->var_path, var_root->var_name, 
                       attr_root->attr_path, attr_root->attr_name, attr_root->group_name,
@@ -696,11 +747,11 @@ static int adios_read_bp_find_var(ADIOS_GROUP *gp, const char *varname)
 
     adios_errno = 0;
     if (!gp) {
-        error(err_invalid_group_struct, "Null pointer passed as group");
+        adios_error (err_invalid_group_struct, "Null pointer passed as group");
         return -1;
     }
     if (!varname) {
-        error(err_invalid_varname, "Null pointer passed as variable name!");
+        adios_error (err_invalid_varname, "Null pointer passed as variable name!");
         return -1;
     }
 
@@ -723,7 +774,7 @@ static int adios_read_bp_find_var(ADIOS_GROUP *gp, const char *varname)
             break; 
     }
     if (varid >= gp->vars_count) {
-        error(err_invalid_varname, "Invalid variable name %s", varname);
+        adios_error (err_invalid_varname, "Invalid variable name %s", varname);
         return -1;
     }
     return varid;
@@ -734,7 +785,7 @@ static int adios_read_bp_find_var(ADIOS_GROUP *gp, const char *varname)
 {\
     var = calloc (num, sz); \
     if (!var)    {\
-        error_at_line ( err_no_memory, __FILE__, __LINE__, "Could not allocate memory for ", comment, " in common_read_get_characteristics"); \
+        adios_error_at_line (err_no_memory, __FILE__, __LINE__, "Could not allocate memory for ", comment, " in common_read_get_characteristics"); \
         return; \
     }\
 }
@@ -743,7 +794,7 @@ static int adios_read_bp_find_var(ADIOS_GROUP *gp, const char *varname)
 {\
     var = malloc (sz); \
     if (!var)    {\
-        error_at_line ( err_no_memory, __FILE__, __LINE__, "Could not allocate memory for ", comment, " in common_read_get_characteristics"); \
+        adios_error_at_line (err_no_memory, __FILE__, __LINE__, "Could not allocate memory for ", comment, " in common_read_get_characteristics"); \
         return; \
     }\
 }\
@@ -773,7 +824,7 @@ static void adios_read_bp_get_characteristics (struct adios_index_var_struct_v1
         if (vi->value)
            memcpy(vi->value, var_root->characteristics [0].value, size);
         else {
-            error_at_line( err_no_memory, __FILE__, __LINE__, "Could not allocate memory for value in common_read_get_characteristics");
+            adios_error_at_line (err_no_memory, __FILE__, __LINE__, "Could not allocate memory for value in common_read_get_characteristics");
             return;
         }
     } else {
@@ -1295,41 +1346,44 @@ static void adios_read_bp_get_dimensions (struct adios_index_var_struct_v1 *var_
            in Fortran array, it can only be the last dim
            (always the slowest changing dim)
         */
-        if (ldims[0] == 1 && gdims[*ndim-1] == 0) {
-            /* first dimension is the time (C array)
-             * ldims[0] = 1 but gdims does not contain time info and 
-             * gdims[0] is 1st data dimension and 
-             * gdims is shorter by one value than ldims in case of C.
-             * Therefore, gdims[*ndim-1] = 0 if there is a time dimension. 
-             */
-            *timedim = 0;
-            // error check
-            if (file_is_fortran && *ndim > 1) {
-                fprintf(stderr,"ADIOS Error: this is a BP file with Fortran ordering but we found"
-                        "an array to have time dimension in the first dimension. l:g:o = (");
-                for (i=0; i < *ndim; i++) {
-                    fprintf(stderr,"%llu:%llu:%llu%s", ldims[i], gdims[i], offsets[i], (i<*ndim-1 ? ", " : "") );
-                }
-                fprintf(stderr, ")\n");
-            }
-            (*dims)[0] = ntsteps;
-            for (i=1; i < *ndim; i++) 
-                 (*dims)[i]=gdims[i-1];
-        }
-        else if (ldims[*ndim-1] == 1 && gdims[*ndim-1] == 0) {
-            // last dimension is the time (Fortran array)
-            *timedim = *ndim - 1;
-            if (!file_is_fortran && *ndim > 1) {
-                fprintf(stderr,"ADIOS Error: this is a BP file with C array ordering but we found"
-                        "an array to have time dimension in the last dimension. l:g:o = (");
-                for (i=0; i < *ndim; i++) {
-                    fprintf(stderr,"%llu:%llu:%llu%s", ldims[i], gdims[i], offsets[i], (i<*ndim-1 ? ", " : "") );
-                }
-                fprintf(stderr, ")\n");
-            }
-            for (i=0; i < *ndim-1; i++) 
-                 (*dims)[i]=gdims[i];
-             (*dims)[*timedim] = ntsteps;
+        if (gdims[*ndim-1] == 0)
+        {
+            if (!file_is_fortran) {
+                /* first dimension is the time (C array)
+                 * ldims[0] = 1 but gdims does not contain time info and 
+                 * gdims[0] is 1st data dimension and 
+                 * gdims is shorter by one value than ldims in case of C.
+                 * Therefore, gdims[*ndim-1] = 0 if there is a time dimension. 
+                 */
+                *timedim = 0;
+                // error check
+                if (*ndim > 1 && ldims[0] != 1) {
+                    fprintf(stderr,"ADIOS Error: this is a BP file with C ordering but we didn't find"
+                            "an array to have time dimension in the first dimension. l:g:o = (");
+                    for (i=0; i < *ndim; i++) {
+                        fprintf(stderr,"%llu:%llu:%llu%s", ldims[i], gdims[i], offsets[i], (i<*ndim-1 ? ", " : "") );
+                    }
+                    fprintf(stderr, ")\n");
+                }
+                (*dims)[0] = ntsteps;
+                for (i=1; i < *ndim; i++) 
+                    (*dims)[i]=gdims[i-1];
+            } else {
+                // last dimension is the time (Fortran array)
+                *timedim = *ndim - 1;
+
+                if (*ndim > 1 && ldims[*ndim-1] != 1) {
+                    fprintf(stderr,"ADIOS Error: this is a BP file with Fortran array ordering but we didn't find"
+                            "an array to have time dimension in the last dimension. l:g:o = (");
+                    for (i=0; i < *ndim; i++) {
+                        fprintf(stderr,"%llu:%llu:%llu%s", ldims[i], gdims[i], offsets[i], (i<*ndim-1 ? ", " : "") );
+                    }
+                    fprintf(stderr, ")\n");
+                }
+                for (i=0; i < *ndim-1; i++) 
+                    (*dims)[i]=gdims[i];
+                (*dims)[*timedim] = ntsteps;
+            }
         } else {
             // no time dimenstion
             for (i=0; i < *ndim; i++) 
@@ -1357,26 +1411,26 @@ ADIOS_VARINFO * adios_read_bp_inq_var_byid (ADIOS_GROUP *gp, int varid)
 
     adios_errno = 0;
     if (!gp) {
-        error(err_invalid_group_struct, "Null pointer passed as group to adios_inq_var()");
+        adios_error (err_invalid_group_struct, "Null pointer passed as group to adios_inq_var()");
         return NULL;
     }
     gh = (struct BP_GROUP *) gp->gh;
     if (!gh) {
-        error(err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh group handle is NULL!");
+        adios_error (err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh group handle is NULL!");
         return NULL;
     }
     fh = gh->fh;
     if (!fh) {
-        error(err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh->fh file handle is NULL!");
+        adios_error (err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh->fh file handle is NULL!");
         return NULL;
     }
     if (varid < 0 || varid >= gh->vars_count) {
-        error(err_invalid_varid, "Invalid variable id %d (allowed 0..%d)", varid, gh->vars_count);
+        adios_error (err_invalid_varid, "Invalid variable id %d (allowed 0..%d)", varid, gh->vars_count);
         return NULL;
     }
     vi = (ADIOS_VARINFO *) malloc(sizeof(ADIOS_VARINFO));
     if (!vi) {
-        error( err_no_memory, "Could not allocate memory for variable info");
+        adios_error ( err_no_memory, "Could not allocate memory for variable info");
         return NULL;
     }
 
@@ -1389,7 +1443,7 @@ ADIOS_VARINFO * adios_read_bp_inq_var_byid (ADIOS_GROUP *gp, int varid)
     }
 
     if (i!=varid) {
-        error (err_corrupted_variable, "Variable id=%d is valid but was not found in internal data structures!",varid);
+        adios_error (err_corrupted_variable, "Variable id=%d is valid but was not found in internal data structures!",varid);
         return NULL; 
     }
 
@@ -1398,11 +1452,12 @@ ADIOS_VARINFO * adios_read_bp_inq_var_byid (ADIOS_GROUP *gp, int varid)
 
     vi->type = var_root->type;
     if (!var_root->characteristics_count) {
-        error(err_corrupted_variable, "Variable %s does not have information on dimensions", 
+        adios_error (err_corrupted_variable, "Variable %s does not have information on dimensions", 
               gp->var_namelist[varid]);
         free(vi);
         return NULL;
     }
+    vi->characteristics_count = var_root->characteristics_count;
 
     /* Get value or min/max */
 
@@ -1410,7 +1465,7 @@ ADIOS_VARINFO * adios_read_bp_inq_var_byid (ADIOS_GROUP *gp, int varid)
                           &(vi->ndim), &(vi->dims), &(vi->timedim));
     
     if (file_is_fortran != futils_is_called_from_fortran()) {
-        /* If this is a Fortran written file and this is called from C code,  
+        /* If this is a Fortran written file and this is called from C code/  
            or this is a C written file and this is called from Fortran code ==>
            We need to reverse the order of the dimensions */
         swap_order(vi->ndim, vi->dims, &(vi->timedim));
@@ -1473,36 +1528,68 @@ void adios_read_bp_free_varinfo (ADIOS_VARINFO *vp)
 
 
 // To read subfiles
-#define MPI_FILE_READ_OPS2                                                                 \
-        bp_realloc_aligned(fh->b, slice_size);                                             \
-        fh->b->offset = 0;                                                                 \
-                                                                                           \
-        MPI_File sfh;                                                                      \
-        int err;                                                                           \
-        err = MPI_File_open (fh->comm                                                      \
-                      ,var_root->characteristics[start_idx + idx].file_name                \
-                      ,MPI_MODE_RDONLY                                                     \
-                      ,(MPI_Info)MPI_INFO_NULL                                             \
-                      ,&sfh                                                                \
-                      );                                                                   \
-       if (err != MPI_SUCCESS)                                                             \
-       {                                                                                   \
-           fprintf (stderr, "can not open file\n");                                        \
-           return -1;                                                                      \
-       }                                                                                   \
-                                                                                           \
-        MPI_File_seek (sfh                                                                 \
-                      ,(MPI_Offset)slice_offset                                            \
-                      ,MPI_SEEK_SET                                                        \
-                      );                                                                   \
-        MPI_File_read (sfh                                                                 \
-                      ,fh->b->buff                                                         \
-                      ,slice_size                                                          \
-                      ,MPI_BYTE                                                            \
-                      ,&status                                                             \
-                      );                                                                   \
-        MPI_File_close (&sfh);                                                             \
-        fh->b->offset = 0;                                                                 \
+#define MPI_FILE_READ_OPS2                                                                  \
+        bp_realloc_aligned(fh->b, slice_size);                                              \
+        fh->b->offset = 0;                                                                  \
+                                                                                            \
+        MPI_File * sfh;                                                                     \
+        sfh = get_BP_file_handle (fh->sfh                                                   \
+                                 ,var_root->characteristics[start_idx + idx].file_index     \
+                                 );                                                         \
+        if (!sfh)                                                                           \
+        {                                                                                   \
+            int err;                                                                        \
+            char * ch, * name_no_path, * name;                                              \
+            struct BP_file_handle * new_h =                                                 \
+                  (struct BP_file_handle *) malloc (sizeof (struct BP_file_handle));        \
+            new_h->file_index = var_root->characteristics[start_idx + idx].file_index;      \
+            new_h->next = 0;                                                                \
+            if (ch = strrchr (fh->fname, '/'))                                              \
+            {                                                                               \
+                name_no_path = malloc (strlen (ch + 1) + 1);                                \
+                strcpy (name_no_path, ch + 1);                                              \
+            }                                                                               \
+            else                                                                            \
+            {                                                                               \
+                name_no_path = malloc (strlen (fh->fname) + 1);                             \
+                strcpy (name_no_path, fh->fname);                                           \
+            }                                                                               \
+                                                                                            \
+            name = malloc (strlen (fh->fname) + 5 + strlen (name_no_path) + 1 + 10 + 1);    \
+            sprintf (name, "%s.dir/%s.%d", fh->fname, name_no_path, new_h->file_index);     \
+                                                                                            \
+            err = MPI_File_open (fh->comm                                                   \
+                                ,name                                                       \
+                                ,MPI_MODE_RDONLY                                            \
+                                ,(MPI_Info)MPI_INFO_NULL                                    \
+                                ,&new_h->fh                                                 \
+                                );                                                          \
+           if (err != MPI_SUCCESS)                                                          \
+           {                                                                                \
+               fprintf (stderr, "can not open file %S\n", name);                            \
+               return -1;                                                                   \
+           }                                                                                \
+                                                                                            \
+           add_BP_file_handle (&fh->sfh                                                     \
+                              ,new_h                                                        \
+                              );                                                            \
+           sfh = &new_h->fh;                                                                \
+                                                                                            \
+           free (name_no_path);                                                             \
+           free (name);                                                                     \
+        }                                                                                   \
+                                                                                            \
+        MPI_File_seek (*sfh                                                                 \
+                      ,(MPI_Offset)slice_offset                                             \
+                      ,MPI_SEEK_SET                                                         \
+                      );                                                                    \
+        MPI_File_read (*sfh                                                                 \
+                      ,fh->b->buff                                                          \
+                      ,slice_size                                                           \
+                      ,MPI_BYTE                                                             \
+                      ,&status                                                              \
+                      );                                                                    \
+        fh->b->offset = 0;                                                                  \
 
 
 int64_t adios_read_bp_read_var (ADIOS_GROUP * gp, const char * varname,
@@ -1515,31 +1602,403 @@ int64_t adios_read_bp_read_var (ADIOS_GROUP * gp, const char * varname,
 
     adios_errno = 0;
     if (!gp) {
-        error(err_invalid_group_struct, "Null pointer passed as group to adios_read_var()");
+        adios_error (err_invalid_group_struct, "Null pointer passed as group to adios_read_var()");
         return -adios_errno;
     }
 
     gh = (struct BP_GROUP *) gp->gh;
     if (!gh) {
-        error(err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh group handle is NULL!");
+        adios_error (err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh group handle is NULL!");
         return -adios_errno;
     }
 
     fh = gh->fh;
     if (!fh) {
-        error(err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh->fh file handle is NULL!");
+        adios_error (err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh->fh file handle is NULL!");
         return -adios_errno;
     }
 
     varid = adios_read_bp_find_var(gp, varname);
     if (varid < 0 || varid >= gh->vars_count) {
-        error(err_invalid_varid, "Invalid variable id %d (allowed 0..%d)", varid, gh->vars_count);
+        adios_error (err_invalid_varid, "Invalid variable id %d (allowed 0..%d)", varid, gh->vars_count);
         return -adios_errno;
     }
 
     return adios_read_bp_read_var_byid(gp, varid, start, count, data);
 }
 
+/***********************************************
+ * This routine is to read in data in a 'local *
+ * array fashion (as opposed to global array)  *
+ *     Q. Liu, 11/2010                         *
+ ***********************************************/
+int64_t adios_read_bp_read_local_var (ADIOS_GROUP * gp, const char * varname,
+                                      int vidx, const uint64_t * start,
+                                      const uint64_t * count, void * data)
+{
+    struct BP_GROUP      * gh;
+    struct BP_FILE       * fh;
+    struct adios_index_var_struct_v1 * var_root;
+    struct adios_var_header_struct_v1 var_header;
+    struct adios_var_payload_struct_v1 var_payload;
+    int    i,j,k, t, varid, start_idx, idx;
+    int    ndim, ndim_notime, has_subfile, file_is_fortran;
+    uint64_t size, * dims;
+    uint64_t ldims[32], gdims[32], offsets[32];
+    uint64_t datasize, nloop, dset_stride,var_stride, total_size=0, items_read;
+    uint64_t count_notime[32], start_notime[32];
+    int timedim = -1, temp_timedim, is_global = 0, size_of_type;
+    uint64_t slice_offset, slice_size, tmpcount = 0;
+    uint64_t datatimeoffset = 0; // offset in data to write a given timestep
+    MPI_Status status;
+
+    adios_errno = 0;
+    if (!gp)
+    {
+        adios_error (err_invalid_group_struct, "Null pointer passed as group to adios_read_var()");
+        return -adios_errno;
+    }
+
+    gh = (struct BP_GROUP *) gp->gh;
+    if (!gh)
+    {
+        adios_error (err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh group handle is NULL!");
+        return -adios_errno;
+    }
+
+    fh = gh->fh;
+    if (!fh)
+    {
+        adios_error (err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh->fh file handle is NULL!");
+        return -adios_errno;
+    }
+
+    varid = adios_read_bp_find_var(gp, varname);
+    if (varid < 0 || varid >= gh->vars_count)
+    {
+        adios_error (err_invalid_varid, "Invalid variable id %d (allowed 0..%d)", varid, gh->vars_count);
+        return -adios_errno;
+    }
+
+    /* Check if file is written out by Fortran or C */
+    file_is_fortran = (fh->pgs_root->adios_host_language_fortran == adios_flag_yes);
+
+    /* Check whether we need to handle subfiles */
+    has_subfile = fh->mfooter.version & ADIOS_VERSION_HAVE_SUBFILE;
+
+    var_root = gh->vars_root; /* first variable of this group. Need to traverse the list */
+    for (i = 0; i< varid && var_root; i++)
+    {
+        var_root = var_root->next;
+    }
+
+    if (i != varid)
+    {
+        adios_error (err_corrupted_variable, 
+                     "Variable id=%d is valid but was not found in internal data structures!",
+                     varid);
+        return -adios_errno; 
+    }
+
+    if (vidx < 0 || vidx >= var_root->characteristics_count)
+    {
+        adios_error (err_out_of_bound, "idx=%d is out of bound", vidx);
+    }
+
+    ndim = var_root->characteristics [vidx].dims.count;
+
+    /* count_notime/start_notime are working copies of count/start */
+    for (i = 0; i < ndim; i++)
+    {
+        count_notime[i] = count[i];
+        start_notime[i] = start[i];
+    }
+
+    ndim_notime = ndim;
+
+    /* Fortran reader was reported of Fortran dimension order so it gives counts and starts in that order.
+       We need to swap them here to read correctly in C order */
+    if (futils_is_called_from_fortran())
+    {
+        timedim = -1;
+        swap_order(ndim_notime, count_notime, &timedim);
+        swap_order(ndim_notime, start_notime, &timedim);
+    }
+    
+    /* items_read = how many data elements are we going to read in total */
+    items_read = 1;
+    for (i = 0; i < ndim_notime; i++)
+        items_read *= count_notime[i];
+
+    size_of_type = bp_get_type_size (var_root->type, var_root->characteristics [vidx].value);
+
+    /* READ A SCALAR VARIABLE */
+    if (ndim_notime == 0)
+    {
+        slice_size = size_of_type;
+        start_idx = 0; // OPS macros below need it
+        idx = vidx; // OPS macros below need it
+
+        if (var_root->type == adios_string)
+        {
+            // strings are stored without \0 in file
+            // size_of_type here includes \0 so decrease by one
+            size_of_type--;
+        }
+
+        /* Old BP files don't have payload_offset characteristic */
+        if (var_root->characteristics[vidx].payload_offset > 0)
+        {
+            slice_offset = var_root->characteristics[vidx].payload_offset;
+
+            if (!has_subfile)
+            {
+                MPI_FILE_READ_OPS
+            }
+            else
+            {
+                MPI_FILE_READ_OPS2
+            }
+        }
+        else
+        {
+            slice_offset = 0;
+            MPI_FILE_READ_OPS1
+        }
+
+        memcpy((char *)data + total_size, fh->b->buff + fh->b->offset, size_of_type);
+
+        if (fh->mfooter.change_endianness == adios_flag_yes)
+            change_endianness((char *)data + total_size
+                             ,size_of_type
+                             ,var_root->type
+                             );
+
+        if (var_root->type == adios_string)
+        {
+            // add \0 to the end of string
+            // size_of_type here is the length of string
+            // FIXME: how would this work for strings written over time?
+            ((char*)data + total_size)[size_of_type] = '\0';
+        }
+
+        total_size += size_of_type;
+
+        return total_size;
+    } /* READ A SCALAR VARIABLE END HERE */
+
+    /* READ AN ARRAY VARIABLE */
+    uint64_t write_offset = 0;
+    int npg = 0;
+    tmpcount = 0;
+    int flag;
+    datasize = 1;
+    nloop = 1;
+    var_stride = 1;
+    dset_stride = 1;
+    uint64_t payload_size = size_of_type;
+
+    /* To get ldims for the index vidx */
+    adios_read_bp_get_dimensioncharacteristics( &(var_root->characteristics[vidx]),
+                                                ldims, gdims, offsets);
+
+    /* Again, a Fortran written file has the dimensions in Fortran order we need to swap here */
+    /* Only local dims are needed for reading local vars */ 
+    if (file_is_fortran)
+    {
+        i=-1;
+        swap_order(ndim, ldims, &(i));
+    }
+
+    /*
+    printf("ldims   = "); for (j = 0; j < ndim; j++) printf("%d ",ldims[j]); printf("\n");
+    printf("count_notime   = "); for (j = 0; j < ndim_notime; j++) printf("%d ",count_notime[j]); printf("\n");
+    printf("start_notime   = "); for (j = 0; j < ndim_notime; j++) printf("%d ",start_notime[j]); printf("\n");
+    */        
+
+    for (j = 0; j < ndim_notime; j++)
+    {
+        payload_size *= ldims [j];
+    
+        if ( (start_notime[j] > ldims[j]) 
+            || (start_notime[j] + count_notime[j] > ldims[j]))
+        {
+                    adios_error ( err_out_of_bound, "Error: Variable (id=%d) out of bound ("
+                        "the data in dimension %d to read is %llu elements from index %llu"
+                        " but the actual data is [0,%llu])",
+                        varid, j+1, count_notime[j], start_notime[j], ldims[j] - 1);
+                    return -adios_errno;
+        }
+    }
+
+    /* determined how many (fastest changing) dimensions can we read in in one read */
+    int break_dim =  ndim_notime - 1;
+    while (break_dim > -1)
+    {
+        if (start_notime[break_dim] == 0 && ldims[break_dim] == count_notime[break_dim])
+        {
+            datasize *= ldims[break_dim];
+        }
+        else
+            break;
+        
+        break_dim--;
+    }
+    
+    slice_offset = 0;
+    slice_size = 0;
+    /* Note: MPI_FILE_READ_OPS  - for reading single BP file.
+     *       MPI_FILE_READ_OPS2 - for reading those with subfiles.
+     *       MPI_FILE_READ_OPS1 - for reading old version of BP files
+     *                            which don't contain "payload_offset"
+     * Whenever to use OPS macro, start_idx and idx variable needs to be
+     * properly set.
+     */
+    
+    start_idx = 0;
+    idx = vidx;
+
+    if (break_dim <= 0) 
+    {
+        /* The slowest changing dimensions should not be read completely but
+           we still need to read only one block */
+   
+        uint64_t size_in_dset = count_notime[0];
+        uint64_t offset_in_dset = start_notime[0];
+
+        slice_size = (break_dim == -1 ? datasize * size_of_type : size_in_dset * datasize * size_of_type);
+    
+        if (var_root->characteristics[start_idx + idx].payload_offset > 0)
+        {
+            slice_offset = var_root->characteristics[start_idx + idx].payload_offset 
+                         + offset_in_dset * datasize * size_of_type;
+
+            if (!has_subfile)
+            {
+                MPI_FILE_READ_OPS
+            }
+            else
+            {
+                MPI_FILE_READ_OPS2
+            }
+        }
+        else
+        {
+            slice_offset = 0;
+            MPI_FILE_READ_OPS1
+        }
+
+        memcpy ((char *)data, fh->b->buff + fh->b->offset, slice_size);
+        if (fh->mfooter.change_endianness == adios_flag_yes)
+        {
+            change_endianness((char *)data + write_offset, slice_size, var_root->type);
+        }
+    }
+    else 
+    {
+        uint64_t stride_offset = 0;
+        uint64_t * size_in_dset, * offset_in_dset, * offset_in_var;
+        uint64_t start_in_payload, end_in_payload, s;
+        uint64_t var_offset;
+        uint64_t dset_offset;
+
+        size_in_dset = (uint64_t *) malloc (8 * ndim_notime);
+        offset_in_dset = (uint64_t *) malloc (8 * ndim_notime);
+        offset_in_var = (uint64_t *) malloc (8 * ndim_notime);
+ 
+        if (size_in_dset == 0 || offset_in_dset == 0 || offset_in_var == 0)
+        {
+             adios_error (err_no_memory, "Malloc failed in %s at %d\n"
+                         , __FILE__, __LINE__
+                         );
+             return -adios_errno;
+        }
+
+        for (i = 0; i < ndim_notime ; i++)
+        {
+            size_in_dset[i] = count_notime[i];
+            offset_in_dset[i] = start_notime[i];
+            offset_in_var[i] = 0;
+        }
+ 
+        datasize = 1;
+        var_stride = 1;
+        for (i = ndim_notime - 1; i >= break_dim; i--)
+        {
+            datasize *= size_in_dset[i];
+            dset_stride *= ldims[i];
+            var_stride *= count_notime[i];
+        }
+
+        /* Calculate the size of the chunk we are trying to read in */
+        start_in_payload = 0;
+        end_in_payload = 0;
+        s = 1;
+        for (i = ndim_notime - 1; i >= 0; i--)
+        {
+            start_in_payload += s * offset_in_dset[i] * size_of_type;
+            end_in_payload += s * (offset_in_dset[i] + size_in_dset[i] - 1) * size_of_type;
+            s *= ldims[i];
+        }
+        slice_size = end_in_payload - start_in_payload + 1 * size_of_type;
+ 
+        if (var_root->characteristics[start_idx + idx].payload_offset > 0)
+        {
+            slice_offset =  var_root->characteristics[start_idx + idx].payload_offset
+                          + start_in_payload;
+            if (!has_subfile)
+            {
+                MPI_FILE_READ_OPS
+            }
+            else
+            {
+                MPI_FILE_READ_OPS2
+            }
+ 
+            for ( i = 0; i < ndim_notime ; i++)
+            {
+                offset_in_dset[i] = 0;
+            }
+        }
+        else
+        {
+            slice_offset =  start_in_payload;
+            MPI_FILE_READ_OPS1
+        }
+
+        var_offset = 0;
+        dset_offset = 0;
+        for (i = 0; i < ndim_notime ; i++)
+        {
+            var_offset = offset_in_var[i] + var_offset * count_notime[i];
+            dset_offset = offset_in_dset[i] + dset_offset * ldims[i];
+        }
+
+        copy_data (data
+                  ,fh->b->buff + fh->b->offset
+                  ,0
+                  ,break_dim
+                  ,size_in_dset
+                  ,ldims
+                  ,count_notime
+                  ,var_stride
+                  ,dset_stride
+                  ,var_offset
+                  ,dset_offset
+                  ,datasize
+                  ,size_of_type 
+                  );
+
+        free (size_in_dset);
+        free (offset_in_dset);
+        free (offset_in_var);
+    }
+    
+    total_size += items_read * size_of_type;
+
+    return total_size;
+}
+
 // The purpose of keeping this function is to be able
 // to read in old BP files. Can be deleted later on.
 int64_t adios_read_bp_read_var_byid1 (ADIOS_GROUP    * gp,
@@ -1577,21 +2036,21 @@ int64_t adios_read_bp_read_var_byid1 (ADIOS_GROUP    * gp,
 
     adios_errno = 0;
     if (!gp) {
-        error(err_invalid_group_struct, "Null pointer passed as group to adios_read_var()");
+        adios_error (err_invalid_group_struct, "Null pointer passed as group to adios_read_var()");
         return -adios_errno;
     }
     gh = (struct BP_GROUP *) gp->gh;
     if (!gh) {
-        error(err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh group handle is NULL!");
+        adios_error (err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh group handle is NULL!");
         return -adios_errno;
     }
     fh = gh->fh;
     if (!fh) {
-        error(err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh->fh file handle is NULL!");
+        adios_error (err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh->fh file handle is NULL!");
         return -adios_errno;
     }
     if (varid < 0 || varid >= gh->vars_count) {
-        error(err_invalid_varid, "Invalid variable id %d (allowed 0..%d)", varid, gh->vars_count);
+        adios_error (err_invalid_varid, "Invalid variable id %d (allowed 0..%d)", varid, gh->vars_count);
         return -adios_errno;
     }
     
@@ -1603,7 +2062,7 @@ int64_t adios_read_bp_read_var_byid1 (ADIOS_GROUP    * gp,
     }
 
     if (i!=varid) {
-        error (err_corrupted_variable, "Variable id=%d is valid but was not found in internal data structures!",varid);
+        adios_error (err_corrupted_variable, "Variable id=%d is valid but was not found in internal data structures!",varid);
         return -adios_errno; 
     }
 
@@ -1620,7 +2079,7 @@ int64_t adios_read_bp_read_var_byid1 (ADIOS_GROUP    * gp,
         {
             if (timedim != ndim - 1)
             {
-                error(err_no_data_at_timestep,"Variable (id=%d) has wrong time dimension index",
+                adios_error (err_no_data_at_timestep,"Variable (id=%d) has wrong time dimension index",
                       varid);
                 return -adios_errno;
             }
@@ -1709,7 +2168,7 @@ int64_t adios_read_bp_read_var_byid1 (ADIOS_GROUP    * gp,
                the cases timedim at any dimension */
             if (timedim != 0)
             {
-                error(err_no_data_at_timestep,"Variable (id=%d) has wrong time dimension",
+                adios_error (err_no_data_at_timestep,"Variable (id=%d) has wrong time dimension",
                       varid);
                 return -adios_errno;
             }
@@ -1830,7 +2289,7 @@ printf ("pgcount = %lld\n", pgcount);
         }
 
         if (start_idx<0) {
-            error(err_no_data_at_timestep,"Variable (id=%d) has no data at %d time step",
+            adios_error (err_no_data_at_timestep,"Variable (id=%d) has no data at %d time step",
                 varid, timestep);
             return -adios_errno;
         }
@@ -1938,7 +2397,7 @@ printf ("pgcount = %lld\n", pgcount);
                 if ( (count_notime[j] > gdims[j]) 
                   || (start_notime[j] > gdims[j]) 
                   || (start_notime[j] + count_notime[j] > gdims[j])){
-                    error( err_out_of_bound, "Error: Variable (id=%d) out of bound ("
+                    adios_error ( err_out_of_bound, "Error: Variable (id=%d) out of bound ("
                         "the data in dimension %d to read is %llu elements from index %llu"
                         " but the actual data is [0,%llu])",
                         varid, j+1, count_notime[j], start_notime[j], gdims[j] - 1);
@@ -2229,7 +2688,7 @@ int64_t adios_read_bp_read_var_byid2 (ADIOS_GROUP    * gp,
     }
 
     if (i!=varid) {
-        error (err_corrupted_variable, 
+        adios_error (err_corrupted_variable, 
                "Variable id=%d is valid but was not found in internal data structures!",
                varid);
         return -adios_errno; 
@@ -2301,7 +2760,7 @@ int64_t adios_read_bp_read_var_byid2 (ADIOS_GROUP    * gp,
         stop_idx = get_var_stop_index(var_root, t);
 
         if (start_idx < 0 || stop_idx < 0) {
-            error(err_no_data_at_timestep,"Variable (id=%d) has no data at %d time step",
+            adios_error (err_no_data_at_timestep,"Variable (id=%d) has no data at %d time step",
                 varid, t);
 //            return -adios_errno;
             continue;
@@ -2374,6 +2833,8 @@ int64_t adios_read_bp_read_var_byid2 (ADIOS_GROUP    * gp,
                 for (j = 0; j< ndim; j++) {
                     gdims[j]=ldims[j];
                 }
+                // we need to read only the first PG, not all, so let's prevent a second loop
+                stop_idx = start_idx;
             }
 
             /* Again, a Fortran written file has the dimensions in Fortran order we need to swap here */
@@ -2405,7 +2866,7 @@ int64_t adios_read_bp_read_var_byid2 (ADIOS_GROUP    * gp,
             printf("offsets = "); for (j = 0; j<ndim; j++) printf("%d ",offsets[j]); printf("\n");
             printf("count_notime   = "); for (j = 0; j<ndim_notime; j++) printf("%d ",count_notime[j]); printf("\n");
             printf("start_notime   = "); for (j = 0; j<ndim_notime; j++) printf("%d ",start_notime[j]); printf("\n");
-            */
+            */ 
                 
             for (j = 0; j < ndim_notime; j++) {
     
@@ -2414,7 +2875,7 @@ int64_t adios_read_bp_read_var_byid2 (ADIOS_GROUP    * gp,
                 if ( (count_notime[j] > gdims[j]) 
                   || (start_notime[j] > gdims[j]) 
                   || (start_notime[j] + count_notime[j] > gdims[j])){
-                    error( err_out_of_bound, "Error: Variable (id=%d) out of bound ("
+                    adios_error ( err_out_of_bound, "Error: Variable (id=%d) out of bound ("
                         "the data in dimension %d to read is %llu elements from index %llu"
                         " but the actual data is [0,%llu])",
                         varid, j+1, count_notime[j], start_notime[j], gdims[j] - 1);
@@ -2449,7 +2910,6 @@ int64_t adios_read_bp_read_var_byid2 (ADIOS_GROUP    * gp,
             hole_break = i;
             slice_offset = 0;
             slice_size = 0;
-
             if (hole_break == -1) {
                 /* The complete read happens to be exactly one pg, and the entire pg */
                 /* This means we enter this only once, and npg=1 at the end */
@@ -2480,6 +2940,7 @@ int64_t adios_read_bp_read_var_byid2 (ADIOS_GROUP    * gp,
                 int isize;
                 uint64_t size_in_dset = 0;
                 uint64_t offset_in_dset = 0;
+                uint64_t offset_in_var = 0;
     
                 isize = offsets[0] + ldims[0];
                 if (start_notime[0] >= offsets[0]) {
@@ -2490,6 +2951,7 @@ int64_t adios_read_bp_read_var_byid2 (ADIOS_GROUP    * gp,
                         else
                             size_in_dset = count_notime[0];
                         offset_in_dset = start_notime[0] - offsets[0];
+                        offset_in_var = 0;
                     }
                 }
                 else {
@@ -2500,10 +2962,12 @@ int64_t adios_read_bp_read_var_byid2 (ADIOS_GROUP    * gp,
                     // tail is in
                         size_in_dset = count_notime[0] + start_notime[0] - offsets[0];
                     offset_in_dset = 0;
+                    offset_in_var = offsets[0] - start_notime[0];
                 }
     
                 slice_size = size_in_dset * datasize * size_of_type;
-    
+                write_offset = offset_in_var * datasize * size_of_type;
+ 
                 if (var_root->characteristics[start_idx + idx].payload_offset > 0) {
                     slice_offset = var_root->characteristics[start_idx + idx].payload_offset 
                                  + offset_in_dset * datasize * size_of_type;
@@ -2523,7 +2987,7 @@ int64_t adios_read_bp_read_var_byid2 (ADIOS_GROUP    * gp,
                     change_endianness((char *)data + write_offset, slice_size, var_root->type);
                 }
     
-                write_offset +=  slice_size;
+                //write_offset +=  slice_size;
             }
             else 
             {
@@ -2659,19 +3123,19 @@ int64_t adios_read_bp_read_var_byid (ADIOS_GROUP    * gp,
 
     adios_errno = 0;
     if (!gp) {
-        error(err_invalid_group_struct, "Null pointer passed as group to adios_read_var()");
+        adios_error (err_invalid_group_struct, "Null pointer passed as group to adios_read_var()");
         return -adios_errno;
     }
 
     gh = (struct BP_GROUP *) gp->gh;
     if (!gh) {
-        error(err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh group handle is NULL!");
+        adios_error (err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh group handle is NULL!");
         return -adios_errno;
     }
 
     fh = gh->fh;
     if (!fh) {
-        error(err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh->fh file handle is NULL!");
+        adios_error (err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh->fh file handle is NULL!");
         return -adios_errno;
     }
 
diff --git a/src/read_bp_staged.c b/src/read_bp_staged.c
new file mode 100644
index 0000000..e6080b8
--- /dev/null
+++ b/src/read_bp_staged.c
@@ -0,0 +1,5649 @@
+/* 
+ * ADIOS is freely available under the terms of the BSD license described
+ * in the COPYING file in the top level directory of this source distribution.
+ *
+ * Copyright (c) 2008 - 2009.  UT-BATTELLE, LLC. All rights reserved.
+ *
+ * Author: Qing Liu
+ */
+
+
+/******************************/
+/* A read method for BP files */
+/******************************/
+
+#include <stdlib.h>
+#include <string.h>
+#include <math.h>
+#include <pthread.h>
+#include <assert.h>
+#include "adios.h"
+#include "bp_utils.h"
+#include "bp_types.h"
+#include "adios_types.h"
+#include "adios_read.h"
+#include "adios_read_hooks.h"
+#include "adios_error.h"
+#include "futils.h"
+
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
+
+#define READ_CLOSE 0
+
+typedef struct read_info
+{
+    int ndim;
+    uint64_t * start_notime;
+    uint64_t * count_notime;
+    int ndim_notime;
+    int file_tdim;
+    int start_time;
+    int stop_time;
+    uint64_t * dims;
+} read_info;
+
+static void swap_order (int n, uint64_t * array, int * tdim);
+static void _swap_order (int n, uint64_t * array);
+static int isTimeless (int tdim);
+void getReadInfo (ADIOS_GROUP * gp
+                 ,struct adios_index_var_struct_v1 * v
+                 ,uint64_t * start
+                 ,uint64_t * count
+                 ,read_info * ri
+                 );
+static int adios_read_bp_staged_get_dimensioncharacteristics (
+                           struct adios_index_characteristic_struct_v1 * c
+                          ,uint64_t * ldims
+                          ,uint64_t * gdims
+                          ,uint64_t * offsets
+                          );
+static void adios_read_bp_staged_get_dimensions (struct adios_index_var_struct_v1 * v
+                                                 ,int ntsteps, int file_is_fortran
+                                                 ,int * ndim, uint64_t ** dims
+                                                 ,int * tdim
+                                                 );
+struct adios_index_var_struct_v1 * adios_find_var_byid (ADIOS_GROUP * gp, int varid);
+static int get_var_start_index (struct adios_index_var_struct_v1 * v, int t);
+static int get_var_stop_index (struct adios_index_var_struct_v1 * v, int t);
+void getDataAddress (ADIOS_GROUP * gp, int varid
+                    ,const uint64_t * start
+                    ,const uint64_t * count
+                    ,int * file_idx
+                    ,uint64_t * offset
+                    ,uint64_t * payload_size
+                    );
+static MPI_File * get_BP_file_handle(struct BP_file_handle * l, uint32_t file_index);
+static void add_BP_file_handle (struct BP_file_handle ** l, struct BP_file_handle * n);
+
+int64_t adios_read_bp_staged_read_var_byid2 (ADIOS_GROUP    * gp, 
+                                      int            varid,
+                                      const uint64_t * start,
+                                      const uint64_t * count,
+                                      void           * data);
+static ADIOS_VARINFO * _inq_var_byid (struct BP_FILE * fh, int varid);
+void adios_read_bp_staged_free_varinfo (ADIOS_VARINFO *vp);
+
+// used to specify which thread is the target for the MPI messages
+enum MPI_TAG
+{
+     TAG_CONTROL = 0
+    ,TAG_DATA = 1
+};
+
+typedef struct read_args
+{   
+    int varid;
+    int ndims;
+    uint64_t * start;
+    uint64_t * count;
+    void * data;
+    uint64_t size;
+    int file_idx;
+    uint64_t offset;
+    void * parent;
+} read_args;
+
+typedef struct candidate_reader
+{
+    int rank;
+    read_args * ra;
+    struct candidate_reader * next;
+} candidate_reader;
+
+struct proc_struct
+{
+    ADIOS_GROUP * gp;
+    int rank;
+    int new_rank;
+    int size;
+    int groups;
+    int group_size;
+    int group;
+    MPI_Comm group_comm;
+    MPI_Comm new_comm;
+    MPI_Comm new_comm2;
+    int aggregator_rank;
+    int aggregator_new_rank;
+    candidate_reader * local_read_request_list;
+    candidate_reader * split_read_request_list;
+    void * b;
+    uint32_t num_aggregators;
+    uint64_t chunk_size;
+    int * aggregator_rank_array;
+    int read_close_received;
+    int group_close_received;
+};
+
+int isAggregator (struct proc_struct * p)
+{
+    return (p->rank == p->aggregator_rank);
+}
+
+void list_print_readers (struct proc_struct * p, candidate_reader * h)
+{
+    read_args * ra;
+    //printf ("%d: Candidate reader:\n", p->rank);
+    //candidate_reader * h = p->split_read_request_list;
+
+    while (h)
+    {
+        ra = h->ra;
+        printf ("%d [varid: %d, ndims = %d, start[0]: %llu, start[1]: %llu, count[0]: %llu, count[1]: %llu, file_index: %d, offset = %llu]\n", p->rank, ra->varid, ra->ndims, ra->start[0], ra->start[1], ra->count[0], ra->count[1], ra->file_idx, ra->offset);
+        h = h->next;
+    }
+    printf ("\n");
+}
+
+void list_insert_reader (candidate_reader ** h, candidate_reader * q)
+{
+    candidate_reader * head;
+    if (!h || !q)
+    {
+        printf ("Error: list_insert_reader ()\n");
+        return;
+    }
+
+    head = * h;
+    if (!head)
+    {
+        * h = q;
+        q->next = NULL;
+
+        return;
+    }
+
+    while (head->next)
+    {
+        head = head->next;
+    }
+
+    head->next = q;
+    q->next = NULL;
+
+    return;
+}
+
+void list_append_reader_list (candidate_reader ** h, candidate_reader * q)
+{
+    candidate_reader * head;
+    if (!h || !q)
+    {
+        printf ("Error: list_append_reader_list: h: %d, q: %d\n", h == 0, q == 0);
+        return;
+    }
+
+    head = * h;
+    if (!head)
+    {
+        * h = q;
+        return;
+    }
+
+    while (head->next)
+    {
+        head = head->next;
+    }
+
+    head->next = q;
+
+    return;
+}
+
+candidate_reader * list_remove_reader (candidate_reader ** h)
+{
+    candidate_reader * t = NULL;
+    if (h && * h)
+    {
+        t = * h;
+        *h = (* h)->next;
+    }
+
+    return t;
+}
+
+int list_get_length (candidate_reader * h)
+{
+    int l = 0;
+
+    while (h)
+    {
+        h = h->next;
+        l++;
+    }
+
+    return l;
+}
+
+static int calc_data_size (struct proc_struct * p)
+{
+    int i, size = 0;
+    candidate_reader * h = p->local_read_request_list;
+
+    // message type
+    size += 4;
+
+    // count
+    size += 4;
+
+    while (h)
+    {
+        // varid + ndim + start + count
+        size += 4 + 4 + h->ra->ndims * (8 + 8) + 8 + 4 + 8;
+        h = h->next;
+    }
+
+    return size;
+}
+
+static void buffer_write (void ** buffer, void * data, int size)
+{
+    memcpy (* buffer, data, size);
+    * buffer = * buffer + size;
+}
+
+// *****************************************************************************
+static void _buffer_write (char ** buffer, uint64_t * buffer_size
+                         ,uint64_t * buffer_offset
+                         ,const void * data, uint64_t size
+                         )
+{
+    if (*buffer_offset + size > *buffer_size || *buffer == 0)
+    {
+        char * b = realloc (*buffer, *buffer_offset + size + 1000);
+        if (b)
+        {
+            *buffer = b;
+            *buffer_size = (*buffer_offset + size + 1000);
+        }
+        else
+        {
+            fprintf (stderr, "Cannot allocate memory in buffer_write.  "
+                             "Requested: %llu\n", *buffer_offset + size + 1000);
+
+            return;
+        }
+    }
+
+    memcpy (*buffer + *buffer_offset, data, size);
+    *buffer_offset += size;
+}
+
+// *****************************************************************************
+static void _buffer_read (char * buffer, uint64_t * buffer_offset
+                         ,void * data, uint64_t size
+                         )
+{
+    memcpy (data, buffer + *buffer_offset, size);
+    *buffer_offset += size;
+}
+
+void sort_read_requests (struct proc_struct * p)
+{
+    int file_idx;
+    uint64_t offset;
+    candidate_reader * r = p->split_read_request_list;
+    candidate_reader * n = 0, * t, * t_prev, * next;
+    while (r)
+    {
+//printf ("[%d]: r->ra->offset = %llu\n", p->rank, r->ra->offset);
+        t = n;
+        t_prev = 0;
+        next = r->next;
+
+        file_idx = r->ra->file_idx;
+        offset = r->ra->offset;
+
+        while (t && t->ra->file_idx <= file_idx)
+        {
+            if (t->ra->file_idx == file_idx && t->ra->offset > offset)
+            {
+                break;
+            }
+
+            t_prev = t;
+            t = t->next;
+        }
+
+        if (!t_prev)
+        {
+            r->next = n;
+            n = r;
+        }
+        else
+        {
+            t_prev->next = r;
+            r->next = t;
+        }
+//if (p->rank == 1) list_print_readers (p, n);
+        r = next;
+    }
+
+    p->split_read_request_list = n;
+}
+
+static void send_read_data (struct proc_struct * p)
+{
+    void * data = 0;
+    uint64_t ds;
+    int i, counter = 0;
+
+    candidate_reader * r = p->local_read_request_list;
+
+    while (r)
+    {
+        if (p->rank != r->rank)
+        {
+            MPI_Send (r->ra->data, r->ra->size, MPI_BYTE
+                     ,r->rank - p->aggregator_rank, TAG_DATA, p->new_comm
+                     );  
+        }
+
+        r = r->next;
+    }
+}
+
+static void get_read_data (struct proc_struct * p)
+{
+    MPI_Status status;
+    candidate_reader * r = p->local_read_request_list;
+
+    if (p->rank != p->aggregator_rank)
+    {
+        while (r) 
+        {
+            MPI_Recv (r->ra->data, r->ra->size, MPI_BYTE
+                     ,MPI_ANY_SOURCE, MPI_ANY_TAG, p->new_comm
+                     ,&status
+                     );
+
+            r = r->next;
+        }
+    }
+}
+
+static void parse_buffer (struct proc_struct * p, void * b, int src)
+{
+    candidate_reader * h = p->local_read_request_list;
+    int i, j, type, count, varid, ndims, size = calc_data_size (p);
+    void * buf;
+    candidate_reader * r;
+
+    // message type
+    type = * (uint32_t *) b;
+    b += 4;
+
+    // count
+    count = * (uint32_t *) b;
+    b += 4;
+
+    for (i = 0; i < count; i++)
+    {
+        r = (candidate_reader *) malloc (sizeof (candidate_reader));
+        assert (r);
+
+        r->rank = src;
+
+        r->ra = (read_args *) malloc (sizeof (read_args));
+        assert (r->ra);
+   
+        r->ra->varid = * (uint32_t *) b;
+        b += 4;
+
+        r->ra->ndims = * (uint32_t *) b;
+        b += 4;
+
+        r->ra->start = (uint64_t *) malloc (r->ra->ndims * 8);
+        r->ra->count = (uint64_t *) malloc (r->ra->ndims * 8);
+        assert (r->ra->start);
+        assert (r->ra->count);
+
+        memcpy (r->ra->start, b, r->ra->ndims * 8);
+        b += r->ra->ndims * 8;
+
+        memcpy (r->ra->count, b, r->ra->ndims * 8);
+        b += r->ra->ndims * 8;
+
+        r->ra->size = * (uint64_t *) b;
+        b += 8;
+
+        r->ra->file_idx = * (uint32_t *) b;
+        b += 4;
+
+        r->ra->offset = * (uint64_t *) b;
+        b += 8;
+
+        r->ra->data = malloc (r->ra->size);
+        assert (r->ra->data);
+
+        r->ra->parent = 0;
+
+        r->next = 0;
+
+        list_insert_reader (&p->local_read_request_list, r);
+    }
+}
+
+candidate_reader * split_read_requests (ADIOS_GROUP * gp, candidate_reader * r)
+{
+    struct BP_GROUP * gh;
+    struct BP_FILE * fh;
+    struct adios_index_var_struct_v1 * v;
+    int i, j, k, idx, t, varid;
+    int start_time, stop_time, start_idx, stop_idx, f_idx;
+    int ndim, ndim_notime, has_subfile, file_is_fortran;
+    uint64_t size, * dims = 0;
+    uint64_t ldims[32], gdims[32], offsets[32];
+    uint64_t count_notime[32], start_notime[32], * start, * count;
+    int file_tdim = -1, read_arg_tdim, is_global = 0, flag;
+    candidate_reader * h = 0;
+
+    gh = (struct BP_GROUP *) gp->gh;
+    fh = gh->fh;
+
+    varid = r->ra->varid;
+    start = r->ra->start;
+    count = r->ra->count;
+
+    file_is_fortran = (fh->pgs_root->adios_host_language_fortran == adios_flag_yes);
+    has_subfile = fh->mfooter.version & ADIOS_VERSION_HAVE_SUBFILE;
+
+    v = adios_find_var_byid (gp, varid);
+
+    /* Get dimensions and flip if caller != writer language */
+    adios_read_bp_staged_get_dimensions (v
+                                         ,fh->tidx_stop - fh->tidx_start + 1
+                                         ,file_is_fortran
+                                         ,&ndim
+                                         ,&dims
+                                         ,&file_tdim
+                                         );
+
+    if (file_is_fortran)
+    {
+        swap_order (ndim, dims, &file_tdim);
+    }
+
+    if (isTimeless (file_tdim))
+    {
+        start_time = fh->tidx_start;
+        stop_time = fh->tidx_stop;
+        ndim_notime = ndim;
+
+        memcpy (start_notime, start, ndim * 8);
+        memcpy (count_notime, count, ndim * 8);
+    }
+    else
+    {
+        read_arg_tdim = futils_is_called_from_fortran () ? ndim - 1 : 0;
+
+        start_time = start[read_arg_tdim] + fh->tidx_start;
+        stop_time = start_time + count[read_arg_tdim] - 1;
+        ndim_notime = ndim - 1;
+
+        memcpy (start_notime
+               ,futils_is_called_from_fortran () ? start : start + 1
+               ,ndim_notime * 8
+               );
+        memcpy (count_notime
+               ,futils_is_called_from_fortran () ? count : count + 1
+               ,ndim_notime * 8
+               );
+    }
+
+    if (futils_is_called_from_fortran ())
+    {
+        _swap_order (ndim_notime, count_notime);
+        _swap_order (ndim_notime, start_notime);
+    }
+
+    for (t = start_time; t <= stop_time; t++)
+    {
+        start_idx = get_var_start_index (v, t);
+        stop_idx = get_var_stop_index (v, t);
+
+        if (start_idx < 0 || stop_idx < 0)
+        {
+            fprintf (stderr,"Variable (id=%d) has no data at %d time step\n",
+                varid, t);
+            continue;
+        }
+
+        if (ndim_notime == 0)
+        {
+            /* THIS IS A SCALAR VARIABLE */
+            idx = 0;
+
+            candidate_reader * n = (candidate_reader *) malloc (sizeof (candidate_reader));
+            assert (n);
+
+            n->rank = r->rank;
+            n->ra = (read_args *) malloc (sizeof (read_args));
+            assert (n->ra);
+
+            n->ra->varid = r->ra->varid;
+            n->ra->file_idx = v->characteristics[start_idx + idx].file_index;
+            n->ra->offset = v->characteristics[start_idx + idx].payload_offset;
+            n->ra->parent = r;
+            n->ra->start = 0;
+            n->ra->count = 0;
+            n->next = 0;
+
+            list_insert_reader (&h, n);
+
+            if (isTimeless (file_tdim) )
+                break;
+            else
+                continue;
+        }
+
+         /* READ AN ARRAY VARIABLE */
+        int * idx_table = (int *) malloc (sizeof(int) * (stop_idx - start_idx + 1));
+
+        // loop over the list of pgs to read from one-by-one
+        for (idx = 0; idx < stop_idx - start_idx + 1; idx++)
+        {
+            idx_table[idx] = 1;
+            /* Each pg can have a different sized array, so we need the actual dimensions from it */
+            is_global = adios_read_bp_staged_get_dimensioncharacteristics(&(v->characteristics[start_idx + idx])
+                                                                          ,ldims
+                                                                          ,gdims
+                                                                          ,offsets
+                                                                          );
+            if (!is_global)
+            {
+                memcpy (gdims, ldims, ndim * 8);
+            }
+
+            if (file_is_fortran)
+            {
+                _swap_order (ndim, gdims);
+                _swap_order (ndim, ldims);
+                _swap_order (ndim, offsets);
+            }
+
+            if (!isTimeless (file_tdim))
+            {
+                for (i = file_tdim; i < ndim - 1; i++)
+                {
+                    ldims[i] = ldims[i + 1];
+                    if (file_is_fortran)
+                    {
+                        gdims[i] = gdims[i + 1];
+                        offsets[i] = offsets[i + 1];
+                    }
+                }
+            }
+
+            /*
+            printf("ldims   = "); for (j = 0; j<ndim; j++) printf("%d ",ldims[j]); printf("\n");
+            printf("gdims   = "); for (j = 0; j<ndim; j++) printf("%d ",gdims[j]); printf("\n");
+            printf("offsets = "); for (j = 0; j<ndim; j++) printf("%d ",offsets[j]); printf("\n");
+            printf("count_notime   = "); for (j = 0; j<ndim_notime; j++) printf("%d ",count_notime[j]); printf("\n");
+            printf("start_notime   = "); for (j = 0; j<ndim_notime; j++) printf("%d ",start_notime[j]); printf("\n");
+            */
+            for (j = 0; j < ndim_notime; j++)
+            {
+                if ( (count_notime[j] > gdims[j])
+                  || (start_notime[j] > gdims[j])
+                  || (start_notime[j] + count_notime[j] > gdims[j]))
+                {
+                    fprintf (stderr, "Error: Variable (id=%d, %s) out of bound ("
+                        "the data in dimension %d to read is %llu elements from index %llu"
+                        " but the actual data is [0,%llu]), count_notime[1] = %llu, count_notime[2] = %llu\n",
+                        varid, v->var_name, j + 1, count_notime[j], start_notime[j], gdims[j] - 1, count_notime[1], count_notime[2]);
+                    return 0;
+                }
+
+                /* check if there is any data in this pg and this dimension to read in */
+                flag = (offsets[j] >= start_notime[j]
+                        && offsets[j] < start_notime[j] + count_notime[j])
+                    || (offsets[j] < start_notime[j]
+                        && offsets[j] + ldims[j] > start_notime[j] + count_notime[j])
+                    || (offsets[j] + ldims[j] > start_notime[j]
+                        && offsets[j] + ldims[j] <= start_notime[j] + count_notime[j]);
+
+                idx_table[idx] = idx_table[idx] && flag;
+            }
+
+            if (!idx_table[idx])
+            {
+                continue;
+            }
+
+            /* determined how many (fastest changing) dimensions can we read in in one read */
+            int hole_break;
+            for (i = ndim_notime - 1; i > -1; i--)
+            {
+                if (offsets[i] == start_notime[i] && ldims[i] == count_notime[i])
+                {
+                }
+                else
+                {
+                    break;
+                }
+            }
+
+            hole_break = i;
+
+            candidate_reader * n = (candidate_reader *) malloc (sizeof (candidate_reader));
+            assert (n);
+
+            n->rank = r->rank;
+            n->ra = (read_args *) malloc (sizeof (read_args));
+            assert (n->ra);
+
+            n->ra->varid = r->ra->varid;
+
+            n->ra->start = (uint64_t *) malloc (ndim_notime * 8);
+            assert (n->ra->start);
+
+            n->ra->count = (uint64_t *) malloc (ndim_notime * 8);
+            assert (n->ra->count);
+
+            n->ra->file_idx = v->characteristics[start_idx + idx].file_index;
+            n->ra->offset = v->characteristics[start_idx + idx].payload_offset;
+            n->ra->parent = r;
+            n->next = 0;
+
+            memcpy (n->ra->start, start_notime, ndim_notime * 8);
+            memcpy (n->ra->count, count_notime, ndim_notime * 8);
+
+            if (hole_break == -1)
+            {
+            }
+            else if (hole_break == 0)
+            {
+                int isize;
+                uint64_t size_in_dset = 0;
+                uint64_t offset_in_dset = 0;
+
+                isize = offsets[0] + ldims[0];
+                if (start_notime[0] >= offsets[0])
+                {
+                    // head is in
+                    if (start_notime[0] < isize)
+                    {
+                        if (start_notime[0] + count_notime[0] > isize)
+                        {
+                            n->ra->count[0] = isize - start_notime[0];
+                        //    size_in_dset = isize - start_notime[0];
+                        }
+                        else
+                        {
+                            n->ra->count[0] = count_notime[0];
+                        //    size_in_dset = count_notime[0];
+                        }
+                        n->ra->start[0] = start_notime[0];
+                        //offset_in_dset = start_notime[0] - offsets[0];
+                    }
+                }
+                else
+                {
+                    // middle is in
+                    if (isize < start_notime[0] + count_notime[0])
+                    {
+                        n->ra->count[0] = ldims[0];
+                    //    size_in_dset = ldims[0];
+                    }
+                    else
+                    {
+                    // tail is in
+                        n->ra->count[0] = count_notime[0] + start_notime[0] - offsets[0];
+                    //    size_in_dset = count_notime[0] + start_notime[0] - offsets[0];
+                    }
+                    n->ra->start[0] = offsets[0];
+                    //offset_in_dset = 0;
+                }
+
+            }
+            else
+            {
+                uint64_t stride_offset = 0;
+                int isize;
+                uint64_t size_in_dset[10];
+                uint64_t offset_in_dset[10];
+                uint64_t offset_in_var[10];
+
+                memset(size_in_dset, 0 , 10 * 8);
+                memset(offset_in_dset, 0 , 10 * 8);
+                memset(offset_in_var, 0 , 10 * 8);
+
+                for (i = 0; i < ndim_notime; i++)
+                {
+                    isize = offsets[i] + ldims[i];
+                    if (start_notime[i] >= offsets[i])
+                    {
+                        // head is in
+                        if (start_notime[i] < isize)
+                        {
+                            if (start_notime[i] + count_notime[i] > isize)
+                            {
+                                n->ra->count[i] = isize - start_notime[i];
+                            //    size_in_dset[i] = isize - start_notime[i];
+                            }
+                            else
+                            {
+                                n->ra->count[i] = count_notime[i];
+                            //    size_in_dset[i] = count_notime[i];
+                            }
+                            //n->ra->start[i] = start_notime[i] - offsets[i];
+                            n->ra->start[i] = start_notime[i];
+                            //offset_in_dset[i] = start_notime[i] - offsets[i];
+                            offset_in_var[i] = 0;
+                        }
+                    }
+                    else
+                    {
+                        // middle is in
+                        if (isize < start_notime[i] + count_notime[i])
+                        {
+                            n->ra->count[i] = ldims[i];
+                        //    size_in_dset[i] = ldims[i];
+                        }
+                        else
+                        {
+                            // tail is in
+                            n->ra->count[i] = count_notime[i] + start_notime[i] - offsets[i];
+                        //    size_in_dset[i] = count_notime[i] + start_notime[i] - offsets[i];
+                        }
+                        n->ra->start[i] = offsets[i];
+                        //offset_in_dset[i] = 0;
+                        offset_in_var[i] = offsets[i] - start_notime[i];
+                    }
+                }
+
+            }
+           
+            n->ra->size = bp_get_type_size (v->type, v->characteristics[start_idx + idx].value);
+            for (i = 0; i < ndim_notime; i++)
+            {
+                n->ra->size *= n->ra->count[i];
+            }
+         
+            list_insert_reader (&h, n);
+        }
+
+        free (idx_table);
+
+        if (isTimeless (file_tdim))
+            break;
+    } // end for (timestep ... loop over timesteps
+
+    if (dims)
+    {
+        free (dims);
+    }
+
+    return h;
+}
+
+static void process_read_requests (struct proc_struct * p)
+{
+    candidate_reader * h = p->local_read_request_list, * n;
+
+    while (h)
+    {
+        n = split_read_requests (p->gp, h);
+
+        list_append_reader_list (&p->split_read_request_list, n);
+
+        h = h->next;
+    }
+}
+
+void adios_read_bp_staged_read_buffer (ADIOS_GROUP * gp
+                                       ,uint64_t buffer_offset
+                                       ,candidate_reader * r
+                                       ,candidate_reader * s
+                                       )
+{
+#define MAX_DIMS 32
+    struct BP_GROUP * gh;
+    struct BP_FILE * fh;
+    struct adios_index_var_struct_v1 * v;
+    uint64_t * r_start, * r_count, * s_start, * s_count; 
+    int i, j, k, idx, t;
+    int varid, start_idx, stop_idx, has_subfile, file_is_fortran;
+    uint64_t ldims[MAX_DIMS], gdims[MAX_DIMS], offsets[MAX_DIMS];
+    uint64_t datasize, dset_stride, var_stride, total_size = 0, items_read, size;
+    uint64_t count_notime[MAX_DIMS], start_notime[MAX_DIMS];
+    int is_global = 0, size_unit, break_dim, idx_check1, idx_check2;
+    uint64_t slice_offset, slice_size;
+    void * data;
+    read_info ri;
+
+    gh = (struct BP_GROUP *) gp->gh;
+    fh = gh->fh;
+    varid = r->ra->varid;
+
+    // data is in "original read request" buffer
+    data = r->ra->data;
+
+    // orginal read request
+    r_start = r->ra->start;
+    r_count = r->ra->count;
+
+    // new read request after split
+    s_start = s->ra->start;
+    s_count = s->ra->count;
+
+    file_is_fortran = (fh->pgs_root->adios_host_language_fortran == adios_flag_yes);
+    has_subfile = fh->mfooter.version & ADIOS_VERSION_HAVE_SUBFILE;
+
+    v = adios_find_var_byid (gp, varid);
+
+    memset (&ri, 0, sizeof (read_info));
+    ri.start_notime = start_notime;
+    ri.count_notime = count_notime;
+
+    getReadInfo (gp, v, r_start, r_count, &ri);
+
+    /* items_read = how many data elements are we going to read in total (per timestep) */
+    items_read = 1;
+    for (i = 0; i < ri.ndim_notime; i++)
+    {
+        items_read *= count_notime[i];
+    }
+    
+    size_unit = bp_get_type_size (v->type, v->characteristics [0].value);
+
+    /* For each timestep, do reading separately (they are stored in different sets of process groups */
+    for (t = ri.start_time; t <= ri.stop_time; t++)
+    {
+        start_idx = get_var_start_index (v, t);
+        stop_idx = get_var_stop_index (v, t);
+
+        if (start_idx < 0 || stop_idx < 0)
+        {
+            adios_error (err_no_data_at_timestep
+                        ,"Variable (id=%d) has no data at %d time step"
+                        ,varid, t
+                        );
+            continue;
+        }
+
+        if (ri.ndim_notime == 0)
+        {
+            /* READ A SCALAR VARIABLE */
+            slice_size = 1 * size_unit;
+            idx = 0;
+
+            if (v->type == adios_string)
+            {
+                // strings are stored without \0 in file
+                // size_of_type here includes \0 so decrease by one
+                size_unit--;
+            }
+
+            slice_offset = v->characteristics[start_idx + idx].payload_offset;
+
+            memcpy (data, fh->b->buff + slice_offset - buffer_offset, size_unit);
+            if (fh->mfooter.change_endianness == adios_flag_yes)
+            {
+                change_endianness (data, size_unit, v->type);
+            }
+
+            if (v->type == adios_string)
+            {
+                // add \0 to the end of string
+                // size_of_type here is the length of string
+                // FIXME: how would this work for strings written over time?
+                ((char *)data + total_size)[size_unit] = '\0';
+            }
+
+            total_size += size_unit;
+
+            if (isTimeless (ri.file_tdim))
+            {
+                break;
+            }
+            else
+            {
+                continue;
+            }
+        }
+
+         /* READ AN ARRAY VARIABLE */
+        // loop over the list of pgs to read from one-by-one
+        for (idx = 0; idx < stop_idx - start_idx + 1; idx++)
+        {
+            int flag1, flag2;
+            uint64_t payload_size = size_unit;
+
+            datasize = 1;
+            var_stride = 1;
+            dset_stride = 1;
+            idx_check1 = 1;
+            idx_check2 = 1;
+    
+            /* Each pg can have a different sized array, so we need the actual dimensions from it */
+            is_global = adios_read_bp_staged_get_dimensioncharacteristics (&(v->characteristics[start_idx + idx])
+                                                                           ,ldims
+                                                                           ,gdims
+                                                                           ,offsets
+                                                                           );
+
+            if (!is_global)
+            {
+                memcpy (gdims, ldims, ri.ndim * 8);
+            }
+
+            if (file_is_fortran)
+            {
+                _swap_order (ri.ndim, gdims);
+                _swap_order (ri.ndim, ldims);
+                _swap_order (ri.ndim, offsets);
+            }
+
+            if (!isTimeless (ri.file_tdim))
+            {
+                for (i = ri.file_tdim; i < ri.ndim - 1; i++)
+                {
+                    ldims[i] = ldims[i + 1];
+                    if (file_is_fortran)
+                    {
+                        gdims[i] = gdims[i + 1];
+                        offsets[i] = offsets[i + 1];
+                    }
+                }
+            }
+
+            for (j = 0; j < ri.ndim_notime; j++)
+            {
+                payload_size *= ldims [j];
+    
+                if ( (count_notime[j] > gdims[j]) 
+                  || (start_notime[j] > gdims[j]) 
+                  || (start_notime[j] + count_notime[j] > gdims[j]))
+                {
+                    adios_error ( err_out_of_bound, "Error: Variable (id=%d) out of bound ("
+                        "the data in dimension %d to read is %llu elements from index %llu"
+                        " but the actual data is [0,%llu])",
+                        varid, j+1, count_notime[j], start_notime[j], gdims[j] - 1);
+                    return;
+                }
+    
+                /* check if there is any data in this pg and this dimension to read in */
+                flag1 = (offsets[j] >= start_notime[j] 
+                        && offsets[j] < start_notime[j] + count_notime[j])
+                    || (offsets[j] < start_notime[j]
+                        && offsets[j] + ldims[j] > start_notime[j] + count_notime[j]) 
+                    || (offsets[j] + ldims[j] > start_notime[j] 
+                        && offsets[j] + ldims[j] <= start_notime[j] + count_notime[j]);
+
+                idx_check1 = idx_check1 && flag1;
+
+                flag2 = (offsets[j] >= s_start[j]
+                        && offsets[j] < s_start[j] + s_count[j])
+                    || (offsets[j] < s_start[j]
+                        && offsets[j] + ldims[j] > s_start[j] + s_count[j])
+                    || (offsets[j] + ldims[j] > s_start[j]
+                        && offsets[j] + ldims[j] <= s_start[j] + s_count[j]);
+
+                idx_check2 = idx_check2 && flag2;
+            }
+
+            if (!idx_check1)
+            {
+                continue;
+            }
+
+            break_dim =  ri.ndim_notime - 1;
+            while (break_dim > -1)
+            {
+                if (start_notime[break_dim] == 0 && ldims[break_dim] == count_notime[break_dim])
+                {
+                    datasize *= ldims[break_dim];
+                }
+                else
+                    break;
+
+                break_dim--;
+            }
+
+            slice_offset = 0;
+            slice_size = 0;
+
+            if (break_dim == -1)
+            {
+                slice_size = payload_size;
+    
+                slice_offset = v->characteristics[start_idx + idx].payload_offset;
+
+                if (idx_check2)
+                { 
+                    memcpy (data, fh->b->buff + slice_offset - buffer_offset, slice_size);
+                    if (fh->mfooter.change_endianness == adios_flag_yes)
+                    {
+                        change_endianness (data, slice_size, v->type);
+                    }
+                }
+            }
+            else if (break_dim == 0) 
+            {
+                int isize;
+                uint64_t size_in_dset = 0, offset_in_dset = 0, offset_in_var = 0, write_offset;
+    
+                isize = offsets[0] + ldims[0];
+                if (start_notime[0] >= offsets[0])
+                {
+                    // head is in
+                    if (start_notime[0] < isize)
+                    {
+                        if (start_notime[0] + count_notime[0] > isize)
+                        {
+                            size_in_dset = isize - start_notime[0];
+                        }
+                        else
+                        {
+                            size_in_dset = count_notime[0];
+                        }
+                        offset_in_var = 0;
+                        offset_in_dset = start_notime[0] - offsets[0];
+                    }
+                }
+                else
+                {
+                    // middle is in
+                    if (isize < start_notime[0] + count_notime[0])
+                    {
+                        size_in_dset = ldims[0];
+                    }
+                    else
+                    {
+                    // tail is in
+                        size_in_dset = count_notime[0] + start_notime[0] - offsets[0];
+                    }
+                    offset_in_var = offsets[0] - start_notime[0];
+                    offset_in_dset = 0;
+                }
+    
+                slice_size = size_in_dset * datasize * size_unit;
+                slice_offset = v->characteristics[start_idx + idx].payload_offset 
+                                 + offset_in_dset * datasize * size_unit;
+        
+                write_offset = offset_in_var * size_unit;
+                for (i = 1; i < ri.ndim_notime; i++)
+                {
+                    write_offset *= count_notime[i];
+                }
+
+                if (idx_check2)
+                {
+                    memcpy (data + write_offset, fh->b->buff + slice_offset - buffer_offset, slice_size);
+                    if (fh->mfooter.change_endianness == adios_flag_yes)
+                    {
+                        change_endianness ((char *) data + write_offset, slice_size, v->type);
+                    }
+                }
+            }
+            else 
+            {
+                uint64_t stride_offset = 0;
+                int isize;
+                uint64_t size_in_dset[MAX_DIMS];
+                uint64_t offset_in_dset[MAX_DIMS];
+                uint64_t offset_in_var[MAX_DIMS];
+
+                memset (size_in_dset, 0, MAX_DIMS * 8);
+                memset (offset_in_dset, 0, MAX_DIMS * 8);
+                memset (offset_in_var, 0, MAX_DIMS * 8);
+
+                for (i = 0; i < ri.ndim_notime ; i++)
+                {
+                    isize = offsets[i] + ldims[i];
+                    if (start_notime[i] >= offsets[i])
+                    {
+                        // head is in
+                        if (start_notime[i] < isize)
+                        {
+                            if (start_notime[i] + count_notime[i] > isize)
+                            {
+                                size_in_dset[i] = isize - start_notime[i];
+                            }
+                            else
+                            {
+                                size_in_dset[i] = count_notime[i];
+                            }
+                            offset_in_dset[i] = start_notime[i] - offsets[i];
+                            offset_in_var[i] = 0;
+                        }
+                        else
+                        {
+                        }
+                    }
+                    else
+                    {
+                        // middle is in
+                        if (isize < start_notime[i] + count_notime[i])
+                        {
+                            size_in_dset[i] = ldims[i];
+                        }
+                        else
+                        {
+                            // tail is in
+                            size_in_dset[i] = count_notime[i] + start_notime[i] - offsets[i];
+                        }
+                        offset_in_dset[i] = 0;
+                        offset_in_var[i] = offsets[i] - start_notime[i];
+                    }
+                }
+    
+                datasize = 1;
+                var_stride = 1;
+    
+                for (i = ri.ndim_notime - 1; i >= break_dim; i--)
+                {
+                    datasize *= size_in_dset[i];
+                    dset_stride *= ldims[i];
+                    var_stride *= count_notime[i];
+                }
+    
+                uint64_t start_in_payload = 0, end_in_payload = 0, s = 1;
+                uint64_t var_offset = 0, dset_offset = 0;
+
+                for (i = ri.ndim_notime - 1; i > -1; i--)
+                {
+                    start_in_payload += s * offset_in_dset[i] * size_unit;
+                    end_in_payload += s * (offset_in_dset[i] + size_in_dset[i] - 1) * size_unit;
+                    s *= ldims[i];
+                }
+    
+                slice_size = end_in_payload - start_in_payload + 1 * size_unit;
+                slice_offset =  v->characteristics[start_idx + idx].payload_offset
+                                  + start_in_payload;
+ 
+                for (i = 0; i < ri.ndim_notime ; i++)
+                {
+                    offset_in_dset[i] = 0;
+                }
+    
+                for (i = 0; i < ri.ndim_notime ; i++)
+                {
+                    var_offset = offset_in_var[i] + var_offset * count_notime[i];
+                    dset_offset = offset_in_dset[i] + dset_offset * ldims[i];
+                }
+
+                if (idx_check2)
+                {
+                    copy_data (data
+                              ,fh->b->buff + fh->b->offset + slice_offset - buffer_offset
+                              ,0
+                              ,break_dim
+                              ,size_in_dset
+                              ,ldims
+                              ,count_notime
+                              ,var_stride
+                              ,dset_stride
+                              ,var_offset
+                              ,dset_offset
+                              ,datasize
+                              ,size_unit 
+                              );
+
+                }
+            }
+        }  // for idx ... loop over pgs
+
+        // shift target pointer for next read in
+        data = (char *)data + (items_read * size_unit);
+
+        if (isTimeless (ri.file_tdim))
+            break;
+    } // for t
+
+    if (ri.dims)
+    {
+        free (ri.dims);
+    }
+#undef MAX_DIMS
+}
+
+void adios_read_bp_staged_read_chunk (ADIOS_GROUP * gp, int file_idx, uint64_t chunk_offset, uint64_t size)
+{
+    struct BP_GROUP * gh;
+    struct BP_FILE * fh;
+    MPI_File * sfh;
+    MPI_Status status;
+    int has_subfile;
+
+struct timeval t0, t1;
+gettimeofday (&t0, NULL);
+
+    gh = (struct BP_GROUP *) gp->gh;
+    fh = gh->fh;
+
+    has_subfile = fh->mfooter.version & ADIOS_VERSION_HAVE_SUBFILE;
+
+    bp_realloc_aligned(fh->b, size);
+    fh->b->offset = 0;
+
+    if (has_subfile)
+    {
+        sfh = get_BP_file_handle (fh->sfh, file_idx);
+
+        if (!sfh)                                                                         
+        {                                                                                   
+            int err;                                                                        
+            char * ch, * name_no_path, * name;                                              
+            struct BP_file_handle * new_h =                                                
+                  (struct BP_file_handle *) malloc (sizeof (struct BP_file_handle));
+
+            new_h->file_index = file_idx;      
+            new_h->next = 0;                                                                
+            if (ch = strrchr (fh->fname, '/'))                                              
+            {                                                                               
+                name_no_path = malloc (strlen (ch + 1) + 1);                                
+                strcpy (name_no_path, ch + 1);                                              
+            }                                                                               
+            else                                                                            
+            {                                                                               
+                name_no_path = malloc (strlen (fh->fname) + 1);                             
+                strcpy (name_no_path, fh->fname);                                           
+            }
+
+            name = malloc (strlen (fh->fname) + 5 + strlen (name_no_path) + 1 + 10 + 1);
+            sprintf (name, "%s.dir/%s.%d", fh->fname, name_no_path, new_h->file_index);
+
+            err = MPI_File_open (MPI_COMM_SELF                                              
+                                ,name                                                       
+                                ,MPI_MODE_RDONLY                                            
+                                ,(MPI_Info)MPI_INFO_NULL                                    
+                                ,&new_h->fh                                                 
+                                );                                                          
+            if (err != MPI_SUCCESS)                                                          
+            {
+                fprintf (stderr, "can not open file %S\n", name);
+                return;
+            }
+                                                                                
+            add_BP_file_handle (&fh->sfh, new_h);
+            sfh = &new_h->fh;
+
+            free (name_no_path);
+            free (name);
+        }
+
+        MPI_File_seek (*sfh
+                      ,(MPI_Offset)chunk_offset
+                      ,MPI_SEEK_SET
+                      );
+        MPI_File_read (*sfh
+                      ,fh->b->buff
+                      ,size
+                      ,MPI_BYTE
+                      ,&status
+                      );
+    }
+    else
+    {
+        MPI_File_seek (fh->mpi_fh
+                      ,(MPI_Offset)chunk_offset
+                      ,MPI_SEEK_SET
+                      );
+        MPI_File_read (fh->mpi_fh
+                      ,fh->b->buff
+                      ,size
+                      ,MPI_BYTE
+                      ,&status
+                      );
+    }
+
+    fh->b->offset = 0;
+
+    gettimeofday (&t1, NULL);
+
+//    printf ("read chunk time = %f \n", t1.tv_sec - t0.tv_sec + (double)(t1.tv_usec - t0.tv_usec)/1000000 );
+
+}
+
+/* 
+The read request link list needs to be sorted beforehand
+*/
+void do_read (struct proc_struct * p)
+{
+// Chunk size is set to 32 MB
+    void * data = 0;
+    int i, counter = 0;
+    int file_idx;
+    uint64_t offset, payload_size;
+struct timeval t0;
+struct timeval t1;
+double t2, t3, t4, t5;
+
+    candidate_reader * s = p->split_read_request_list, * f_start = s, * f_end = s;
+    candidate_reader * o_start = s, * o_end = s, * o_prev_end = 0, * parent = 0;
+
+    gettimeofday (&t0, NULL);
+
+    t2 = MPI_Wtime();
+
+    while (f_start)
+    {
+        f_end = f_start;
+
+        // Find a set of reqeusts that fall into the same file, i.e., [f_start, f_end)
+        while (f_end && f_end->ra->file_idx == f_start->ra->file_idx)
+        {
+            f_end = f_end->next;
+        }
+
+        o_start = f_start;
+        o_end = f_start;
+        o_prev_end = 0;
+
+        while (o_start != f_end)         
+        {
+            // Find a set of requests that fall into chunk size, i.e., [o_start, o_end)
+            while (o_end && o_end != f_end && o_end->ra->offset - o_start->ra->offset <= p->chunk_size)
+            {
+                o_prev_end = o_end;
+                o_end = o_end->next;
+            }
+
+            // Calculate the var payload size of the last request
+            getDataAddress (p->gp, o_prev_end->ra->varid, o_prev_end->ra->start, o_prev_end->ra->count, &file_idx, &offset, &payload_size);;
+//printf ("o_start.offset = %llu\n", o_start->ra->offset);
+//printf ("o_prev_end.offset = %llu\n", o_prev_end->ra->offset);
+
+            t4 = MPI_Wtime ();
+            // read a chunk from file into internal buffer
+            adios_read_bp_staged_read_chunk (p->gp, o_start->ra->file_idx, o_start->ra->offset, o_prev_end->ra->offset - o_start->ra->offset + payload_size); 
+
+            t5 = MPI_Wtime ();
+//    printf ("read chunk = %f \n", t5 - t4);
+
+            s = o_start;
+            do
+            {
+                parent = s->ra->parent;
+                // copy data from internal buffer to user buffer
+//                adios_read_bp_staged_read_buffer (p->gp, o_start->ra->offset, parent, s);
+
+                s = s->next;
+            } while (s != o_end);
+
+            o_start = o_end;
+            o_prev_end = 0;
+        }
+
+        f_start = f_end;
+    }
+
+    gettimeofday (&t1, NULL);
+    t3 = MPI_Wtime ();
+
+//    printf ("while time = %f \n", t1.tv_sec - t0.tv_sec + (double)(t1.tv_usec - t0.tv_usec)/1000000 );
+//    printf ("while time = %f \n", t3 - t2);
+}
+
+void free_candidate_reader_list (candidate_reader * h)
+{
+    candidate_reader * n;
+    while (h)
+    {
+        n = h->next;
+
+        if (h->ra && h->ra->start)
+        {
+            free (h->ra->start);
+        }
+
+        if (h->ra && h->ra->count)
+        {
+            free (h->ra->count);
+        }
+
+        if (h->ra)
+        {
+            free (h->ra);
+        }
+
+        free (h);
+        h = n;
+    }
+}
+
+void free_proc_struct (struct proc_struct * p)
+{
+    candidate_reader * h = p->local_read_request_list, * n;
+    while (h)
+    {
+        n = h->next;
+
+        if (h->ra && h->ra->start)
+        {
+            free (h->ra->start);
+        }
+
+        if (h->ra && h->ra->count)
+        {
+            free (h->ra->count);
+        }
+
+        if (h->ra && h->ra->data && h->rank != p->rank)
+        {
+            free (h->ra->data);
+        }
+
+        if (h->ra)
+        {
+            free (h->ra);
+        }
+
+        free (h);
+        h = n;
+    }
+
+    h = p->split_read_request_list;
+    while (h)
+    {
+        n = h->next;
+    
+        if (h->ra && h->ra->start)
+        {
+            free (h->ra->start);
+        }
+    
+        if (h->ra && h->ra->count)
+        {
+            free (h->ra->count); 
+        }
+
+        if (h->ra)
+        {
+            free (h->ra);
+        }
+
+        free (h);
+        h = n;
+    }
+
+    if (p->aggregator_rank_array)
+    {
+        free (p->aggregator_rank_array);
+    }
+
+    if (p->b)
+    {
+        free (p->b);
+    }
+}
+
+void init_read (struct BP_FILE * fh)
+{
+    int thread_level, i, remain;
+    int color1, color2;
+    char * env_str;
+
+    struct proc_struct * p = (struct proc_struct *) malloc (sizeof (struct proc_struct));
+    assert (p);
+
+    fh->priv = p;
+    MPI_Comm_rank (fh->comm, &p->rank);
+    MPI_Comm_size (fh->comm, &p->size);
+
+    env_str = getenv ("num_aggregators");
+    if (!env_str)
+    {
+        fprintf (stderr, "Environment variable \"num_aggregators\" hasn't been set.\n");
+        exit(0);
+    }
+
+    p->num_aggregators = atoi (env_str);
+
+    if (p->rank == 0)
+    {
+        printf ("%d aggregators are used.\n", p->num_aggregators);
+    }
+
+    env_str = getenv ("chunk_size");
+    if (!env_str)
+    {
+        fprintf (stderr, "Environment variable \"chunk_size\" (in MB) hasn't been set.\n");
+        exit(0);
+    }
+
+    p->chunk_size = 1024 * 1024 * atoi (env_str);
+    p->gp = 0; // p->gp is set in gopen call
+    p->groups = (p->num_aggregators > p->size || p->num_aggregators <= 0) ? p->size : p->num_aggregators;
+    p->group_size = p->size / p->groups;
+    remain = p->size - p->group_size * p->groups;
+
+    p->aggregator_rank_array = (int *) malloc (p->groups * sizeof (int));
+    for (i = 0; i < p->groups; i++)
+    {
+        if (remain == 0)
+        {
+            p->aggregator_rank_array[i] = p->group_size * i;
+        }
+        else
+        {
+            if (i < remain)
+            {
+                p->aggregator_rank_array[i] = (p->group_size + 1) * i;
+            }
+            else
+            {
+                p->aggregator_rank_array[i] = remain * (p->group_size + 1) + (i - remain) * p->group_size;
+            }
+        }
+    }
+
+    if (remain == 0)
+    {
+        color1 = p->rank / p->group_size;
+        color2 = p->rank % p->group_size;
+ 
+        p->aggregator_rank = color1 * p->group_size;
+    }
+    else
+    {
+        if (p->rank < (p->group_size + 1) * remain)
+        {
+            color1 = p->rank / (p->group_size + 1);
+            color2 = p->rank % (p->group_size + 1);
+        
+            p->aggregator_rank = color1 * (p->group_size + 1);
+            p->group_size++;
+        }
+        else
+        {
+            color1 = remain + (p->rank - (p->group_size + 1) * remain) / p->group_size;
+            color2 = (p->rank - (p->group_size + 1) * remain) % p->group_size;
+        
+            p->aggregator_rank = remain * (p->group_size + 1) + (color1 - remain) * p->group_size;
+        }
+    }
+
+    p->group = color1;
+
+    MPI_Comm_split (fh->comm, color1, p->rank, &p->new_comm);
+    MPI_Comm_split (fh->comm, color2, p->rank, &p->new_comm2);
+    MPI_Comm_rank (p->new_comm, &p->new_rank);
+
+    p->aggregator_new_rank = 0;
+    p->group_comm = fh->comm;
+
+    p->local_read_request_list = 0;
+    p->split_read_request_list = 0;
+    p->b = 0;
+    p->read_close_received = 0;
+    p->group_close_received = 0;
+
+    return;
+}
+
+static MPI_File * get_BP_file_handle(struct BP_file_handle * l, uint32_t file_index)
+{
+    if (!l)
+        return 0;
+
+    while (l)
+    {
+        if (l->file_index == file_index)
+            return &l->fh;
+
+        l = l->next;
+    }
+
+    return 0;
+}
+
+static void add_BP_file_handle (struct BP_file_handle ** l, struct BP_file_handle * n)
+{
+    if (!n)
+        return;
+
+    n->next = *l;
+    *l = n;
+}
+
+
+static void close_all_BP_files (struct BP_file_handle * l)
+{
+    struct BP_file_handle * n;
+
+    while (l)
+    {
+        n = l->next;
+
+        MPI_File_close (&l->fh);
+        free (l);
+
+        l = n;
+    }
+}
+
+/* Return 0: if file is little endian, 1 if file is big endian 
+ * We know if it is different from the current system, so here
+ * we determine the current endianness and report accordingly.
+ */
+static int adios_read_bp_staged_get_endianness( uint32_t change_endianness )
+{
+   int LE = 0;
+   int BE = !LE;
+   int i = 1;
+   char *p = (char *) &i;
+   int current_endianness;
+   if (p[0] == 1) // Lowest address contains the least significant byte
+       current_endianness = LE;
+   else
+       current_endianness = BE;
+    if (change_endianness == adios_flag_yes)
+        return !current_endianness;
+    else
+        return current_endianness;
+}
+
+static int getNumSubfiles (const char * fname)
+{
+   char * dirname;
+   int n = 0;
+#include <sys/types.h>
+#include <dirent.h>
+    dirname = malloc (strlen (fname) + 5);
+    sprintf (dirname, "%s%s", fname, ".dir");
+
+    DIR * mydir = opendir(dirname);
+    struct dirent * entry;
+
+    n = 0;
+    while((entry = (struct dirent *)readdir (mydir)))
+    {
+        n++;
+    }
+
+    // exclude . and ..
+    n -= 2;
+    closedir(mydir);
+    free (dirname);
+
+    return n;
+}
+
+int adios_read_bp_staged_init (MPI_Comm comm) { return 0; }
+int adios_read_bp_staged_finalize () { return 0; }
+
+void broadcast_fh_buffer (struct BP_FILE * fh)
+{
+    struct bp_index_pg_struct_v1 * pgs_root = fh->pgs_root, * pg;
+    struct adios_index_var_struct_v1 * vars_root = fh->vars_root, * v;
+    struct adios_index_attribute_struct_v1 * attrs_root = fh->attrs_root;
+    void * buffer;
+    uint64_t buffer_size, buffer_offset = 0;
+    int i, j, timedim;
+    uint16_t len;
+    uint8_t flag;
+    struct proc_struct * p = (struct proc_struct *) fh->priv;
+
+
+    bp_realloc_aligned (fh->b, 0);
+/*
+    buffer = fh->b->buff;
+*/
+    buffer = 0;
+    buffer_size = 0;
+    buffer_offset = 0;
+
+    if (isAggregator (p))
+    {
+        _buffer_write (&buffer, &buffer_size, &buffer_offset, &p->num_aggregators, 4); // n_sf
+        _buffer_write (&buffer, &buffer_size, &buffer_offset, &fh->gvar_h->group_count, 2); //group_count 
+        _buffer_write (&buffer, &buffer_size, &buffer_offset, &fh->mfooter.pgs_count, 8); //vars_count 
+        _buffer_write (&buffer, &buffer_size, &buffer_offset, &fh->mfooter.vars_count, 2); //vars_count 
+        _buffer_write (&buffer, &buffer_size, &buffer_offset, &fh->mfooter.attrs_count, 2); //attrs_count 
+
+        for (i = 0; i < fh->gvar_h->group_count; i++)
+        {
+            len = strlen (fh->gvar_h->namelist[i]);
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, &len, 2); // namelist
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, fh->gvar_h->namelist[i], len); // namelist
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, &fh->gvar_h->var_counts_per_group[i], 2); // var_counts_per_group
+        }
+
+        _buffer_write (&buffer, &buffer_size, &buffer_offset, &fh->gattr_h->group_count, 2); //group_count 
+        for (i = 0; i < fh->gattr_h->group_count; i++)
+        {
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, &fh->gattr_h->attr_counts_per_group[i], 2); // attr_counts_per_group
+        }
+
+        for (i = 0; i < fh->mfooter.vars_count; i++)
+        {
+            len = strlen (fh->gvar_h->var_namelist[i]);
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, &len, 2); // namelist
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, fh->gvar_h->var_namelist[i], len); // namelist
+        }
+
+        for (i = 0; i < fh->mfooter.attrs_count; i++)
+        {
+            len = strlen (fh->gattr_h->attr_namelist[i]);
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, &len, 2); // namelist
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, fh->gattr_h->attr_namelist[i], len); // namelist
+        }   
+
+        _buffer_write (&buffer, &buffer_size, &buffer_offset, &fh->tidx_start, 4); // tidx_start
+        _buffer_write (&buffer, &buffer_size, &buffer_offset, &fh->tidx_stop, 4); // tidx_start
+
+        pgs_root = fh->pgs_root;
+        while (pgs_root)
+        {
+            len = strlen (pgs_root->group_name);
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, &len, 2); // group_name len
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, pgs_root->group_name, len); // group_name
+
+            flag = (pgs_root->adios_host_language_fortran == adios_flag_yes) ? 'y' : 'n';
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, &flag, 1);
+
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, &pgs_root->process_id, 4);
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, &pgs_root->time_index, 4);
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, &pgs_root->offset_in_file, 8);
+
+            pgs_root = pgs_root->next;
+        }
+
+        vars_root = fh->vars_root;
+        while (vars_root)
+        {
+uint64_t bo = buffer_offset;
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, &vars_root->id, 2); // id
+
+            len = strlen (vars_root->group_name);
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, &len, 2); // group_name len
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, vars_root->group_name, len); // group_name
+
+            len = strlen (vars_root->var_name);
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, &len, 2); // var_name len
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, vars_root->var_name, len); // var_name
+
+            len = strlen (vars_root->var_path);
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, &len, 2); // var_path len
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, vars_root->var_path, len); // var_path
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, &vars_root->type, 4); // type
+
+            ADIOS_VARINFO * vi = _inq_var_byid (fh, vars_root->id);
+            assert (vi);
+
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, &vi->ndim, 4); // ndim
+            if (vi->ndim)
+            {
+                _buffer_write (&buffer, &buffer_size, &buffer_offset, vi->dims, vi->ndim * 8); // dims
+            }
+
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, &vi->timedim, 4); // ndim
+         
+            len = (vars_root->characteristics[0].value == 0) ? 0 : bp_get_type_size (vars_root->type, vars_root->characteristics[0].value);
+            if (vars_root->type == adios_string)
+            {
+                len--;
+            }
+/*
+int rank;
+MPI_Comm_rank (MPI_COMM_WORLD, &rank);
+if (rank == 0)
+fprintf (stderr, "bc %s bo 1 = %llu, bo 2 = %llu, len = %d\n", vars_root->var_name, bo, buffer_offset, len);
+*/
+            _buffer_write (&buffer, &buffer_size, &buffer_offset, &len, 2);
+
+            if (len)
+            {
+//                _buffer_write (&buffer, &buffer_size, &buffer_offset, vi->value, len); // ndim
+                _buffer_write (&buffer, &buffer_size, &buffer_offset, vars_root->characteristics[0].value, len); // ndim
+
+            }
+
+            adios_read_bp_staged_free_varinfo (vi);
+
+            vars_root = vars_root->next;
+        }
+    }
+
+    MPI_Bcast (&buffer_offset, 8, MPI_BYTE, 0, p->new_comm);
+    if (!isAggregator (p))
+    {
+/*
+        bp_realloc_aligned (fh->b, buffer_offset);
+        assert (fh->b->buff);
+
+        buffer = fh->b->buff;
+*/
+        buffer = malloc (buffer_offset);
+        assert (buffer);
+    }
+
+    MPI_Bcast (buffer, buffer_offset, MPI_BYTE, 0, p->new_comm);
+
+    if (!isAggregator (p))
+    {
+        uint16_t len, group_count, var_counts_per_group;
+
+        buffer_offset = 0;
+
+        _buffer_read (buffer, &buffer_offset, &p->num_aggregators, 4);
+
+        fh->gvar_h = (struct BP_GROUP_VAR *) malloc (sizeof (struct BP_GROUP_VAR));
+        assert (fh->gvar_h);
+        fh->gvar_h->time_index = 0;
+        fh->gvar_h->var_offsets = 0;
+        fh->gvar_h->pg_offsets = 0;
+
+        _buffer_read (buffer, &buffer_offset, &fh->gvar_h->group_count, 2); //group_count 
+        _buffer_read (buffer, &buffer_offset, &fh->mfooter.pgs_count, 8); //pgs_count 
+        _buffer_read (buffer, &buffer_offset, &fh->mfooter.vars_count, 2); //vars_count 
+        _buffer_read (buffer, &buffer_offset, &fh->mfooter.attrs_count, 2); //attrs_count 
+
+        fh->gvar_h->namelist = (char **) malloc (fh->gvar_h->group_count * sizeof (char *));
+        fh->gvar_h->var_counts_per_group = (uint16_t *) malloc (fh->gvar_h->group_count * 2);
+
+        for (i = 0; i < fh->gvar_h->group_count; i++)
+        {
+            _buffer_read (buffer, &buffer_offset, &len, 2); // len
+            fh->gvar_h->namelist[i] = (char *) malloc (len + 1);
+            _buffer_read (buffer, &buffer_offset, fh->gvar_h->namelist[i], len); // namelist
+            fh->gvar_h->namelist[i][len] = '\0';
+
+            _buffer_read (buffer, &buffer_offset, &fh->gvar_h->var_counts_per_group[i], 2); // var_counts_per_group
+        }
+
+        fh->gattr_h = (struct BP_GROUP_ATTR *) malloc (sizeof (struct BP_GROUP_ATTR));
+        assert (fh->gattr_h);
+        fh->gattr_h->attr_offsets = 0;
+
+        _buffer_read (buffer, &buffer_offset, &fh->gattr_h->group_count, 2); //group_count 
+
+        fh->gattr_h->attr_counts_per_group = (uint16_t *) malloc (fh->gattr_h->group_count * 2);
+        fh->gattr_h->namelist = fh->gvar_h->namelist;
+
+        for (i = 0; i < fh->gattr_h->group_count; i++)
+        {
+            _buffer_read (buffer, &buffer_offset, &fh->gattr_h->attr_counts_per_group[i], 2); // attr_counts_per_group
+        }
+
+        fh->gvar_h->var_namelist = (char **) malloc (fh->mfooter.vars_count * sizeof (char *));
+        for (i = 0; i < fh->mfooter.vars_count; i++)
+        {
+            _buffer_read (buffer, &buffer_offset, &len, 2); // len
+            fh->gvar_h->var_namelist[i] = (char *) malloc (len + 1);
+            _buffer_read (buffer, &buffer_offset, fh->gvar_h->var_namelist[i], len); // namelist
+            fh->gvar_h->var_namelist[i][len] = '\0';
+        }
+
+        fh->gattr_h->attr_namelist = (char **) malloc (fh->mfooter.attrs_count * sizeof (char *));
+        for (i = 0; i < fh->mfooter.attrs_count; i++)
+        {
+            _buffer_read (buffer, &buffer_offset, &len, 2); // len
+            fh->gattr_h->attr_namelist[i] = (char *) malloc (len + 1);
+            _buffer_read (buffer, &buffer_offset, fh->gattr_h->attr_namelist[i], len); // namelist
+            fh->gattr_h->attr_namelist[i][len] = '\0';
+        }
+
+        _buffer_read (buffer, &buffer_offset, &fh->tidx_start, 4);
+        _buffer_read (buffer, &buffer_offset, &fh->tidx_stop, 4);
+
+        pgs_root = 0;
+        int pgs_count = fh->mfooter.pgs_count;
+
+        for (i = 0; i < pgs_count; i++)
+        {
+            pg = (struct bp_index_pg_struct_v1 *) malloc (sizeof (struct bp_index_pg_struct_v1));
+            assert (pg);
+
+            _buffer_read (buffer, &buffer_offset, &len, 2);
+
+            pg->group_name = (char *) malloc (len + 1);
+            _buffer_read (buffer, &buffer_offset, pg->group_name, len);
+            pg->group_name[len] = '\0';
+
+            _buffer_read (buffer, &buffer_offset, &flag, 1);
+            pg->adios_host_language_fortran = (flag == 'y') ? adios_flag_yes : adios_flag_no;
+
+            _buffer_read (buffer, &buffer_offset, &pg->process_id, 4);
+            _buffer_read (buffer, &buffer_offset, &pg->time_index, 4);
+            _buffer_read (buffer, &buffer_offset, &pg->offset_in_file, 8);
+
+            pg->time_index_name = 0;
+            pg->next = 0;
+
+            if (!pgs_root)
+            {
+                pgs_root = pg;
+                fh->pgs_root = pg;
+            }
+            else
+            {
+                pgs_root->next = pg;
+                pgs_root = pg;
+            }
+        }
+
+        vars_root = 0;
+        for (i = 0; i < fh->mfooter.vars_count; i++)
+        {
+            v = (struct adios_index_var_struct_v1 *) malloc (sizeof (struct adios_index_var_struct_v1));
+            assert (v);
+uint64_t bo = buffer_offset;
+            _buffer_read (buffer, &buffer_offset, &v->id, 2);
+
+            _buffer_read (buffer, &buffer_offset, &len, 2);
+            v->group_name = (char *) malloc (len + 1);
+            _buffer_read (buffer, &buffer_offset, v->group_name, len);
+            v->group_name[len] = '\0';
+
+            _buffer_read (buffer, &buffer_offset, &len, 2);
+            v->var_name = (char *) malloc (len + 1);
+            _buffer_read (buffer, &buffer_offset, v->var_name, len);
+            v->var_name[len] = '\0';
+
+            _buffer_read (buffer, &buffer_offset, &len, 2);
+            v->var_path = (char *) malloc (len + 1);
+            _buffer_read (buffer, &buffer_offset, v->var_path, len);
+            v->var_path[len] = '\0';
+
+            _buffer_read (buffer, &buffer_offset, &v->type, 4);
+
+            v->characteristics_count = 1; 
+            v->characteristics = (struct adios_index_characteristic_struct_v1 *)
+                                     malloc (sizeof (struct adios_index_characteristic_struct_v1));
+            assert (v->characteristics);
+ 
+            v->characteristics->stats = 0;
+            _buffer_read (buffer, &buffer_offset, &(v->characteristics->dims.count), 4);
+
+            v->characteristics->dims.dims = 0;
+
+int rank;
+MPI_Comm_rank (MPI_COMM_WORLD, &rank);
+
+            if (v->characteristics->dims.count)
+            {
+                v->characteristics->dims.dims = (uint64_t *) malloc (v->characteristics->dims.count * 3 * 8);
+                assert (v->characteristics->dims.dims);
+
+                uint64_t * gdims = (uint64_t *) malloc (v->characteristics->dims.count * 8);
+                assert (gdims);
+
+                _buffer_read (buffer, &buffer_offset, gdims, v->characteristics->dims.count * 8);
+                for (j = 0; j < v->characteristics->dims.count; j++)
+                {
+                    v->characteristics->dims.dims[j * 3] = gdims[j];
+                    v->characteristics->dims.dims[j * 3 + 1] = gdims[j];
+                    v->characteristics->dims.dims[j * 3 + 2] = 0;
+                }
+                free (gdims);
+            }
+            _buffer_read (buffer, &buffer_offset, &timedim, 4);
+/*
+if (rank == 1)
+fprintf (stderr, "bc 1 v->id = %d, bo 1 = %llu, bo 2 = %llu, v->var_name = %s\n", v->id, bo, buffer_offset, v->var_name);
+*/
+            _buffer_read (buffer, &buffer_offset, &len, 2);
+    
+            if (len)
+            {
+                if (v->type == adios_string)
+                {
+                    v->characteristics->value = malloc (len + 1);
+                }
+                else
+                {
+                    v->characteristics->value = malloc (len);
+                }
+
+                _buffer_read (buffer, &buffer_offset, v->characteristics->value, len);
+
+                if (v->type == adios_string)
+                {
+                    ((char * )(v->characteristics->value))[len] = '\0';
+                }
+            }
+            else
+            {
+                v->characteristics->value = 0;
+            }
+            v->next = 0;
+
+            if (!vars_root)
+            {
+                vars_root = v;
+                fh->vars_root = v;
+            }
+            else
+            {
+                vars_root->next = v;
+                vars_root = v;
+            }
+        }
+    }
+
+    if (buffer)
+    {
+        free (buffer);
+    }
+}
+
+ADIOS_FILE * adios_read_bp_staged_fopen (const char * fname, MPI_Comm comm)
+{
+    int i, rank;
+    struct BP_FILE * fh;
+    ADIOS_FILE * fp;
+    uint64_t header_size;
+    struct proc_struct * p;
+    char * env_str;
+
+    adios_errno = 0;
+
+    fh = (struct BP_FILE *) malloc (sizeof (struct BP_FILE));
+    assert (fh);
+
+    fh->fname = (fname ? strdup (fname) : 0L);
+    //FIXME
+    fh->mpi_fh = 0;
+    fh->sfh = 0;
+    fh->comm = comm;
+    fh->gvar_h = 0;
+    fh->pgs_root = 0;
+    fh->vars_root = 0;
+    fh->attrs_root = 0;
+    fh->b = malloc (sizeof (struct adios_bp_buffer_struct_v1));
+    assert (fh->b);
+
+    fp = (ADIOS_FILE *) malloc (sizeof (ADIOS_FILE));
+    assert (fp);
+
+    adios_buffer_struct_init (fh->b);
+
+    init_read (fh);
+
+    p = (struct proc_struct *) fh->priv;
+
+    if (isAggregator (p))
+    {
+        if (bp_read_open (fname, p->new_comm2, fh))
+            return NULL;
+
+        if (p->rank == 0)
+        {
+            if (bp_read_minifooter (fh))
+            {
+                return NULL;
+            }
+        }
+
+        MPI_Bcast (&fh->mfooter, sizeof (struct bp_minifooter), MPI_BYTE, 0, p->new_comm2);
+
+        header_size = fh->mfooter.file_size - fh->mfooter.pgs_index_offset;
+
+        if (p->rank != 0)
+        {
+            if (!fh->b->buff)
+            {
+                bp_alloc_aligned (fh->b, header_size);
+                if (!fh->b->buff)
+                   return NULL;
+                memset (fh->b->buff, 0, header_size);
+                fh->b->offset = 0;
+            }
+        }
+    
+        MPI_Bcast (fh->b->buff, fh->mfooter.file_size - fh->mfooter.pgs_index_offset, MPI_BYTE, 0, p->new_comm2);
+
+        /* Everyone parses the index on its own */
+        bp_parse_pgs (fh);
+        bp_parse_vars (fh);
+        bp_parse_attrs (fh);
+
+        /* fill out ADIOS_FILE struct */
+        fp->vars_count = fh->mfooter.vars_count;
+        fp->attrs_count = fh->mfooter.attrs_count;
+        fp->tidx_start = fh->tidx_start;
+        fp->ntimesteps = fh->tidx_stop - fh->tidx_start + 1;
+        fp->file_size = fh->mfooter.file_size;
+        fp->version = fh->mfooter.version;
+        fp->endianness = adios_read_bp_staged_get_endianness (fh->mfooter.change_endianness);
+    }
+
+    broadcast_fh_buffer (fh);
+
+    fp->fh = (uint64_t) fh;
+    fp->groups_count = fh->gvar_h->group_count;
+    alloc_namelist (&fp->group_namelist, fp->groups_count);
+
+    for (i = 0;i < fp->groups_count; i++)
+    {
+        if (!fp->group_namelist[i])
+        {
+            adios_error (err_no_memory, "Could not allocate buffer for %d strings in adios_fopen()", fp->groups_count);
+            adios_read_bp_fclose (fp);
+            return NULL;
+        }
+        else
+        {
+            strcpy (fp->group_namelist[i], fh->gvar_h->namelist[i]);
+        }
+    }
+
+    return fp;
+}
+
+/* This function can be called if user places 
+   the wrong sequences of dims for a var 
+*/   
+void adios_read_bp_staged_reset_dimension_order (ADIOS_FILE *fp, int is_fortran)
+{
+    struct BP_FILE * fh = (struct BP_FILE *)(fp->fh);
+    struct bp_index_pg_struct_v1 ** root = &(fh->pgs_root);
+    struct bp_minifooter * mh = &(fh->mfooter);
+    uint64_t i;
+
+    for (i = 0; i < mh->pgs_count; i++) {
+        is_fortran ? ((*root)->adios_host_language_fortran = adios_flag_yes) 
+               : ((*root)->adios_host_language_fortran = adios_flag_no);
+        root = &(*root)->next;
+    }
+}
+
+int adios_read_bp_staged_fclose (ADIOS_FILE *fp) 
+{
+    struct BP_FILE * fh = (struct BP_FILE *) fp->fh;
+    struct BP_GROUP_VAR * gh = fh->gvar_h;
+    struct BP_GROUP_ATTR * ah = fh->gattr_h;
+    struct adios_index_var_struct_v1 * vars_root = fh->vars_root, *vr;
+    struct adios_index_attribute_struct_v1 * attrs_root = fh->attrs_root, *ar;
+    struct bp_index_pg_struct_v1 * pgs_root = fh->pgs_root, *pr;
+    int i,j;
+
+    MPI_File mpi_fh = fh->mpi_fh;
+
+    adios_errno = 0;
+    if (fh->mpi_fh) 
+        MPI_File_close (&mpi_fh);
+
+    if (fh->sfh)
+        close_all_BP_files (fh->sfh);
+
+    if (fh->b) {
+        adios_posix_close_internal (fh->b);
+        free(fh->b);
+    }
+
+    /* Free variable structures */
+    /* alloc in bp_utils.c: bp_parse_vars() */
+    while (vars_root) {
+        vr = vars_root;
+        vars_root = vars_root->next;
+        for (j = 0; j < vr->characteristics_count; j++) {
+            // alloc in bp_utils.c:bp_parse_characteristics() <- bp_get_characteristics_data()
+
+            if (vr->characteristics[j].dims.dims)
+                free (vr->characteristics[j].dims.dims);
+
+            if (vr->characteristics[j].value)
+                free (vr->characteristics[j].value);
+            // NCSU - Clearing up statistics
+            if (vr->characteristics[j].stats)
+            {
+                uint8_t k = 0, idx = 0;
+                uint8_t i = 0, count = adios_get_stat_set_count(vr->type);
+
+                while (vr->characteristics[j].bitmap >> k)
+                {
+                    if ((vr->characteristics[j].bitmap >> k) & 1)
+                    {
+                        for (i = 0; i < count; i ++)
+                        {
+                            if (k == adios_statistic_hist)
+                            {
+                                struct adios_index_characteristics_hist_struct * hist = (struct adios_index_characteristics_hist_struct *) (vr->characteristics [j].stats[i][idx].data);
+                                free (hist->breaks);
+                                free (hist->frequencies);
+                                free (hist);
+                            }
+                            else
+                            free (vr->characteristics[j].stats [i][idx].data);
+                        }
+                        idx ++;
+                    }
+                    k ++;
+                }
+
+                for (i = 0; i < count; i ++)
+                    free (vr->characteristics[j].stats [i]);
+
+                free (vr->characteristics[j].stats);
+                vr->characteristics[j].stats = 0;
+            }
+
+        }
+
+        if (vr->characteristics) 
+            free (vr->characteristics);
+        if (vr->group_name) 
+            free (vr->group_name);
+        if (vr->var_name) 
+            free (vr->var_name);
+        if (vr->var_path) 
+            free (vr->var_path);
+        free(vr);
+    }
+
+    /* Free attributes structures */
+    /* alloc in bp_utils.c bp_parse_attrs() */
+
+    while (attrs_root) {
+        ar = attrs_root;
+        attrs_root = attrs_root->next;
+        for (j = 0; j < ar->characteristics_count; j++) {
+            if (ar->characteristics[j].value)
+                free (ar->characteristics[j].value);
+        }
+        if (ar->characteristics) 
+            free (ar->characteristics);
+        if (ar->group_name) 
+            free (ar->group_name);
+        if (ar->attr_name) 
+            free (ar->attr_name);
+        if (ar->attr_path) 
+            free (ar->attr_path);
+        free(ar);
+    }
+
+
+    /* Free process group structures */
+    /* alloc in bp_utils.c bp_parse_pgs() first loop */
+    //printf ("pgs: %d\n", fh->mfooter.pgs_count);
+    while (pgs_root) {
+        pr = pgs_root;
+        pgs_root = pgs_root->next;
+        //printf("%d\tpg pid=%d addr=%x next=%x\n",i, pr->process_id, pr, pr->next);
+        if (pr->group_name)
+            free(pr->group_name);
+        if (pr->time_index_name)
+            free(pr->time_index_name);
+        free(pr);
+    }
+
+    /* Free variable structures in BP_GROUP_VAR */
+    if (gh) {
+        for (j=0;j<2;j++) { 
+            for (i=0;i<gh->group_count;i++) {
+                if (gh->time_index && gh->time_index[j] && gh->time_index[j][i])
+                    free(gh->time_index[j][i]);
+            }
+            if (gh->time_index && gh->time_index[j])
+                free(gh->time_index[j]);
+        }
+        free (gh->time_index);
+    
+        for (i=0;i<gh->group_count;i++) { 
+            if (gh->namelist[i])
+                free(gh->namelist[i]);
+        }
+        if (gh->namelist)
+            free (gh->namelist);
+
+        for (i=0;i<fh->mfooter.vars_count;i++) {
+            if (gh->var_namelist[i])
+                free(gh->var_namelist[i]);
+            if (gh->var_offsets && gh->var_offsets[i]) 
+                free(gh->var_offsets[i]);
+        }
+        if (gh->var_namelist)
+            free (gh->var_namelist);
+
+        if (gh->var_offsets) 
+            free(gh->var_offsets);
+
+        if (gh->var_counts_per_group)
+            free(gh->var_counts_per_group);
+
+        if (gh->pg_offsets)
+            free (gh->pg_offsets);
+
+        free (gh);
+    }
+
+    /* Free attribute structures in BP_GROUP_ATTR */
+    if (ah) {
+        for (i = 0; i < fh->mfooter.attrs_count; i++) {
+            if (ah->attr_offsets && ah->attr_offsets[i]) 
+                free(ah->attr_offsets[i]);
+            if (ah->attr_namelist && ah->attr_namelist[i]) 
+                free(ah->attr_namelist[i]);
+        }
+        if (ah->attr_offsets)
+            free(ah->attr_offsets);
+
+        if (ah->attr_namelist)
+            free(ah->attr_namelist);
+        if (ah->attr_counts_per_group) 
+            free(ah->attr_counts_per_group);
+
+        free(ah);
+    }
+
+    if (fh->fname)
+        free (fh->fname);
+    if (fh->priv)
+        free (fh->priv);    
+    if (fh)
+        free (fh);    
+
+    free_namelist ((fp->group_namelist),fp->groups_count);
+    free(fp);
+    return 0;
+}
+
+
+ADIOS_GROUP * adios_read_bp_staged_gopen (ADIOS_FILE *fp, const char * grpname)
+{
+    struct BP_FILE * fh = (struct BP_FILE *) fp->fh;
+    int grpid, rank, nproc; 
+    ADIOS_GROUP * gp;
+    struct proc_struct * p = (struct proc_struct *) fh->priv;
+
+    adios_errno = 0;
+    for (grpid=0;grpid<(fh->gvar_h->group_count);grpid++) {
+        if (!strcmp(fh->gvar_h->namelist[grpid], grpname))
+            break; 
+    }
+
+    if (grpid >= fh->gvar_h->group_count) {
+        adios_error ( err_invalid_group, "Invalid group name %s", grpname);
+        return NULL;
+    }
+
+    gp = adios_read_bp_staged_gopen_byid (fp, grpid);
+
+    p->gp = gp; 
+
+    return gp;
+}
+
+ADIOS_GROUP * adios_read_bp_staged_gopen_byid (ADIOS_FILE *fp, int grpid)
+{
+    struct BP_FILE * fh = (struct BP_FILE *) fp->fh;
+    struct BP_GROUP * gh;
+    ADIOS_GROUP * gp;
+    int i, offset;
+
+    adios_errno = 0;
+    if (grpid < 0 || grpid >= fh->gvar_h->group_count) {
+        adios_error ( err_invalid_group, "Invalid group index %d", grpid);
+        return NULL;
+    }
+
+    gh = (struct BP_GROUP *) malloc(sizeof(struct BP_GROUP));
+    if (!gh) {
+        adios_error ( err_no_memory, "Could not allocate memory for group info");
+        return NULL;
+    }
+
+    gp = (ADIOS_GROUP *) malloc(sizeof(ADIOS_GROUP));
+    if (!gp) {
+        adios_error ( err_no_memory, "Could not allocate memory for group info");
+        free(gh);
+        return NULL;
+    }
+
+    /* set offset index of variables (which is a long list of all vars in all groups) in this group */
+    offset = 0;
+    for (i=0; i<grpid; i++)
+        offset += fh->gvar_h->var_counts_per_group[i];
+
+
+    /* gh->vars_root will point to the list of vars in this group */
+    gh->vars_root = fh->vars_root; 
+    for (i=0; i<offset; i++)
+        gh->vars_root = gh->vars_root->next;
+
+    gh->group_id = grpid;
+    gh->vars_offset = offset;
+    gh->vars_count = fh->gvar_h->var_counts_per_group[grpid];
+
+    /* set offset of attributes in this group */
+    offset = 0;
+    for(i=0;i<grpid;i++)
+        offset += fh->gattr_h->attr_counts_per_group[i];
+
+    /* gh->attrs_root will point to the list of vars in this group */
+    gh->attrs_root = fh->attrs_root; 
+    for (i=0; i<offset; i++)
+        gh->attrs_root = gh->attrs_root->next;
+
+    gh->attrs_offset = offset;
+    gh->attrs_count = fh->gattr_h->attr_counts_per_group[grpid];
+
+    gh->fh = fh; 
+
+    /* fill out ADIOS_GROUP struct */
+    gp->grpid = grpid;
+    gp->gh = (uint64_t) gh;
+    gp->fp = fp;
+    gp->vars_count = gh->vars_count;
+    gp->attrs_count = gh->attrs_count;
+
+    offset = gh->vars_offset;
+    alloc_namelist (&(gp->var_namelist), gp->vars_count);
+    for (i=0;i<gp->vars_count;i++) {
+        if (!gp->var_namelist[i]) { 
+            adios_error (err_no_memory, "Could not allocate buffer for %d strings in adios_gopen()", gp->vars_count);
+            adios_read_bp_staged_gclose(gp);
+            return NULL;
+        }
+        else
+            strcpy(gp->var_namelist[i], gh->fh->gvar_h->var_namelist[i+offset]);
+    }
+
+    offset = gh->attrs_offset;
+    alloc_namelist (&(gp->attr_namelist), gp->attrs_count);
+    for (i=0;i<gp->attrs_count;i++) {
+        if (!gp->attr_namelist[i]) {
+            adios_error (err_no_memory, "Could not allocate buffer for %d strings in adios_gopen()", gp->vars_count);
+            adios_read_bp_staged_gclose(gp);
+            return NULL;
+        }
+        else {
+            strcpy(gp->attr_namelist[i], gh->fh->gattr_h->attr_namelist[i+offset]);
+        }
+    }
+
+    return gp;
+}
+                   
+int adios_read_bp_staged_gclose (ADIOS_GROUP * gp)
+{
+    struct BP_GROUP * gh = (struct BP_GROUP *) gp->gh;
+    struct BP_FILE * fh = gh->fh;
+    struct proc_struct * p = (struct proc_struct *) fh->priv;
+    candidate_reader * h = p->local_read_request_list;
+    int i, type, count, varid, ndims, total_size, size = calc_data_size (p);
+    void * buf;
+
+    p->b = malloc (size);
+
+    assert (p->b);
+
+    buf = p->b;
+
+    // message type
+    type = READ_CLOSE;
+    buffer_write (&buf, &type, 4);
+
+    // count
+    count = list_get_length (h);
+    buffer_write (&buf, &count, 4);
+
+    while (h)
+    {
+        varid = h->ra->varid;
+        ndims = h->ra->ndims;
+
+        buffer_write (&buf, &varid, 4);
+        buffer_write (&buf, &ndims, 4);
+        buffer_write (&buf, h->ra->start, ndims * 8);
+        buffer_write (&buf, h->ra->count, ndims * 8);
+        buffer_write (&buf, &h->ra->size, 8);
+        buffer_write (&buf, &h->ra->file_idx, 4);
+        buffer_write (&buf, &h->ra->offset, 8);
+
+        h = h->next;
+    }
+
+    int * sizes = malloc (p->group_size * 4);
+    int * offsets = malloc (p->group_size * 4);
+    void * recv_buffer;
+
+    MPI_Gather (&size, 1, MPI_INT
+               ,sizes, 1, MPI_INT
+               ,p->aggregator_new_rank, p->new_comm
+               );
+
+    if (isAggregator (p))
+    {
+        total_size = 0;
+        offsets[0] = 0;
+
+        for (i = 0; i < p->group_size; i++)
+        {
+            total_size += sizes[i];
+            if (i > 0)
+            {
+                offsets[i] = offsets[i - 1] + sizes[i - 1];
+            }
+        }
+
+        recv_buffer = malloc (total_size);
+        assert (recv_buffer);
+    }
+
+    MPI_Gatherv (p->b, size, MPI_BYTE
+                ,recv_buffer, sizes, offsets
+                ,MPI_BYTE, p->aggregator_new_rank, p->new_comm
+                );
+
+    if (isAggregator (p))
+    {
+        for (i = 1; i < p->group_size; i++)
+        {
+            parse_buffer (p, recv_buffer + offsets[i], p->aggregator_rank + i);
+        }
+        free (recv_buffer);
+
+        process_read_requests (p);
+    }
+
+    free (sizes);
+    free (offsets);
+
+    if (isAggregator (p))
+    {
+        sort_read_requests (p);
+        //list_print_readers (p, p->split_read_request_list);
+
+    struct timeval t0, t1;
+    gettimeofday (&t0, NULL);
+
+        do_read (p);
+
+    gettimeofday (&t1, NULL);
+//    printf ("[%3d] do_read time = %f\n", p->rank, t1.tv_sec - t0.tv_sec + (double)(t1.tv_usec - t0.tv_usec)/1000000);
+
+        send_read_data (p);
+    }
+    else
+    {
+        get_read_data (p); 
+    }
+
+    free_proc_struct (p);
+    free (gh);
+    free_namelist ((gp->var_namelist), gp->vars_count);
+    free_namelist ((gp->attr_namelist), gp->attrs_count);
+    free (gp);
+
+    return 0;
+}
+
+int adios_read_bp_staged_get_attr (ADIOS_GROUP * gp, const char * attrname, enum ADIOS_DATATYPES * type,
+                    int * size, void ** data)
+{
+    // Find the attribute: full path is stored with a starting / 
+    // Like in HDF5, we need to match names given with or without the starting /
+    // startpos is 0 or 1 to indicate if the argument has starting / or not
+    int attrid;
+    int vstartpos = 0, fstartpos = 0; 
+    struct BP_GROUP * gh = (struct BP_GROUP *)gp->gh;
+    int offset;
+
+    adios_errno = 0;
+    if (!gp) {
+        adios_error (err_invalid_group_struct, "Null pointer passed as group to adios_get_attr()");
+        return adios_errno;
+    }
+    if (!attrname) {
+        adios_error (err_invalid_attrname, "Null pointer passed as attribute name to adios_get_attr()!");
+        return adios_errno;
+    }
+
+    offset = gh->attrs_offset;
+
+    if (attrname[0] == '/') 
+        vstartpos = 1;
+    for (attrid=0; attrid<(gp->attrs_count);attrid++) {
+        //if (gp->attr_namelist[attrid][0] == '/') 
+        if (gh->fh->gattr_h->attr_namelist[attrid+offset][0] == '/') 
+            fstartpos = 1;
+        //if (!strcmp(gp->attr_namelist[attrid]+fstartpos, attrname+vstartpos))
+        if (!strcmp(gh->fh->gattr_h->attr_namelist[attrid+offset]+fstartpos, attrname+vstartpos))
+            break; 
+    }
+    if (attrid >= gp->attrs_count) {
+        adios_error ( err_invalid_attrname, "Invalid attribute name %s", attrname);
+        return adios_errno;
+    }
+
+    return adios_read_bp_staged_get_attr_byid(gp, attrid, type, size, data);
+}
+
+int adios_read_bp_staged_get_attr_byid (ADIOS_GROUP * gp, int attrid, 
+                    enum ADIOS_DATATYPES * type, int * size, void ** data)
+{
+    int    i, offset, count;
+    struct BP_GROUP * gh;
+    struct BP_FILE * fh;
+    struct adios_index_attribute_struct_v1 * attr_root;
+    struct adios_index_var_struct_v1 * var_root;
+    int    file_is_fortran;
+
+    adios_errno = 0;
+    if (!gp) {
+        adios_error (err_invalid_group_struct, "Null pointer passed as group to adios_get_attr()");
+        return adios_errno;
+    }
+    gh = (struct BP_GROUP *) gp->gh;
+    if (!gh) {
+        adios_error (err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh group handle is NULL!");
+        return adios_errno;
+    }
+    fh = gh->fh;
+    if (!fh) {
+        adios_error (err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh->fh file handle is NULL!");
+        return adios_errno;
+    }
+    if (attrid < 0 || attrid >= gh->attrs_count) {
+        adios_error (err_invalid_attrid, "Invalid attribute id %d (allowed 0..%d)", attrid, gh->attrs_count);
+        return adios_errno;
+    }
+
+    attr_root = gh->attrs_root; /* need to traverse the attribute list of the group */
+    for (i = 0; i < attrid && attr_root; i++)
+        attr_root = attr_root->next;
+    if (i != attrid) {
+        adios_error (err_corrupted_attribute, "Attribute id=%d is valid but was not found in internal data structures!",attrid);
+        return adios_errno; 
+    }
+
+    file_is_fortran = (fh->pgs_root->adios_host_language_fortran == adios_flag_yes);
+
+    if (attr_root->characteristics[0].value) {
+        /* Attribute has its own value */
+        *size = bp_get_type_size (attr_root->type, attr_root->characteristics[0].value);
+        *type = attr_root->type;
+        *data = (void *) malloc (*size);  
+        if (*data)
+            memcpy(*data, attr_root->characteristics[0].value, *size);
+    }
+    else if (attr_root->characteristics[0].var_id) {
+        /* Attribute is a reference to a variable */
+        /* FIXME: var ids are not unique in BP. If a group of variables are written several
+           times under different path using adios_set_path(), the id of a variable is always
+           the same (should be different). As a temporary fix, we look first for a matching
+           id plus path between an attribute and a variable. If not found, then we look for
+           a match on the ids only.*/
+        var_root = gh->vars_root; 
+        while (var_root) {
+            if (var_root->id == attr_root->characteristics[0].var_id && 
+                !strcmp(var_root->var_path, attr_root->attr_path))
+                break;
+            var_root = var_root->next;
+        }
+        if (!var_root) {
+            var_root = gh->vars_root; 
+            while (var_root) {
+                if (var_root->id == attr_root->characteristics[0].var_id)
+                    break;
+                var_root = var_root->next;
+            }
+        }
+
+        if (!var_root) {
+            adios_error (err_invalid_attribute_reference, 
+                   "Attribute %s/%s in group %s is a reference to variable ID %d, which is not found", 
+                   attr_root->attr_path, attr_root->attr_name, attr_root->group_name,
+                   attr_root->characteristics[0].var_id);
+            return adios_errno;
+        }
+
+        /* default values in case of error */
+        *data = NULL;
+        *size = 0;
+        *type = attr_root->type;
+
+        /* FIXME: variable and attribute type may not match, then a conversion is needed. */
+        /* Cases:
+                1. attr has no type, var is byte array     ==> string
+                2. attr has no type, var is not byte array ==> var type
+                3. attr is string, var is byte array       ==> string
+                4. attr type == var type                   ==> var type 
+                5. attr type != var type                   ==> attr type and conversion needed 
+        */
+        /* Error check: attr cannot reference an array in general */
+        if (var_root->characteristics[0].dims.count > 0) {
+            if ( (var_root->type == adios_byte || var_root->type == adios_unsigned_byte) &&
+                 (attr_root->type == adios_unknown || attr_root->type == adios_string) &&
+                 (var_root->characteristics[0].dims.count == 1)) {
+                 ; // this conversions are allowed
+            } else {
+                adios_error (err_invalid_attribute_reference, 
+                    "Attribute %s/%s in group %s, typeid=%d is a reference to an %d-dimensional array variable "
+                    "%s/%s of type %s, which is not supported in ADIOS",
+                    attr_root->attr_path, attr_root->attr_name, attr_root->group_name, attr_root->type,
+                    var_root->characteristics[0].dims.count,
+                    var_root->var_path, var_root->var_name, common_read_type_to_string(var_root->type));
+                return adios_errno;
+            }
+        }
+
+        if ( (attr_root->type == adios_unknown || attr_root->type == adios_string) &&
+             (var_root->type == adios_byte || var_root->type == adios_unsigned_byte) &&
+             (var_root->characteristics[0].dims.count == 1) ) {
+            /* 1D byte arrays are converted to string */
+            /* 1. read in variable */
+            char varname[512];
+            char *tmpdata;
+            uint64_t start, count;
+            int status;
+            start = 0; 
+            count = var_root->characteristics[0].dims.dims[0];
+            snprintf(varname, 512, "%s/%s", var_root->var_path, var_root->var_name);
+            tmpdata = (char *) malloc (count+1);
+            if (tmpdata == NULL) {
+                adios_error (err_no_memory, 
+                      "Cannot allocate memory of %lld bytes for reading in data for attribute %s/%s of group %s.",
+                      count, attr_root->attr_path, attr_root->attr_name, attr_root->group_name);
+                return adios_errno;
+            }
+
+            status = adios_read_bp_staged_read_var (gp, varname, &start, &count, tmpdata);
+            
+            if (status < 0) {
+                char *msg = strdup(adios_get_last_errmsg());
+                adios_error ((enum ADIOS_ERRCODES) status, 
+                      "Cannot read data of variable %s/%s for attribute %s/%s of group %s: %s",
+                      var_root->var_path, var_root->var_name, 
+                      attr_root->attr_path, attr_root->attr_name, attr_root->group_name,
+                      msg);
+                free(tmpdata);
+                free(msg);
+                return status;
+            }
+
+            *type = adios_string;
+            if (file_is_fortran) {
+                /* Fortran byte array to C string */
+                *data = futils_fstr_to_cstr( tmpdata, (int)count); /* FIXME: supports only 2GB strings... */
+                *size = strlen( (char *)data );
+                free(tmpdata);
+            } else {
+                /* C array to C string */
+                tmpdata[count] = '\0';
+                *size = count+1;
+                *data = tmpdata;
+            }
+        } else {
+            /* other types are inherited */
+            *type = var_root->type;
+            *size = bp_get_type_size (var_root->type, var_root->characteristics[0].value);
+            *data = (void *) malloc (*size);  
+            if (*data)
+                memcpy(*data, var_root->characteristics[0].value, *size);
+        }
+    }
+
+    return 0;
+}
+
+static void _swap_order (int n, uint64_t * array)
+{
+    int i;
+    uint64_t tmp;
+
+    for (i = 0; i< n / 2; i++)
+    {
+        tmp = array[i];
+        array[i] = array[n - 1 - i];
+        array[n - 1 - i] = tmp;
+    }
+}
+
+/* Reverse the order in an array in place.
+   use swapping from Fortran/column-major order to ADIOS-read-api/C/row-major order and back
+*/
+static void swap_order (int n, uint64_t * array, int * tdim)
+{
+    int i;
+    uint64_t tmp;
+
+    _swap_order (n, array);
+
+    if (* tdim > -1)
+    {
+        * tdim = (n - 1) - * tdim;
+    }
+}
+
+/* Look up variable id based on variable name.
+   Return index 0..gp->vars_count-1 if found, -1 otherwise
+*/
+static int adios_read_bp_staged_find_var(ADIOS_GROUP *gp, const char *varname)
+{
+    // Find the variable: full path is stored with a starting / 
+    // Like in HDF5, we need to match names given with or without the starting /
+    // startpos is 0 or 1 to indicate if the argument has starting / or not
+    int varid;
+    int vstartpos = 0, fstartpos; 
+    struct BP_GROUP * gh = (struct BP_GROUP *)gp->gh;
+    int offset;
+
+    adios_errno = 0;
+    if (!gp) {
+        adios_error (err_invalid_group_struct, "Null pointer passed as group");
+        return -1;
+    }
+    if (!varname) {
+        adios_error (err_invalid_varname, "Null pointer passed as variable name!");
+        return -1;
+    }
+
+    /* Search in gp->fh->gvar_h->var_namelist instead of gp->var_namelist, because that
+       one comes back from the user. One idiot (who writes this comment) sorted the
+       list in place after gopen and before inq_var.
+    */
+    offset = gh->vars_offset;
+
+    if (varname[0] == '/') 
+        vstartpos = 1;
+    for (varid=0; varid<(gp->vars_count);varid++) {
+        fstartpos = 0;
+        /* if (gp->var_namelist[varid][0] == '/') */
+        fstartpos = 0;
+        if (gh->fh->gvar_h->var_namelist[varid+offset][0] == '/')
+            fstartpos = 1;
+        /*if (!strcmp(gp->var_namelist[varid]+fstartpos, varname+vstartpos))*/
+        if (!strcmp(gh->fh->gvar_h->var_namelist[varid+offset]+fstartpos, varname+vstartpos))
+            break; 
+    }
+    if (varid >= gp->vars_count) {
+        adios_error (err_invalid_varname, "Invalid variable name %s", varname);
+        return -1;
+    }
+    return varid;
+}
+
+// NCSU - For custom memory allocation 
+#define CALLOC(var, num, sz, comment)\
+{\
+    var = calloc (num, sz); \
+    if (!var)    {\
+        adios_error_at_line (err_no_memory, __FILE__, __LINE__, "Could not allocate memory for ", comment, " in common_read_get_characteristics"); \
+        return; \
+    }\
+}
+
+#define MALLOC(var,sz,comment)\
+{\
+    var = malloc (sz); \
+    if (!var)    {\
+        adios_error_at_line (err_no_memory, __FILE__, __LINE__, "Could not allocate memory for ", comment, " in common_read_get_characteristics"); \
+        return; \
+    }\
+}\
+
+// NCSU - Reading the statistics
+/** Get value and statistics, allocate space for them too */
+static void adios_read_bp_staged_get_characteristics (struct adios_index_var_struct_v1 * var_root, ADIOS_VARINFO *vi)
+{
+    int i, j, c, count = 1;
+    int size, sum_size, sum_type;
+
+    vi->value = NULL;
+
+    vi->gmin = vi->gmax = NULL;
+    vi->gavg = NULL;
+    vi->mins = vi->maxs = NULL;
+    vi->avgs = NULL;
+    vi->gstd_dev = NULL;
+    vi->std_devs = NULL;
+    vi->hist = NULL;
+
+    // set value for scalars
+    if (var_root->characteristics [0].value) {
+        size = bp_get_type_size(var_root->type, var_root->characteristics [0].value);
+        vi->value = (void *) malloc (size);
+        
+        if (vi->value)
+           memcpy(vi->value, var_root->characteristics [0].value, size);
+        else {
+            adios_error_at_line (err_no_memory, __FILE__, __LINE__, "Could not allocate memory for value in common_read_get_characteristics");
+            return;
+        }
+    } else {
+        vi->value = NULL;
+    }
+/*
+    int npgs = var_root->characteristics_count, timestep, ntimes = -1;
+    uint64_t gcnt = 0, * cnts;
+
+    double *gsum = NULL, *gsum_square = NULL;
+    double **sums = NULL, **sum_squares = NULL;
+
+    int16_t map[32];
+    memset (map, -1, sizeof(map));
+
+    // Bitmap shows which statistical information has been calculated
+    i = j = 0;
+    while (var_root->characteristics[0].bitmap >> j)
+    {
+        if ((var_root->characteristics[0].bitmap >> j) & 1)
+            map [j] = i ++;
+        j ++;
+     }
+
+    if(vi->timedim >= 0)
+    {    
+        ntimes = vi->dims[0];
+
+        if (map[adios_statistic_min] != -1)
+        {
+            MALLOC(vi->mins, ntimes * sizeof(void *), "minimum per timestep");
+            for (i = 0; i < ntimes; i++)
+                vi->mins[i] = 0;
+        }
+
+        if (map[adios_statistic_max] != -1)
+        {
+            MALLOC(vi->maxs, ntimes * sizeof(void *), "maximum per timestep");
+            for (i = 0; i < ntimes; i++)
+                vi->maxs[i] = 0;
+        }
+
+        if (map[adios_statistic_sum] != -1)
+        {
+            MALLOC(sums, ntimes * sizeof(double *), "summation per timestep");
+            MALLOC(vi->avgs, ntimes * sizeof(double *), "average per timestep");
+
+            for (i = 0; i < ntimes; i++)
+                sums[i] = vi->avgs[i] = 0;
+
+            CALLOC(cnts, ntimes, sizeof(uint64_t), "count of elements per timestep");
+        }
+
+        if (map[adios_statistic_sum_square] != -1)
+        {
+            MALLOC(sum_squares, ntimes * sizeof(double *), "summation per timestep");
+            MALLOC(vi->std_devs, ntimes * sizeof(double *), "standard deviation per timestep");
+
+            for (i = 0; i < ntimes; i++)
+                vi->std_devs[i] = sum_squares[i] = 0;
+        }
+    }
+
+    if (map[adios_statistic_hist] != -1 && (var_root->characteristics[0].stats[0][map[adios_statistic_hist]].data))
+    {
+        struct adios_index_characteristics_stat_struct * stats = var_root->characteristics[0].stats[0];
+        struct adios_index_characteristics_hist_struct * hist = stats[map[adios_statistic_hist]].data;
+        int num_breaks = hist->num_breaks;
+
+        MALLOC(vi->hist, sizeof(struct ADIOS_HIST), "histogram");
+        MALLOC(vi->hist->breaks, num_breaks * sizeof(double), "break points of histogram");    
+        MALLOC(vi->hist->gfrequencies, (num_breaks + 1) * sizeof(uint32_t), "global frequencies of histogram");
+
+        vi->hist->num_breaks = hist->num_breaks;
+        vi->hist->min = hist->min;
+        vi->hist->max = hist->max;
+
+        memcpy(vi->hist->breaks, hist->breaks, num_breaks * sizeof(double));
+        CALLOC(vi->hist->gfrequencies, (num_breaks + 1), bp_get_type_size(adios_unsigned_integer, ""), "global frequency");
+
+        if (ntimes > 0)
+        {
+            MALLOC(vi->hist->frequenciess, (ntimes * sizeof(int32_t *)), "frequencies for timesteps");
+            for(i = 0; i < ntimes; i++)
+                CALLOC(vi->hist->frequenciess[i], (num_breaks + 1), bp_get_type_size(adios_unsigned_integer, ""), "frequency at timestep");
+        }
+    }
+
+    size = bp_get_type_size (var_root->type, "");    
+    sum_size = bp_get_type_size (adios_double, "");
+
+    if (var_root->type == adios_complex || var_root->type == adios_double_complex)
+    {
+        int type;
+        count = 3;
+        timestep = 0;
+
+        if (var_root->type == adios_complex)
+            type = adios_double;
+        else
+            type = adios_long_double;
+
+        // Only a double precision returned for all complex values
+        size = bp_get_type_size (adios_double, "");    
+
+           for (i=0; i<var_root->characteristics_count; i++)
+        {
+            if (ntimes > 0)
+                timestep = var_root->characteristics[i].time_index - 1;
+
+            if (!var_root->characteristics[i].stats)
+                continue;
+
+            struct adios_index_characteristics_stat_struct ** stats = var_root->characteristics[i].stats;
+
+            if ((map[adios_statistic_finite] != -1) && (* ((uint8_t *) stats[0][map[adios_statistic_finite]].data) == 0))
+                continue;
+
+            if (map[adios_statistic_min] != -1 && stats[0][map[adios_statistic_min]].data)
+            {
+                double data[3];
+                for (c = 0; c < count; c ++)
+                    data[c] = bp_value_to_double(type, stats[c][map[adios_statistic_min]].data);
+
+                if(!vi->gmin) {
+                    MALLOC (vi->gmin, count * size, "global minimum")
+                    for (c = 0; c < count; c ++)
+                           ((double * ) vi->gmin)[c] = data[c]; 
+
+                } else {
+                    for (c = 0; c < count; c ++)
+                        if (data[c] < ((double *) vi->gmin)[c])
+                               ((double * ) vi->gmin)[c] = data[c]; 
+                }
+
+                if (ntimes > 0) {
+                    if(!vi->mins[timestep]) {
+                        MALLOC (vi->mins[timestep], count * size, "minimum per timestep")
+                        for (c = 0; c < count; c ++)
+                               ((double **) vi->mins)[timestep][c] = data[c]; 
+
+                    } else {
+                        for (c = 0; c < count; c ++)
+                            if (data[c] < ((double **) vi->mins)[timestep][c])
+                                   ((double **) vi->mins)[timestep][c] = data[c]; 
+                    }
+                }
+            }
+
+            if (map[adios_statistic_max] != -1 && stats[0][map[adios_statistic_max]].data)
+            {
+                double data[3];
+                for (c = 0; c < count; c ++)
+                    data[c] = bp_value_to_double(type, stats[c][map[adios_statistic_max]].data);
+
+                if(!vi->gmax) {
+                    MALLOC (vi->gmax, count * size, "global minimum")
+                    for (c = 0; c < count; c ++)
+                        ((double * ) vi->gmax)[c] = data[c];
+
+                } else {
+                    for (c = 0; c < count; c ++)
+                        if (data[c] > ((double *) vi->gmax)[c])
+                            ((double * ) vi->gmax)[c] = data[c];
+                }
+
+                if (ntimes > 0) {
+                    if(!vi->maxs[timestep]) {
+                        MALLOC (vi->maxs[timestep], count * size, "minimum per timestep")
+                        for (c = 0; c < count; c ++)
+                            ((double **) vi->maxs)[timestep][c] = data[c];
+
+                    } else {
+                        for (c = 0; c < count; c ++)
+                            if (data[c] > ((double **) vi->maxs)[timestep][c])
+                                ((double **) vi->maxs)[timestep][c] = data[c];
+                    }
+                }
+            }
+
+            if (map[adios_statistic_sum] != -1 && stats[0][map[adios_statistic_sum]].data)
+            {    
+                double data[3];
+                for (c = 0; c < count; c ++)
+                    data[c] = bp_value_to_double(type, stats[c][map[adios_statistic_sum]].data);
+
+                if(!gsum) {
+                    MALLOC(gsum, count * sum_size, "global summation")
+                    for (c = 0; c < count; c ++)
+                           gsum[c] = data[c];
+
+                } else {
+                    for (c = 0; c < count; c ++)
+                        gsum[c] = gsum[c] + data[c];
+                }
+
+                if (ntimes > 0) {
+                    if(!sums[timestep]) {
+                        MALLOC(sums[timestep], count * sum_size, "summation per timestep")
+                        for (c = 0; c < count; c ++)
+                            sums[timestep][c] = data[c];
+
+                    } else {
+                        for (c = 0; c < count; c ++)
+                            sums[timestep][c] = sums[timestep][c] + data[c];
+                    }
+                }
+            }
+
+            if (map[adios_statistic_sum_square] != -1 && stats[0][map[adios_statistic_sum_square]].data)
+            {
+                double data[3];
+                for (c = 0; c < count; c ++)
+                    data[c] = bp_value_to_double(type, stats[c][map[adios_statistic_sum_square]].data);
+
+                if(!gsum_square) {
+                    MALLOC(gsum_square, count * sum_size, "global summation of squares")
+                    for (c = 0; c < count; c ++)
+                        gsum_square[c] = data[c];
+
+                } else {
+                    for (c = 0; c < count; c ++)
+                           gsum_square[c] = gsum_square[c] + data[c]; 
+                }
+
+                if (ntimes > 0) {
+                    if(!sum_squares[timestep]) {
+                        MALLOC(sum_squares[timestep], count * sum_size, "summation of square per timestep")
+                        for (c = 0; c < count; c ++)
+                            sum_squares[timestep][c] = data[c];
+
+                    } else {
+                        for (c = 0; c < count; c ++)
+                            sum_squares[timestep][c] = sum_squares[timestep][c] + data[c]; 
+                    }
+                }
+            }
+
+            if (map[adios_statistic_cnt] != -1 && stats[0][map[adios_statistic_cnt]].data)
+            {
+                if (ntimes > 0)
+                    cnts[timestep] += * ((uint32_t *) stats[0][map[adios_statistic_cnt]].data);
+                gcnt += * (uint32_t *) stats[0][map[adios_statistic_cnt]].data;
+            }
+        }
+
+        if(ntimes > 0 && vi->gmin && (map[adios_statistic_sum] != -1) && (map[adios_statistic_sum_square] != -1)) {
+            // min, max, summation exists only for arrays
+            // Calculate average / timestep
+
+            for(timestep = 0; timestep < ntimes; timestep ++) {
+                MALLOC(vi->avgs[timestep], count * sum_size, "average per timestep")
+                for (c = 0; c < count; c ++)
+                    vi->avgs[timestep][c] = sums[timestep][c] / cnts[timestep];
+
+                MALLOC(vi->std_devs[timestep], count * sum_size, "standard deviation per timestep")
+                for (c = 0; c < count; c ++)
+                    vi->std_devs[timestep][c] = sqrt((sum_squares[timestep][c] / cnts[timestep]) - (vi->avgs[timestep][c] * vi->avgs[timestep][c]));
+
+                free (sums[timestep]);
+                free (sum_squares[timestep]);
+            }
+        }
+
+        // Calculate global average
+        if(vi->gmin && gsum && (map[adios_statistic_sum] != -1) && (map[adios_statistic_sum_square] != -1)) {
+            MALLOC(vi->gavg, count * sum_size, "global average")
+
+            if(gcnt > 0)
+                for (c = 0; c < count; c ++)
+                    vi->gavg[c] = gsum[c] / gcnt;
+            else
+                for (c = 0; c < count; c ++)
+                    vi->gavg[c] = gsum[c];
+
+            MALLOC(vi->gstd_dev, count * sum_size, "global average")
+            if(vi->gavg && gcnt > 0)
+                for (c = 0; c < count; c ++)
+                    vi->gstd_dev[c] = sqrt(gsum_square[c] / gcnt - (vi->gavg[c] * vi->gavg[c]));
+            else
+                for (c = 0; c < count; c ++)
+                    vi->gstd_dev[c] = 0;
+        }
+    }
+    else
+    {
+        timestep = 0;
+           for (i=0; i<var_root->characteristics_count; i++)
+        {
+            if (ntimes > 0)
+                timestep = var_root->characteristics[i].time_index - 1;
+                //timestep = i / (npgs / ntimes);
+
+            if (!var_root->characteristics[i].stats)
+                continue;
+
+            struct adios_index_characteristics_stat_struct * stats = var_root->characteristics[i].stats[0];
+            struct adios_index_characteristics_hist_struct * hist = stats[map[adios_statistic_hist]].data;
+
+            if (map[adios_statistic_finite] != -1 && (* ((uint8_t *) stats[map[adios_statistic_finite]].data) == 0))
+                continue;
+
+            if (map[adios_statistic_min] != -1 && stats[map[adios_statistic_min]].data)
+            {
+                if(!vi->gmin) {
+                    MALLOC (vi->gmin, size, "global minimum")
+                       memcpy(vi->gmin, stats[map[adios_statistic_min]].data, size);
+
+                } else if (adios_lt(var_root->type, stats[map[adios_statistic_min]].data, vi->gmin)){
+                       memcpy(vi->gmin, stats[map[adios_statistic_min]].data, size);
+                }
+
+                if (ntimes > 0) {
+                    if(!vi->mins[timestep]) {
+                        MALLOC (vi->mins[timestep], size, "minimum per timestep")
+                        memcpy(vi->mins[timestep], stats[map[adios_statistic_min]].data, size);
+
+                    } else if (adios_lt(var_root->type, stats[map[adios_statistic_min]].data, vi->mins[timestep])) {
+                        memcpy(vi->mins[timestep], stats[map[adios_statistic_min]].data, size);
+                    }
+                }
+            }
+
+            if (map[adios_statistic_max] != -1 && stats[map[adios_statistic_max]].data)
+            {
+                if(!vi->gmax) {
+                    MALLOC (vi->gmax, size, "global maximum")
+                    memcpy(vi->gmax, stats[map[adios_statistic_max]].data, size);
+
+                } else if (adios_lt(var_root->type, vi->gmax, stats[map[adios_statistic_max]].data))
+                       memcpy(vi->gmax, stats[map[adios_statistic_max]].data, size);
+                
+                if (ntimes > 0) {
+                    if(!vi->maxs[timestep]) {
+                        MALLOC (vi->maxs[timestep], size, "maximum per timestep")
+                        memcpy(vi->maxs[timestep], stats[map[adios_statistic_max]].data, size);
+
+                    } else if (adios_lt(var_root->type, vi->maxs[timestep], stats[map[adios_statistic_max]].data)) {
+                        memcpy(vi->maxs[timestep], stats[map[adios_statistic_max]].data, size);    
+                    }
+                }
+            }
+    
+            if (map[adios_statistic_sum] != -1 && stats[map[adios_statistic_sum]].data)
+            {    
+                if(!gsum) {
+                    MALLOC(gsum, sum_size, "global summation")
+                       memcpy(gsum, stats[map[adios_statistic_sum]].data, sum_size);
+
+                } else {
+                    *gsum = *gsum + * ((double *) stats[map[adios_statistic_sum]].data);
+                }
+
+                if (ntimes > 0) {
+                    if(!sums[timestep]) {
+                        MALLOC(sums[timestep], sum_size, "summation per timestep")
+                        memcpy(sums[timestep], stats[map[adios_statistic_sum]].data, sum_size);
+
+                    } else {
+                        *sums[timestep] = *sums[timestep] + * ((double *) stats[map[adios_statistic_sum]].data);
+                    }
+                }
+            }
+
+            if (map[adios_statistic_sum_square] != -1 && stats[map[adios_statistic_sum_square]].data)
+            {
+                if(!gsum_square) {
+                    MALLOC(gsum_square, sum_size, "global summation of squares")
+                    memcpy(gsum_square, stats[map[adios_statistic_sum_square]].data, sum_size);
+
+                } else {
+                       *gsum_square = *gsum_square + * ((double *) stats[map[adios_statistic_sum_square]].data);
+                }
+
+                if (ntimes > 0) {
+                    if(!sum_squares[timestep]) {
+                        MALLOC(sum_squares[timestep], sum_size, "summation of square per timestep")
+                        memcpy(sum_squares[timestep], stats[map[adios_statistic_sum_square]].data, sum_size);
+
+                    } else {
+                        *sum_squares[timestep] = *sum_squares[timestep] + * ((double *) stats[map[adios_statistic_sum_square]].data);
+                    }
+                }
+            }
+
+            if(map[adios_statistic_hist] != -1 && stats[map[adios_statistic_hist]].data)
+            {
+                for(j = 0; j <= vi->hist->num_breaks; j++)
+                {    
+                    uint32_t freq = hist->frequencies[j];
+                    vi->hist->gfrequencies[j] += freq;
+                    if (ntimes > 0)
+                        vi->hist->frequenciess[timestep][j] += freq;
+                }
+            }
+
+            if (map[adios_statistic_cnt] != -1 && stats[map[adios_statistic_cnt]].data)
+            {
+                if (ntimes > 0)
+                    cnts[timestep] += * (uint32_t *) stats[map[adios_statistic_cnt]].data;
+                gcnt += * (uint32_t *) stats[map[adios_statistic_cnt]].data;
+            }
+        }
+
+        if(ntimes > 0 && vi->gmin && (map[adios_statistic_sum] != -1) && (map[adios_statistic_sum_square] != -1)) {
+            // min, max, summation exists only for arrays
+            // Calculate average / timestep
+
+            for(timestep = 0; timestep < ntimes; timestep ++) {
+                MALLOC(vi->avgs[timestep], sum_size, "average per timestep")
+                *(vi->avgs[timestep]) = *(sums[timestep]) / cnts[timestep];
+
+                MALLOC(vi->std_devs[timestep], sum_size, "standard deviation per timestep")
+                *(vi->std_devs[timestep]) = sqrt(*(sum_squares[timestep]) / cnts[timestep] - ((*(vi->avgs[timestep]) * (*(vi->avgs[timestep])))));
+
+                free (sums[timestep]);
+                free (sum_squares[timestep]);
+            }
+        }
+
+        // Calculate global average
+        if(vi->gmin && gsum && (map[adios_statistic_sum] != -1) && (map[adios_statistic_sum_square] != -1)) {
+            MALLOC(vi->gavg, sum_size, "global average")
+            if(gcnt > 0)
+                *vi->gavg = *gsum / gcnt;
+            else
+                vi->gavg = gsum;
+
+            MALLOC(vi->gstd_dev, sum_size, "global average")
+            if(vi->gavg && gcnt > 0)
+                *vi->gstd_dev = sqrt(*gsum_square / gcnt - ((*(vi->gavg)) * (*(vi->gavg))));
+            else
+                *vi->gstd_dev = 0;
+        }
+    }
+
+    if (!vi->value && vi->gmin) {
+        vi->value = vi->gmin; // arrays have no value but we assign here the minimum
+    }
+
+    if(!vi->gmin) {
+        vi->gmin = vi->value; // scalars have value but not min
+    }
+    if(!vi->gmax) {
+        vi->gmax = vi->value; // scalars have value but not max
+    }
+
+    if (sums && gsum) {
+        free (sums);
+        free (gsum);
+    }
+
+    if (sum_squares && gsum_square) {
+        free (sum_squares);
+        free (gsum_square);
+    } 
+*/   
+}
+
+/* get local and global dimensions and offsets from a variable characteristics 
+   return: 1 = it is a global array, 0 = local array
+*/
+static int adios_read_bp_staged_get_dimensioncharacteristics (
+                           struct adios_index_characteristic_struct_v1 * c
+                          ,uint64_t * ldims
+                          ,uint64_t * gdims
+                          ,uint64_t * offsets
+                          )
+{
+    int is_global = 0;
+    int ndim = c->dims.count;
+    int i;
+
+    for (i = 0; i < ndim; i++)
+    {
+        ldims[i] = c->dims.dims[i * 3];
+        gdims[i] = c->dims.dims[i * 3 + 1];
+        offsets[i] = c->dims.dims[i * 3 + 2];
+
+        if (gdims[i])
+        {
+            is_global = 1;
+        }
+    }
+
+    return is_global;
+}
+
+static void adios_read_bp_staged_get_dimensions (struct adios_index_var_struct_v1 * v
+                                                 ,int ntsteps, int file_is_fortran
+                                                 ,int * ndim, uint64_t ** dims
+                                                 ,int * tdim
+                                                 )
+{
+    int i, k;
+    int is_global; // global array or just an array written by one process?
+    uint64_t ldims[32], gdims[32], offsets[32];
+
+    /* Get dimension information */    
+    * ndim = v->characteristics [0].dims.count; 
+/*
+int rank;
+MPI_Comm_rank (MPI_COMM_WORLD, &rank);
+fprintf (stderr, "[%3d] ndim 2 = %d\n", rank, * ndim);
+*/
+    * dims = NULL;
+    * tdim = -1;
+
+    if (* ndim == 0)
+    {
+        return;
+    }
+
+    * dims = (uint64_t *) malloc (sizeof (uint64_t) * (* ndim));
+    memset (* dims, 0, sizeof (uint64_t) * (* ndim));
+
+    is_global = adios_read_bp_staged_get_dimensioncharacteristics (&(v->characteristics[0])
+                                                                   ,ldims
+                                                                   ,gdims
+                                                                   ,offsets
+                                                                   );
+    if (!is_global)
+    {
+        for (i = 0; i < * ndim; i++)
+        { 
+            if (ldims[i] == 1 && v->characteristics_count > 1)
+            {
+                * tdim = i;
+                (* dims)[i] = ntsteps;
+            }
+            else
+            {
+                (* dims)[i] = ldims[i];
+            }
+
+            gdims[i] = ldims[i];
+        }
+    }         
+    else
+    {
+        if (gdims[* ndim - 1] == 0)
+        {
+            * tdim = (!file_is_fortran) ? 0 : * ndim - 1;
+            (* dims)[* tdim] = ntsteps;
+
+            if (* ndim > 1 && ldims[* tdim] != 1)
+            {
+                fprintf (stderr, "ndim = %d\n", * ndim);
+                fprintf (stderr, "name = %s\n", v->var_name);
+                fprintf (stderr,"ADIOS Error: this is a BP file with C ordering but we didn't find "
+                        "an array to have time dimension in the first dimension. l:g:o = (");
+                for (i = 0; i < * ndim; i++)
+                {
+                    fprintf (stderr,"%llu:%llu:%llu%s", ldims[i], gdims[i], offsets[i]
+                                                      , (i < * ndim - 1 ? ", " : "") );
+                }
+
+                fprintf (stderr, ")\n");
+            }
+
+            if (!file_is_fortran)
+            {
+                for (i = 1; i < * ndim; i++)
+                {
+                    (* dims)[i] = gdims[i - 1];
+                }
+            }
+            else
+            {
+                for (i = 0; i < * ndim - 1; i++)
+                {
+                    (* dims)[i] = gdims[i];
+                }
+            }
+        }
+        else
+        {
+            for (i = 0; i < * ndim; i++)
+            {
+                (* dims)[i] = gdims[i];
+            }
+        }
+    }
+}
+
+ADIOS_VARINFO * adios_read_bp_staged_inq_var (ADIOS_GROUP *gp, const char * varname) 
+{
+    int varid = adios_read_bp_staged_find_var(gp, varname);
+    if (varid < 0)
+        return NULL;
+    return adios_read_bp_staged_inq_var_byid(gp, varid);
+}
+
+static ADIOS_VARINFO * _inq_var_byid (struct BP_FILE * fh, int varid)
+{
+    ADIOS_VARINFO * vi;
+    int file_is_fortran;
+    struct adios_index_var_struct_v1 * var_root = fh->vars_root;
+    int i,k;
+
+    assert (fh);
+
+    vi = (ADIOS_VARINFO *) malloc(sizeof(ADIOS_VARINFO));
+    assert (vi);
+
+    file_is_fortran = (fh->pgs_root->adios_host_language_fortran == adios_flag_yes);
+    
+    for (i = 1; i < varid && var_root; i++)
+    {
+        var_root = var_root->next;
+    }
+
+    if (i!=varid) {
+        adios_error (err_corrupted_variable, "Variable id=%d is valid but was not found in internal data structures!",varid);
+        return NULL; 
+    }
+
+    vi->varid = varid;
+    vi->type = var_root->type;
+    vi->value = 0;
+    vi->gmin = 0;
+    vi->gmax = 0;
+
+    if (!var_root->characteristics_count)
+    {
+        free(vi);
+        return NULL;
+    }
+    vi->characteristics_count = var_root->characteristics_count;
+
+    /* Get value or min/max */
+    adios_read_bp_staged_get_dimensions (var_root, fh->tidx_stop - fh->tidx_start + 1, file_is_fortran, 
+                          &(vi->ndim), &(vi->dims), &(vi->timedim));
+    
+    if (file_is_fortran != futils_is_called_from_fortran()) {
+        /* If this is a Fortran written file and this is called from C code,  
+           or this is a C written file and this is called from Fortran code ==>
+           We need to reverse the order of the dimensions */
+        swap_order(vi->ndim, vi->dims, &(vi->timedim));
+        /*printf("File was written from %s and read now from %s, so we swap order of dimensions\n",
+                (file_is_fortran ? "Fortran" : "C"), (futils_is_called_from_fortran() ? "Fortran" : "C"));*/
+    }
+    
+    adios_read_bp_staged_get_characteristics (var_root, vi);
+
+    return vi;
+}
+
+ADIOS_VARINFO * adios_read_bp_staged_inq_var_byid (ADIOS_GROUP *gp, int varid)
+{
+    struct BP_GROUP      * gh;
+    struct BP_FILE       * fh;
+    ADIOS_VARINFO * vi;
+    int file_is_fortran;
+    struct adios_index_var_struct_v1 * var_root;
+    int i,k;
+
+    adios_errno = 0;
+    assert (gp);
+
+    gh = (struct BP_GROUP *) gp->gh;
+    assert (gh);
+
+    fh = gh->fh;
+    assert (fh);
+
+    if (varid < 0 || varid >= gh->vars_count) {
+        adios_error (err_invalid_varid, "Invalid variable id %d (allowed 0..%d)", varid, gh->vars_count);
+        return NULL;
+    }
+    vi = (ADIOS_VARINFO *) malloc(sizeof(ADIOS_VARINFO));
+    assert (vi);
+
+    file_is_fortran = (fh->pgs_root->adios_host_language_fortran == adios_flag_yes);
+    
+    var_root = gh->vars_root; /* first variable of this group. Need to traverse the list */
+    for (i=0; i<varid && var_root; i++) {
+        var_root = var_root->next;
+    }
+
+    if (i!=varid) {
+        adios_error (err_corrupted_variable, "Variable id=%d is valid but was not found in internal data structures!",varid);
+        return NULL; 
+    }
+
+    vi->varid = varid;
+    vi->type = var_root->type;
+    vi->value = 0;
+    vi->gmin = 0;
+    vi->gmax = 0;
+
+    if (!var_root->characteristics_count) {
+        adios_error (err_corrupted_variable, "Variable %s does not have information on dimensions", 
+              gp->var_namelist[varid]);
+        free(vi);
+        return NULL;
+    }
+    vi->characteristics_count = var_root->characteristics_count;
+
+    /* Get value or min/max */
+
+    adios_read_bp_staged_get_dimensions (var_root, fh->tidx_stop - fh->tidx_start + 1, file_is_fortran, 
+                          &(vi->ndim), &(vi->dims), &(vi->timedim));
+
+    if (file_is_fortran != futils_is_called_from_fortran()) {
+        /* If this is a Fortran written file and this is called from C code,  
+           or this is a C written file and this is called from Fortran code ==>
+           We need to reverse the order of the dimensions */
+        swap_order(vi->ndim, vi->dims, &(vi->timedim));
+        /*printf("File was written from %s and read now from %s, so we swap order of dimensions\n",
+                (file_is_fortran ? "Fortran" : "C"), (futils_is_called_from_fortran() ? "Fortran" : "C"));*/
+    }
+
+    adios_read_bp_staged_get_characteristics (var_root, vi);
+
+    return vi;
+}
+
+void adios_read_bp_staged_free_varinfo (ADIOS_VARINFO *vp)
+{
+    if (vp) {
+        if (vp->dims)   free(vp->dims);
+        if (vp->value)  free(vp->value);
+        if (vp->gmin && vp->gmin != vp->value)   free(vp->gmin);
+        if (vp->gmax && vp->gmax != vp->value)   free(vp->gmax);
+        //if (vp->mins)   free(vp->mins);
+        //if (vp->maxs)   free(vp->maxs);
+        free(vp);
+    }
+}
+
+#define MPI_FILE_READ_OPS                           \
+        bp_realloc_aligned(fh->b, slice_size);      \
+        fh->b->offset = 0;                          \
+                                                    \
+        MPI_File_seek (fh->mpi_fh                   \
+                      ,(MPI_Offset)slice_offset     \
+                      ,MPI_SEEK_SET                 \
+                      );                            \
+                                                    \
+        MPI_File_read (fh->mpi_fh                   \
+                      ,fh->b->buff                  \
+                      ,slice_size                   \
+                      ,MPI_BYTE                     \
+                      ,&status                      \
+                      );                            \
+        fh->b->offset = 0;                          \
+
+//We also need to be able to read old .bp which doesn't have 'payload_offset'
+#define MPI_FILE_READ_OPS1                                                                  \
+        MPI_File_seek (fh->mpi_fh                                                           \
+                      ,(MPI_Offset) var_root->characteristics[start_idx + idx].offset       \
+                      ,MPI_SEEK_SET);                                                       \
+        MPI_File_read (fh->mpi_fh, fh->b->buff, 8, MPI_BYTE, &status);                      \
+        tmpcount= *((uint64_t*)fh->b->buff);                                                \
+                                                                                            \
+        bp_realloc_aligned(fh->b, tmpcount + 8);                                            \
+        fh->b->offset = 0;                                                                  \
+                                                                                            \
+        MPI_File_seek (fh->mpi_fh                                                           \
+                      ,(MPI_Offset) (var_root->characteristics[start_idx + idx].offset)     \
+                      ,MPI_SEEK_SET);                                                       \
+        MPI_File_read (fh->mpi_fh, fh->b->buff, tmpcount + 8, MPI_BYTE, &status);           \
+        fh->b->offset = 0;                                                                  \
+        adios_parse_var_data_header_v1 (fh->b, &var_header);                                \
+
+
+// To read subfiles
+#define MPI_FILE_READ_OPS2                                                                  \
+        bp_realloc_aligned(fh->b, slice_size);                                              \
+        fh->b->offset = 0;                                                                  \
+                                                                                            \
+        MPI_File * sfh;                                                                     \
+        sfh = get_BP_file_handle (fh->sfh                                                   \
+                                 ,var_root->characteristics[start_idx + idx].file_index     \
+                                 );                                                         \
+        if (!sfh)                                                                           \
+        {                                                                                   \
+            int err;                                                                        \
+            char * ch, * name_no_path, * name;                                              \
+            struct BP_file_handle * new_h =                                                 \
+                  (struct BP_file_handle *) malloc (sizeof (struct BP_file_handle));        \
+            new_h->file_index = var_root->characteristics[start_idx + idx].file_index;      \
+            new_h->next = 0;                                                                \
+            if (ch = strrchr (fh->fname, '/'))                                              \
+            {                                                                               \
+                name_no_path = malloc (strlen (ch + 1) + 1);                                \
+                strcpy (name_no_path, ch + 1);                                              \
+            }                                                                               \
+            else                                                                            \
+            {                                                                               \
+                name_no_path = malloc (strlen (fh->fname) + 1);                             \
+                strcpy (name_no_path, fh->fname);                                           \
+            }                                                                               \
+                                                                                            \
+            name = malloc (strlen (fh->fname) + 5 + strlen (name_no_path) + 1 + 10 + 1);    \
+            sprintf (name, "%s.dir/%s.%d", fh->fname, name_no_path, new_h->file_index);     \
+                                                                                            \
+            err = MPI_File_open (MPI_COMM_SELF                                              \
+                                ,name                                                       \
+                                ,MPI_MODE_RDONLY                                            \
+                                ,(MPI_Info)MPI_INFO_NULL                                    \
+                                ,&new_h->fh                                                 \
+                                );                                                          \
+           if (err != MPI_SUCCESS)                                                          \
+           {                                                                                \
+               fprintf (stderr, "can not open file %S\n", name);                            \
+               return -1;                                                                   \
+           }                                                                                \
+                                                                                            \
+           add_BP_file_handle (&fh->sfh                                                     \
+                              ,new_h                                                        \
+                              );                                                            \
+           sfh = &new_h->fh;                                                                \
+                                                                                            \
+           free (name_no_path);                                                             \
+           free (name);                                                                     \
+        }                                                                                   \
+                                                                                            \
+        MPI_File_seek (*sfh                                                                 \
+                      ,(MPI_Offset)slice_offset                                             \
+                      ,MPI_SEEK_SET                                                         \
+                      );                                                                    \
+        MPI_File_read (*sfh                                                                 \
+                      ,fh->b->buff                                                          \
+                      ,slice_size                                                           \
+                      ,MPI_BYTE                                                             \
+                      ,&status                                                              \
+                      );                                                                    \
+        fh->b->offset = 0;                                                                  \
+
+// Search for the start var index.
+static int get_var_start_index (struct adios_index_var_struct_v1 * v, int t)
+{
+    int i = 0;
+
+    while (i < v->characteristics_count) {
+        if (v->characteristics[i].time_index == t) {
+            return i;
+        }
+
+        i++;
+    }
+
+    return -1;
+}
+
+// Search for the stop var index
+static int get_var_stop_index (struct adios_index_var_struct_v1 * v, int t)
+{
+    int i = v->characteristics_count - 1;
+
+    while (i > -1) {
+        if (v->characteristics[i].time_index == t) {
+            return i;
+        }
+
+        i--;
+    }
+
+    return -1;
+}
+
+/****************************************************
+  Find the var associated with the given variable id 
+*****************************************************/
+struct adios_index_var_struct_v1 * adios_find_var_byid (ADIOS_GROUP * gp, int varid)
+{
+    struct BP_GROUP * gh;
+    struct adios_index_var_struct_v1 * var_root;
+    int i;
+
+    gh = (struct BP_GROUP *) gp->gh;
+    var_root = gh->vars_root;
+
+    for (i = 0; i < varid && var_root; i++)
+    {
+        var_root = var_root->next;
+    }
+
+    if (i != varid)
+    {
+        adios_error (err_corrupted_variable,
+               "Variable id=%d is valid but was not found in internal data structures!",
+               varid);
+        return NULL;
+    }
+
+    return var_root;
+}
+
+/* Check whether it has time */
+static int isTimeless (int tdim)
+{
+    return tdim <= -1;
+}
+
+/* Populate read_info data structure  */
+void getReadInfo (ADIOS_GROUP * gp
+                 ,struct adios_index_var_struct_v1 * v
+                 ,uint64_t * start
+                 ,uint64_t * count
+                 ,read_info * ri
+                 )
+{
+    struct BP_GROUP * gh;
+    struct BP_FILE * fh;
+    int i, j, k, idx, t;
+    int start_idx, stop_idx, f_idx;
+    int has_subfile, file_is_fortran;
+    uint64_t size, * dims;
+    uint64_t ldims[32], gdims[32], offsets[32];
+    int file_tdim = -1, read_arg_tdim, is_global = 0, flag;
+
+    gh = (struct BP_GROUP *) gp->gh;
+    fh = gh->fh;
+
+    file_is_fortran = (fh->pgs_root->adios_host_language_fortran == adios_flag_yes);
+    has_subfile = fh->mfooter.version & ADIOS_VERSION_HAVE_SUBFILE;
+
+    /* Get dimensions and flip if caller != writer language */
+    adios_read_bp_staged_get_dimensions (v
+                                         ,fh->tidx_stop - fh->tidx_start + 1
+                                         ,file_is_fortran
+                                         ,&ri->ndim
+                                         ,&ri->dims
+                                         ,&ri->file_tdim
+                                         );
+
+    if (file_is_fortran)
+    {
+        swap_order (ri->ndim, ri->dims, &ri->file_tdim);
+    }
+
+    if (isTimeless (ri->file_tdim))
+    {
+        ri->start_time = fh->tidx_start;
+        ri->stop_time = fh->tidx_stop;
+        ri->ndim_notime = ri->ndim;
+
+        memcpy (ri->start_notime, start, ri->ndim * 8);
+        memcpy (ri->count_notime, count, ri->ndim * 8);
+    }
+    else
+    {
+        read_arg_tdim = futils_is_called_from_fortran () ? ri->ndim - 1 : 0;
+
+        ri->start_time = start[read_arg_tdim] + fh->tidx_start;
+        ri->stop_time = ri->start_time + count[read_arg_tdim] - 1;
+        ri->ndim_notime = ri->ndim - 1;
+
+        memcpy (ri->start_notime
+               ,futils_is_called_from_fortran () ? start : start + 1
+               , ri->ndim_notime * 8
+               );
+        memcpy (ri->count_notime
+               ,futils_is_called_from_fortran () ? count : count + 1
+               ,ri->ndim_notime * 8
+               );
+    }
+
+    if (futils_is_called_from_fortran ())
+    {
+        _swap_order (ri->ndim_notime, ri->count_notime);
+        _swap_order (ri->ndim_notime, ri->start_notime);
+    }
+
+
+}
+
+/**************************************************
+* Get the subfile index and associate data offset *
+***************************************************/
+void getDataAddress (ADIOS_GROUP * gp, int varid
+                    ,const uint64_t * start
+                    ,const uint64_t * count
+                    ,int * file_idx
+                    ,uint64_t * offset
+                    ,uint64_t * payload_size
+                    )
+{
+    struct BP_GROUP * gh;
+    struct BP_FILE * fh;
+    struct adios_index_var_struct_v1 * v;
+    int i, j, k, idx, t;
+    int start_time, stop_time, start_idx, stop_idx, f_idx;
+    int ndim, ndim_notime, has_subfile, file_is_fortran;
+    uint64_t size, * dims = 0;
+    uint64_t ldims[32], gdims[32], offsets[32];
+    uint64_t count_notime[32], start_notime[32];
+    int file_tdim = -1, read_arg_tdim, is_global = 0, flag;
+
+    gh = (struct BP_GROUP *) gp->gh;
+    fh = gh->fh;
+
+    file_is_fortran = (fh->pgs_root->adios_host_language_fortran == adios_flag_yes);
+    has_subfile = fh->mfooter.version & ADIOS_VERSION_HAVE_SUBFILE;
+
+    v = adios_find_var_byid (gp, varid);
+
+    /* Get dimensions and flip if caller != writer language */
+    adios_read_bp_staged_get_dimensions (v
+                                         ,fh->tidx_stop - fh->tidx_start + 1
+                                         ,file_is_fortran
+                                         ,&ndim
+                                         ,&dims
+                                         ,&file_tdim
+                                         );
+
+    if (file_is_fortran)
+    {
+        swap_order (ndim, dims, &file_tdim);
+    }
+
+    if (isTimeless (file_tdim))
+    {
+        start_time = fh->tidx_start;
+        stop_time = fh->tidx_stop;
+        ndim_notime = ndim;
+
+        memcpy (start_notime, start, ndim * 8);
+        memcpy (count_notime, count, ndim * 8);
+    }
+    else
+    {
+        read_arg_tdim = futils_is_called_from_fortran () ? ndim - 1 : 0;
+
+        start_time = start[read_arg_tdim] + fh->tidx_start;
+        stop_time = start_time + count[read_arg_tdim] - 1;
+        ndim_notime = ndim - 1;
+
+        memcpy (start_notime
+               ,futils_is_called_from_fortran () ? start : start + 1
+               ,ndim_notime * 8
+               );
+        memcpy (count_notime
+               ,futils_is_called_from_fortran () ? count : count + 1
+               ,ndim_notime * 8
+               );
+    }
+
+    if (futils_is_called_from_fortran ())
+    {
+        _swap_order (ndim_notime, count_notime);
+        _swap_order (ndim_notime, start_notime);
+    }
+
+    for (t = start_time; t <= stop_time; t++)
+    {
+        start_idx = get_var_start_index (v, t);
+        stop_idx = get_var_stop_index (v, t);
+
+        if (start_idx < 0 || stop_idx < 0)
+        {
+            adios_error (err_no_data_at_timestep,"Variable (id=%d) has no data at %d time step",
+                varid, t);
+            continue;
+        }
+
+        if (ndim_notime == 0)
+        {
+            /* THIS IS A SCALAR VARIABLE */
+            idx = 0;
+
+            if (isTimeless (file_tdim) )
+                break;
+            else
+                continue;
+        }
+
+         /* READ AN ARRAY VARIABLE */
+        int * idx_table = (int *) malloc (sizeof(int) * (stop_idx - start_idx + 1));
+
+        // loop over the list of pgs to read from one-by-one
+        for (idx = 0; idx < stop_idx - start_idx + 1; idx++)
+        {
+            idx_table[idx] = 1;
+            /* Each pg can have a different sized array, so we need the actual dimensions from it */
+            is_global = adios_read_bp_staged_get_dimensioncharacteristics(&(v->characteristics[start_idx + idx])
+                                                                          ,ldims
+                                                                          ,gdims
+                                                                          ,offsets
+                                                                          );
+            if (!is_global)
+            {
+                memcpy (gdims, ldims, ndim * 8);
+            }
+
+            if (file_is_fortran)
+            {
+                _swap_order (ndim, gdims);
+                _swap_order (ndim, ldims);
+                _swap_order (ndim, offsets);
+            }
+
+            if (!isTimeless (file_tdim))
+            {
+                for (i = file_tdim; i < ndim - 1; i++)
+                {
+                    ldims[i] = ldims[i + 1];
+                    if (file_is_fortran)
+                    {
+                        gdims[i] = gdims[i + 1];
+                        offsets[i] = offsets[i + 1];
+                    }
+                }
+            }
+
+            /*
+            printf("ldims   = "); for (j = 0; j<ndim; j++) printf("%d ",ldims[j]); printf("\n");
+            printf("gdims   = "); for (j = 0; j<ndim; j++) printf("%d ",gdims[j]); printf("\n");
+            printf("offsets = "); for (j = 0; j<ndim; j++) printf("%d ",offsets[j]); printf("\n");
+            printf("count_notime   = "); for (j = 0; j<ndim_notime; j++) printf("%d ",count_notime[j]); printf("\n");
+            printf("start_notime   = "); for (j = 0; j<ndim_notime; j++) printf("%d ",start_notime[j]); printf("\n");
+            */
+            for (j = 0; j < ndim_notime; j++)
+            {
+                if ( (count_notime[j] > gdims[j])
+                  || (start_notime[j] > gdims[j])
+                  || (start_notime[j] + count_notime[j] > gdims[j]))
+                {
+                    adios_error ( err_out_of_bound, "Error: Variable (id=%d) out of bound ("
+                        "the data in dimension %d to read is %llu elements from index %llu"
+                        " but the actual data is [0,%llu])",
+                        varid, j + 1, count_notime[j], start_notime[j], gdims[j] - 1);
+                    return;
+                }
+
+                /* check if there is any data in this pg and this dimension to read in */
+                flag = (offsets[j] >= start_notime[j]
+                        && offsets[j] < start_notime[j] + count_notime[j])
+                    || (offsets[j] < start_notime[j]
+                        && offsets[j] + ldims[j] > start_notime[j] + count_notime[j])
+                    || (offsets[j] + ldims[j] > start_notime[j]
+                        && offsets[j] + ldims[j] <= start_notime[j] + count_notime[j]);
+
+                idx_table[idx] = idx_table[idx] && flag;
+            }
+
+            //FIXME
+            if (idx_table[idx])
+            {
+                free (idx_table);
+                if (dims)
+                {
+                    free (dims);
+                }
+
+                * file_idx = v->characteristics[start_idx + idx].file_index;
+                * offset = v->characteristics[start_idx + idx].payload_offset;
+                * payload_size = bp_get_type_size (v->type, v->characteristics[start_idx + idx].value);
+                for (j = 0; j < ndim_notime; j++)
+                {
+                    * payload_size *= ldims[j];
+                }
+                return;
+            }
+        }
+
+        free (idx_table);
+
+        if (isTimeless (file_tdim))
+            break;
+    } // end for (timestep ... loop over timesteps
+
+    if (dims)
+    {
+        free (dims);
+    }
+}
+
+int64_t adios_read_bp_staged_read_var (ADIOS_GROUP * gp
+                                       ,const char * varname
+                                       ,const uint64_t * start
+                                       ,const uint64_t * count
+                                       ,void * data
+                                       )
+{
+    struct BP_GROUP * gh;
+    struct BP_FILE * fh;
+    int i, varid, has_subfile, rank, nproc;
+    uint64_t ds, payload_size;
+    struct proc_struct * p;
+    candidate_reader * r;
+
+    adios_errno = 0;
+
+    assert (gp);
+
+    gh = (struct BP_GROUP *) gp->gh;
+    assert (gh);
+
+    fh = gh->fh;
+    assert (fh);
+
+    varid = adios_read_bp_staged_find_var (gp, varname);
+    if (varid < 0 || varid >= gh->vars_count)
+    {
+        adios_error (err_invalid_varid, "Invalid variable id %d (allowed 0..%d)", varid, gh->vars_count);
+        return -adios_errno;
+    }
+
+    p = (struct proc_struct *) fh->priv;
+    assert (p);
+
+    read_args * ra = (read_args *) malloc (sizeof (read_args));
+    assert (ra);
+
+    ADIOS_VARINFO * vi = adios_read_bp_staged_inq_var_byid (gp, varid);
+    ra->varid = varid;
+    ra->ndims = vi->ndim;
+
+    ra->start = (uint64_t *) malloc (ra->ndims * 8);
+    memcpy (ra->start, start, ra->ndims * 8);
+
+    ra->count = (uint64_t *) malloc (ra->ndims * 8);
+    memcpy (ra->count, count, ra->ndims * 8);
+
+    ra->data = data;
+
+    ra->size = bp_get_type_size (vi->type, 0);
+
+    for (i = 0; i < vi->ndim; i++)
+    {
+        ra->size *= ra->count[i];
+    }
+
+    ra->parent = 0;
+
+    getDataAddress (gp, varid, start, count, &ra->file_idx, &ra->offset, &payload_size);
+
+    adios_read_bp_staged_free_varinfo (vi);
+
+    r = (candidate_reader *) malloc (sizeof (candidate_reader));
+    assert (r);
+
+    r->rank = p->rank;
+    r->ra = ra;
+    r->next = NULL;
+
+    list_insert_reader (&p->local_read_request_list, r);
+
+    return 0;
+}
+
+/***********************************************
+ * This routine is to read in data in a 'local *
+ * array fashion (as opposed to global array)  *
+ *     Q. Liu, 11/2010                         *
+ ***********************************************/
+int64_t adios_read_bp_staged_read_local_var (ADIOS_GROUP * gp, const char * varname,
+                                      int vidx, const uint64_t * start,
+                                      const uint64_t * count, void * data)
+{
+    struct BP_GROUP      * gh;
+    struct BP_FILE       * fh;
+    struct adios_index_var_struct_v1 * var_root;
+    struct adios_var_header_struct_v1 var_header;
+    struct adios_var_payload_struct_v1 var_payload;
+    int    i,j,k, t, varid, start_idx, idx;
+    int    ndim, ndim_notime, has_subfile, file_is_fortran;
+    uint64_t size, * dims;
+    uint64_t ldims[32], gdims[32], offsets[32];
+    uint64_t datasize, nloop, dset_stride,var_stride, total_size=0, items_read;
+    uint64_t count_notime[32], start_notime[32];
+    int timedim = -1, temp_timedim, is_global = 0, size_of_type;
+    uint64_t slice_offset, slice_size, tmpcount = 0;
+    uint64_t datatimeoffset = 0; // offset in data to write a given timestep
+    MPI_Status status;
+
+    adios_errno = 0;
+    if (!gp)
+    {
+        adios_error (err_invalid_group_struct, "Null pointer passed as group to adios_read_var()");
+        return -adios_errno;
+    }
+
+    gh = (struct BP_GROUP *) gp->gh;
+    if (!gh)
+    {
+        adios_error (err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh group handle is NULL!");
+        return -adios_errno;
+    }
+
+    fh = gh->fh;
+    if (!fh)
+    {
+        adios_error (err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh->fh file handle is NULL!");
+        return -adios_errno;
+    }
+
+    varid = adios_read_bp_staged_find_var(gp, varname);
+    if (varid < 0 || varid >= gh->vars_count)
+    {
+        adios_error (err_invalid_varid, "Invalid variable id %d (allowed 0..%d)", varid, gh->vars_count);
+        return -adios_errno;
+    }
+
+    /* Check if file is written out by Fortran or C */
+    file_is_fortran = (fh->pgs_root->adios_host_language_fortran == adios_flag_yes);
+
+    /* Check whether we need to handle subfiles */
+    has_subfile = fh->mfooter.version & ADIOS_VERSION_HAVE_SUBFILE;
+
+    var_root = gh->vars_root; /* first variable of this group. Need to traverse the list */
+    for (i = 0; i< varid && var_root; i++)
+    {
+        var_root = var_root->next;
+    }
+
+    if (i != varid)
+    {
+        adios_error (err_corrupted_variable, 
+                     "Variable id=%d is valid but was not found in internal data structures!",
+                     varid);
+        return -adios_errno; 
+    }
+
+    if (vidx < 0 || vidx >= var_root->characteristics_count)
+    {
+        adios_error (err_out_of_bound, "idx=%d is out of bound", vidx);
+    }
+
+    ndim = var_root->characteristics [vidx].dims.count;
+
+    /* count_notime/start_notime are working copies of count/start */
+    for (i = 0; i < ndim; i++)
+    {
+        count_notime[i] = count[i];
+        start_notime[i] = start[i];
+    }
+
+    ndim_notime = ndim;
+
+    /* Fortran reader was reported of Fortran dimension order so it gives counts and starts in that order.
+       We need to swap them here to read correctly in C order */
+    if (futils_is_called_from_fortran())
+    {
+        timedim = -1;
+        swap_order(ndim_notime, count_notime, &timedim);
+        swap_order(ndim_notime, start_notime, &timedim);
+    }
+    
+    /* items_read = how many data elements are we going to read in total */
+    items_read = 1;
+    for (i = 0; i < ndim_notime; i++)
+        items_read *= count_notime[i];
+
+    size_of_type = bp_get_type_size (var_root->type, var_root->characteristics [vidx].value);
+
+    /* READ A SCALAR VARIABLE */
+    if (ndim_notime == 0)
+    {
+        slice_size = size_of_type;
+        start_idx = 0; // OPS macros below need it
+        idx = vidx; // OPS macros below need it
+
+        if (var_root->type == adios_string)
+        {
+            // strings are stored without \0 in file
+            // size_of_type here includes \0 so decrease by one
+            size_of_type--;
+        }
+
+        /* Old BP files don't have payload_offset characteristic */
+        if (var_root->characteristics[vidx].payload_offset > 0)
+        {
+            slice_offset = var_root->characteristics[vidx].payload_offset;
+
+            if (!has_subfile)
+            {
+                MPI_FILE_READ_OPS
+            }
+            else
+            {
+                MPI_FILE_READ_OPS2
+            }
+        }
+        else
+        {
+            slice_offset = 0;
+            MPI_FILE_READ_OPS1
+        }
+
+        memcpy((char *)data + total_size, fh->b->buff + fh->b->offset, size_of_type);
+
+        if (fh->mfooter.change_endianness == adios_flag_yes)
+            change_endianness((char *)data + total_size
+                             ,size_of_type
+                             ,var_root->type
+                             );
+
+        if (var_root->type == adios_string)
+        {
+            // add \0 to the end of string
+            // size_of_type here is the length of string
+            // FIXME: how would this work for strings written over time?
+            ((char*)data + total_size)[size_of_type] = '\0';
+        }
+
+        total_size += size_of_type;
+
+        return total_size;
+    } /* READ A SCALAR VARIABLE END HERE */
+
+    /* READ AN ARRAY VARIABLE */
+    uint64_t write_offset = 0;
+    int npg = 0;
+    tmpcount = 0;
+    int flag;
+    datasize = 1;
+    nloop = 1;
+    var_stride = 1;
+    dset_stride = 1;
+    uint64_t payload_size = size_of_type;
+
+    /* To get ldims for the index vidx */
+    adios_read_bp_staged_get_dimensioncharacteristics( &(var_root->characteristics[vidx]),
+                                                ldims, gdims, offsets);
+
+    /* Again, a Fortran written file has the dimensions in Fortran order we need to swap here */
+    /* Only local dims are needed for reading local vars */ 
+    if (file_is_fortran)
+    {
+        i=-1;
+        swap_order(ndim, ldims, &(i));
+    }
+
+    /*
+    printf("ldims   = "); for (j = 0; j < ndim; j++) printf("%d ",ldims[j]); printf("\n");
+    printf("count_notime   = "); for (j = 0; j < ndim_notime; j++) printf("%d ",count_notime[j]); printf("\n");
+    printf("start_notime   = "); for (j = 0; j < ndim_notime; j++) printf("%d ",start_notime[j]); printf("\n");
+    */        
+
+    for (j = 0; j < ndim_notime; j++)
+    {
+        payload_size *= ldims [j];
+    
+        if ( (start_notime[j] > ldims[j]) 
+            || (start_notime[j] + count_notime[j] > ldims[j]))
+        {
+                    adios_error ( err_out_of_bound, "Error: Variable (id=%d) out of bound ("
+                        "the data in dimension %d to read is %llu elements from index %llu"
+                        " but the actual data is [0,%llu])",
+                        varid, j+1, count_notime[j], start_notime[j], ldims[j] - 1);
+                    return -adios_errno;
+        }
+    }
+
+    /* determined how many (fastest changing) dimensions can we read in in one read */
+    int break_dim =  ndim_notime - 1;
+    while (break_dim > -1)
+    {
+        if (start_notime[break_dim] == 0 && ldims[break_dim] == count_notime[break_dim])
+        {
+            datasize *= ldims[break_dim];
+        }
+        else
+            break;
+        
+        break_dim--;
+    }
+    
+    slice_offset = 0;
+    slice_size = 0;
+    /* Note: MPI_FILE_READ_OPS  - for reading single BP file.
+     *       MPI_FILE_READ_OPS2 - for reading those with subfiles.
+     *       MPI_FILE_READ_OPS1 - for reading old version of BP files
+     *                            which don't contain "payload_offset"
+     * Whenever to use OPS macro, start_idx and idx variable needs to be
+     * properly set.
+     */
+    
+    start_idx = 0;
+    idx = vidx;
+
+    if (break_dim <= 0) 
+    {
+        /* The slowest changing dimensions should not be read completely but
+           we still need to read only one block */
+   
+        uint64_t size_in_dset = count_notime[0];
+        uint64_t offset_in_dset = start_notime[0];
+
+        slice_size = (break_dim == -1 ? datasize * size_of_type : size_in_dset * datasize * size_of_type);
+    
+        if (var_root->characteristics[start_idx + idx].payload_offset > 0)
+        {
+            slice_offset = var_root->characteristics[start_idx + idx].payload_offset 
+                         + offset_in_dset * datasize * size_of_type;
+
+            if (!has_subfile)
+            {
+                MPI_FILE_READ_OPS
+            }
+            else
+            {
+                MPI_FILE_READ_OPS2
+            }
+        }
+        else
+        {
+            slice_offset = 0;
+            MPI_FILE_READ_OPS1
+        }
+
+        memcpy ((char *)data, fh->b->buff + fh->b->offset, slice_size);
+        if (fh->mfooter.change_endianness == adios_flag_yes)
+        {
+            change_endianness((char *)data + write_offset, slice_size, var_root->type);
+        }
+    }
+    else 
+    {
+        uint64_t stride_offset = 0;
+        uint64_t * size_in_dset, * offset_in_dset, * offset_in_var;
+        uint64_t start_in_payload, end_in_payload, s;
+        uint64_t var_offset;
+        uint64_t dset_offset;
+
+        size_in_dset = (uint64_t *) malloc (8 * ndim_notime);
+        offset_in_dset = (uint64_t *) malloc (8 * ndim_notime);
+        offset_in_var = (uint64_t *) malloc (8 * ndim_notime);
+ 
+        if (size_in_dset == 0 || offset_in_dset == 0 || offset_in_var == 0)
+        {
+             adios_error (err_no_memory, "Malloc failed in %s at %d\n"
+                         , __FILE__, __LINE__
+                         );
+             return -adios_errno;
+        }
+
+        for (i = 0; i < ndim_notime ; i++)
+        {
+            size_in_dset[i] = count_notime[i];
+            offset_in_dset[i] = start_notime[i];
+            offset_in_var[i] = 0;
+        }
+ 
+        datasize = 1;
+        var_stride = 1;
+        for (i = ndim_notime - 1; i >= break_dim; i--)
+        {
+            datasize *= size_in_dset[i];
+            dset_stride *= ldims[i];
+            var_stride *= count_notime[i];
+        }
+
+        /* Calculate the size of the chunk we are trying to read in */
+        start_in_payload = 0;
+        end_in_payload = 0;
+        s = 1;
+        for (i = ndim_notime - 1; i >= 0; i--)
+        {
+            start_in_payload += s * offset_in_dset[i] * size_of_type;
+            end_in_payload += s * (offset_in_dset[i] + size_in_dset[i] - 1) * size_of_type;
+            s *= ldims[i];
+        }
+        slice_size = end_in_payload - start_in_payload + 1 * size_of_type;
+ 
+        if (var_root->characteristics[start_idx + idx].payload_offset > 0)
+        {
+            slice_offset =  var_root->characteristics[start_idx + idx].payload_offset
+                          + start_in_payload;
+            if (!has_subfile)
+            {
+                MPI_FILE_READ_OPS
+            }
+            else
+            {
+                MPI_FILE_READ_OPS2
+            }
+ 
+            for ( i = 0; i < ndim_notime ; i++)
+            {
+                offset_in_dset[i] = 0;
+            }
+        }
+        else
+        {
+            slice_offset =  start_in_payload;
+            MPI_FILE_READ_OPS1
+        }
+
+        var_offset = 0;
+        dset_offset = 0;
+        for (i = 0; i < ndim_notime ; i++)
+        {
+            var_offset = offset_in_var[i] + var_offset * count_notime[i];
+            dset_offset = offset_in_dset[i] + dset_offset * ldims[i];
+        }
+
+        copy_data (data
+                  ,fh->b->buff + fh->b->offset
+                  ,0
+                  ,break_dim
+                  ,size_in_dset
+                  ,ldims
+                  ,count_notime
+                  ,var_stride
+                  ,dset_stride
+                  ,var_offset
+                  ,dset_offset
+                  ,datasize
+                  ,size_of_type 
+                  );
+
+        free (size_in_dset);
+        free (offset_in_dset);
+        free (offset_in_var);
+    }
+    
+    total_size += items_read * size_of_type;
+
+    return total_size;
+}
+
+// The purpose of keeping this function is to be able
+// to read in old BP files. Can be deleted later on.
+int64_t adios_read_bp_staged_read_var_byid1 (ADIOS_GROUP    * gp,
+                             int              varid,
+                             const uint64_t  * start,
+                             const uint64_t  * count,
+                             void           * data)
+{
+    struct BP_GROUP      * gh;
+    struct BP_FILE       * fh;
+    int file_is_fortran;
+    struct adios_index_var_struct_v1 * var_root;
+    struct adios_var_header_struct_v1 var_header;
+    struct adios_var_payload_struct_v1 var_payload;
+    int    i,j,k, idx, timestep;
+    int    start_time, stop_time;
+    int    pgoffset, pgcount, next_pgoffset,start_idx, stop_idx;
+    int    ndim, ndim_notime;  
+    uint64_t size;
+    uint64_t *dims;
+    uint64_t ldims[32];
+    uint64_t gdims[32];
+    uint64_t offsets[32];
+    uint64_t datasize, nloop, dset_stride,var_stride, total_size=0, items_read;
+    uint64_t count_notime[32], start_notime[32];
+    MPI_Status status;
+    int timedim = -1, temp_timedim, timedim_c;
+    int rank;
+    int is_global = 0;
+    int size_of_type;
+    uint64_t slice_offset;
+    uint64_t slice_size;
+    uint64_t tmpcount = 0;
+    uint64_t datatimeoffset = 0; // offset in data to write a given timestep
+
+    adios_errno = 0;
+    if (!gp) {
+        adios_error (err_invalid_group_struct, "Null pointer passed as group to adios_read_var()");
+        return -adios_errno;
+    }
+    gh = (struct BP_GROUP *) gp->gh;
+    if (!gh) {
+        adios_error (err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh group handle is NULL!");
+        return -adios_errno;
+    }
+    fh = gh->fh;
+    if (!fh) {
+        adios_error (err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh->fh file handle is NULL!");
+        return -adios_errno;
+    }
+    if (varid < 0 || varid >= gh->vars_count) {
+        adios_error (err_invalid_varid, "Invalid variable id %d (allowed 0..%d)", varid, gh->vars_count);
+        return -adios_errno;
+    }
+    
+    file_is_fortran = (fh->pgs_root->adios_host_language_fortran == adios_flag_yes);
+    
+    var_root = gh->vars_root; /* first variable of this group. Need to traverse the list */
+    for (i=0; i<varid && var_root; i++) {
+        var_root = var_root->next;
+    }
+
+    if (i!=varid) {
+        adios_error (err_corrupted_variable, "Variable id=%d is valid but was not found in internal data structures!",varid);
+        return -adios_errno; 
+    }
+
+    /* Get dimensions and flip if caller != writer language */
+    adios_read_bp_staged_get_dimensions (var_root, fh->tidx_stop - fh->tidx_start + 1, file_is_fortran, 
+                          &ndim, &dims, &timedim);
+
+    /* Here the cases in which .bp written from Fortran and C are considered separately.
+       1) bp written from Fortran */
+    if (file_is_fortran)
+    {
+        /* Get the timesteps we need to read */
+        if (timedim > -1) 
+        {
+            if (timedim != ndim - 1)
+            {
+                adios_error (err_no_data_at_timestep,"Variable (id=%d) has wrong time dimension index",
+                      varid);
+                return -adios_errno;
+            }
+            if (futils_is_called_from_fortran())
+            {
+                start_time = start[timedim] + fh->tidx_start;
+                stop_time = start_time + count[timedim] - 1;
+            }
+            else
+            {
+                start_time = start[0] + fh->tidx_start;
+                stop_time = start_time + count[0] - 1;
+            }
+        }
+        else 
+        {
+            /* timeless variable, but we still need to handle the case that
+               var is not written in the first few timesteps. 
+               This happens in Pixie3D.  */
+            for (i = 0; i < fh->mfooter.time_steps; i++)
+            {
+                pgoffset = fh->gvar_h->time_index[0][gh->group_id][i];
+                if (i < fh->mfooter.time_steps - 1)
+                    next_pgoffset = fh->gvar_h->time_index[0][gh->group_id][i + 1];
+                else
+                    next_pgoffset = -1;
+
+                if (fh->gvar_h->pg_offsets[pgoffset] < var_root->characteristics[0].offset
+                && (i == fh->mfooter.time_steps - 1 
+                   ||fh->gvar_h->pg_offsets[next_pgoffset] > var_root->characteristics[0].offset)
+                )
+                {
+                    start_time = fh->tidx_start + i;
+                    stop_time = start_time;
+                    break;
+                }
+            }
+        }
+
+        /* flip dims and timedim to C order */
+        swap_order(ndim, dims, &timedim);
+
+        /* Take out the time dimension from start[] and count[] */
+        /* if we have time dimension */
+        if (timedim > -1)
+        {
+            j = 0;
+            if (futils_is_called_from_fortran())
+                temp_timedim = ndim - 1;
+            else
+                temp_timedim = 0;
+
+            for (i = 0; i < temp_timedim; i++)
+            {
+                count_notime[j] = count[i];
+                start_notime[j] = start[i];
+                j++;
+            }
+            i++; // skip timedim
+            for (; i < ndim; i++)
+            {
+                count_notime[j] = count[i];
+                start_notime[j] = start[i];
+                j++;
+            }
+            ndim_notime = ndim-1;
+        }
+        else
+        /* if we don't have time dimension */
+        {
+            for (i = 0; i < ndim; i++)
+            {
+                count_notime[i] = count[i];
+                start_notime[i] = start[i];
+            }
+            ndim_notime = ndim;
+        }
+    }
+    /* 2) .bp written by C */
+    else
+    {
+        /* Get the timesteps we need to read */
+        if (timedim > -1) 
+        {
+            /* timedim has to be the 1st dimension. To be extended to handle 
+               the cases timedim at any dimension */
+            if (timedim != 0)
+            {
+                adios_error (err_no_data_at_timestep,"Variable (id=%d) has wrong time dimension",
+                      varid);
+                return -adios_errno;
+            }
+
+            if (futils_is_called_from_fortran())
+            {
+                start_time = start[ndim - 1] + fh->tidx_start;
+                stop_time = start_time + count[ndim -1] - 1;
+            }
+            else
+            {
+                start_time = start[0] + fh->tidx_start;
+                stop_time = start_time + count[0] - 1;
+            }
+
+            start_time = start[timedim] + fh->tidx_start;
+            stop_time = start_time + count[timedim] - 1;
+        }
+        else 
+        {
+            /* timeless variable */
+            start_time = fh->tidx_start;
+            stop_time = fh->tidx_start;
+        }
+
+        /* No need to flip dims, timedim as they are already in C order. */
+        //swap_order(ndim, dims, &timedim);
+
+        /* Take out the time dimension from start[] and count[] */
+        if (timedim == -1) /* timeless variable */ 
+        {
+            for (i = 0; i < ndim; i++) 
+            {
+                count_notime[i] = count[i];
+                start_notime[i] = start[i];
+            }
+            ndim_notime = ndim;
+        }
+        /* if we have time dimension */
+        else
+        {
+            j = 0;
+            if (futils_is_called_from_fortran())
+                temp_timedim = ndim - 1;
+            else
+                temp_timedim = 0;
+
+            for (i = 0; i < temp_timedim; i++)
+            {
+                count_notime[j] = count[i];
+                start_notime[j] = start[i];
+                j++;
+            }
+            i++; // skip timedim
+            for (; i < ndim; i++)
+            {
+                count_notime[j] = count[i];
+                start_notime[j] = start[i];
+                j++;
+            }
+            ndim_notime = ndim - 1;
+        }
+    }
+
+    /* Fortran reader was reported of Fortran dimension order so it gives counts and starts in that order.
+       We need to swap them here to read correctly in C order */
+    if ( futils_is_called_from_fortran()) {
+        swap_order(ndim_notime, count_notime, &timedim);
+        swap_order(ndim_notime, start_notime, &timedim);
+    }
+    
+    /* items_read = how many data elements are we going to read in total (per timestep) */
+    items_read = 1;
+    for (i = 0; i < ndim_notime; i++)
+        items_read *= count_notime[i];
+    
+    MPI_Comm_rank(gh->fh->comm, &rank);
+
+    size_of_type = bp_get_type_size (var_root->type, var_root->characteristics [0].value);
+
+    /* For each timestep, do reading separately (they are stored in different sets of process groups */
+    for (timestep = start_time; timestep <= stop_time; timestep++) {
+
+        // pgoffset = the starting offset for the given time step
+        // pgcount  = number of process groups of that time step
+        pgoffset = fh->gvar_h->time_index[0][gh->group_id][timestep - fh->tidx_start];
+        pgcount = fh->gvar_h->time_index[1][gh->group_id][timestep - fh->tidx_start];
+
+        start_idx = -1;
+        for (i=0;i<var_root->characteristics_count;i++) {
+            if (   (  var_root->characteristics[i].offset > fh->gvar_h->pg_offsets[pgoffset])
+                && (  (pgoffset + pgcount == fh->mfooter.pgs_count) 
+                    ||(  var_root->characteristics[i].offset < fh->gvar_h->pg_offsets[pgoffset + 1]))
+               ) 
+            {
+                start_idx = i;
+                break;
+            }
+        }
+/*
+printf ("var_root->characteristics_count = %d\n", var_root->characteristics_count);
+printf ("pg offset 0 = %lld\n", fh->gvar_h->pg_offsets[pgoffset]);
+printf ("pg offset 1 = %lld\n", fh->gvar_h->pg_offsets[pgoffset + 1]);
+printf ("var offset 3 = %lld\n", var_root->characteristics[3].offset);
+printf ("var offset 2 = %lld\n", var_root->characteristics[2].offset);
+printf ("var offset 1 = %lld\n", var_root->characteristics[1].offset);
+printf ("pgcount = %lld\n", pgcount);
+*/
+        for (i=var_root->characteristics_count-1;i>-1;i--) {
+            if (   (  var_root->characteristics[i].offset > fh->gvar_h->pg_offsets[pgoffset])
+                && (  (pgoffset + pgcount == fh->mfooter.pgs_count)
+                    ||(  var_root->characteristics[i].offset < fh->gvar_h->pg_offsets[pgoffset + pgcount]))
+               )
+            {
+                stop_idx = i;
+                break;
+            }
+        }
+
+        if (start_idx<0) {
+            adios_error (err_no_data_at_timestep,"Variable (id=%d) has no data at %d time step",
+                varid, timestep);
+            return -adios_errno;
+        }
+
+        if (ndim_notime == 0) {
+            /* READ A SCALAR VARIABLE */
+
+            slice_size = size_of_type;
+            idx = 0; // macros below need it
+
+            if (var_root->type == adios_string) {
+                // strings are stored without \0 in file
+                // size_of_type here includes \0 so decrease by one
+                size_of_type--;
+            }
+
+            if (var_root->characteristics[start_idx+idx].payload_offset > 0) {
+                slice_offset = var_root->characteristics[start_idx+idx].payload_offset;
+                MPI_FILE_READ_OPS
+            } else {
+                slice_offset = 0;
+                MPI_FILE_READ_OPS1
+            }
+
+            memcpy((char *)data+total_size, fh->b->buff + fh->b->offset, size_of_type);
+            if (fh->mfooter.change_endianness == adios_flag_yes) {
+                change_endianness((char *)data+total_size, size_of_type, var_root->type);
+            }
+
+            if (var_root->type == adios_string) {
+                // add \0 to the end of string
+                // size_of_type here is the length of string
+                // FIXME: how would this work for strings written over time?
+                ((char*)data+total_size)[size_of_type] = '\0';
+            }
+
+            total_size += size_of_type;
+            continue;
+        }
+
+        /* READ AN ARRAY VARIABLE */
+        //int * idx_table = (int *) malloc (sizeof(int) * pgcount);
+        //int * idx_table = (int *) malloc (sizeof(int) * (var_root->characteristics_count - start_idx));
+        int * idx_table = (int *) malloc (sizeof(int) * (stop_idx - start_idx + 1));
+
+        uint64_t write_offset = 0;
+        int npg = 0;
+        tmpcount = 0;
+        if (pgcount > var_root->characteristics_count)
+            pgcount = var_root->characteristics_count;
+
+        // loop over the list of pgs to read from one-by-one
+        for (idx = 0; idx < stop_idx - start_idx + 1; idx++) {
+            int flag;
+            datasize = 1;
+            nloop = 1;
+            var_stride = 1;
+            dset_stride = 1;
+            idx_table[idx] = 1;
+            uint64_t payload_size = size_of_type;
+    
+            /* Each pg can have a different sized array, so we need the actual dimensions from it */
+            is_global = adios_read_bp_staged_get_dimensioncharacteristics( &(var_root->characteristics[start_idx + idx]),
+                                                            ldims, gdims, offsets);
+            if (!is_global) {
+                // we use gdims below, which is 0 for a local array; set to ldims here
+                for (j = 0; j< ndim; j++) {
+                    gdims[j]=ldims[j];
+                }
+            }
+
+            /* Again, a Fortran written file has the dimensions in Fortran order we need to swap here */
+            //if (file_is_fortran != futils_is_called_from_fortran()) {
+            if (file_is_fortran ) {
+                i=-1;
+                swap_order(ndim, gdims,   &(i)); // i is dummy 
+                swap_order(ndim, ldims,   &(i));
+                swap_order(ndim, offsets, &(i));
+            }
+            
+            /* take out the time dimension */
+            /* For C, gdims and offset are one size shorter because the timedim part is missing,
+               so we take it out only for fortran files
+            */
+            if (timedim > -1) {
+                for (i = timedim; i < ndim-1; i++) {
+                    ldims[i] = ldims[i+1];
+                    if (file_is_fortran) {
+                        gdims[i] = gdims[i+1];
+                        offsets[i] = offsets[i+1];
+                    }
+                }
+            }
+            /*
+            printf("ldims   = "); for (j = 0; j<ndim; j++) printf("%d ",ldims[j]); printf("\n");
+            printf("gdims   = "); for (j = 0; j<ndim; j++) printf("%d ",gdims[j]); printf("\n");
+            printf("offsets = "); for (j = 0; j<ndim; j++) printf("%d ",offsets[j]); printf("\n");
+            printf("count_notime   = "); for (j = 0; j<ndim_notime; j++) printf("%d ",count_notime[j]); printf("\n");
+            printf("start_notime   = "); for (j = 0; j<ndim_notime; j++) printf("%d ",start_notime[j]); printf("\n");
+            */
+            for (j = 0; j < ndim_notime; j++) {
+    
+                payload_size *= ldims [j];
+    
+                if ( (count_notime[j] > gdims[j]) 
+                  || (start_notime[j] > gdims[j]) 
+                  || (start_notime[j] + count_notime[j] > gdims[j])){
+                    adios_error ( err_out_of_bound, "Error: Variable (id=%d) out of bound ("
+                        "the data in dimension %d to read is %llu elements from index %llu"
+                        " but the actual data is [0,%llu])",
+                        varid, j+1, count_notime[j], start_notime[j], gdims[j] - 1);
+                    return -adios_errno;
+                }
+    
+                /* check if there is any data in this pg and this dimension to read in */
+                flag = (offsets[j] >= start_notime[j] 
+                        && offsets[j] < start_notime[j] + count_notime[j])
+                    || (offsets[j] < start_notime[j]
+                        && offsets[j] + ldims[j] > start_notime[j] + count_notime[j]) 
+                    || (offsets[j] + ldims[j] > start_notime[j] 
+                        && offsets[j] + ldims[j] <= start_notime[j] + count_notime[j]);
+                idx_table [idx] = idx_table[idx] && flag;
+            }
+            
+            if ( !idx_table[idx] ) {
+                continue;
+            }
+            ++npg;
+
+            /* determined how many (fastest changing) dimensions can we read in in one read */
+            int hole_break; 
+            for (i = ndim_notime - 1; i > -1; i--) {
+                if (offsets[i] == start_notime[i] && ldims[i] == count_notime[i]) {
+                    datasize *= ldims[i];
+                }
+                else
+                    break;
+            }
+    
+            hole_break = i;
+            slice_offset = 0;
+            slice_size = 0;
+
+            if (hole_break == -1) {
+                /* The complete read happens to be exactly one pg, and the entire pg */
+                /* This means we enter this only once, and npg=1 at the end */
+                /* This is a rare case. FIXME: cannot eliminate this? */
+                slice_size = payload_size;
+
+                if (var_root->characteristics[start_idx + idx].payload_offset > 0) {
+                    slice_offset = var_root->characteristics[start_idx + idx].payload_offset;
+                    MPI_FILE_READ_OPS
+                } else {
+                    slice_offset = 0;
+                    MPI_FILE_READ_OPS1
+                }
+    
+                memcpy( (char *)data, fh->b->buff + fh->b->offset, slice_size);
+                if (fh->mfooter.change_endianness == adios_flag_yes) {
+                    change_endianness(data, slice_size, var_root->type);
+                }
+            }
+            else if (hole_break == 0) 
+            {
+                /* The slowest changing dimensions should not be read completely but
+                   we still need to read only one block */
+                int isize;
+                uint64_t size_in_dset = 0;
+                uint64_t offset_in_dset = 0;
+                uint64_t offset_in_var = 0;
+    
+                isize = offsets[0] + ldims[0];
+                if (start_notime[0] >= offsets[0]) {
+                    // head is in
+                    if (start_notime[0]<isize) {
+                        if (start_notime[0] + count_notime[0] > isize)
+                            size_in_dset = isize - start_notime[0];
+                        else
+                            size_in_dset = count_notime[0];
+                        offset_in_dset = start_notime[0] - offsets[0];
+                        offset_in_var = 0;
+                    }
+                }
+                else {
+                    // middle is in
+                    if (isize < start_notime[0] + count_notime[0])
+                        size_in_dset = ldims[0];
+                    else
+                    // tail is in
+                        size_in_dset = count_notime[0] + start_notime[0] - offsets[0];
+                    offset_in_dset = 0;
+                    offset_in_var = offsets[0] - start_notime[0];
+                }
+    
+                slice_size = size_in_dset * datasize * size_of_type;
+                write_offset = offset_in_var * datasize * size_of_type;
+
+                if (var_root->characteristics[start_idx + idx].payload_offset > 0) {
+                    slice_offset = var_root->characteristics[start_idx + idx].payload_offset 
+                                 + offset_in_dset * datasize * size_of_type;
+                    MPI_FILE_READ_OPS
+                } else {
+                    slice_offset = 0;
+                    MPI_FILE_READ_OPS1
+                }
+    
+                memcpy ((char *)data + write_offset, fh->b->buff + fh->b->offset, slice_size);
+                if (fh->mfooter.change_endianness == adios_flag_yes) {
+                    change_endianness((char *)data + write_offset, slice_size, var_root->type);
+                }
+    
+                //write_offset +=  slice_size;
+            }
+            else 
+            {
+
+                uint64_t stride_offset = 0;
+                int isize;
+                uint64_t size_in_dset[10];
+                uint64_t offset_in_dset[10];
+                uint64_t offset_in_var[10];
+                memset(size_in_dset, 0 , 10 * 8);
+                memset(offset_in_dset, 0 , 10 * 8);
+                memset(offset_in_var, 0 , 10 * 8);
+                int hit = 0;
+                for ( i = 0; i < ndim_notime ; i++) {
+                    isize = offsets[i] + ldims[i];
+                    if (start_notime[i] >= offsets[i]) {
+                        // head is in
+                        if (start_notime[i]<isize) {
+                            if (start_notime[i] + count_notime[i] > isize)
+                                size_in_dset[i] = isize - start_notime[i];
+                            else
+                                size_in_dset[i] = count_notime[i];
+                            offset_in_dset[i] = start_notime[i] - offsets[i];
+                            offset_in_var[i] = 0;
+                            hit = 1 + hit * 10;
+                        }
+                        else
+                            hit = -1;
+                    }
+                    else {
+                        // middle is in
+                        if (isize < start_notime[i] + count_notime[i]) {
+                            size_in_dset[i] = ldims[i];
+                            hit = 2 + hit * 10;
+                        }
+                        else {
+                            // tail is in
+                            size_in_dset[i] = count_notime[i] + start_notime[i] - offsets[i];
+                            hit = 3 + hit * 10;
+                        }
+                        offset_in_dset[i] = 0;
+                        offset_in_var[i] = offsets[i] - start_notime[i];
+                    }
+                }
+    
+                datasize = 1;
+                var_stride = 1;
+    
+                for ( i = ndim_notime-1; i >= hole_break; i--) {
+                    datasize *= size_in_dset[i];
+                    dset_stride *= ldims[i];
+                    var_stride *= count_notime[i];
+                }
+    
+                uint64_t start_in_payload = 0, end_in_payload = 0, s = 1;
+                for (i = ndim_notime - 1; i > -1; i--) {
+                    start_in_payload += s * offset_in_dset[i] * size_of_type;
+                    end_in_payload += s * (offset_in_dset[i] + size_in_dset[i] - 1) * size_of_type;
+                    s *= ldims[i];
+                }
+    
+                slice_size = end_in_payload - start_in_payload + 1 * size_of_type;
+    
+                if (var_root->characteristics[start_idx + idx].payload_offset > 0) {
+                    slice_offset =  var_root->characteristics[start_idx + idx].payload_offset
+                                  + start_in_payload;
+                    MPI_FILE_READ_OPS
+    
+                    for ( i = 0; i < ndim_notime ; i++) {
+                        offset_in_dset[i] = 0;
+                    }
+                } else {
+                    slice_offset =  start_in_payload;
+                    MPI_FILE_READ_OPS1
+                }
+
+                uint64_t var_offset = 0;
+                uint64_t dset_offset = 0;
+                for ( i = 0; i < hole_break; i++) {
+                    nloop *= size_in_dset[i];
+                }
+    
+                for ( i = 0; i < ndim_notime ; i++) {
+                    var_offset = offset_in_var[i] + var_offset * count_notime[i];
+                    dset_offset = offset_in_dset[i] + dset_offset * ldims[i];
+                }
+
+                copy_data (data
+                          ,fh->b->buff + fh->b->offset
+                          ,0
+                          ,hole_break
+                          ,size_in_dset
+                          ,ldims
+                          ,count_notime
+                          ,var_stride
+                          ,dset_stride
+                          ,var_offset
+                          ,dset_offset
+                          ,datasize
+                          ,size_of_type 
+                          );
+
+            }
+        }  // end for (idx ... loop over pgs
+    
+        free (idx_table);
+
+        total_size += items_read * size_of_type;
+        // shift target pointer for next read in
+        data = (char *)data + (items_read * size_of_type);
+
+    } // end for (timestep ... loop over timesteps
+
+    free (dims);
+
+    return total_size;
+}
+
+int64_t adios_read_bp_staged_read_var_byid2 (ADIOS_GROUP    * gp,
+                                      int            varid,
+                                      const uint64_t * start,
+                                      const uint64_t * count,
+                                      void           * data)
+{
+    struct BP_GROUP      * gh;
+    struct BP_FILE       * fh;
+    struct adios_index_var_struct_v1 * var_root;
+    struct adios_var_header_struct_v1 var_header;
+    struct adios_var_payload_struct_v1 var_payload;
+    int    i,j,k, idx, t;
+    int    start_time, stop_time;
+    int    start_idx, stop_idx;
+    int    ndim, ndim_notime, has_subfile, file_is_fortran;
+    uint64_t size, * dims;
+    uint64_t ldims[32], gdims[32], offsets[32];
+    uint64_t datasize, nloop, dset_stride,var_stride, total_size=0, items_read;
+    uint64_t count_notime[32], start_notime[32];
+    int timedim = -1, temp_timedim, is_global = 0, size_of_type;
+    uint64_t slice_offset, slice_size, tmpcount = 0;
+    uint64_t datatimeoffset = 0; // offset in data to write a given timestep
+    MPI_Status status;
+
+    gh = (struct BP_GROUP *) gp->gh;
+    fh = gh->fh;
+
+    file_is_fortran = (fh->pgs_root->adios_host_language_fortran == adios_flag_yes);
+    has_subfile = fh->mfooter.version & ADIOS_VERSION_HAVE_SUBFILE;
+
+    var_root = gh->vars_root; /* first variable of this group. Need to traverse the list */
+    for (i = 0; i< varid && var_root; i++) {
+        var_root = var_root->next;
+    }
+
+    if (i!=varid) {
+        adios_error (err_corrupted_variable, 
+               "Variable id=%d is valid but was not found in internal data structures!",
+               varid);
+        return -adios_errno; 
+    }
+
+    /* Get dimensions and flip if caller != writer language */
+    adios_read_bp_staged_get_dimensions (var_root, fh->tidx_stop - fh->tidx_start + 1, file_is_fortran, 
+                          &ndim, &dims, &timedim);
+
+    /* In a Fortran written files, dimensions are in reversed order for C */
+    //if ( file_is_fortran != futils_is_called_from_fortran() ) 
+    if (file_is_fortran) 
+        swap_order(ndim, dims, &timedim);
+
+    /* Take out the time dimension from start[] and count[] */
+    if (timedim == -1) {
+        /* For timeless var, we still search from fh->tidx_start to fh->tidx_stop
+           to handle the situation that some variables are dumped out in selected timesteps
+        */
+        start_time = fh->tidx_start;
+        stop_time = fh->tidx_stop;
+
+        for (i = 0; i < ndim; i++) {
+             count_notime[i] = count[i];
+             start_notime[i] = start[i];
+        }
+        ndim_notime = ndim;
+    } else {
+        j = 0;
+        if (futils_is_called_from_fortran())
+            temp_timedim = ndim - 1;
+        else
+            temp_timedim = 0;
+
+        start_time = start[temp_timedim] + fh->tidx_start;
+        stop_time = start_time + count[temp_timedim] - 1;
+
+        for (i = 0; i < temp_timedim; i++) {
+             count_notime[j] = count[i];
+             start_notime[j] = start[i];
+             j++;
+        }
+        i++; // skip timedim
+        for (; i < ndim; i++) {
+             count_notime[j] = count[i];
+             start_notime[j] = start[i];
+             j++;
+        }
+        ndim_notime = ndim-1;
+    }
+
+    /* Fortran reader was reported of Fortran dimension order so it gives counts and starts in that order.
+       We need to swap them here to read correctly in C order */
+    if ( futils_is_called_from_fortran()) {
+        swap_order(ndim_notime, count_notime, &timedim);
+        swap_order(ndim_notime, start_notime, &timedim);
+    }
+    
+    /* items_read = how many data elements are we going to read in total (per timestep) */
+    items_read = 1;
+    for (i = 0; i < ndim_notime; i++)
+        items_read *= count_notime[i];
+    
+    size_of_type = bp_get_type_size (var_root->type, var_root->characteristics [0].value);
+
+    /* For each timestep, do reading separately (they are stored in different sets of process groups */
+    for (t = start_time; t <= stop_time; t++) {
+        start_idx = get_var_start_index(var_root, t);
+        stop_idx = get_var_stop_index(var_root, t);
+
+        if (start_idx < 0 || stop_idx < 0) {
+            adios_error (err_no_data_at_timestep,"Variable (id=%d) has no data at %d time step",
+                varid, t);
+//            return -adios_errno;
+            continue;
+        }
+
+        if (ndim_notime == 0) {
+            /* READ A SCALAR VARIABLE */
+            slice_size = size_of_type;
+            idx = 0; // macros below need it
+
+            if (var_root->type == adios_string) {
+                // strings are stored without \0 in file
+                // size_of_type here includes \0 so decrease by one
+                size_of_type--;
+            }
+
+            if (var_root->characteristics[start_idx+idx].payload_offset > 0) {
+                slice_offset = var_root->characteristics[start_idx+idx].payload_offset;
+                if (!has_subfile) {
+                    MPI_FILE_READ_OPS
+                } else {
+                    MPI_FILE_READ_OPS2
+                }
+            } else {
+                slice_offset = 0;
+                MPI_FILE_READ_OPS1
+            }
+
+            memcpy((char *)data+total_size, fh->b->buff + fh->b->offset, size_of_type);
+
+            memcpy((char *)data+total_size, var_root->characteristics[start_idx+idx].value, size_of_type);
+            if (fh->mfooter.change_endianness == adios_flag_yes) {
+                change_endianness((char *)data+total_size, size_of_type, var_root->type);
+            }
+
+            if (var_root->type == adios_string) {
+                // add \0 to the end of string
+                // size_of_type here is the length of string
+                // FIXME: how would this work for strings written over time?
+                ((char*)data+total_size)[size_of_type] = '\0';
+            }
+
+            total_size += size_of_type;
+            
+            if (timedim == -1)
+                break;
+            else
+                continue;
+        }
+
+         /* READ AN ARRAY VARIABLE */
+        int * idx_table = (int *) malloc (sizeof(int) * (stop_idx - start_idx + 1));
+
+        uint64_t write_offset = 0;
+        int npg = 0;
+        tmpcount = 0;
+        // loop over the list of pgs to read from one-by-one
+        for (idx = 0; idx < stop_idx - start_idx + 1; idx++) {
+            int flag;
+            datasize = 1;
+            nloop = 1;
+            var_stride = 1;
+            dset_stride = 1;
+            idx_table[idx] = 1;
+            uint64_t payload_size = size_of_type;
+    
+            /* Each pg can have a different sized array, so we need the actual dimensions from it */
+            is_global = adios_read_bp_staged_get_dimensioncharacteristics( &(var_root->characteristics[start_idx + idx]),
+                                                            ldims, gdims, offsets);
+            if (!is_global) {
+                // we use gdims below, which is 0 for a local array; set to ldims here
+                for (j = 0; j< ndim; j++) {
+                    gdims[j]=ldims[j];
+                }
+            }
+
+            /* Again, a Fortran written file has the dimensions in Fortran order we need to swap here */
+            //if (file_is_fortran != futils_is_called_from_fortran()) {
+            if (file_is_fortran) {
+                i=-1;
+                swap_order(ndim, gdims,   &(i)); // i is dummy 
+                swap_order(ndim, ldims,   &(i));
+                swap_order(ndim, offsets, &(i));
+            }
+            
+            /* take out the time dimension */
+            /* For C, gdims and offset are one size shorter because the timedim part is missing,
+               so we take it out only for fortran files
+            */
+            if (timedim > -1) {
+                for (i = timedim; i < ndim-1; i++) {
+                    ldims[i] = ldims[i+1];
+                    if (file_is_fortran) {
+                        gdims[i] = gdims[i+1];
+                        offsets[i] = offsets[i+1];
+                    }
+                }
+            }
+
+            /*
+            printf("ldims   = "); for (j = 0; j<ndim; j++) printf("%d ",ldims[j]); printf("\n");
+            printf("gdims   = "); for (j = 0; j<ndim; j++) printf("%d ",gdims[j]); printf("\n");
+            printf("offsets = "); for (j = 0; j<ndim; j++) printf("%d ",offsets[j]); printf("\n");
+            printf("count_notime   = "); for (j = 0; j<ndim_notime; j++) printf("%d ",count_notime[j]); printf("\n");
+            printf("start_notime   = "); for (j = 0; j<ndim_notime; j++) printf("%d ",start_notime[j]); printf("\n");
+            */
+                
+            for (j = 0; j < ndim_notime; j++) {
+    
+                payload_size *= ldims [j];
+    
+                if ( (count_notime[j] > gdims[j]) 
+                  || (start_notime[j] > gdims[j]) 
+                  || (start_notime[j] + count_notime[j] > gdims[j])){
+                    adios_error ( err_out_of_bound, "Error: Variable (id=%d) out of bound ("
+                        "the data in dimension %d to read is %llu elements from index %llu"
+                        " but the actual data is [0,%llu])",
+                        varid, j+1, count_notime[j], start_notime[j], gdims[j] - 1);
+                    return -adios_errno;
+                }
+    
+                /* check if there is any data in this pg and this dimension to read in */
+                flag = (offsets[j] >= start_notime[j] 
+                        && offsets[j] < start_notime[j] + count_notime[j])
+                    || (offsets[j] < start_notime[j]
+                        && offsets[j] + ldims[j] > start_notime[j] + count_notime[j]) 
+                    || (offsets[j] + ldims[j] > start_notime[j] 
+                        && offsets[j] + ldims[j] <= start_notime[j] + count_notime[j]);
+                idx_table [idx] = idx_table[idx] && flag;
+            }
+            
+            if ( !idx_table[idx] ) {
+                continue;
+            }
+            ++npg;
+
+            /* determined how many (fastest changing) dimensions can we read in in one read */
+            int hole_break; 
+            for (i = ndim_notime - 1; i > -1; i--) {
+                if (offsets[i] == start_notime[i] && ldims[i] == count_notime[i]) {
+                    datasize *= ldims[i];
+                }
+                else
+                    break;
+            }
+    
+            hole_break = i;
+            slice_offset = 0;
+            slice_size = 0;
+
+            if (hole_break == -1) {
+                /* The complete read happens to be exactly one pg, and the entire pg */
+                /* This means we enter this only once, and npg=1 at the end */
+                /* This is a rare case. FIXME: cannot eliminate this? */
+                slice_size = payload_size;
+    
+                if (var_root->characteristics[start_idx + idx].payload_offset > 0) {
+                    slice_offset = var_root->characteristics[start_idx + idx].payload_offset;
+                    if (!has_subfile) {
+                        MPI_FILE_READ_OPS
+                    } else {
+                        MPI_FILE_READ_OPS2
+                    }
+                } else {
+                    slice_offset = 0;
+                    MPI_FILE_READ_OPS1
+                }
+ 
+                memcpy( (char *)data, fh->b->buff + fh->b->offset, slice_size);
+                if (fh->mfooter.change_endianness == adios_flag_yes) {
+                    change_endianness(data, slice_size, var_root->type);
+                }
+            }
+            else if (hole_break == 0) 
+            {
+                /* The slowest changing dimensions should not be read completely but
+                   we still need to read only one block */
+                int isize;
+                uint64_t size_in_dset = 0;
+                uint64_t offset_in_dset = 0;
+    
+                isize = offsets[0] + ldims[0];
+                if (start_notime[0] >= offsets[0]) {
+                    // head is in
+                    if (start_notime[0]<isize) {
+                        if (start_notime[0] + count_notime[0] > isize)
+                            size_in_dset = isize - start_notime[0];
+                        else
+                            size_in_dset = count_notime[0];
+                        offset_in_dset = start_notime[0] - offsets[0];
+                    }
+                }
+                else {
+                    // middle is in
+                    if (isize < start_notime[0] + count_notime[0])
+                        size_in_dset = ldims[0];
+                    else
+                    // tail is in
+                        size_in_dset = count_notime[0] + start_notime[0] - offsets[0];
+                    offset_in_dset = 0;
+                }
+    
+                slice_size = size_in_dset * datasize * size_of_type;
+    
+                if (var_root->characteristics[start_idx + idx].payload_offset > 0) {
+                    slice_offset = var_root->characteristics[start_idx + idx].payload_offset 
+                                 + offset_in_dset * datasize * size_of_type;
+                    if (!has_subfile) {
+                        MPI_FILE_READ_OPS
+                    } else {
+                        MPI_FILE_READ_OPS2
+                    }
+
+                } else {
+                    slice_offset = 0;
+                    MPI_FILE_READ_OPS1
+                }
+    
+                memcpy ((char *)data + write_offset, fh->b->buff + fh->b->offset, slice_size);
+                if (fh->mfooter.change_endianness == adios_flag_yes) {
+                    change_endianness((char *)data + write_offset, slice_size, var_root->type);
+                }
+    
+                write_offset +=  slice_size;
+            }
+            else 
+            {
+
+                uint64_t stride_offset = 0;
+                int isize;
+                uint64_t size_in_dset[10];
+                uint64_t offset_in_dset[10];
+                uint64_t offset_in_var[10];
+                memset(size_in_dset, 0 , 10 * 8);
+                memset(offset_in_dset, 0 , 10 * 8);
+                memset(offset_in_var, 0 , 10 * 8);
+                int hit = 0;
+                for ( i = 0; i < ndim_notime ; i++) {
+                    isize = offsets[i] + ldims[i];
+                    if (start_notime[i] >= offsets[i]) {
+                        // head is in
+                        if (start_notime[i]<isize) {
+                            if (start_notime[i] + count_notime[i] > isize)
+                                size_in_dset[i] = isize - start_notime[i];
+                            else
+                                size_in_dset[i] = count_notime[i];
+                            offset_in_dset[i] = start_notime[i] - offsets[i];
+                            offset_in_var[i] = 0;
+                            hit = 1 + hit * 10;
+                        }
+                        else
+                            hit = -1;
+                    }
+                    else {
+                        // middle is in
+                        if (isize < start_notime[i] + count_notime[i]) {
+                            size_in_dset[i] = ldims[i];
+                            hit = 2 + hit * 10;
+                        }
+                        else {
+                            // tail is in
+                            size_in_dset[i] = count_notime[i] + start_notime[i] - offsets[i];
+                            hit = 3 + hit * 10;
+                        }
+                        offset_in_dset[i] = 0;
+                        offset_in_var[i] = offsets[i] - start_notime[i];
+                    }
+                }
+    
+                datasize = 1;
+                var_stride = 1;
+    
+                for ( i = ndim_notime-1; i >= hole_break; i--) {
+                    datasize *= size_in_dset[i];
+                    dset_stride *= ldims[i];
+                    var_stride *= count_notime[i];
+                }
+    
+                uint64_t start_in_payload = 0, end_in_payload = 0, s = 1;
+                for (i = ndim_notime - 1; i > -1; i--) {
+                    start_in_payload += s * offset_in_dset[i] * size_of_type;
+                    end_in_payload += s * (offset_in_dset[i] + size_in_dset[i] - 1) * size_of_type;
+                    s *= ldims[i];
+                }
+    
+                slice_size = end_in_payload - start_in_payload + 1 * size_of_type;
+    
+                if (var_root->characteristics[start_idx + idx].payload_offset > 0) {
+                    slice_offset =  var_root->characteristics[start_idx + idx].payload_offset
+                                  + start_in_payload;
+                    if (!has_subfile) {
+                        MPI_FILE_READ_OPS
+                    } else {
+                        MPI_FILE_READ_OPS2
+                    }
+ 
+                    for ( i = 0; i < ndim_notime ; i++) {
+                        offset_in_dset[i] = 0;
+                    }
+                } else {
+                    slice_offset =  start_in_payload;
+                    MPI_FILE_READ_OPS1
+                }
+    
+                uint64_t var_offset = 0;
+                uint64_t dset_offset = 0;
+                for ( i = 0; i < hole_break; i++) {
+                    nloop *= size_in_dset[i];
+                }
+    
+                for ( i = 0; i < ndim_notime ; i++) {
+                    var_offset = offset_in_var[i] + var_offset * count_notime[i];
+                    dset_offset = offset_in_dset[i] + dset_offset * ldims[i];
+                }
+    
+                copy_data (data
+                          ,fh->b->buff + fh->b->offset
+                          ,0
+                          ,hole_break
+                          ,size_in_dset
+                          ,ldims
+                          ,count_notime
+                          ,var_stride
+                          ,dset_stride
+                          ,var_offset
+                          ,dset_offset
+                          ,datasize
+                          ,size_of_type 
+                          );
+            }
+        }  // end for (idx ... loop over pgs
+    
+        free (idx_table);
+    
+        total_size += items_read * size_of_type;
+        // shift target pointer for next read in
+        data = (char *)data + (items_read * size_of_type);
+
+        if (timedim == -1)
+            break;
+    } // end for (timestep ... loop over timesteps
+
+    free (dims);
+
+    return total_size;
+}
+
+int64_t adios_read_bp_staged_read_var_byid (ADIOS_GROUP    * gp,
+                                     int            varid,
+                                     const uint64_t  * start,
+                                     const uint64_t  * count,
+                                     void            * data)
+{
+    struct BP_GROUP      * gh;
+    struct BP_FILE       * fh;
+    int has_time_index_characteristic;
+
+    adios_errno = 0;
+    if (!gp) {
+        adios_error (err_invalid_group_struct, "Null pointer passed as group to adios_read_var()");
+        return -adios_errno;
+    }
+
+    gh = (struct BP_GROUP *) gp->gh;
+    if (!gh) {
+        adios_error (err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh group handle is NULL!");
+        return -adios_errno;
+    }
+
+    fh = gh->fh;
+    if (!fh) {
+        adios_error (err_invalid_group_struct, "Invalid ADIOS_GROUP struct: .gh->fh file handle is NULL!");
+        return -adios_errno;
+    }
+
+    has_time_index_characteristic = fh->mfooter.version & ADIOS_VERSION_HAVE_TIME_INDEX_CHARACTERISTIC;
+    if (!has_time_index_characteristic) {
+        // read older file format. Can be deleted later on.
+        return adios_read_bp_staged_read_var_byid1(gp, varid, start, count, data);
+    } else {
+        return adios_read_bp_staged_read_var_byid2(gp, varid, start, count, data);
+    }
+}
diff --git a/src/read_dart.c b/src/read_dart.c
index c7b1bbf..9e1abde 100644
--- a/src/read_dart.c
+++ b/src/read_dart.c
@@ -22,6 +22,7 @@
 #include "adios_error.h"
 #include "futils.h"
 #include "globals.h"
+#include "ds_metadata.h"
 
 #include "dart.h"
 
@@ -30,26 +31,58 @@
 #endif
 
 #if 1
-#   define DBG_PRINTF printf
+#   define DBG_PRINTF(...) fprintf(stderr,__VA_ARGS__); fflush(NULL)
 #else
 #   define DBG_PRINTF(a,...) 
 #endif
 
 #define MAXDARTNAMELEN 128
-
+/* Maximum number of different filenames allowed per process during the whole run */
+#define MAXNFILE 10 
 /*#define DART_DO_VERSIONING   define it at configure as -DDART_DO_VERSIONING in CFLAGS */
-static int number_of_fopens = 0;  /* for versioning, works only if one file is fopened (in a loop) in the application */
 
-struct adios_read_dart_data_struct {
+struct adios_read_dart_fileversions_struct { // describes one variable (of one group)
+    char      * filename[MAXNFILE];
+    int         version[MAXNFILE];  /* for versioning of one given filename */
+};
+static struct adios_read_dart_fileversions_struct file_versions;
+static int n_filenames; /* number of filenames appeared during the run */
+
+
+struct adios_read_dart_var_struct { // describes one variable (of one group)
+    char                 * name;
+    enum ADIOS_DATATYPES   type;
+    int                    hastime; // 0: no, 1:yes (time dimension is not stored in dataspaces)
+    int                    ndims;
+    uint64_t               dims[4]; // we have max 3+time dims in DataSpaces
+    void                 * value;
+};
+
+struct adios_read_dart_attr_struct { // describes one attribute (of one group)
+    char                 * name;
+    enum ADIOS_DATATYPES   type;
+    void                 * value;
+};
+
+struct adios_read_dart_group_struct { // accessible as fp->fh->groups[grpid]
+    int group_index_len;       // length of group index in GROUP at fn/gn variable 
+    struct adios_read_dart_var_struct  * vars;  // number of vars is ADIOS_GROUP->vars_count
+    struct adios_read_dart_attr_struct * attrs; // number of attrs is ADIOS_GROUP->attrs_count
+};
+
+struct adios_read_dart_data_struct { // accessible as fp->fh
     char *fname;               // path of file 
     int access_version;        // counting the access
     int disconnect_at_fclose;  // disconnect from DART in fclose()
     int mpi_rank;              // just for debug prints
+    int ngroups;               // number of groups (=1 right now)
+    struct adios_read_dart_group_struct * groups;
 };
 
 // Declarations
 static int adios_read_dart_get (const char * varname, enum ADIOS_DATATYPES vartype, 
                                 struct adios_read_dart_data_struct * ds, 
+                                int ndims, int is_fortran_ordering, 
                                 int * offset, int * readsize, void * data);
 
 /* If init is used, we connect to DART here, otherwise we connect in fopen.
@@ -72,7 +105,7 @@ int adios_read_dart_init (MPI_Comm comm)
         DBG_PRINTF("-- %s, rank %d: connect to dart with nproc=%d and appid=%d\n", __func__, rank, nproc, appid);
         err = dart_init(nproc, appid);
         if (err < 0) {
-            error(err_connection_failed, "Failed to connect with DART\n");
+            adios_error (err_connection_failed, "Failed to connect with DART\n");
             return -err_connection_failed;
         }
 
@@ -80,6 +113,7 @@ int adios_read_dart_init (MPI_Comm comm)
         //dpeers = dart_peers(dcg);
     }
     globals_adios_set_dart_connected_from_reader();
+    n_filenames = 0;
     return 0; 
 }
 
@@ -95,6 +129,72 @@ int adios_read_dart_finalize ()
     globals_adios_set_dart_disconnected_from_reader();
 }
 
+ADIOS_FILE * ds_unpack_file_info (char * buf, int buf_len, 
+                                  /* OUT */ struct adios_read_dart_data_struct * ds)
+{
+    ADIOS_FILE *fp;
+    struct adios_read_dart_group_struct * groups; // will be added to ds->groups
+    char * b = buf;
+    int blen, glen, i;
+
+    if (!buf || buf_len < 21)
+        return NULL;
+
+    fp = (ADIOS_FILE *) malloc (sizeof (ADIOS_FILE));
+    if (!fp) {
+        adios_error (err_no_memory, "Cannot allocate memory for file info.");
+        return NULL;
+    }
+
+    // add the single group to ds
+    groups = (struct adios_read_dart_group_struct *) malloc (sizeof(struct adios_read_dart_data_struct));
+    if (!groups) {
+        adios_error (err_no_memory, "Cannot allocate memory for group struct in file info.");
+        return NULL;
+    }
+    fp->groups_count = 1;  // FIXME: more groups per file in the future?
+    ds->groups = groups;
+
+    blen = *(int*)b;  // buf len again from buffer itself
+    if (blen != buf_len) {
+        DBG_PRINTF("WARNING: %s(): expected file info  buffer length is %d but buffer head says %d\n", 
+                    __func__, buf_len, blen);
+    }
+    b += sizeof(int); // skip buf len
+    fp->tidx_start = *(int*)b; // time index
+    b += sizeof(int);
+    fp->vars_count = *(int*)b; // number of variables
+    b += sizeof(int);
+    fp->attrs_count = *(int*)b; // number of attributes
+    b += sizeof(int);
+    groups[0].group_index_len = *(int*)b; // length of group index
+    b += sizeof(int);
+    glen = *(int*)b; // length of (only) group name
+    b += sizeof(int);
+
+    fp->fh = (uint64_t)ds; // note: repeated in the caller fopen(), where is the right place?
+    fp->ntimesteps = 1;
+    fp->file_size = 0;
+    fp->version = 1;
+    fp->endianness = 0; // FIXME: not always Little Endian. Does it matter? 
+    alloc_namelist (&fp->group_namelist, fp->groups_count);
+    for (i=0;i<fp->groups_count;i++) {
+        if (!fp->group_namelist[i]) {
+            adios_error (err_no_memory, "Could not allocate buffer for %d strings in adios_fopen()", 
+                        fp->groups_count);
+            if (i>0) free_namelist ((fp->group_namelist),i);
+            free(fp);
+            return NULL;
+        }
+        else  {
+            strcpy(fp->group_namelist[i],b);
+        }
+    }
+
+    return fp;
+}
+
+
 ADIOS_FILE * adios_read_dart_fopen (const char * fname, MPI_Comm comm)
 {
     ADIOS_FILE * fp;
@@ -105,14 +205,32 @@ ADIOS_FILE * adios_read_dart_fopen (const char * fname, MPI_Comm comm)
 
     ds = (struct adios_read_dart_data_struct *) malloc (sizeof(struct adios_read_dart_data_struct));
     if (!ds) {
-        error( err_no_memory, "Cannot allocate memory for file info.");
+        adios_error (err_no_memory, "Cannot allocate memory for file info.");
         return NULL;
     }
 
     /* fill out dart method specific struct */
     ds->fname = strdup(fname);
 #ifdef DART_DO_VERSIONING
-    ds->access_version = number_of_fopens;  /* Read data of separate versions from DataSpaces */
+   // check this filename's version number
+    int fidx;
+    for (fidx=0; fidx<n_filenames; fidx++) {
+        if (!strcmp(fname, file_versions.filename[fidx]))
+            break;
+    }
+    if (fidx == n_filenames) {
+        if (n_filenames < MAXNFILE) {
+            file_versions.filename[ n_filenames ] = strdup(fname);
+            file_versions.version [ n_filenames ] = -1;
+            n_filenames++;
+        } else {
+            DBG_PRINTF("ADIOS ERROR: rank %d: Too many different filenames has been used for adios_fopen().\n\tDART method allows max %d files\n", ds->mpi_rank, MAXNFILE);
+            adios_error (err_too_many_files, "Too many different filenames has been used for adios_fopen().\n\tDART method allows max %d files", MAXNFILE);
+            return NULL;
+        }
+    }
+    ds->access_version = file_versions.version[fidx]+1;  /* Read data of separate versions from DataSpaces */
+    DBG_PRINTF("fopen version filename=%s version=%d fidx=%d\n", fname, ds->access_version, fidx);
 #else
     ds->access_version = 0;    /* Data in DataSpaces is always overwritten (read same version) */
 #endif
@@ -131,10 +249,9 @@ ADIOS_FILE * adios_read_dart_fopen (const char * fname, MPI_Comm comm)
 
     /* Try to get variable with fname. If it does not exists, we get an error, which means
        the data does not exist. So we return an error just like with real files */
-    int offset[] = {0,0,0}, readsize[3] = {1,1,1};
-    int time_index;
+    int offset[] = {0,0,0}, readsize[3] = {128,1,1};
+    char file_info_buf[128];
     int err;
-    enum ADIOS_DATATYPES time_index_type = adios_integer;
     char dart_fname[MAXDARTNAMELEN];
     snprintf(dart_fname, MAXDARTNAMELEN, "FILE@%s",fname);
     DBG_PRINTF("-- %s, rank %d: Get variable %s\n", __func__, ds->mpi_rank, dart_fname);
@@ -142,48 +259,45 @@ ADIOS_FILE * adios_read_dart_fopen (const char * fname, MPI_Comm comm)
     DBG_PRINTF("   rank %d: call dcg_lock_on_read(%s)\n", ds->mpi_rank, fname);
     dart_lock_on_read(fname);
     DBG_PRINTF("   rank %d: dart_get %s\n", ds->mpi_rank, dart_fname);
-    err = adios_read_dart_get(dart_fname, time_index_type, ds, offset, readsize, &time_index);
+    err = adios_read_dart_get(dart_fname, adios_byte, ds, 1, 0, offset, readsize, file_info_buf);
     if (err) {
-        error(err_file_not_found_error, "Data of '%s' does not exist in DataSpaces\n", dart_fname);
+        /* Check if this file is finalized by the writer */
+        char dart_cname[MAXDARTNAMELEN];
+        int coffset[] = {0,0,0}, creadsize[3] = {1,1,1};
+        int cvalue; 
+        int save_version = ds->access_version;
+        snprintf(dart_cname, MAXDARTNAMELEN, "CLOSED@%s",fname);
+        ds->access_version = 0; // this variable is stored with version 0 only
+        DBG_PRINTF("   rank %d: dart_get %s\n", ds->mpi_rank, dart_cname);
+        err = adios_read_dart_get(dart_cname, adios_integer, ds, 1, 0, coffset, creadsize, &cvalue);
+        ds->access_version = save_version; 
+        if (!err) {
+            /* This file was finalized */
+            adios_error (err_end_of_file, "End of file '%s'. Writer finalized this file.\n", fname);
+        } else {
+            /* Not finalized, just no new timestep available */
+            adios_error (err_file_not_found_error, "Data of '%s' does not exist in DataSpaces\n", dart_fname);
+        }
         DBG_PRINTF("   rank %d: call dcg_unlock_on_read(%s)\n", ds->mpi_rank, fname);
         dart_unlock_on_read(fname);
         free(ds);
         return NULL;
     } else {
-        DBG_PRINTF("-- %s, rank %d: data of '%s' exists, time index = %d\n", __func__, ds->mpi_rank, dart_fname, time_index);
+        DBG_PRINTF("-- %s, rank %d: data of '%s' exists\n", __func__, ds->mpi_rank, dart_fname);
     }
 
-
-    fp = (ADIOS_FILE *) malloc (sizeof (ADIOS_FILE));
+    fp = ds_unpack_file_info (file_info_buf, 128, ds);
+    /*fp = (ADIOS_FILE *) malloc (sizeof (ADIOS_FILE));*/
     if (!fp) {
-        error( err_no_memory, "Cannot allocate memory for file info.");
+        adios_error (err_no_memory, "Cannot allocate memory for file info.");
+        dart_unlock_on_read(ds->fname);
         return NULL;
     }
 
-    /* fill out ADIOS_FILE struct */
     fp->fh = (uint64_t) ds;
-    fp->groups_count = 1;
-    fp->vars_count = 0;
-    fp->attrs_count = 0;
-    fp->tidx_start = 0;
-    fp->ntimesteps = 1;
-    fp->file_size = 0;
-    fp->version = 1;
-    fp->endianness = 0; /* FIXME: not always Little Endian. Does it matter? */
-    alloc_namelist (&fp->group_namelist,fp->groups_count); 
-    for (i=0;i<fp->groups_count;i++) {
-        if (!fp->group_namelist[i]) {
-            error(err_no_memory, "Could not allocate buffer for %d strings in adios_fopen()", fp->groups_count);
-            adios_read_dart_fclose(fp);
-            return NULL;
-        }
-        else  {
-            strcpy(fp->group_namelist[i],"dart");
-        }
-    }
     DBG_PRINTF("-- %s, rank %d: done fp=%x, fp->fh=%x\n", __func__, ds->mpi_rank, fp, fp->fh);
 #ifdef DART_DO_VERSIONING
-    number_of_fopens++;
+    file_versions.version[fidx]++; // next open will use new version
 #endif
     return fp;
 }
@@ -220,24 +334,258 @@ void adios_read_dart_reset_dimension_order (ADIOS_FILE *fp, int is_fortran)
     /* unimplemented */
 }
 
-
-ADIOS_GROUP * adios_read_dart_gopen (ADIOS_FILE *fp, const char * grpname)
+ADIOS_GROUP * ds_unpack_group_info (char * buf, struct adios_read_dart_group_struct * group)
+        
 {
-    /* DART has no groups, so any grpname is accepted and the same empty stuff is returned */
-    return adios_read_dart_gopen_byid(fp, 0);
+    ADIOS_GROUP *gp;
+    char * b = buf;
+    int i, j, k, blen, namelen, extrabyte;
+    int datasize;
+    struct adios_read_dart_var_struct * vars;
+    struct adios_read_dart_attr_struct * attrs;
+    int buf_len = group->group_index_len;
+    uint64_t dims[3]; // all variables has 3 dimension values in the index 
+    int didx[3]; // dimension reordering 
+    
+
+    if (!buf || buf_len < 12)
+        return NULL;
+
+    gp = (ADIOS_GROUP *) malloc(sizeof(ADIOS_GROUP));
+    if (!gp) {
+        adios_error (err_no_memory, "Could not allocate memory for group info");
+        return NULL;
+    }
+
+    
+    DBG_PRINTF("   %s: buffer length = %d, content:\n", __func__, buf_len);
+    for (i=0; i<buf_len; i+=16) {
+        for (j=0; j<4; j++) {
+            DBG_PRINTF("%3.3d %3.3d %3.3d %3.3d    ", b[i+4*j], b[i+4*j+1], b[i+4*j+2], b[i+4*j+3]);
+        }
+        DBG_PRINTF("\n");
+    }
+    
+
+    blen = *(int*)b;  // buf len again from buffer itself
+    if (blen != buf_len) {
+        DBG_PRINTF("WARNING: %s(): expected group info buffer length is %d but buffer head says %d\n", 
+                    __func__, buf_len, blen);
+    }
+    b += sizeof(int); 
+    gp->vars_count = *(int*)b; // number of variables
+    b += sizeof(int);
+    gp->attrs_count = *(int*)b; // number of attributes
+    b += sizeof(int);
+
+    DBG_PRINTF("   %s(): vars count = %d, attrs count = %d\n", __func__, gp->vars_count, gp->attrs_count);
+    gp->var_namelist = (char **) calloc (sizeof(char*), gp->vars_count);
+    gp->attr_namelist = (char **) calloc (sizeof(char*),  gp->attrs_count);
+    if (!gp->var_namelist || !gp->attr_namelist) {
+        adios_error (err_no_memory, "Could not allocate space for variable/attribute names when opening a group");
+        free(gp);
+        if (gp->var_namelist) free(gp->var_namelist);
+        return NULL;
+    }
+
+    vars = (struct adios_read_dart_var_struct *) 
+              malloc (gp->vars_count * sizeof(struct adios_read_dart_var_struct));
+    attrs = (struct adios_read_dart_attr_struct *) 
+              malloc (gp->attrs_count * sizeof(struct adios_read_dart_attr_struct));
+
+    if (!vars || !attrs) {
+        adios_error (err_no_memory, "Could not allocate space for variable/attribute metadata");
+        free(gp);
+        free(gp->var_namelist);
+        free(gp->attr_namelist);
+        if (vars) free(vars);
+        return NULL;
+    }
+
+    group->vars = vars;
+    group->attrs = attrs;
+
+    // extract each variable
+    DBG_PRINTF("    Extract variables\n");
+    for (i=0;i<gp->vars_count;i++) {
+        DBG_PRINTF("      var %d, b = %d\n", i, b);
+        namelen = *(int*)b; // lenght of name
+        b += sizeof(int);
+        DBG_PRINTF("        namelen = %d, b = %d\n", namelen, b);
+        gp->var_namelist[i] = (char *) malloc (namelen+1);
+        if (!gp->var_namelist[i]) {
+            adios_error (err_no_memory, "Could not allocate space for variable name when opening a group"); 
+            if (i>0) free_namelist ((gp->var_namelist),i);
+            free(gp);
+            return NULL;
+        }
+        else  {
+            memcpy(gp->var_namelist[i], b, namelen);
+            gp->var_namelist[i][namelen] = '\0';
+        }
+        b += namelen;
+        vars[i].name = strdup(gp->var_namelist[i]);  
+        DBG_PRINTF("        name = %s, b = %d\n", vars[i].name, b);
+        // type
+        vars[i].type = *(enum ADIOS_DATATYPES*)b; 
+        b += sizeof(int);
+        DBG_PRINTF("        type = %d, b = %d\n", (int)vars[i].type, b);
+        // hastime
+        vars[i].hastime = *(int*)b; 
+        b += sizeof(int);
+        DBG_PRINTF("        hastime = %d, b = %d\n", vars[i].hastime, b);
+        // dimensions
+        vars[i].ndims = *(int*)b; 
+        b += sizeof(int);
+        DBG_PRINTF("        ndims w/o time = %d, b = %d\n", vars[i].ndims, b);
+        for (j=0; j < 3; j++) {
+            dims[j] = *(uint64_t*)b; 
+            b += 8;
+            DBG_PRINTF("          unordered dim[%d] = %lld, b = %d\n", j, dims[j], b);
+        }
+        // reorder DS dimensions to Fortran/C dimensions
+        ds_dimension_ordering (vars[i].ndims, futils_is_called_from_fortran(), 
+                               1 /*unpack*/, didx);
+        // handle time too in this reordering
+        k=0;
+        if (vars[i].hastime && !futils_is_called_from_fortran()) {
+            // C reader: time dimension is first. 
+            k=1;
+            vars[i].dims[0] = 1;
+            DBG_PRINTF("          dim[0] = %lld (time)\n", vars[i].dims[0], b);
+        }
+        for (j=0; j < vars[i].ndims; j++) {
+            vars[i].dims[j+k] = dims[didx[j]];
+            DBG_PRINTF("          dim[%d] = %lld, b = %d\n", j+k, vars[i].dims[j+k], b);
+        }
+        if (vars[i].hastime && futils_is_called_from_fortran()) {
+            // Fortran reader: time dimension is last
+            vars[i].dims[ vars[i].ndims ] = 1;
+            DBG_PRINTF("          dim[%d] = %lld (time)", 
+                    vars[i].ndims, vars[i].dims[vars[i].ndims]);
+        }
+
+        if (vars[i].hastime) {
+            vars[i].ndims++;
+            DBG_PRINTF("        ndims = %d (with time)\n", vars[i].ndims);
+        }
+        if (vars[i].ndims == 0) { // && !vars[i].hastime) {
+            // need to get scalar value too
+            if (vars[i].type != adios_string) {
+                datasize = common_read_type_size(vars[i].type, NULL);
+                extrabyte=0;
+            } else {
+                memcpy (&datasize, b, sizeof(int));
+                b += sizeof(int);
+                extrabyte=1;
+            }
+            vars[i].value = (void *) malloc (datasize+extrabyte);
+            if (vars[i].value) {
+                memcpy (vars[i].value, b, datasize);
+                if (vars[i].type == adios_string) 
+                    ((char *)vars[i].value)[datasize] = '\0';
+            } else {
+                DBG_PRINTF("ERROR: cannot allocate %d bytes to store the value of variable %s\n",
+                        datasize, vars[i].name);
+            }
+            
+            b += datasize;
+            DBG_PRINTF("        value read, b = %d\n", b);
+        } else {
+            vars[i].value = NULL;
+        }
+    }
+
+    // extract each attribute
+    for (i=0;i<gp->attrs_count;i++) {
+        namelen = *(int*)b; // lenght of name
+        b += sizeof(int);
+        gp->attr_namelist[i] = (char *) malloc (namelen+1);
+        if (!gp->attr_namelist[i]) {
+            adios_error (err_no_memory, "Could not allocate space for attribute name when opening a group"); 
+            if (i>0) free_namelist ((gp->attr_namelist),i);
+            free(gp);
+            return NULL;
+        }
+        else  {
+            memcpy(gp->attr_namelist[i], b, namelen);
+            gp->attr_namelist[i][namelen] = '\0';
+        }
+        b += namelen;
+        attrs[i].name = strdup(gp->var_namelist[i]);  
+        // type
+        attrs[i].type = *(enum ADIOS_DATATYPES*)b; 
+        b += sizeof(int);
+        // get attribute value 
+        if (attrs[i].type != adios_string) {
+            datasize = common_read_type_size(attrs[i].type, NULL);
+            extrabyte=0;
+        } else {
+            memcpy (&datasize, b, sizeof(int));
+            b += sizeof(int);
+            extrabyte=1;
+        }
+        
+        attrs[i].value = (void *) malloc (datasize+extrabyte);
+        if (attrs[i].value) {
+            memcpy (attrs[i].value, b, datasize);
+            if (attrs[i].type == adios_string) 
+                ((char*)attrs[i].value)[datasize] = '\0';
+            DBG_PRINTF("        value read, b = %d\n", b);
+        } else {
+            DBG_PRINTF("ERROR: cannot allocate %d bytes to store the value of attribute %s\n",
+                    datasize, attrs[i].name);
+        }
+        
+        b += datasize;
+    }
+    return gp;
 }
 
-ADIOS_GROUP * adios_read_dart_gopen_byid (ADIOS_FILE *fp, int grpid)
+ADIOS_GROUP * adios_read_dart_gopen (ADIOS_FILE *fp, const char * grpname)
 {
-    struct adios_read_dart_data_struct * ds = (struct adios_read_dart_data_struct *) fp->fh;
     ADIOS_GROUP * gp;
-
-    /* DART has no groups, so any grpid is accepted and the same empty stuff is returned */
+    struct adios_read_dart_data_struct * ds = (struct adios_read_dart_data_struct *) fp->fh;
+    int grpid;
 
     adios_errno = 0;
-    gp = (ADIOS_GROUP *) malloc(sizeof(ADIOS_GROUP));
+    /* check if grpname is found in the group name list */
+    for (grpid=0; grpid < fp->groups_count; grpid++) {
+        if (!strcmp (grpname, fp->group_namelist[grpid]))
+            break;
+    }
+    if (grpid >= fp->groups_count) {
+        adios_error (err_invalid_group, "Invalid group name %s for file %s", grpname, ds->fname);
+        return NULL;
+    }
+
+    /* Try to get group metadata from DataSpaces. If it does not exists, we get an error, which means
+       the data does not exist. */
+    int offset[] = {0,0,0}, readsize[3] = {ds->groups[0].group_index_len,1,1};
+    char * group_info_buf = malloc (ds->groups[0].group_index_len);
+    if (!group_info_buf) {
+            adios_error (err_no_memory, "%s: Could not allocate buffer for group info buffer of %d bytes", 
+                        __func__, ds->groups[0].group_index_len);
+        return NULL;
+    }
+    int err;
+    char dart_name[MAXDARTNAMELEN];
+    snprintf (dart_name, MAXDARTNAMELEN, "GROUP@%s/%s",ds->fname, grpname);
+    DBG_PRINTF("-- %s, rank %d: Get variable %s with size %d\n", __func__, ds->mpi_rank, dart_name, readsize[0]);
+    err = adios_read_dart_get(dart_name, adios_byte, ds, 1, 0, offset, readsize, group_info_buf);
+    if (err) {
+        adios_error (err_invalid_group, "Invalid group name %s for file %s. "
+                     "Entity %s could not be retrieved from DataSpaces\n",
+                     grpname, ds->fname, dart_name);
+        return NULL;
+    } else {
+        DBG_PRINTF("-- %s, rank %d: data of '%s' exists\n", __func__, ds->mpi_rank, dart_name);
+    }
+
+
+    gp = ds_unpack_group_info (group_info_buf, &(ds->groups[grpid]));
     if (!gp) {
-        error( err_no_memory, "Could not allocate memory for group info");
+        DBG_PRINTF("-- %s, rank %d: unpacking group index failed\n", __func__, ds->mpi_rank);
         return NULL;
     }
 
@@ -245,22 +593,48 @@ ADIOS_GROUP * adios_read_dart_gopen_byid (ADIOS_FILE *fp, int grpid)
     gp->grpid = grpid;
     gp->gh = (uint64_t) 0;
     gp->fp = fp;
-    gp->vars_count = 0;
-    gp->attrs_count = 0;
-    gp->var_namelist = 0;
-    gp->attr_namelist = 0;
+    gp->timestep = ds->access_version;
+    gp->lasttimestep = ds->access_version;
     
+    free (group_info_buf);
     return gp;
 }
+
+ADIOS_GROUP * adios_read_dart_gopen_byid (ADIOS_FILE *fp, int grpid)
+{
+    struct adios_read_dart_data_struct * ds = (struct adios_read_dart_data_struct *) fp->fh;
+    if ( grpid < 0 || grpid > fp->groups_count-1) {
+        adios_error (err_invalid_group, "Invalid group id %s. There are %d groups in %s", 
+                     grpid, fp->groups_count, ds->fname);
+        return NULL;
+    }
+    return adios_read_dart_gopen (fp, fp->group_namelist[grpid]);
+}
                    
 int adios_read_dart_gclose (ADIOS_GROUP *gp)
 {
-    struct adios_read_dart_data_struct * ds = (struct adios_read_dart_data_struct *) gp->fp->fh;
+    struct adios_read_dart_data_struct * ds = 
+                (struct adios_read_dart_data_struct *) gp->fp->fh;
+    struct adios_read_dart_var_struct * vars = 
+                (struct adios_read_dart_var_struct *) ds->groups[gp->grpid].vars;
+    struct adios_read_dart_attr_struct * attrs = 
+                (struct adios_read_dart_attr_struct *) ds->groups[gp->grpid].attrs;
+    int i;
 
     adios_errno = 0;
 
     free_namelist ((gp->var_namelist),gp->vars_count);
     free_namelist ((gp->attr_namelist),gp->attrs_count);
+    for (i=0; i<gp->vars_count; i++) {
+        free (vars[i].name);
+        free (vars[i].value);
+    }
+    free(ds->groups[gp->grpid].vars);
+    for (i=0; i<gp->attrs_count; i++) {
+        free (attrs[i].name);
+        free (attrs[i].value);
+    }
+    free(ds->groups[gp->grpid].attrs);
     free(gp);
     return 0;
 }
@@ -270,52 +644,128 @@ int adios_read_dart_gclose (ADIOS_GROUP *gp)
 int adios_read_dart_get_attr (ADIOS_GROUP * gp, const char * attrname, enum ADIOS_DATATYPES * type,
                     int * size, void ** data)
 {
-    /* DART does not support attributes */
-    error(err_invalid_attrname, "DART read method does not support attributes!");
-    *size = 0;
-    *type = adios_unknown;
-    *data = 0;
-    return adios_errno;
+    struct adios_read_dart_data_struct * ds = (struct adios_read_dart_data_struct *) gp->fp->fh;
+    struct adios_read_dart_attr_struct * attrs = ds->groups[gp->grpid].attrs;
+
+    int attrid, vstartpos=0, fstartpos;
+
+    // find names with or without beginning /
+    if (attrname[0] == '/') vstartpos = 1;
+
+    for (attrid=0; attrid < gp->attrs_count; attrid++) {
+        if (attrs[attrid].name[0] == '/') vstartpos = 1;
+        else fstartpos = 0;
+        if (!strcmp (attrs[attrid].name+fstartpos, attrname+vstartpos))
+            break; // found this name
+    }
+
+    if (attrid == gp->attrs_count) {
+        adios_error (err_invalid_attrname, 
+                     "attribute name '%s' not found among %d attributes of group '%s'!",
+                     attrname, gp->attrs_count, gp->fp->group_namelist[gp->grpid]
+                    );
+        return adios_errno;
+    }
+
+    return adios_read_dart_get_attr_byid(gp, attrid, type, size, data);
 }
 
 int adios_read_dart_get_attr_byid (ADIOS_GROUP * gp, int attrid, 
                     enum ADIOS_DATATYPES * type, int * size, void ** data)
 {
-    /* DART does not support attributes */
-    error(err_invalid_attrid, "DART read method does not support attributes!");
-    *size = 0;
-    *type = adios_unknown;
-    *data = 0;
-    return adios_errno;
+    struct adios_read_dart_data_struct * ds = (struct adios_read_dart_data_struct *) gp->fp->fh;
+    struct adios_read_dart_attr_struct * attrs = ds->groups[gp->grpid].attrs;
+
+    if (attrid < 0 || attrid > gp->attrs_count) {
+        adios_error (err_invalid_attrid, "Group %s has %d attributes. Invalid attrid %d",
+                    gp->fp->group_namelist[gp->grpid], gp->attrs_count, attrid);
+        return adios_errno;
+    }
+
+    adios_errno = 0;
+    *type = attrs[attrid].type;
+    *size = common_read_type_size(*type, attrs[attrid].value);
+    *data = (void *) malloc (*size);
+    if (*data) {
+        memcpy (*data, attrs[attrid].value, *size);
+    } else {
+        adios_error (err_no_memory, "Could not allocate memory for variable info.");
+        return adios_errno;
+    }
+    return 0; 
 }
 
+/** Search name in list with or without leading /, return position or -1 if not found */
+static int adios_read_dart_find_varname (int nvars, struct adios_read_dart_var_struct * vars, const char * name) 
+{
+    int id, vstartpos=0, fstartpos;
+
+    // find names with or without beginning /
+    if (name[0] == '/') vstartpos = 1;
+
+    DBG_PRINTF("   find var %s, startpos=%d\n", name, vstartpos);
+
+    for (id=0; id < nvars; id++) {
+        if (vars[id].name[0] == '/') fstartpos = 1;
+        else fstartpos = 0;
+        DBG_PRINTF("     check %s, startpos=%d\n", vars[id].name, fstartpos);
+        if (!strcmp (vars[id].name+fstartpos, name+vstartpos))
+            break; // found this name
+    }
+
+    if (id == nvars) {
+        return -1;
+    }
+    return id;
+}
 
 ADIOS_VARINFO * adios_read_dart_inq_var (ADIOS_GROUP *gp, const char * varname) 
 {
-    /* DART has no inquiry capability, report somthing dummy */
-    return adios_read_dart_inq_var_byid(gp, 0);
+    struct adios_read_dart_data_struct * ds = (struct adios_read_dart_data_struct *) gp->fp->fh;
+    struct adios_read_dart_var_struct * vars = ds->groups[gp->grpid].vars;
+    int varid; 
+
+    varid = adios_read_dart_find_varname (gp->vars_count, vars, varname);
+    if (varid == -1) {
+        adios_error (err_invalid_varname, 
+                     "Variable name '%s' not found among %d variables of group '%s'!",
+                     varname, gp->vars_count, gp->fp->group_namelist[gp->grpid]
+                    );
+        return NULL;
+    }
+
+    return adios_read_dart_inq_var_byid(gp, varid);
 }
 
 ADIOS_VARINFO * adios_read_dart_inq_var_byid (ADIOS_GROUP *gp, int varid)
 {
     struct adios_read_dart_data_struct * ds = (struct adios_read_dart_data_struct *) gp->fp->fh;
+    struct adios_read_dart_var_struct * vars = ds->groups[gp->grpid].vars;
     ADIOS_VARINFO * vi;
     int i,k;
 
+    if (varid < 0 || varid > gp->vars_count) {
+        adios_error (err_invalid_varid, "Group %s has %d variables. Invalid varid %d",
+                    gp->fp->group_namelist[gp->grpid], gp->vars_count, varid);
+        return NULL;
+    }
+
     adios_errno = 0;
     vi = (ADIOS_VARINFO *) malloc(sizeof(ADIOS_VARINFO));
     if (!vi) {
-        error( err_no_memory, "Could not allocate memory for variable info.");
+        adios_error (err_no_memory, "Could not allocate memory for variable info.");
         return NULL;
     }
 
-    /* DART has no inquiry capability, report somthing dummy */
     vi->varid = varid;
-    vi->type = adios_unknown;
-    vi->ndim = 0;
-    vi->dims = NULL;
-    vi->timedim = -1;
-    vi->value = NULL;
+    vi->type = vars[varid].type;
+    vi->ndim = vars[varid].ndims;
+    vi->dims = vars[varid].dims;
+    if (vars[varid].hastime)
+        vi->timedim = 0;
+    else
+        vi->timedim = -1;
+    vi->value = vars[varid].value;
     vi->gmin = NULL;
     vi->gmax = NULL;
     vi->mins = NULL;
@@ -327,8 +777,8 @@ ADIOS_VARINFO * adios_read_dart_inq_var_byid (ADIOS_GROUP *gp, int varid)
 void adios_read_dart_free_varinfo (ADIOS_VARINFO *vp)
 {
     if (vp) {
-        if (vp->dims)   free(vp->dims);
-        if (vp->value)  free(vp->value);
+        //if (vp->dims)   free(vp->dims);  // link to vars[varid].dims
+        //if (vp->value)  free(vp->value); // link to vars[varid].value
         if (vp->gmin && vp->gmin != vp->value)   free(vp->gmin);
         if (vp->gmax && vp->gmax != vp->value)   free(vp->gmax);
         if (vp->mins)   free(vp->mins);
@@ -339,30 +789,39 @@ void adios_read_dart_free_varinfo (ADIOS_VARINFO *vp)
 
 static int adios_read_dart_get (const char * varname, enum ADIOS_DATATYPES vartype, 
                                 struct adios_read_dart_data_struct * ds, 
+                                int ndims, int is_fortran_ordering, 
                                 int * offset, int * readsize, void * data)
 {
 
     struct obj_data *od;
     int elemsize = common_read_type_size(vartype, NULL);
-    int err;
+    int i, err;
+    int didx[3];
+    int lb[3] = {0,0,0};
+    int ub[3] = {0,0,0};
+
+    // reorder DS dimensions to Fortran/C dimensions
+    ds_dimension_ordering (ndims, is_fortran_ordering, 0 /*pack*/, didx);
+    for (i=0; i<3; i++) {
+        lb[i] = offset[didx[i]];
+        ub[i] = offset[didx[i]]+readsize[didx[i]]-1;
+    }
 
     DBG_PRINTF("-- %s, rank %d: get data: varname=%s version=%d, lb=(%d,%d,%d) ub=(%d,%d,%d)}\n",
-        __func__, ds->mpi_rank, varname, ds->access_version, offset[1], offset[0], offset[2],
-        offset[1]+readsize[1]-1, offset[0]+readsize[0]-1, offset[2]+readsize[2]-1);
+        __func__, ds->mpi_rank, varname, ds->access_version, lb[0], lb[1], lb[2], 
+        ub[0], ub[1], ub[2]);
 
     err =  dart_get (varname, ds->access_version, elemsize, 
-                     offset[1], offset[0], offset[2],
-                     offset[1]+readsize[1]-1,
-                     offset[0]+readsize[0]-1,
-                     offset[2]+readsize[2]-1,
+                     lb[0], lb[1], lb[2],
+                     ub[0], ub[1], ub[2],
                      data
                     );
     /*if (err == -ENOMEM) {
-        error(err_no_memory, "Not enough memory for DART to perform dart_get()");  
+        adios_error (err_no_memory, "Not enough memory for DART to perform dart_get()");  
         return -err_no_memory;
     } 
     else*/ if (err) {
-        error(err_corrupted_variable, "DART failed to read variable %s.", varname);  
+        adios_error (err_corrupted_variable, "DART failed to read variable %s.", varname);  
         return -err_corrupted_variable;
     }
 
@@ -373,62 +832,172 @@ int64_t adios_read_dart_read_var (ADIOS_GROUP * gp, const char * varname,
                         const uint64_t * start, const uint64_t * count,
                         void * data)
 {
+    struct adios_read_dart_data_struct * ds = (struct adios_read_dart_data_struct *) gp->fp->fh;
+    struct adios_read_dart_var_struct * vars = ds->groups[gp->grpid].vars;
+    int varid; 
+
+    varid = adios_read_dart_find_varname (gp->vars_count, vars, varname);
+    if (varid == -1) {
+        adios_error (err_invalid_varname,
+                "Variable name '%s' not found among %d variables of group '%s'!",
+                varname, gp->vars_count, gp->fp->group_namelist[gp->grpid]
+                );
+        return -adios_errno;
+    }
+
+    return adios_read_dart_read_var_byid(gp, varid, start, count, data);
+}
+
+
+int64_t adios_read_dart_read_var_byid (ADIOS_GROUP    * gp,
+                             int              varid,
+                             const uint64_t  * start,
+                             const uint64_t  * count,
+                             void           * data)
+{
     int64_t total_size;
-    int offset[3], readsize[3], Toffset[3], Treadsize[3];
+    int offset[3] = {0,0,0};
+    int readsize[3] = {1,1,1};
     struct adios_read_dart_data_struct * ds = (struct adios_read_dart_data_struct *) gp->fp->fh;
-    enum ADIOS_DATATYPES vartype;
+    struct adios_read_dart_var_struct * vars = ds->groups[gp->grpid].vars;
     int elemsize;
     int err;
-    int i;
+    int i,k,ndims,tidx;
     char dart_name[MAXDARTNAMELEN];
 
-    /* DART uses integers for boundaries */
-    total_size = 1;
-    for (i=0; i<3; i++) {
-        offset[i]    = (int) start[i];
-        Toffset[i]   = 0;
-        readsize[i]  = (int) count[i];
-        Treadsize[i] = 1;
-        total_size   = total_size * count[i];
+    if (varid < 0 || varid > gp->vars_count) {
+        adios_error (err_invalid_varid, "Group %s has %d variables. Invalid varid %d",
+                    gp->fp->group_namelist[gp->grpid], gp->vars_count, varid);
+        return -adios_errno;
     }
 
-    /* Get type information for the variable from DataSpaces:
-       type variable name = TYPE@<filename>/<varname>
-    */
-    snprintf(dart_name, MAXDARTNAMELEN, "TYPE@%s/%s", ds->fname, varname);
-    err = adios_read_dart_get(dart_name, adios_integer, ds, Toffset, Treadsize, &vartype);
-    if (err)
-        return err;
-    DBG_PRINTF("-- %s, rank %d: get type: varname=%s type=%d (%s)}\n",
-        __func__, ds->mpi_rank, dart_name, vartype, common_read_type_to_string(vartype)) ;
-
-    elemsize = common_read_type_size(vartype, NULL);
-    DBG_PRINTF("-- %s, rank %d: get data: varname=%s type=%d (%s) elemsize=%d}\n",
-        __func__, ds->mpi_rank, dart_name, vartype, common_read_type_to_string(vartype), elemsize);
+    elemsize = common_read_type_size(vars[varid].type, vars[varid].value);
 
-    total_size *= elemsize; 
+    // handle scalars first (no need to read from space again)
+    if (vars[varid].ndims == 0) { // && !vars[varid].hastime) {
+        if (data) {
+            memcpy (data, vars[varid].value, elemsize);
+        } else {
+            adios_error (err_no_memory, "adios_read_var() expects an allocated array to store data.");
+            return -adios_errno;
+        }
+        return elemsize;
+    }
+        
+    adios_errno = 0;
+    k=0;
+    ndims = vars[varid].ndims;
+    /* DART uses integers for boundaries */
+    if (vars[varid].hastime) {
+        /* DART has no time dimensions stored in space. Remove from dims */
+        ndims = vars[varid].ndims - 1;
+        if (futils_is_called_from_fortran()) {
+            // Fortran: time dim is last
+            k = 0;
+            tidx = ndims;
+        } else {
+            // C: time dim is first
+            k = 1;
+            tidx = 0;
+        }
+        if (start[tidx] != gp->timestep || count[tidx] != 1) {
+            adios_error (err_out_of_bound, 
+                         "offset/readsize is out of bound in time dimension %d for variable %s\n"
+                         "you can read 1 element from offset (=timestep) %lld\n" 
+                         "you provided start=%lld, count=%lld\n",
+                         tidx, vars[varid].name, gp->timestep, start[tidx], count[tidx]
+                         );
+            return -adios_errno;
+        }
+    } else {
+        k = 0;
+    }
+    total_size = elemsize;
+    for (i=0; i<ndims; i++) {
+        if ( start[i+k] < 0 || start[i+k]+count[i+k] > vars[varid].dims[i+k]) {
+            adios_error (err_out_of_bound, 
+                         "offset/readsize is out of bound in dimension %d for variable %s\n"
+                         "size of dimension %d = %lld; you provided start=%lld, count=%lld",
+                         i+k, vars[varid].name, i+k, vars[varid].dims[i+k], start[i+k], count[i+k]
+                         );
+            return -adios_errno;
+        }
+        offset[i]    = (int) start[i+k];
+        readsize[i]  = (int) count[i+k];
+        total_size   = total_size * count[i+k];
+    }
 
-    DBG_PRINTF("-- %s, rank %d: get data: varname=%s start=(%lld,%lld,%lld) count=(%lld,%lld,%lld)}\n",
-        __func__, ds->mpi_rank, dart_name, start[0], start[1], start[2], count[0], count[1], count[2]);
+    snprintf(dart_name, MAXDARTNAMELEN, "%s/%s/%s", 
+             ds->fname, gp->fp->group_namelist[gp->grpid], vars[varid].name);
+    DBG_PRINTF("-- %s, rank %d: get data: varname=%s start=(%lld,%lld,%lld,%lld) count=(%lld,%lld,%lld,%lld)}\n",
+        __func__, ds->mpi_rank, dart_name, start[0], start[1], start[2], start[3], count[0], count[1], count[2], count[3]);
     DBG_PRINTF("-- %s, rank %d: get data: varname=%s offset=(%d,%d,%d) readsize=(%d,%d,%d)}\n",
         __func__, ds->mpi_rank, dart_name, offset[0], offset[1], offset[2], readsize[0], readsize[1], readsize[2]);
 
-    snprintf(dart_name, MAXDARTNAMELEN, "%s/%s", ds->fname, varname);
-    err = adios_read_dart_get(dart_name, vartype, ds, offset, readsize, data);
+    err = adios_read_dart_get(dart_name, vars[varid].type, ds, 
+                              ndims, futils_is_called_from_fortran(),
+                              offset, readsize, data);
     if (err)
         return err;
 
     return total_size;
 }
 
-int64_t adios_read_dart_read_var_byid (ADIOS_GROUP    * gp,
-                             int              varid,
-                             const uint64_t  * start,
-                             const uint64_t  * count,
-                             void           * data)
+
+/* Tell the DataSpaces order of dimensions for a 1-3 dim array written from Fortran or C.
+   unpack=1: the reverse of packing (to retrieve the original order).
+   didx should be an int [3] array in any case.
+*/
+void ds_dimension_ordering(int ndims, int is_app_fortran, int unpack, int *didx)
 {
-    error( err_invalid_varid, "DART does not know variable indicies, only variable names can be used.");
-    return -err_invalid_varid;
+    /* Order of dimensions: in DataSpaces: slow, fast, slowest
+       Fortran: i,j,k --> j, i, k  = lb[1], lb[0], lb[2]
+                i,j   --> j, i     = lb[1], lb[0], lb[2]=1
+                i     --> 1, i     = lb[1]=1, lb[0], lb[2]=1
+       C:       i,j,k --> j, k, i  = lb[1], lb[2], lb[0]
+                i,j   --> i, j     = lb[0], lb[1], lb[2]=1
+                i     --> 1, i     = lb[1]=1, lb[0], lb[2]=1 (same as Fortran)
+
+       unpack: C(i,j,k) ordering applied twice does not result in the original order
+               so we need to have a reverse mapping for this case.
+               For all the other cases, applying twice results in the same order
+               even for packing from Fortran and unpacking to C, and vice versa.
+               F(i,j,k) -(pack)-> DS(j,i,k) -(unpack)-> C(k,j,i) or F(i,j,k)
+               C(i,j,k) -(pack)-> DS(j,k,i) -(unpack)-> C(i,j,k) or F(k,j,i)
+               F(i,j)   -(pack)-> DS(j,i)   -(unpack)-> C(j,i)   or F(i,j)
+               C(i,j)   -(pack)-> DS(i,j)   -(unpack)-> C(i,j)   or F(j,i)
+               F(i)     -(pack)-> DS(1,i)   -(unpack)-> C(i,(1)) or F(i,(1))
+               C(i)     -(pack)-> DS(1,i)   -(unpack)-> C(i,(1)) or F(i,(1))
+    */
+
+    if (ndims == 0) {
+        didx[0] = 0; didx[1] = 1; didx[2] = 2;
+    } else if (is_app_fortran || ndims == 1) {
+        /* Flip 1st and 2nd dimension for DataSpaces representation
+           for any Fortran writings and for any 1D array :
+           Fortran: i,j,k --> j, i, k  = lb[1], lb[0], lb[2]
+           C:       i     --> 1, i     = lb[1]=1, lb[0], lb[2]=1 
+        */
+        didx[0] = 1; didx[1] = 0; didx[2] = 2;
+    } else if (ndims == 2) {
+        /* C: i,j   --> i, j     = lb[0], lb[1], lb[2]=1 */
+        didx[0] = 0; didx[1] = 1; didx[2] = 2;
+    } else { // (ndims == 3) 
+        if (!unpack) {
+            /* C: i,j,k --> j, k, i  = lb[1], lb[2], lb[0] */
+            didx[0] = 1; didx[1] = 2; didx[2] = 0;
+        } else {
+            /* DataSpaces x,y,z --> z,x,y  (ijk->kij, or jki->ijk) */
+            didx[0] = 2; didx[1] = 0; didx[2] = 1;
+        }
+    }
 }
 
 
+int64_t adios_read_dart_read_local_var (ADIOS_GROUP * gp, const char * varname,
+                                      int vidx, const uint64_t * start,
+                                      const uint64_t * count, void * data)
+{  
+    adios_error (err_operation_not_supported, "adios_read_local_var() is not supported with DART method.");
+    return -adios_errno;
+}
diff --git a/src/read_datatap.c b/src/read_datatap.c
new file mode 100644
index 0000000..a4d5c19
--- /dev/null
+++ b/src/read_datatap.c
@@ -0,0 +1,2304 @@
+#include "config.h"
+
+#if NO_DATATAP == 0
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <ffs.h>
+#include <atl.h>
+#include <evpath.h>
+//#include <mpi.h>
+
+#ifdef _NOMPI
+    /* Sequential processes can use the library compiled with -D_NOMPI */
+#   include "mpidummy.h"
+#define MPI_SUM 0
+#else
+    /* Parallel applications should use MPI to communicate file info and slices of data */
+#   include "mpi.h"
+#endif
+
+#include <pthread.h>
+#include "adios.h"
+#include "adios_read.h"
+#include "adios_read_hooks.h"
+#include "adios_error.h"
+#include "globals.h"
+
+#include <sys/queue.h>
+#if HAVE_PORTALS == 1
+#include <thin_portal.h>
+#elif HAVE_INFINIBAND == 1
+#include <thin_ib.h>
+#endif
+
+#include <sys/socket.h>
+#include <sys/times.h>
+#include <netinet/in.h>
+#include <sys/time.h>
+#include <sys/uio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <ctype.h>
+
+#include <gen_thread.h>
+//#include "queue.h"
+//#include "get_clock.h"
+//#include "attributes.h"
+//#include "memwatch.h"
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
+
+
+#define DT_MAX_QUEUE_LENGTH 512 
+
+typedef struct _Queue_Item
+{
+    uint32_t length;
+    char * data;
+    FMStructDescList var_list;
+    int32_t rank;     // rank of client from which the chunk comes
+} QueueItem;
+
+typedef struct _datatap_var_chunk
+{
+    int rank;
+    void *data;
+    uint64_t *local_bounds; // ndims
+    uint64_t *global_bounds; // ndims
+    uint64_t *global_offsets; // ndims
+    struct _datata_var_chunk *next;
+} datatap_var_chunk, *datatap_var_chunk_p;
+
+typedef struct _datatap_var_info
+{
+    int id;
+    char *varname;
+    char *varpath;
+    enum ADIOS_DATATYPES type;
+    uint64_t data_size;   
+    int time_dim; // -1 means no time dimension
+    int ndims;
+    int num_chunks;
+    datatap_var_chunk *chunks;
+    struct _datatap_var_info *next;
+} datatap_var_info, *datatap_var_info_p;
+
+
+//typedef struct _datatap_pg_info
+//{
+//    int rank;    
+//    int num_vars;    
+//    datatap_var_info *vars;    
+//} datatap_pg_info, *datatap_pg_info_p;
+
+#define VAR_BITMAP_SIZE 16
+
+// TODO
+typedef struct _datatap_read_file_data
+{
+    char *file_name;
+    char *group_name; // TODO: assume one group in file
+    file_info *f_info;
+//    int timestep;    // TODO: it's already in file_info
+    int num_vars;
+    datatap_var_info *vars;
+//    FMStructDescList var_list; // TODO
+
+    // TODO: replicated meta-data info from peer readers
+    // it is a list of vars which is not present locally
+    int num_vars_peer;
+    datatap_var_info *vars_peer;
+
+    MPI_Comm comm;
+    int my_rank;
+    int comm_size;
+
+    int host_language_fortran; // 1 for Fortran; 0 for C
+
+    char var_bitmap[VAR_BITMAP_SIZE]; // 128 bit for 128 var
+
+//    int num_vars_read;    
+//    datatap_var_info *vars_read;    
+//    datatap_var_info *vars_read_tail;    
+} datatap_read_file_data, *datatap_read_file_data_p;
+
+typedef struct _datatap_read_method_data
+{
+    pthread_t dt_server_thread;
+//    Queue *dt_queue;
+//    uint32_t dt_queue_max_length;
+//    pthread_mutex_t mutex;
+//    pthread_cond_t cond1;
+//    pthread_cond_t cond2;
+    MPI_Comm dt_comm;
+    int dt_comm_rank;
+    int dt_comm_size;
+    CManager dt_cm;
+    IOhandle *dt_handle;
+    int dt_server_ready; 
+//    int dt_server_stop; 
+    int num_io_dumps;    // TODO: timestep
+} datatap_read_method_data, *datatap_read_method_data_p;
+
+
+// this sructure holds all global data for Datatap Read method
+datatap_read_method_data *dt_read_data = NULL;
+
+// compare used-providd varname with the full path name of variable v
+// return zero if matches and non-zero otherwise
+static int compare_var_name (char *varname, datatap_var_info *v) 
+{
+    if (varname[0] == '/') { // varname is full path
+        char fullpath[256];
+        if(!strcmp(v->varpath, "/")) {
+            sprintf(fullpath, "/%s\0", v->varname);  
+        } 
+        else {   
+            sprintf(fullpath, "%s/%s\0", v->varpath, v->varname);  
+        }
+        return strcmp(fullpath, varname);
+    }
+    else { // varname doesn't include path
+        return strcmp(v->varname, varname);
+    }
+}
+
+static FMField *find_field (char *name, char *path, FMFieldList flist)
+{
+    char *temp_name;
+    char *full_path_name = get_full_path_name(name, path);
+    temp_name = getFixedName(full_path_name);
+    free(full_path_name);
+    FMField *f = flist;
+    while (f->field_name != NULL) {
+        if(!strcmp(temp_name, f->field_name)) {
+            free(temp_name);
+            return f;
+        }
+        else {
+            f++;
+        }
+#if 0
+        char *name_pos = f->field_name + (strlen(f->field_name) - strlen(name));
+        if(!strncmp(path, f->field_name, strlen(path)) &&
+           !strcmp(name, name_pos)) {
+            return f;
+        }
+        else {
+            f++;
+        }
+#endif
+    }
+    free(temp_name);
+    return f;
+}
+
+int64_t read_array(datatap_read_file_data *ds, datatap_var_info *var, 
+                    uint64_t *start, uint64_t *count, void *data)
+{
+    int type_size = common_read_type_size(var->type, NULL);
+fprintf(stderr, "im here type_size %d %s:%d\n", type_size, __FILE__,__LINE__);
+    int64_t total_size = 0;
+
+    // go over the whole list of data chunks and reorganize arrays
+    Queue *data_q = ds->f_info->dt_queue;
+
+    // TODO: we should be able to access the queue since the dt server will not
+    // touch it any more
+    ListElmt *current_chunk = list_head(data_q);
+    while(current_chunk) {
+        QueueItem *qi = (QueueItem *)current_chunk->data;  
+        FMFieldList filed_list = qi->var_list->field_list; // TODO
+        
+        // first, find the var   
+        FMField *f = find_field(var->varname, var->varpath, filed_list);
+
+        if(!f) { 
+            // actually this will not happen because the filed_list will
+            // contain all vars even though some may not be written
+            current_chunk = current_chunk->next;
+            continue;
+        }
+
+        char *source_addr = (char *)qi->data + f->field_offset; // this is the address
+        void *source_addr2;
+  
+        // here we need to distinguish static and dynamic arrays
+        int dim_are_nums = 1;
+
+        {
+            char *dim_start = strchr(f->field_type, '[');
+            char *dim_end = strrchr(f->field_type, ']');
+            while(dim_start < dim_end) {
+                if(*dim_start == '[' || *dim_start == ']') {
+                    dim_start ++;
+                    continue;
+                } else if(!isdigit(*dim_start)) {
+                    dim_are_nums = 0;
+                    break;
+                }
+                else {
+                    dim_start ++;
+                    continue;
+                }
+            }
+        }
+
+        if(dim_are_nums) {
+            source_addr2 = source_addr;
+        } else {
+            switch(var->type) {
+                case adios_byte:
+                case adios_unsigned_byte:
+                    source_addr2 = *((char **)source_addr);
+                    break;
+
+                case adios_string: // TODO
+                    return strlen((char *)source_addr) + 1;
+                    //source_addr2 = *((char **)source_addr);
+                    //break;
+
+                case adios_short:
+                case adios_unsigned_short:
+                    source_addr2 = *((short int **)source_addr);
+                    break;
+
+                case adios_integer:
+                case adios_unsigned_integer:
+                    source_addr2 = *((int **)source_addr);
+                    break;
+
+                case adios_long:
+                case adios_unsigned_long:
+                    source_addr2 = *((long int **)source_addr);
+                    break;
+
+                case adios_real:
+                    source_addr2 = *((float **)source_addr);
+                    break;
+
+                case adios_double:
+                    source_addr2 = *((double **)source_addr);
+                    break;
+
+                case adios_long_double:
+                    source_addr2 = *((long double **)source_addr);
+                    break;
+
+                case adios_complex:
+                case adios_double_complex:
+                default:
+                    adios_error(err_invalid_read_method, "complex data type is not supported.");
+                    return -1;
+            }
+        }
+
+        // find the array dimension info 
+        int j;
+        datatap_var_chunk *chunk = var->chunks; 
+        while(chunk) {
+            if(chunk->rank == qi->rank) {
+                break;
+            } 
+            else {
+                chunk = chunk->next;
+            }
+        }
+
+        if(!chunk) { // this chunk doesn't contain the var so skip it
+            current_chunk = current_chunk->next;
+            continue;
+        }
+
+        // now we copy data into user's read buffer
+        uint64_t global_start_r = 0;
+        for(j = var->ndims-1; j >= 0; j --) {
+            global_start_r *= chunk->global_bounds[j];
+            global_start_r += start[j];
+        }
+
+
+        total_size = type_size;
+        for(j = var->ndims-1; j >= 0; j --) {
+            total_size *= count[j];
+        }
+
+        for(j = 0; j < var->ndims; j ++) {
+            int lower = chunk->global_offsets[j] - start[j];
+            int higher = (start[j]+count[j]) - (chunk->global_offsets[j]+chunk->local_bounds[j]);
+            if(lower < 0 || higher < 0) {
+                // this means this chunk has some data which is not needed by this reader
+                // TODO: for pixie3d case, this will not happen
+                adios_error(err_invalid_read_method, "Datatap cannot support this decomposition.\n");
+                return -1;
+            }
+        }
+
+        // find the smallest slice
+        int min_dim = 0;
+        uint64_t stride_size = type_size;
+        for(j = 0; j < var->ndims; j ++) {
+            int lower = chunk->global_offsets[j] - start[j];
+            int higher = (start[j]+count[j]) - (chunk->global_offsets[j]+chunk->local_bounds[j]);
+            if(lower == 0 && higher == 0) {
+                // this means this dimnesion fits, let's move on to the next dimension
+                stride_size *= chunk->local_bounds[j];
+                min_dim ++; 
+                continue;
+            }
+            else if((lower > 0 && higher >= 0) ||
+                    (lower >= 0 && higher > 0)) {
+                // this means this dimension is strided. this dimension is the highest possible 
+                // dimension
+                break;
+            }
+        }
+ 
+        uint64_t num_strides = 1;
+        for(j = min_dim; j < var->ndims; j ++) {
+            num_strides *= chunk->local_bounds[j];
+        }
+
+        uint64_t current_pos[var->ndims]; // track current stride's starting global offset
+        for(j = 0; j < var->ndims; j ++) {
+            current_pos[j] = chunk->global_offsets[j];
+        }
+        uint64_t k = 0;       
+        char *stride_start_addr = source_addr2; 
+        int should_stop = 0;
+        for(; k < num_strides; k ++) {
+            // calculate the coordinates within the bounding box
+            uint64_t my_start = 0;
+            for(j = var->ndims-1; j >= 0; j --) {
+                my_start *= count[j];
+                my_start += (current_pos[j] - chunk->global_offsets[j]);
+            } 
+            char *position = (char *)data + my_start * type_size;
+
+            memcpy(position, stride_start_addr, stride_size);
+
+            // now advance to copy next stride
+            stride_start_addr += stride_size; 
+            should_stop = 0;
+            for(j = min_dim; j < var->ndims; j ++) {
+                if(!should_stop) {
+                    if(current_pos[j] == chunk->global_offsets[j]+chunk->local_bounds[j]-1) {
+                        // don't set should_stop so we move on to next dimension
+                        current_pos[j] = chunk->global_offsets[j];
+                    }
+                    else {
+                        current_pos[j] ++;
+                        should_stop = 1;
+                    }
+                } 
+                else {
+                    break;
+                }
+            }
+        }  
+
+#if 0
+        for(j = var->ndims-1; j >= 0; j --) {
+            // for each sub-chunk, test if it falls into the reading region
+            int lower = (chunk->global_offsets[j] >= start[j]) ? 1: 0;
+            int higher = ((chunk->global_offsets[j]+chunk->local_bounds[j]) <=
+                 (start[j]+count[j])) ? 1: 0;
+            if(lower && higher) {
+                if(j == 0) { // copy the whole chunks
+                    uint64_t my_start = 0;
+                    uint64_t my_size = type_size;
+                    int k;
+                    for(k = var->ndims-1; k >= 0; k --) {
+                        my_start *= chunk->global_bounds[k];
+                        my_start += chunk->global_offsets[k];
+                        my_size *= chunk->local_bounds[k];
+                    }
+                    
+                    int y, z;
+                    for(z = 0; z < ; z ++) {
+                        uint64_t z_offset = pix_record->zoffset + k;
+                        for(y = 0; y < pix_record->ysize; y ++) {
+                            unsigned long long y_offset = pix_record->yoffset + j;
+                            unsigned long long position = z_offset * pix_record->nyd_plus_2 * pix_record->nxd_plus_2 +
+                               y_offset * pix_record->nxd_plus_2 + pix_record->xoffset;
+                            position -= p_data->start_pos;
+                            memcpy(&(p_data->buffers[m].buffer[position]), v, pix_record->xsize * sizeof(double));
+                        }
+                    }
+
+
+                    char *position = (char *)data + (my_start - global_start_r) * type_size;
+                    memcpy(position, source_addr2, my_size);
+
+
+fprintf(stderr, "%d rank=%d name = %s position=%p data=%p mystart = %lu global_start_r = %lu mysize = %lu %s:%d\n", ds->my_rank,chunk->rank,var->varname,position,data,my_start, global_start_r, my_size, __FILE__,__LINE__);
+                    total_size += my_size;
+fprintf(stderr, "im here %d %s:%d\n", ds->my_rank,__FILE__,__LINE__);
+                    break;
+                }
+                else {
+fprintf(stderr, "im here %s:%d\n", __FILE__,__LINE__);
+                    // TODO
+                    continue;
+                }
+            }
+            else {
+                // TODO
+                adios_error(err_invalid_read_method, "Datatap cannot support this decomposition.\n");
+                return -1;
+            }
+        }
+        // we are done with this chunk, now extract data from next chunk
+#endif
+        
+
+        current_chunk = current_chunk->next;
+    }
+fprintf(stderr, "im here read rank %d var %s total size %ld %s:%d\n", ds->my_rank, var->varname, total_size,__FILE__,__LINE__);
+
+    // TODO: the data size is messed up because of ghost zone
+    total_size = type_size;
+    int j;
+    for(j = var->ndims-1; j >= 0; j --) {
+        total_size *= count[j]; 
+    }
+    return total_size;       
+}
+
+#if 0
+int reorganize_array (QueueItem *qi, datatap_read_file_data *ds)
+{
+fprintf(stderr, "im here rank %d %s:%d\n",dt_read_data->dt_comm_rank,__FILE__,__LINE__);
+    // go through all variables user wants to read
+    datatap_pg_info *pg = NULL;
+    int i;
+    for(i = 0; i < ds->num_pgs; i ++) {
+        if(ds->pgs[i].rank == qi->rank) {
+            pg = &(ds->pgs[i]);                   
+            break;
+        }
+    }
+    if(!pg) {
+        adios_error(err_unspecified, "cannot find pg.\n");
+        return -1;        
+    }
+    
+fprintf(stderr, "im here rank %d %s:%d\n",dt_read_data->dt_comm_rank,__FILE__,__LINE__);
+    datatap_var_info *var = ds->vars_read;
+    FMFieldList filed_list = qi->var_list->field_list; // TODO
+    while(var) {
+        // first search within the pg for this var        
+fprintf(stderr, "im here rank %d var name %s %s:%d\n",dt_read_data->dt_comm_rank,var->varname,__FILE__,__LINE__);
+        datatap_var_info *v = NULL;
+        for(i = 0; i < pg->num_vars; i ++) {
+fprintf(stderr, "im here rank %d var name %s i %d %s:%d\n",dt_read_data->dt_comm_rank,var->varname,i,__FILE__,__LINE__);
+            //if(!strcmp(pg->vars[i].varname, var->varname)) {
+            if(!compare_var_name(var->varname, &(pg->vars[i]))) {
+fprintf(stderr, "im here rank %d var name %s i %d %s:%d\n",dt_read_data->dt_comm_rank,var->varname,i,__FILE__,__LINE__);
+                // got it
+                v = &(pg->vars[i]);
+fprintf(stderr, "im here rank %d var name %s i %d %s:%d\n",dt_read_data->dt_comm_rank,var->varname,i,__FILE__,__LINE__);
+                 
+                int type_size = common_read_type_size(v->type, NULL); 
+fprintf(stderr, "im here rank %d var name %s i %d %s:%d\n",dt_read_data->dt_comm_rank,var->varname,i,__FILE__,__LINE__);
+                FMField *f = find_field(v->varname, v->varpath, filed_list);
+fprintf(stderr, "im here rank %d var name %s i %d %s:%d\n",dt_read_data->dt_comm_rank,var->varname,i,__FILE__,__LINE__);
+                char *source_addr = (char *)qi->data + f->field_offset; // this is the address
+                void *source_addr2;
+fprintf(stderr, "im here rank %d var name %s i %d %s:%d\n",dt_read_data->dt_comm_rank,var->varname,i,__FILE__,__LINE__);
+                switch(v->type) {
+                    case adios_byte:
+                    case adios_unsigned_byte:
+                        source_addr2 = *((char **)source_addr);
+                        break;
+          
+                    case adios_string: // TODO
+                        return strlen((char *)source_addr) + 1;
+                        source_addr2 = *((char **)source_addr);
+                        break;
+         
+                    case adios_short:
+                    case adios_unsigned_short:
+                        source_addr2 = *((short int **)source_addr);
+                        break;
+        
+                    case adios_integer:
+                    case adios_unsigned_integer:
+                        source_addr2 = *((int **)source_addr);
+                        break;
+        
+                    case adios_long:
+                    case adios_unsigned_long:
+                        source_addr2 = *((long int **)source_addr);
+                        break;
+        
+                    case adios_real:
+                        source_addr2 = *((float **)source_addr);
+                        break;
+        
+                    case adios_double:
+                        source_addr2 = *((double **)source_addr);
+                        break;
+        
+                    case adios_long_double:
+                        source_addr2 = *((long double **)source_addr);
+                        break;
+        
+                    case adios_complex:
+                    case adios_double_complex:
+                    default:
+                        adios_error(err_invalid_read_method, "complex data type is not supported.");
+                        return -1;
+                }
+                //memcopy(var->read_buffer, source_addr2, var->read_buffer_size);
+                                      
+                // now we need to calculate how to map chunks into read buffer
+                // according to dimension specification
+                // also we need to figure out which part should be shuffled to
+                // other peer processes and which part should be moved in from
+                // other processes
+                // search along the slowest changing dimension and determine if 
+                // the sub-chunk falls into the reading region. If so, copy the 
+                // whole sub-chunk, otherwise search along the second slowest
+                // changing dimension within that subchunk, identify which part
+                // should go where and copy the remaining part to local buffer
+fprintf(stderr, "im here rank %d var name %s i %d %s:%d\n",dt_read_data->dt_comm_rank,var->varname,i,__FILE__,__LINE__);
+                int j;
+                uint64_t global_start_r = 0; 
+                for(j = var->ndims-1; j >= 0; j --) {
+                    if(var->global_bounds[j]) {
+                        global_start_r *= var->global_bounds[j];
+                        global_start_r += var->global_offsets[j];
+                    }
+                }
+                
+if(!strcmp(v->varname,"bconds")){
+    int *bconds = (int *)source_addr2;
+    int t;
+    for(t=0;t<48;t++) {
+        fprintf(stderr, "bconds[%d]=%d\n",t,bconds[t]);
+    }
+
+}
+
+if(!strcmp(v->varname,"v1")){
+    double *v1 = (double *)source_addr2;
+    int t;
+    for(t=0;t<100;t++) {
+        fprintf(stderr, "v1[%d]=%f\n",t,v1[t]);
+    }
+
+}
+
+fprintf(stderr, "im here rank %d var name %s i %d %s:%d\n",dt_read_data->dt_comm_rank,var->varname,i,__FILE__,__LINE__);
+                for(j = v->ndims-1; j >= 0; j --) {
+                    // for each sub-chunk, test if it falls into the reading region
+                    int lower = (v->global_offsets[j] >= var->global_offsets[j]) ? 1: 0;
+                    int higher = ((v->global_offsets[j]+v->local_bounds[j]) <= 
+                         (var->global_offsets[j]+var->local_bounds[j])) ? 1: 0; 
+fprintf(stderr, "im here rank=%d j %d name %s go %lu lb %lu go %lu lb %lu %s:%d\n", dt_read_data->dt_comm_rank,j,var->varname,v->global_offsets[j],v->local_bounds[j],var->global_offsets[j],var->local_bounds[j],__FILE__,__LINE__);
+                    if(lower && higher) { 
+fprintf(stderr, "im here j %d %s:%d\n", j,__FILE__,__LINE__);
+                        if(j == 0) { // copy the whole chunks
+                            uint64_t my_start = 0;
+                            uint64_t my_size = type_size;
+                            int k;
+                            for(k = v->ndims-1; k >= 0; k --) {
+                                my_start *= v->global_bounds[k];
+                                my_start += v->global_offsets[k];
+                                my_size *= v->local_bounds[k];  
+                            }
+                            char *position = (char *)var->data + (my_start - global_start_r) * type_size;                            
+fprintf(stderr, "rank=%d name = %s position=%lu data=%lu mystart = %lu global_start_r = %lu mysize = %lu %s:%d\n", dt_read_data->dt_comm_rank,var->varname,position,var->data,my_start, global_start_r, my_size, __FILE__,__LINE__);
+                            memcpy(position, source_addr2, my_size);      
+fprintf(stderr, "im here j %d %s:%d\n", j,__FILE__,__LINE__);
+                            break;
+                        }
+                        else {
+                            // TODO 
+                            continue; 
+                        }
+                    }
+                    else {
+fprintf(stderr, "im here rank=%d j %d name %s go %lu lb %lu go %lu lb %lu %s:%d\n", dt_read_data->dt_comm_rank,j,var->varname,v->global_offsets[j],v->local_bounds[j],var->global_offsets[j],var->local_bounds[j],__FILE__,__LINE__);
+fprintf(stderr, "im here j %d %s:%d\n", j,__FILE__,__LINE__);
+                        // TODO
+                        adios_error(err_invalid_read_method, "Datatap cannot support this decomposition.\n");
+                        return -1;
+                    } 
+fprintf(stderr, "im here j %d %s:%d\n", j,__FILE__,__LINE__);
+                }
+                break;
+                // end of data re-organization for this var
+            } 
+        }             
+        
+        // now process the next var to read        
+        var = var->next;
+    }    
+fprintf(stderr, "im here rank %d %s:%d\n",dt_read_data->dt_comm_rank,__FILE__,__LINE__);
+
+    return 0;
+}
+#endif
+
+void data_handler (void *data, int length, void *user_data, attr_list attr, int rank, void *timing, file_info *f)
+{
+    recvtime *r = (recvtime*)timing;
+    IOhandle *h = (IOhandle*)user_data;
+    elapsedtime *e = updateTimes(h, r, length);
+    
+    // decode the data and insert the data into the queue
+    int decoded_length = FFS_est_decode_length(h->iocontext, data, length);
+
+    // TODO: make sure we free this later (after writing to hdf5 file)
+    char *decoded_data = (char *)malloc(decoded_length);
+
+    if(!decoded_data) {
+        adios_error(err_no_memory, "Cannot allocate memory for Datatap.");
+        exit(-1);
+    }
+
+    FFSTypeHandle ffshandle = FFSTypeHandle_from_encode(h->iocontext, data);
+    FMFormat form = FMFormat_of_original(ffshandle);
+
+    // TODO
+    FMStructDescList var_list = get_localized_formats(form);
+    establish_conversion(h->iocontext, ffshandle, var_list);
+    FFSdecode_to_buffer(h->iocontext, data, decoded_data);
+
+    // The encoded data can be recycled now
+    returnbuffer(h, data, length);
+
+    QueueItem * qi =(QueueItem *) malloc(sizeof(QueueItem));
+    if(!qi) {
+        adios_error(err_no_memory, "Cannot allocate memory for Datatap.");
+        exit(-1);
+    }
+    qi->data = decoded_data;
+    qi->length = decoded_length;
+    qi->var_list = var_list;
+    qi->rank = rank; // TODO: hack it!   
+
+    // put message in queue
+    pthread_mutex_lock(&(f->mutex));
+//    while(queue_size(f->dt_queue) >= f->dt_queue_max_length) {
+//        // wait until queue is not full
+//        pthread_cond_signal(&(dt_read_data->cond2));
+//        pthread_cond_wait(&(dt_read_data->cond1), &(dt_read_data->mutex));
+//    }
+    queue_enqueue(f->dt_queue, qi);
+    if(queue_size(f->dt_queue) == f->num_chunks) {
+        pthread_cond_signal(&(f->cond2));
+    }
+    pthread_mutex_unlock(&(f->mutex));
+
+
+fprintf(stderr, "im here rank= %d client rank=%d data handler done %s:%d\n",h->rank,rank,__FILE__,__LINE__);
+    
+    // TODO: check if it's time to stop
+}
+
+void * dt_server_thread_func (void *arg)
+{
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+    MPI_Comm orig_comm = (MPI_Comm) arg;
+
+#if 0 // open-mpi   
+    // duplicate a MPI communicator for synchronization between dt servers
+    int rc = MPI_Comm_dup(orig_comm, &(dt_read_data->dt_comm));
+    if(rc != MPI_SUCCESS) {
+        error(err_unspecified, "Cannot duplicate communicator for Datatap.");
+        pthread_exit(NULL);
+    }
+#else 
+    dt_read_data->dt_comm = orig_comm;
+#endif
+
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+
+#ifdef _NOMPI
+    dt_read_data->dt_comm_size = 1;
+    dt_read_data->dt_comm_rank = 0;
+#else 
+    MPI_Comm_size(dt_read_data->dt_comm, &(dt_read_data->dt_comm_size));
+    MPI_Comm_rank(dt_read_data->dt_comm, &(dt_read_data->dt_comm_rank));
+#endif
+  
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+    // initialize ptlpbio interface
+    dt_read_data->dt_cm = CManager_create();
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+    CMlisten_specific(dt_read_data->dt_cm, NULL);
+
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+    lrand48();
+
+    dt_read_data->dt_handle = EVthin_portals_listen(dt_read_data->dt_cm, 120,
+                              0, data_handler, dt_read_data->dt_comm);
+
+    char param_file[30];
+    int appid, was_set;
+    appid = globals_adios_get_application_id(&was_set);
+    if(!was_set) {
+        adios_error(err_unspecified, "Application ID was not set.");
+        sprintf(param_file, "datatap_param\0");
+    }
+    else {
+        sprintf(param_file, "datatap_param%d\0", appid);
+    }
+
+    // dt server(rank 0) gather contact info from other servers and write to
+    // a file so upstream writers can connect to this application
+    outputConnectionData(param_file, dt_read_data->dt_handle);
+
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+    dt_read_data->dt_server_ready = 1;
+
+    // serve the network
+    CMrun_network(dt_read_data->dt_cm);
+
+    // TODO: cleanup and exit
+    CManager_close(dt_read_data->dt_cm);
+    return NULL;
+}
+
+int adios_read_datatap_init (MPI_Comm comm)
+{
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+    setenv("CMSelfFormats", "1", 1);
+
+    // initialize Datatap read method structure
+    dt_read_data = (datatap_read_method_data *) malloc(sizeof(datatap_read_method_data));
+    if(!dt_read_data) {
+        adios_error(err_no_memory, "Cannot allocate memory for Datatap.");
+        return -1;
+    }    
+    memset(dt_read_data, 0, sizeof(datatap_read_method_data));
+
+    // enable threading for EVPath
+    gen_pthread_init();
+
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+#if 0
+    // set up queue for incoming data chunks
+    dt_read_data->dt_queue =(Queue *) calloc(1, sizeof(Queue));
+    if(!dt_read_data->dt_queue) {
+        adios_error(err_no_memory, "Cannot allocate memory for Datatap.");
+        return -1;
+    }
+    queue_init(dt_read_data->dt_queue, free);
+    dt_read_data->dt_queue_max_length = DT_MAX_QUEUE_LENGTH;
+
+    pthread_mutex_init(&(dt_read_data->mutex), NULL);
+    pthread_cond_init(&(dt_read_data->cond1), NULL);
+    pthread_cond_init(&(dt_read_data->cond2), NULL);
+#endif    
+
+    // fork the thread to poll network 
+    int rc = pthread_create(&(dt_read_data->dt_server_thread), NULL, 
+                            dt_server_thread_func, (void *)comm);
+    if(rc) {
+        adios_error(err_unspecified, "Failed to create Datatap server thread.");
+        return -1; 
+    }
+
+    // TODO: wait until the dt server thread is ready
+    while(!dt_read_data->dt_server_ready) { }
+    
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+    return 0;
+}
+
+int adios_read_datatap_finalize ()
+{
+    // notify and wait for dt server thread to exit
+    datatap_stop_server(dt_read_data->dt_handle);
+    pthread_join(dt_read_data->dt_server_thread, NULL);
+
+#if 0
+    // TODO: we need a datatap cleanup function
+    pthread_mutex_destroy(&(dt_read_data->mutex));
+    pthread_cond_destroy(&(dt_read_data->cond1));
+    pthread_cond_destroy(&(dt_read_data->cond2));    
+    free(dt_read_data->dt_queue);
+#endif
+
+    free(dt_read_data);
+    return 0;
+}
+
+ADIOS_FILE *adios_read_datatap_fopen(const char *fname, MPI_Comm comm)
+{
+    ADIOS_FILE *fp;
+    adios_errno = 0;
+
+    datatap_read_file_data *ds = (datatap_read_file_data *) malloc(sizeof(datatap_read_file_data));
+    if(!ds) {
+        adios_error(err_no_memory, "Cannot allocate memory for Datatap.");
+        return NULL;                
+    }
+    ds->file_name = strdup(fname);    
+     
+    // here we need to syncrhonize with other reader processes to see what they find
+    // 1: file available locally
+    // 0: file not found
+    int my_status, global_status;
+    int total_num_readers, my_rank;
+
+#ifdef _NOMPI
+    total_num_readers = 1;
+    my_rank = 0;
+#else
+    MPI_Comm_size(comm, &total_num_readers);
+    MPI_Comm_rank(comm, &my_rank);
+#endif
+
+    ds->comm = comm;
+    ds->my_rank = my_rank;
+    ds->comm_size = total_num_readers;
+
+    // first we need to make sure the file has been 'written'
+    // TODO: always start from timstep 0
+    int is_EOF = 0;
+    ds->f_info = datatap_get_file_info(dt_read_data->dt_handle, fname, dt_read_data->num_io_dumps, &is_EOF);
+    if(ds->f_info) {
+        // now I should tell my peer readers that I have seen this file available locally
+        my_status = 1;
+        if(total_num_readers > 1) {
+            int rc = MPI_Allreduce(&my_status, &global_status, 1, MPI_INT, MPI_SUM, comm);
+            if(rc != MPI_SUCCESS) {
+                fprintf(stderr, "something bad happened somewhere.\n");
+                free(ds->file_name);
+                free(ds);
+                return NULL;
+            } 
+        }
+        // now I can move on to process meta-data
+fprintf(stderr, "im here rank %d move on %s:%d\n", my_rank, __FILE__,__LINE__);
+    }
+    else {
+        if(is_EOF) {
+            adios_errno = err_end_of_file;
+            adios_error(err_end_of_file, "Reach the end of file (%s).", fname);
+            free(ds->file_name);
+            free(ds);
+    
+            if(total_num_readers > 1) {               
+                // now I should wait for my peer readers to see EOF in their local context
+                int rc = MPI_Barrier(comm);
+                if(rc != MPI_SUCCESS) {
+                    fprintf(stderr, "something bad happened somewhere.\n");
+                }
+                return NULL; 
+            }
+        }
+        else {
+            if(total_num_readers > 1) {
+
+                // I didn't see the file available in my local context, but my peer readers may
+                // have seen it, so I should ask them to figure out
+fprintf(stderr, "im here rank %d ask %s:%d\n", my_rank, __FILE__,__LINE__);
+                my_status = 0;
+                MPI_Allreduce(&my_status, &global_status, 1, MPI_INT, MPI_SUM, comm);
+                if(global_status == 0) { // no one see file available
+fprintf(stderr, "im here rank %d no file %s:%d\n", my_rank, __FILE__,__LINE__);
+                    adios_errno = err_file_not_found_error;
+                    adios_error(err_file_not_found_error, "Cannot find file (%s).", fname);
+fprintf(stderr, "im here rank %d no file %s:%d\n", my_rank, __FILE__,__LINE__);
+                    free(ds->file_name);
+                    free(ds);
+                    return NULL;
+                }
+                else { 
+                    // some one has seen this file available, so I should keep polling instead of return
+                    do {
+fprintf(stderr, "im here rank %d %s:%d\n", my_rank, __FILE__,__LINE__);
+                        is_EOF = 0;
+                        ds->f_info = datatap_get_file_info(dt_read_data->dt_handle, 
+                            fname, dt_read_data->num_io_dumps, &is_EOF);
+                        if(ds->f_info) { 
+                            // now we get it!
+fprintf(stderr, "im here rank %d %s:%d\n", my_rank, __FILE__,__LINE__);
+                            break;
+                        }
+                        else {
+                            if(is_EOF) {
+                                adios_errno = err_end_of_file;
+                                adios_error(err_end_of_file, "Reach the end of file (%s).", fname);
+                                free(ds->file_name);
+                                free(ds);
+
+                                int rc = MPI_Barrier(comm);
+                                if(rc != MPI_SUCCESS) {
+                                    fprintf(stderr, "something bad happened somewhere.\n");
+                                }
+                                return NULL;
+                            }
+                            else {
+                                usleep(10000); // TODO: we need to set a proper value
+fprintf(stderr, "im here rank %d %s:%d\n", my_rank, __FILE__,__LINE__);
+                                continue;
+                            }
+                        }  
+                    } 
+                    while (1);
+                }
+            }
+            else {
+                adios_errno = err_file_not_found_error;
+                adios_error(err_file_not_found_error, "Cannot find file (%s).", fname);
+fprintf(stderr, "im here rank %d no file %s:%d\n", my_rank, __FILE__,__LINE__);
+                free(ds->file_name);
+                free(ds);
+                return NULL;
+            }  
+        }
+    }       
+fprintf(stderr, "im here rank %d see file %s:%d\n", my_rank, __FILE__,__LINE__);
+    
+    // we don't know what to read yet
+    ds->num_vars = 0;
+    ds->vars = NULL;
+//    ds->num_vars_read = 0;
+//    ds->vars_read = NULL;
+//    ds->vars_read_tail = NULL;
+
+    // TODO: add a loop over chunks
+    int i;
+    for(i = 0; i < ds->f_info->num_chunks; i ++) {  
+        chunk_info *current_chunk = &(ds->f_info->chunks[i]);  
+        
+fprintf(stderr, "im here %s:%d\n", __FILE__,__LINE__);
+        // parse the var info
+        char *current_pos = current_chunk->var_info_buffer;
+        int total_var_info_size = *(int *)current_pos; // total size
+        current_pos += 4;
+
+        if(i == 0) {
+            ds->host_language_fortran = *(enum ADIOS_FLAG *)current_pos; // host language
+        }
+        current_pos += 4;
+
+        int group_name_len = *(int *)current_pos; // size of group name
+        current_pos += 4; 
+  
+        if(i == 0) { // TODO: let's assume one group name
+            ds->group_name = strdup(current_pos); // group name
+        }
+        current_pos += group_name_len;
+
+        int num_vars_in_pg = *(int *)current_pos; // total num of vars  
+        current_pos += 4;
+fprintf(stderr, "im here info size %d num vars %d %s:%d\n", total_var_info_size,num_vars_in_pg,__FILE__,__LINE__);
+
+        datatap_var_info *current_var;
+        char *end = current_chunk->var_info_buffer + total_var_info_size;
+        while(current_pos < end) {
+            // size of this var info
+            int var_info_size = *(int *) current_pos;             
+            current_pos += sizeof(int);        
+            int var_id = *(int *) current_pos;
+            current_pos += sizeof(int);        
+            int varname_len = *(int *) current_pos;        
+            current_pos += sizeof(int);        
+            char *varname = current_pos;  
+            current_pos += varname_len;
+            int varpath_len = *(int *) current_pos;
+            current_pos += sizeof(int);
+            char *varpath = current_pos;
+            current_pos += varpath_len;
+
+            // now we go through the current list of vars to see if this is new
+            current_var = ds->vars;
+            while(current_var != NULL) {
+                // TODO: compare var id
+                //if(!strcmp(current_var->varname, varname) && 
+                //    !strcmp(current_var->varpath, varpath)) {
+                if(var_id == current_var->id) {
+                    break;
+                }
+                else {
+                    current_var = current_var->next;
+                }
+            }
+
+            if(!current_var) { // this is a new var
+                current_var = (datatap_var_info *) malloc(sizeof(datatap_var_info));
+                if(!current_var) {
+                    adios_error(err_no_memory, "Cannot allocate memory for Datatap.");
+                    return NULL;
+                }
+                current_var->id = var_id;
+                current_var->varname = strdup(varname);
+                current_var->varpath = strdup(varpath);
+                current_var->type = *(enum ADIOS_DATATYPES *) current_pos;
+                current_pos += sizeof(enum ADIOS_DATATYPES);
+                current_var->time_dim = *(int *) current_pos;
+                current_pos += sizeof(int);
+                current_var->ndims = *(int *) current_pos;
+                current_pos += sizeof(int);
+                current_var->num_chunks = 0;
+                current_var->chunks = NULL;
+                if(!current_var->ndims) { // scalars and strings
+                    current_var->data_size = common_read_type_size(current_var->type, current_pos);
+                }
+fprintf(stderr, "im here %s %s %d %s:%d\n", current_var->varname, current_var->varpath, current_var->ndims, __FILE__,__LINE__);
+                current_var->next = ds->vars;
+                ds->vars = current_var;
+                ds->num_vars ++;
+            }
+            else {
+                current_pos += sizeof(enum ADIOS_DATATYPES);
+                //current_var->time_dim = *(int *) current_pos;
+                current_pos += sizeof(int);
+                //current_var->ndims = *(int *) current_pos;
+                current_pos += sizeof(int);
+            }            
+            
+            datatap_var_chunk *new_chunk = (datatap_var_chunk *) malloc(sizeof(datatap_var_chunk));             
+            if(!new_chunk) {
+                    adios_error(err_no_memory, "Cannot allocate memory for Datatap.");
+                    return NULL;
+            }
+            new_chunk->next = current_var->chunks;
+            current_var->chunks = new_chunk;
+            current_var->num_chunks ++; 
+
+            new_chunk->rank = current_chunk->rank;
+            if(!current_var->ndims) { // scalars and strings
+                // copy data value             
+                new_chunk->data = malloc(current_var->data_size);
+                if(!new_chunk->data) {
+                    adios_error(err_no_memory, "Cannot allocate memory for Datatap.");
+                    return NULL;                                  
+                }
+                memcpy(new_chunk->data, current_pos, current_var->data_size);         
+                current_pos += current_var->data_size;
+            }
+            else { // arrays
+                new_chunk->local_bounds = (uint64_t *) malloc(current_var->ndims * sizeof(uint64_t));  
+                if(!new_chunk->local_bounds) {
+                    adios_error(err_no_memory, "Cannot allocate memory for Datatap.");
+                    return NULL;                                  
+                }
+                new_chunk->global_bounds = (uint64_t *) malloc(current_var->ndims * sizeof(uint64_t));  
+                if(!new_chunk->global_bounds) {
+                    adios_error(err_no_memory, "Cannot allocate memory for Datatap.");
+                    return NULL;                                  
+                }
+                new_chunk->global_offsets = (uint64_t *) malloc(current_var->ndims * sizeof(uint64_t));  
+                if(!new_chunk->global_offsets) {
+                    adios_error(err_no_memory, "Cannot allocate memory for Datatap.");
+                    return NULL;                                  
+                }
+                int i;
+                for(i = 0; i < current_var->ndims; i ++) {
+                    new_chunk->local_bounds[i] = *(uint64_t *)current_pos;
+                    current_pos += sizeof(uint64_t);  
+                    new_chunk->global_bounds[i] = *(uint64_t *)current_pos;
+                    current_pos += sizeof(uint64_t);  
+                    new_chunk->global_offsets[i] = *(uint64_t *)current_pos;
+                    current_pos += sizeof(uint64_t);  
+                }                          
+            }
+        }    
+        // TODO: at this point, we no longer need var_info_buffer so free it
+        // free(current_chunk->var_info_buffer);
+    }
+        
+
+    // TODO: replicate meta-data among peer reader
+    ds->num_vars_peer = 0;
+    ds->vars_peer = NULL;
+
+    if(total_num_readers > 1)
+    {
+        char *send_buf = NULL;
+        char *recv_buf = NULL; 
+        int send_count = VAR_INFO_SIZE, recv_count = VAR_INFO_SIZE;
+        if(my_rank == 0) {
+            for(i = 0; i < ds->f_info->num_chunks; i ++) {
+                chunk_info *current_chunk = &(ds->f_info->chunks[i]);
+fprintf(stderr, "im here rank %d %d %s:%d\n", ds->my_rank, current_chunk->rank,__FILE__,__LINE__);
+                if(current_chunk->rank == 0) {
+                    send_buf = ds->f_info->chunks[i].var_info_buffer;
+                    break;
+                } 
+            }
+            
+            // TODO: before we do this, we need to make sure this one has sth special
+            // the only case we need to deal with is local array with only one chunk
+            // we will check this when calling read_var
+
+fprintf(stderr, "im here rank %d %s:%d\n", ds->my_rank, __FILE__,__LINE__);
+            int rc = MPI_Bcast(send_buf, send_count, MPI_BYTE, 0, comm);
+            if(rc != MPI_SUCCESS) {
+                fprintf(stderr, "rank %d: MPI_Scatter returns error (%d). %s:%d\n",
+                    my_rank, rc, __FILE__, __LINE__);
+                return NULL;
+            }
+        }
+        else {
+            recv_buf = (char *) malloc(VAR_INFO_SIZE); 
+            if(!recv_buf) {
+                adios_error(err_no_memory, "Cannot allocate memory for Datatap.");
+                return NULL;
+            }
+
+fprintf(stderr, "im here rank %d %s:%d\n", ds->my_rank, __FILE__,__LINE__);
+            int rc = MPI_Bcast(recv_buf, recv_count, MPI_BYTE, 0, comm);
+            if(rc != MPI_SUCCESS) {
+                fprintf(stderr, "rank %d: MPI_Scatter returns error (%d). %s:%d\n",
+                    my_rank, rc, __FILE__, __LINE__);
+                return NULL;
+            }
+        }
+
+        if(my_rank != 0) {
+            // parse the var_info buffer
+            char *current_pos = recv_buf;
+            int total_var_info_size = *(int *)current_pos; // total size
+            current_pos += 4;
+
+            current_pos += 4; // host language
+
+            int group_name_len = *(int *)current_pos; // size of group name
+            current_pos += 4;
+            current_pos += group_name_len;
+
+            int num_vars = *(int *)current_pos; // total num of vars
+            current_pos += 4;
+
+            datatap_var_info *current_var;
+            char *end = recv_buf + total_var_info_size;
+            while(current_pos < end) {
+                // size of this var info
+                int var_info_size = *(int *) current_pos;
+                char *start_of_next_var = current_pos + var_info_size;
+                current_pos += sizeof(int);
+                int var_id = *(int *) current_pos;
+                current_pos += sizeof(int);
+                int varname_len = *(int *) current_pos;
+                current_pos += sizeof(int);
+                char *varname = current_pos;
+                current_pos += varname_len;
+                int varpath_len = *(int *) current_pos;
+                current_pos += sizeof(int);
+                char *varpath = current_pos;
+                current_pos += varpath_len;
+
+                // now we go through the current list of vars to see if this is new
+                current_var = ds->vars;
+                while(current_var != NULL) {
+                    //if(!strcmp(current_var->varname, varname) &&
+                    //    !strcmp(current_var->varpath, varpath)) {
+                    if(var_id == current_var->id) {
+                        // this var is locally available, so skip it
+                        break;
+                    }
+                    else {
+                        current_var = current_var->next;
+                    }
+                }
+
+                if(current_var) { // this var is locally available
+                    current_pos = start_of_next_var;
+                    continue;
+                }
+
+                current_var = (datatap_var_info *) malloc(sizeof(datatap_var_info));
+                if(!current_var) {
+                    adios_error(err_no_memory, "Cannot allocate memory for Datatap.");
+                    return NULL;
+                }
+                current_var->id = var_id;
+                current_var->varname = strdup(varname);
+                current_var->varpath = strdup(varpath);
+                current_var->type = *(enum ADIOS_DATATYPES *) current_pos;
+                current_pos += sizeof(enum ADIOS_DATATYPES);
+                current_var->time_dim = *(int *) current_pos;
+                current_pos += sizeof(int);
+                current_var->ndims = *(int *) current_pos;
+                current_pos += sizeof(int);
+                current_var->num_chunks = 0;
+                current_var->chunks = NULL;
+                if(!current_var->ndims) { // scalars and strings
+                    current_var->data_size = common_read_type_size(current_var->type, current_pos);
+                }
+                current_var->next = ds->vars_peer;
+                ds->vars_peer = current_var;
+                ds->num_vars_peer ++;
+
+                datatap_var_chunk *new_chunk = (datatap_var_chunk *) malloc(sizeof(datatap_var_chunk));
+                if(!new_chunk) {
+                    adios_error(err_no_memory, "Cannot allocate memory for Datatap.");
+                    return NULL;
+                }
+                new_chunk->next = current_var->chunks;
+                current_var->chunks = new_chunk;
+                current_var->num_chunks ++;
+
+                new_chunk->rank = 0;
+                if(!current_var->ndims) { // scalars and strings
+                    // copy data value
+                    new_chunk->data = malloc(current_var->data_size);
+                    if(!new_chunk->data) {
+                        adios_error(err_no_memory, "Cannot allocate memory for Datatap.");
+                        return NULL;
+                    }
+                    memcpy(new_chunk->data, current_pos, current_var->data_size);
+                    current_pos += current_var->data_size;
+                }
+                else { // arrays
+                    new_chunk->local_bounds = (uint64_t *) malloc(current_var->ndims * sizeof(uint64_t));
+                    if(!new_chunk->local_bounds) {
+                        adios_error(err_no_memory, "Cannot allocate memory for Datatap.");
+                        return NULL;
+                    }
+                    new_chunk->global_bounds = (uint64_t *) malloc(current_var->ndims * sizeof(uint64_t));
+                    if(!new_chunk->global_bounds) {
+                        adios_error(err_no_memory, "Cannot allocate memory for Datatap.");
+                        return NULL;
+                    }
+                    new_chunk->global_offsets = (uint64_t *) malloc(current_var->ndims * sizeof(uint64_t));
+                    if(!new_chunk->global_offsets) {
+                        adios_error(err_no_memory, "Cannot allocate memory for Datatap.");
+                        return NULL;
+                    }
+                    int i;
+                    for(i = 0; i < current_var->ndims; i ++) {
+                        new_chunk->local_bounds[i] = *(uint64_t *)current_pos;
+                        current_pos += sizeof(uint64_t);
+                        new_chunk->global_bounds[i] = *(uint64_t *)current_pos;
+                        current_pos += sizeof(uint64_t);
+                        new_chunk->global_offsets[i] = *(uint64_t *)current_pos;
+                        current_pos += sizeof(uint64_t);
+                    }
+                }
+            }
+            
+            free(recv_buf);   
+        }
+    }
+
+fprintf(stderr, "im here %d %d %d %s:%d\n", ds->host_language_fortran, adios_flag_yes, futils_is_called_from_fortran(), __FILE__, __LINE__);
+    // TODO: here we need to ajust array dimension if the reader is in C 
+    // but writer is in Fortran or vice versa
+    if(ds->host_language_fortran == adios_flag_yes && !futils_is_called_from_fortran()) {
+        // reader is in C but writer is in Fortran, there are several things to adjust:
+        // array dimension index starts from 1 in Fortran --> start from 0 in C
+        // change array dimension order (including time dimension)
+        datatap_var_info *v = ds->vars;        
+        while(v) {
+            datatap_var_chunk *chunk = v->chunks; 
+            while(chunk) {
+                int i;
+                uint64_t temp;
+                for(i = 0; i < v->ndims/2; i ++) {
+                    temp = chunk->local_bounds[v->ndims-i-1];
+                    chunk->local_bounds[v->ndims-i-1] = chunk->local_bounds[i];
+                    chunk->local_bounds[i] = temp;
+                    temp = chunk->global_bounds[v->ndims-i-1];
+                    chunk->global_bounds[v->ndims-i-1] = chunk->global_bounds[i];
+                    chunk->global_bounds[i] = temp;
+                    temp = chunk->global_offsets[v->ndims-i-1];
+                    chunk->global_offsets[v->ndims-i-1] = chunk->global_offsets[i];
+                    chunk->global_offsets[i] = temp;
+                }
+                chunk = chunk->next;
+            }
+            if(v->time_dim > 0) { // -1 means no time dimension
+                v->time_dim = v->ndims - v->time_dim;  
+            }
+            v = v->next;
+        }
+
+        v = ds->vars_peer;
+        while(v) {
+            datatap_var_chunk *chunk = v->chunks;
+            while(chunk) {
+                int i;
+                for(i = 0; i < v->ndims; i ++) {
+                    chunk->local_bounds[i] --;
+                    //chunk->global_offsets[i] --;
+                }
+                uint64_t temp;
+                for(i = 0; i < v->ndims/2; i ++) {
+                    temp = chunk->local_bounds[v->ndims-i-1];
+                    chunk->local_bounds[v->ndims-i-1] = chunk->local_bounds[i];
+                    chunk->local_bounds[i] = temp;
+                    temp = chunk->global_bounds[v->ndims-i-1];
+                    chunk->global_bounds[v->ndims-i-1] = chunk->global_bounds[i];
+                    chunk->global_bounds[i] = temp;
+                    temp = chunk->global_offsets[v->ndims-i-1];
+                    chunk->global_offsets[v->ndims-i-1] = chunk->global_offsets[i];
+                    chunk->global_offsets[i] = temp;
+                }
+                chunk = chunk->next;
+            }
+            v->time_dim = v->ndims - v->time_dim - 1;
+            v = v->next;
+        }
+    }
+    else if(ds->host_language_fortran == adios_flag_no && futils_is_called_from_fortran()) {
+        // adjuct dimension C --> Fortran  
+        // TODO: for the demo, this will not happen so leave it here
+    }
+
+    fp = (ADIOS_FILE *) malloc(sizeof(ADIOS_FILE));
+    if(!fp) {
+        adios_error(err_no_memory, "Cannot allocate memory for file info.");
+        free(ds);
+        return NULL;
+    }
+ 
+    fp->fh = (uint64_t) ds;
+    fp->groups_count = 1; // TODO: assume one group per file
+    fp->vars_count = 0; // TODO: just do not use this filed
+    fp->attrs_count = 0; // TODO: do not support attributes yet
+
+    // TODO: since we require fopen/fclose for each timestep, 
+    // so there is always only 1 timestep in file
+    // TODO: set ntimesteps to be max to make pixie3d working
+    fp->tidx_start = ds->f_info->timestep;  
+    fp->ntimesteps = INT32_MAX;
+fprintf(stderr, "im here timestep %d %s:%d\n", fp->tidx_start = ds->f_info->timestep, __FILE__,__LINE__);
+
+    fp->file_size = 0; 
+    fp->version = 1;
+    fp->endianness = 0; 
+    alloc_namelist(&fp->group_namelist, fp->groups_count); 
+    for (i = 0; i < fp->groups_count; i++) {
+        if (!fp->group_namelist[i])  {
+            adios_error(err_no_memory, "Cannot allocate buffer in adios_fopen()");
+            return NULL;
+        }
+        else {
+            strcpy(fp->group_namelist[i], ds->group_name); 
+        }
+    }
+fprintf(stderr, "im here %s:%d\n", __FILE__,__LINE__);
+
+    // TODO: return code of adios_errno for fopen:
+    // 0: file metadata is available and everything is success
+    // we need a value telling that the file is not available yet
+    // we also need a value telling that writer is finishing so don't
+    // read this file any more
+
+    return fp;	
+}
+
+int adios_read_datatap_fclose(ADIOS_FILE *fp)
+{
+fprintf(stderr, "im here rank %d %s:%d\n",dt_read_data->dt_comm_rank,__FILE__,__LINE__);
+    datatap_read_file_data *ds = (datatap_read_file_data *) fp->fh;
+
+    adios_errno = 0;
+
+    dt_read_data->num_io_dumps ++;
+
+    // recycle the queue
+    QueueItem *qi;
+
+    while((!queue_dequeue(ds->f_info->dt_queue, &qi)) && qi) {
+        free(qi->data);
+        free(qi);  
+    }
+
+    // now we 'read' the data into user-provided buffers
+    // note that the data is actually moved by dt servr thread
+    // here we just re-organize the data into the distribution
+    // user wants
+
+#if 0
+    // process the incoming data chunks 
+    void *d = NULL;
+    QueueItem *qi;
+    uint64_t num_chunks_processed = 0;
+    int file_done = 0;
+
+    while(1) {
+        pthread_mutex_lock(&(ds->f_info->mutex));
+		while(queue_size(ds->f_info->dt_queue) == 0) {
+	fprintf(stderr, "im here num_chunks_processed %d %d %s:%d\n",num_chunks_processed, ds->num_pgs,__FILE__,__LINE__);
+            // check if it's time to finish this file
+            if(num_chunks_processed == ds->num_pgs) { // TODO
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+                dt_read_data->num_io_dumps ++;
+                pthread_mutex_unlock(&(ds->f_info->mutex));
+                file_done = 1;
+                break;
+            }
+            else { 
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+                pthread_cond_signal(&(ds->f_info->cond1));
+                pthread_cond_wait(&(ds->f_info->cond2), &(ds->f_info->mutex));
+            }
+        }
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+
+        if(file_done) {
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+            break;
+        }
+
+        // start of busy time
+        while((!queue_dequeue(ds->f_info->dt_queue, &d)) && d) {
+            //pthread_cond_signal(&(ds->f_info->cond1));
+            pthread_mutex_unlock(&(ds->f_info->mutex));
+
+            qi =(QueueItem *) d;
+
+fprintf(stderr, "im here rank %d %s:%d\n",dt_read_data->dt_comm_rank,__FILE__,__LINE__);
+            int rc = reorganize_array (qi, ds);
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+            if(rc) {
+                adios_error(err_unspecified, "Error in reorganize_array() function.");
+                exit(-1);
+            }
+
+            // recycle decoded data buffer
+            free(qi->data);
+            free(qi);
+
+            num_chunks_processed ++;
+
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+            pthread_mutex_unlock(&(ds->f_info->mutex));
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+            pthread_mutex_lock(&(ds->f_info->mutex));
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+        }
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+
+        pthread_mutex_unlock(&(ds->f_info->mutex));
+    }
+#endif    
+
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+    // notify dt server thread that we are done with this file 
+    int rc = datatap_release_file(dt_read_data->dt_handle, ds->f_info);
+    if(rc != 0) {
+        adios_error(err_unspecified, "Could not close file.");
+        return -1;
+    }
+
+    free_namelist((fp->group_namelist), fp->groups_count);
+    if (ds->file_name) { 
+        free(ds->file_name); 
+        ds->file_name = NULL; 
+    }
+    
+    if (ds->group_name) {
+        free(ds->group_name);
+        ds->group_name = NULL;
+    }
+
+    // TODO release pg_info and var_info 
+    datatap_var_info *v = ds->vars;
+    datatap_var_info *tmp_v;
+    while(v) {
+        tmp_v = v;
+        free(v->varname);
+        free(v->varpath);
+        datatap_var_chunk *chunk = v->chunks;
+        datatap_var_chunk *tmp_chunk;
+        while(chunk) {
+            tmp_chunk = chunk;
+            if(v->ndims) {
+                free(chunk->local_bounds);
+                free(chunk->global_bounds);
+                free(chunk->global_offsets);
+            }
+            else {
+                free(chunk->data);     
+            }
+            chunk = chunk->next;
+            free(tmp_chunk);
+        }
+        v = v->next;
+        free(tmp_v);
+    }
+
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+    v = ds->vars_peer;
+    while(v) {
+        tmp_v = v;
+        free(v->varname);
+        free(v->varpath);
+        datatap_var_chunk *chunk = v->chunks;
+        datatap_var_chunk *tmp_chunk;
+        while(chunk) {
+            tmp_chunk = chunk;
+            if(v->ndims) {
+                free(chunk->local_bounds);
+                free(chunk->global_bounds);
+                free(chunk->global_offsets);
+            }
+            else {
+                free(chunk->data);
+            }
+            chunk = chunk->next;
+            free(tmp_chunk);
+        }
+        v = v->next;
+        free(tmp_v);
+    }
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+
+    free(ds);
+    free(fp);
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+    return 0;
+}
+
+ADIOS_GROUP * adios_read_datatap_gopen (ADIOS_FILE *fp, const char *grpname)
+{
+fprintf(stderr, "im here %s:%d\n", __FILE__,__LINE__);
+    if(!grpname) {
+        adios_error(err_invalid_group, "Group name is not valid");
+        return NULL;
+    }
+    int i;
+    for(i = 0; i < fp->groups_count; i ++) {   
+        if(!strcmp(grpname, fp->group_namelist[i])) {
+            return adios_read_datatap_gopen_byid(fp, i);
+        }
+    }
+    adios_error(err_invalid_group, "Group %s is not valid", grpname);
+    return NULL;
+}
+
+ADIOS_GROUP * adios_read_datatap_gopen_byid (ADIOS_FILE *fp, int grpid)
+{
+fprintf(stderr, "im here %s:%d\n", __FILE__,__LINE__);
+    datatap_read_file_data *ds = (datatap_read_file_data *) fp->fh;
+    ADIOS_GROUP * gp;
+
+    adios_errno = 0;
+
+    gp = (ADIOS_GROUP *) malloc(sizeof(ADIOS_GROUP));
+    if (!gp) {
+        adios_error(err_no_memory, "Could not allocate memory for group info");
+        return NULL;
+    }
+
+    // TODO: again, assume one group per file
+    gp->grpid = grpid;
+    gp->gh = (uint64_t) 0; // TODO: we should re-organize the metadata
+    gp->fp = fp;
+    gp->attrs_count = 0; // attributes are not supported yet
+    
+fprintf(stderr, "im here rank %d %s:%d\n", ds->my_rank, __FILE__,__LINE__);
+    // generate a list of variables with distinct names among all pgs
+    gp->vars_count = ds->num_vars + ds->num_vars_peer;
+fprintf(stderr, "im here count %d %s:%d\n", gp->vars_count,__FILE__,__LINE__);
+    
+    // to return a globally consistently ordered var list, we sort the list by var id
+    datatap_var_info **vars = (datatap_var_info *) malloc(sizeof(datatap_var_info *) * gp->vars_count);
+    if(!vars) {
+        adios_error(err_no_memory, "Cannot allocate buffer in adios_read_datatap_gopen_byid()");
+        return NULL;
+    }
+    memset(vars, 0, sizeof(datatap_var_info *) * gp->vars_count);
+
+fprintf(stderr, "im here rank %d %s:%d\n", ds->my_rank, __FILE__,__LINE__);
+    datatap_var_info *current_var = ds->vars_peer;
+    datatap_var_info *var_to_sort = current_var;
+    while(var_to_sort) {
+        int j;
+        for(j = 0; j < gp->vars_count; j ++) {
+            if(vars[j] == NULL) {
+                vars[j] = var_to_sort;
+                current_var = current_var->next;
+                var_to_sort = current_var;
+                break; 
+            }
+            else if(vars[j]->id < var_to_sort->id) {
+                // move vars[j] 
+                datatap_var_info *tmp; 
+                tmp = vars[j];
+                vars[j] = var_to_sort;
+                var_to_sort = tmp;
+                break;
+            }
+        }
+    }
+fprintf(stderr, "im here rank %d %s:%d\n", ds->my_rank, __FILE__,__LINE__);
+
+    current_var = ds->vars;
+    var_to_sort = current_var;
+    while(var_to_sort) {
+        int j;
+        for(j = 0; j < gp->vars_count; j ++) {
+            if(vars[j] == NULL) {
+                vars[j] = var_to_sort;
+                current_var = current_var->next;
+                var_to_sort = current_var;
+                break;
+            }
+            else if(vars[j]->id < var_to_sort->id) {
+                // move vars[j]
+                datatap_var_info *tmp;
+                tmp = vars[j];
+                vars[j] = var_to_sort;
+                var_to_sort = tmp;
+                break;
+            }
+        }
+    }
+    // now the vars list is in descendent order
+    gp->var_namelist = (char **) malloc(gp->vars_count * sizeof(char *));
+    if(!gp->var_namelist) {
+        adios_error(err_no_memory, "Cannot allocate buffer in adios_read_datatap_gopen_byid()");
+        return NULL;
+    }
+
+fprintf(stderr, "im here rank %d %s:%d\n", ds->my_rank, __FILE__,__LINE__);
+    int i;
+    for(i = 0; i < gp->vars_count; i ++) {
+        int index = gp->vars_count - i - 1;
+        gp->var_namelist[i] = (char *) malloc(strlen(vars[index]->varname) +
+            strlen(vars[index]->varpath) + 2);
+        if(!gp->var_namelist[i]) {
+            adios_error(err_no_memory, "Cannot allocate buffer in adios_read_datatap_gopen_byid()");
+            return NULL;
+        }
+        // return full path name
+        // TODO: make sure the size of var_namelist[j] is enough
+        if(!strcmp(vars[index]->varpath, "/")) {
+            sprintf(gp->var_namelist[i], "/%s\0\0", vars[index]->varname);
+        }
+        else {
+            sprintf(gp->var_namelist[i], "%s/%s\0", vars[index]->varpath,
+                vars[index]->varname);
+        }
+    }
+fprintf(stderr, "im here rank %d %s:%d\n", ds->my_rank, __FILE__,__LINE__);
+
+    // here we construct a bitmap of var list and send it to rank 0 so rank 0 knows 
+    // which vars are only avaialble in its local memory
+    memset(ds->var_bitmap, 0, VAR_BITMAP_SIZE);
+    current_var = ds->vars_peer;
+    while(current_var) {           
+        int byte_pos = current_var->id / 8;
+        int bit_pos = current_var->id % 8;
+        unsigned char mask = 0x01 << bit_pos;
+        ds->var_bitmap[byte_pos] = ds->var_bitmap[byte_pos] | mask;
+        current_var = current_var->next;
+    }
+
+fprintf(stderr, "im here rank %d %s:%d\n", ds->my_rank, __FILE__,__LINE__);
+    // send back to rank 0 so it knows which var is missing on other processes
+    unsigned char *combined_bitmap = NULL;
+    int combined_size = ds->comm_size * VAR_BITMAP_SIZE;
+    if(ds->my_rank == 0) {
+        combined_bitmap = (unsigned char *) malloc(combined_size);
+        if(!combined_size) {
+            adios_error(err_no_memory, "Cannot allocate buffer in adios_read_datatap_gopen_byid()");
+            return NULL;
+        }
+    }
+    MPI_Gather(ds->var_bitmap, VAR_BITMAP_SIZE, MPI_BYTE, combined_bitmap, VAR_BITMAP_SIZE, MPI_BYTE, 0, ds->comm);
+
+fprintf(stderr, "im here rank %d %s:%d\n", ds->my_rank, __FILE__,__LINE__);
+    if(ds->my_rank == 0) {
+        // now determine which var is missing on other processes 
+        for(i = 0; i < ds->comm_size; i ++) {
+            int j;
+            for(j = 0; j < VAR_BITMAP_SIZE; j ++) {
+                ds->var_bitmap[j] = ds->var_bitmap[j] | combined_bitmap[i*VAR_BITMAP_SIZE+j];
+            }
+        }
+        free(combined_bitmap);
+        // if the corresponding bit is set in ds->var_bitmap, then the var is missing on other processes
+    }
+
+fprintf(stderr, "im here rank %d %s:%d\n", ds->my_rank, __FILE__,__LINE__);
+#if 0
+    do {
+        if(i == 0) { // the first pg
+            gp->vars_count = ds->pgs[0].num_vars;
+            gp->var_namelist = (char **) malloc(gp->vars_count * sizeof(char *));
+            if(!gp->var_namelist) {
+                adios_error(err_no_memory, "Cannot allocate buffer in adios_read_datatap_gopen_byid()");
+                return NULL;
+            }
+            for(j = 0; j < gp->vars_count; j ++) {
+                gp->var_namelist[j] = (char *) malloc(strlen(ds->pgs[i].vars[j].varname) + 
+                    strlen(ds->pgs[i].vars[j].varpath) + 2);
+                if(!gp->var_namelist[j]) {
+                    adios_error(err_no_memory, "Cannot allocate buffer in adios_read_datatap_gopen_byid()");
+                    return NULL;
+                }   
+                // return full path name   
+                // TODO: make sure the size of var_namelist[j] is enough
+                if(!strcmp(ds->pgs[i].vars[j].varpath, "/")) {
+                    sprintf(gp->var_namelist[j], "/%s\0\0", ds->pgs[i].vars[j].varname);
+                }
+                else {
+                    sprintf(gp->var_namelist[j], "%s/%s\0", ds->pgs[i].vars[j].varpath, 
+                        ds->pgs[i].vars[j].varname);
+                }    
+            }
+            k = gp->vars_count;
+            i ++;
+            continue;
+        } 
+
+        // go over the vars in the ith pg 
+        for(j = 0; j < ds->pgs[i].num_vars; j ++) {
+            // first, we need to make sure the var is not seen before
+            int t;
+            int is_new = 1;
+            char fullname[256];
+            if(!strcmp(ds->pgs[i].vars[j].varpath, "/")) {
+                sprintf(fullname, "/%s\0", ds->pgs[i].vars[j].varname);
+            }
+            else { 
+                sprintf(fullname, "%s/%s\0", ds->pgs[i].vars[j].varpath, ds->pgs[i].vars[j].varname);  
+            } 
+            for(t = 0; t < k; t++) {
+                if(!strcmp(fullname, gp->var_namelist[t])) { 
+                    is_new = 0;
+                    break;  
+                } 
+            }
+
+            if(!is_new) continue;
+
+            // now add this var to list
+            char **temp = gp->var_namelist;  
+//            temp = (char **) realloc(gp->var_namelist, (k+1) * sizeof(char*));
+            temp = (char **) malloc((k+1) * sizeof(char*));
+            if(!temp) {
+                adios_error(err_no_memory, "Cannot allocate buffer in adios_read_datatap_gopen_byid()");
+                return NULL;
+            }
+            else {
+                memcpy(temp, gp->var_namelist, k*sizeof(char *));
+                free(gp->var_namelist);
+                gp->var_namelist = temp;
+
+            }
+             
+            // return full path name
+            gp->var_namelist[k] = strdup(fullname);
+            gp->vars_count ++; 
+            k ++; 
+        }
+ 
+        i ++;
+    }
+    while(i < ds->num_pgs);
+#endif 
+
+fprintf(stderr, "im here rank %d %s:%d\n", ds->my_rank, __FILE__,__LINE__);
+
+    gp->attr_namelist = 0;
+
+    gp->timestep = ds->f_info->timestep;
+    gp->lasttimestep = ds->f_info->timestep;
+
+    // now we need to wait here until we see all data are ready
+    pthread_mutex_lock(&(ds->f_info->mutex));
+    while(queue_size(ds->f_info->dt_queue) != ds->f_info->num_chunks) {
+        pthread_cond_wait(&(ds->f_info->cond2), &(ds->f_info->mutex));
+    }
+    pthread_mutex_unlock(&(ds->f_info->mutex));
+
+fprintf(stderr, "im here rank %d %s:%d\n", ds->my_rank, __FILE__,__LINE__);
+    return gp;
+}
+
+int adios_read_datatap_gclose (ADIOS_GROUP *gp)
+{
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+//    datatap_read_file_data *ds = (datatap_read_file_data *) gp->fp->fh;
+    adios_errno = 0;
+    free_namelist ((gp->attr_namelist),gp->attrs_count);
+    int i;
+    for(i = 0; i < gp->vars_count; i ++) {
+        free(gp->var_namelist[i]); 
+    }
+    free(gp->var_namelist);
+//    free_namelist ((gp->var_namelist),gp->vars_count);
+    free(gp);
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+    return 0;
+
+}
+
+int adios_read_datatap_get_attr (ADIOS_GROUP *gp, const char *attrname, 
+                                 enum ADIOS_DATATYPES *type,
+                                 int *size, void **data)
+{
+    // TODO: borrowed from dimes
+    adios_error(err_invalid_read_method, "adios_read_datatap_get_attr is not implemented.");
+    *size = 0;
+    *type = adios_unknown;
+    *data = 0;
+    return adios_errno;
+}
+
+int adios_read_datatap_get_attr_byid (ADIOS_GROUP *gp, int attrid, 
+                                      enum ADIOS_DATATYPES *type, 
+                                      int *size, void **data)
+{
+    // TODO: borrowed from dimes
+    adios_error(err_invalid_read_method, "adios_read_datatap_get_attr_byid is not implemented.");
+    *size = 0;
+    *type = adios_unknown;
+    *data = 0;
+    return adios_errno;
+}
+
+ADIOS_VARINFO * adios_read_datatap_inq_var (ADIOS_GROUP *gp, const char *varname) 
+{
+    // TODO: usually user will read those variables reperesenting dimensions directly
+//    error(err_invalid_read_method, "adios_read_datatap_inq_var is not implemented.");
+
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+    // find the var among all pgs
+    ADIOS_VARINFO *v = (ADIOS_VARINFO *) malloc(sizeof(ADIOS_VARINFO));
+    if(!v) {
+        adios_error(err_no_memory, "Cannot allocate buffer in adios_read_datatap_inq_var()");
+        return NULL;
+    }
+    memset(v, 0, sizeof(ADIOS_VARINFO));
+
+    datatap_read_file_data *ds = (datatap_read_file_data *) gp->fp->fh;
+    
+    int found = 0;
+    datatap_var_info *current_var = ds->vars;
+    while(current_var) {
+        if(!compare_var_name(varname, current_var)) { 
+            found = 1;
+            break;
+        }
+        else {
+            current_var = current_var->next;
+        } 
+    } 
+
+    if(!found) {
+        current_var = ds->vars_peer;
+        while(current_var) {
+            if(!compare_var_name(varname, current_var)) {
+                found = 1;
+                break;
+            }
+            else {
+                current_var = current_var->next;
+            }
+        }
+    }
+  
+    if(found) {
+        v->grpid = gp->grpid;
+        int i;
+        for(i = 0; i < gp->vars_count; i ++) {
+            if(!strcmp(gp->var_namelist[i], varname)) {
+                v->varid = i; // TODO: this may not be cmpatible with BP
+                break;
+            }
+        }
+        v->type = current_var->type;
+        v->ndim = current_var->ndims;
+        v->timedim = current_var->time_dim;
+        if(!v->ndim) { // scalar and string
+            if(v->timedim != -1) { // scalar with time dimension
+                v->ndim = 1;
+                v->dims = (uint64_t *) malloc(sizeof(uint64_t));
+                if(!v->dims) {
+                    adios_error(err_no_memory, "Cannot allocate buffer in adios_read_datatap_inq_var()");
+                    return NULL;
+                }
+                v->dims[0] = 1; // TODO: only one timestep in the file
+            }
+            //int value_size = common_read_type_size(v->type, current_var->chunks->data);
+            int value_size = current_var->data_size;
+            v->value = malloc(value_size);
+            if(!v->value) {
+                adios_error(err_no_memory, "Cannot allocate buffer in adios_read_datatap_inq_var()");
+                return NULL;
+            }
+            memcpy(v->value, current_var->chunks->data, value_size);
+        }
+        else { // arrays
+            v->dims = (uint64_t *) malloc(v->ndim * sizeof(uint64_t));
+            if(!v->dims) {
+                adios_error(err_no_memory, "Cannot allocate buffer in adios_read_datatap_inq_var()");
+                return NULL;
+            }
+            int k;
+            for(k = 0; k < v->ndim; k ++) {
+                //v->dims[k] = ds->pgs[i].vars[j].global_bounds[k];
+                v->dims[k] = current_var->chunks->global_bounds[k];
+            }
+        }
+        return v;
+    }
+    else {
+        adios_error(err_invalid_varname, "Cannot find var %s\n", varname);
+        return NULL;
+    }
+
+    
+#if 0
+    int i, j;
+    for(i = 0; i < ds->num_pgs; i ++) {
+        for(j = 0; j < ds->pgs[i].num_vars; j ++) {
+            // the parameter varname can be full path or just var name, so we
+            // need to first find it by matching the name
+            if(!compare_var_name(varname, &(ds->pgs[i].vars[j]))) {     
+                v->grpid = gp->grpid;
+                v->varid = j; // TODO: this may not be cmpatible with BP 
+                v->type = ds->pgs[i].vars[j].type;
+                v->ndim = ds->pgs[i].vars[j].ndims; 
+                v->timedim = ds->pgs[i].vars[j].time_dim;
+                if(!v->ndim) { // scalar
+                    if(v->timedim != -1) { // scalar with time dimension
+                        v->ndim = 1;
+                        v->dims = (uint64_t *) malloc(sizeof(uint64_t));
+                        if(!v->dims) {
+                            adios_error(err_no_memory, "Cannot allocate buffer in adios_read_datatap_inq_var()");
+                            return NULL;
+                        }
+                        v->dims[0] = 1; // TODO: only one timestep in the file
+                    }
+                    int value_size = common_read_type_size(v->type, ds->pgs[i].vars[j].data);
+                    v->value = malloc(value_size); 
+                    if(!v->value) {
+                        adios_error(err_no_memory, "Cannot allocate buffer in adios_read_datatap_inq_var()");
+                        return NULL;
+                    }
+                    memcpy(v->value, ds->pgs[i].vars[j].data, value_size);
+                }
+                else { // arrays  
+                    v->dims = (uint64_t *) malloc(v->ndim * sizeof(uint64_t));   
+                    if(!v->dims) {
+                        adios_error(err_no_memory, "Cannot allocate buffer in adios_read_datatap_inq_var()");
+                        return NULL;
+                    }
+                    int k;
+                    for(k = 0; k < v->ndim; k ++) {
+                        v->dims[k] = ds->pgs[i].vars[j].global_bounds[k]; 
+                    }
+                }
+                return v;
+            }
+        }
+    }
+
+    return NULL;    
+#endif
+
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+}
+
+ADIOS_VARINFO * adios_read_datatap_inq_var_byid (ADIOS_GROUP *gp, int varid)
+{
+    if(varid >= 0 && varid < gp->vars_count) {
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+        return adios_read_datatap_inq_var(gp, gp->var_namelist[varid]);
+    }
+    else {
+        adios_error(err_invalid_varid, "Cannot find var %d\n", varid);
+        return NULL;
+    }
+}
+
+void adios_read_datatap_free_varinfo (ADIOS_VARINFO *vp)
+{
+    if(!vp) return;
+
+    if(!vp->ndim) { // scalar
+        if(vp->timedim != -1) { // scalar with time dimension
+            free(vp->dims);
+        }
+        free(vp->value);
+    }
+    else { // arrays
+        free(vp->dims);
+    }
+}
+
+int64_t adios_read_datatap_read_var (ADIOS_GROUP *gp, const char *varname,
+                                     const uint64_t *start, const uint64_t *count,
+                                     void *data)
+{
+fprintf(stderr, "im here read var %s addr %p %s:%d\n", varname, data,__FILE__,__LINE__);
+    int64_t total_size;
+    datatap_read_file_data *ds = (datatap_read_file_data *) gp->fp->fh;
+    int found = 0;
+
+fprintf(stderr, "im here rank %d %s %s:%d\n", ds->my_rank,varname, __FILE__,__LINE__);
+    datatap_var_info *current_var = ds->vars;
+    while(current_var) {
+fprintf(stderr, "im here rank %d %s %s %s %s:%d\n", ds->my_rank, varname, current_var->varname,current_var->varpath,__FILE__,__LINE__);
+        if(!compare_var_name(varname, current_var)) {
+fprintf(stderr, "im here rank %d %s %s %s %s:%d\n", ds->my_rank, varname, current_var->varname,current_var->varpath,__FILE__,__LINE__);
+            // found it locally
+            found = 1;
+            if(!current_var->ndims) { // scalar
+fprintf(stderr, "im here rank %d %s %s %s %s:%d\n", ds->my_rank, varname, current_var->varname,current_var->varpath,__FILE__,__LINE__);
+                // TODO: check time dimension if there is any
+                if(current_var->time_dim != -1 &&
+                    (gp->fp->tidx_start != start[0] || count[0] > 1)) {
+                // TODO: check time dimension if there is any
+                    adios_error(err_no_data_at_timestep, "Specified time step is not available.");
+                    return -1;
+                }
+
+                total_size = current_var->data_size;
+                memcpy(data, current_var->chunks->data, total_size);
+                return total_size;
+            }
+            else { // arrays
+fprintf(stderr, "im here rank %d %s:%d\n", ds->my_rank, __FILE__,__LINE__);
+                // TODO: check time dimension if there is any
+                if(current_var->time_dim != -1) {
+                    uint64_t ti = current_var->time_dim;
+                    if(futils_is_called_from_fortran()) {
+                        ti --;
+                    }
+                    // TODO: in Fortran index starts from 1 but in C index starts from 0
+                    if(count[ti] > 1 || start[ti] != current_var->chunks->global_offsets[ti]) {
+                        adios_error(err_no_data_at_timestep, "Specified time step is not available.");
+                        return -1;
+                    }
+                }
+
+fprintf(stderr, "im here rank %d %s:%d\n", ds->my_rank, __FILE__,__LINE__);
+                total_size = read_array(ds, current_var, start, count, data);
+fprintf(stderr, "im here rank %d %s:%d\n", ds->my_rank, __FILE__,__LINE__);
+
+                // rank 0 should be responsible for send data out to peer readers
+                if(ds->comm_size > 1) {
+                    if(ds->my_rank == 0) {
+                        // check if this array is missing on peer readers  
+                        //if(current_var->num_chunks == 1) {
+                        int byte_pos = current_var->id / 8;
+                        int bit_pos = current_var->id % 8;
+                        unsigned char mask = 0x01 << bit_pos;
+                        //if(current_var->num_chunks == 1) {
+                        if((ds->var_bitmap[byte_pos] & mask) != 0x00) {
+fprintf(stderr, "im here rank %d %s:%d\n", ds->my_rank, __FILE__,__LINE__);
+                            int rc = MPI_Bcast(data, total_size, MPI_BYTE, 0, ds->comm); 
+                            if(rc != MPI_SUCCESS) {
+                                fprintf(stderr, "rank %d: MPI_Bcast() returns error (%d). %s:%d\n",
+                                    ds->my_rank, rc, __FILE__, __LINE__);
+                                return -1;
+                            }
+                        }
+                    } 
+                }
+                return total_size;
+            }
+        }
+        else {
+            current_var = current_var->next;
+fprintf(stderr, "im here rank %d %s:%d\n", ds->my_rank, __FILE__,__LINE__);
+        }
+    }
+fprintf(stderr, "im here rank %d %s:%d\n", ds->my_rank, __FILE__,__LINE__);
+
+    if(!found) {
+        current_var = ds->vars_peer;
+        while(current_var) {
+            if(!compare_var_name(varname, current_var)) {
+                // found it on remote peer reader
+                if(!current_var->ndims) { // scalar
+                    // TODO: check time dimension if there is any
+                    if(current_var->time_dim != -1 &&
+                        (gp->fp->tidx_start != start[0] || count[0] > 1)) {
+                        adios_error(err_no_data_at_timestep, "Specified time step is not available.");
+                        return -1;
+                    }
+
+                    total_size = current_var->data_size;
+                    memcpy(data, current_var->chunks->data, total_size);
+                    return total_size;
+                }
+                else { // arrays
+                    // TODO: check time dimension if there is any
+                    if(current_var->time_dim != -1) {
+                        uint64_t ti = current_var->time_dim;
+                        // TODO: in Fortran index starts from 1 but in C index starts from 0
+                        if(futils_is_called_from_fortran()) {
+                            ti --;
+                        }
+
+                        if(count[ti] > 1 || start[ti] != current_var->chunks->global_offsets[ti]) {
+                            adios_error(err_no_data_at_timestep, "Specified time step is not available.");
+                            return -1;
+                        }
+                    }
+
+                    if(ds->my_rank != 0) {
+                        int i = 0;
+                        total_size = common_read_type_size(current_var->type, NULL); 
+                        for(; i < current_var->ndims; i ++) {
+                             total_size *= count[i];
+                        }
+                                     
+                        if(ds->comm_size > 1) {
+fprintf(stderr, "im here rank %d %s %ld %s:%d\n", ds->my_rank, current_var->varname,total_size, __FILE__,__LINE__);
+                            // check if this array is missing on peer readers
+                            int rc = MPI_Bcast(data, total_size, MPI_BYTE, 0, ds->comm);
+fprintf(stderr, "im here rank %d %s %ld %s:%d\n", ds->my_rank, current_var->varname,total_size, __FILE__,__LINE__);
+                            if(rc != MPI_SUCCESS) {
+                                fprintf(stderr, "rank %d: MPI_Bcast() returns error (%d). %s:%d\n",
+                                    ds->my_rank, rc, __FILE__, __LINE__);
+                                return -1;
+                            }
+fprintf(stderr, "im here rank %d %s %ld %s:%d\n", ds->my_rank, current_var->varname,total_size, __FILE__,__LINE__);
+                        }
+                    }
+
+fprintf(stderr, "im here read rank %d var %s addr %p total size %ld %s:%d\n", ds->my_rank, varname, data,total_size,__FILE__,__LINE__);
+                    return total_size;
+                }
+            }
+            else {
+                current_var = current_var->next;
+            }
+        }
+    }
+
+fprintf(stderr, "im here rank %d %s:%d\n", ds->my_rank, __FILE__,__LINE__);
+    adios_error(err_invalid_varname, "Cannot find var %s\n", varname);
+    return -1;
+
+
+
+#if 0
+    // TODO: search through all pgs to find this var
+    int p;
+    for(p = 0; p < ds->num_pgs; p ++) {
+        datatap_pg_info *current_pg = &(ds->pgs[p]);    
+        datatap_var_info *var_info = NULL;
+        int v;
+        for(v = 0; v < current_pg->num_vars; v ++) {
+            if(!compare_var_name(varname, &(current_pg->vars[v]))) {     
+                // found it
+                found = 1;
+
+                if(!current_pg->vars[v].ndims) { // scalar
+                    // TODO: check time dimension if there is any
+                    if(current_pg->vars[v].time_dim != -1 && 
+                        (gp->fp->tidx_start != start[0] || count[0] > 1)) {
+                        adios_error(err_no_data_at_timestep, "Specified time step is not available.");
+                        return -1;
+                    }
+  
+                    total_size = common_read_type_size(current_pg->vars[v].type, current_pg->vars[v].data);                
+                    memcpy(data, current_pg->vars[v].data, total_size);
+                    return total_size;
+                }
+                else { // arrays
+                    // TODO: check time dimension if there is any
+                    if(current_pg->vars[v].time_dim != -1) {
+                        // TODO: in Fortran index starts from 1 but in C index starts from 0 
+                        uint64_t ti = current_pg->vars[v].time_dim;
+                        if(count[ti] > 1 || start[ti] != current_pg->vars[v].global_offsets[ti]) {
+                            adios_error(err_no_data_at_timestep, "Specified time step is not available.");
+                            return -1;
+                        } 
+                    }
+
+                    // Datatap batches per-variable reads, so here we only record the buffer address
+                    datatap_var_info *var_info = (datatap_var_info *) malloc(sizeof(datatap_var_info));
+                    if(!var_info) {
+                        adios_error(err_no_memory, "Could not allocate memory for group info");
+                        return -1;
+                    }                
+                    memcpy(var_info, &(current_pg->vars[v]), sizeof(datatap_var_info));
+                    var_info->local_bounds = (uint64_t *) malloc(var_info->ndims * sizeof(uint64_t));
+                    if(!var_info->local_bounds) {
+                        adios_error(err_no_memory, "Cannot allocate memory for Datatap.");
+                        return NULL;
+                    }
+                    var_info->global_bounds = (uint64_t *) malloc(var_info->ndims * sizeof(uint64_t));
+                    if(!var_info->global_bounds) {
+                        adios_error(err_no_memory, "Cannot allocate memory for Datatap.");
+                        return NULL;
+                    }
+                    var_info->global_offsets = (uint64_t *) malloc(var_info->ndims * sizeof(uint64_t));
+                    if(!var_info->global_offsets) {
+                        adios_error(err_no_memory, "Cannot allocate memory for Datatap.");
+                        return NULL;
+                    }
+
+                    total_size = 1;
+                    int i;
+                    for(i = 0; i < var_info->ndims; i ++) {
+                        var_info->local_bounds[i] = count[i];
+                        // TODO: it seems that user won't read from N-dimensional array into M-dimension
+                        var_info->global_bounds[i] = current_pg->vars[v].global_bounds[i];  
+                        var_info->global_offsets[i] = start[i];
+                        total_size = total_size * count[i];
+                    }
+                    total_size *= common_read_type_size(var_info->type, NULL);
+                    var_info->data = data;
+                    var_info->data_size = total_size;
+                    
+                    // now we add this to the list of vars to read
+                    if(!ds->vars_read) {
+                        ds->vars_read = var_info;                
+                        ds->vars_read_tail = var_info;
+                        var_info->next = NULL;                   
+                    }
+                    else {
+                        ds->vars_read_tail->next = var_info;     
+                        ds->vars_read_tail = var_info;
+                        var_info->next = NULL; 
+                    }
+                    ds->num_vars_read ++;                  
+                    return total_size;
+                }            
+            }   
+        }    
+    }
+fprintf(stderr, "im here read var %s addr %p %s:%d\n", varname, data,__FILE__,__LINE__);
+
+    if(found) {
+        return total_size;
+    }
+
+    adios_error(err_invalid_varname, "Cannot find var %s\n", varname);
+    return -1;    
+#endif 
+
+}
+
+int64_t adios_read_datatap_read_var_byid (ADIOS_GROUP *gp, int varid,
+                                          const uint64_t *start,
+                                          const uint64_t *count,
+                                          void *data)
+{
+    if(varid >= 0 && varid < gp->vars_count) {
+fprintf(stderr, "im here %s:%d\n",__FILE__,__LINE__);
+        return adios_read_datatap_read_var (gp, gp->var_namelist[varid], start, count, data);
+    }
+    else {
+        adios_error(err_invalid_varid, "Cannot find var %d\n", varid);
+        return -1;
+    }
+
+}
+
+void adios_read_datatap_reset_dimension_order (ADIOS_FILE *fp, int is_fortran)
+{
+    // TODO
+    adios_error(err_invalid_read_method, "adios_read_datatap_reset_dimension_order is not implemented.");
+}
+#endif
+
diff --git a/src/read_dimes.c b/src/read_dimes.c
index baad958..f478f1e 100644
--- a/src/read_dimes.c
+++ b/src/read_dimes.c
@@ -78,7 +78,7 @@ int adios_read_dimes_init(MPI_Comm comm)
 	//int num_total_peers = 64+16+1;
 	err = dimes_init(nproc,nproc,appid);
 	if(err < 0){
-		error(err_connection_failed, "Failed to connect with DIMES index srv\n");
+		adios_error (err_connection_failed, "Failed to connect with DIMES index srv\n");
 		return -err_connection_failed;
 	}
    }
@@ -111,7 +111,7 @@ ADIOS_FILE *adios_read_dimes_fopen(const char *fname, MPI_Comm comm)
 	
 	ds = (struct adios_read_DIMES_data_struct *)malloc(sizeof(struct adios_read_DIMES_data_struct));
 	if(!ds){
-		error(err_no_memory, "Cannot allocate memory for file info.");
+		adios_error (err_no_memory, "Cannot allocate memory for file info.");
 		return NULL;
 	}
 	
@@ -146,7 +146,7 @@ ADIOS_FILE *adios_read_dimes_fopen(const char *fname, MPI_Comm comm)
 	
     	err = adios_read_dimes_get(dimes_fname, time_index_type, ds, offset, readsize, &time_index);
     	if (err) {
-        	error(err_file_not_found_error, "Data of '%s' does not exist in DIMES\n", dimes_fname);
+        	adios_error (err_file_not_found_error, "Data of '%s' does not exist in DIMES\n", dimes_fname);
         	free(ds);
         	return NULL;
         } else {
@@ -155,7 +155,7 @@ ADIOS_FILE *adios_read_dimes_fopen(const char *fname, MPI_Comm comm)
 
     	fp = (ADIOS_FILE *) malloc (sizeof (ADIOS_FILE));
     	if (!fp) {
-        	error( err_no_memory, "Cannot allocate memory for file info.");
+        	adios_error (err_no_memory, "Cannot allocate memory for file info.");
         	return NULL;
     	}
 
@@ -172,7 +172,7 @@ ADIOS_FILE *adios_read_dimes_fopen(const char *fname, MPI_Comm comm)
     	alloc_namelist (&fp->group_namelist,fp->groups_count); 
     	for (i=0;i<fp->groups_count;i++) {
         	if (!fp->group_namelist[i]) {
-            		error(err_no_memory, "Could not allocate buffer for %d strings in adios_fopen()", fp->groups_count);
+            		adios_error (err_no_memory, "Could not allocate buffer for %d strings in adios_fopen()", fp->groups_count);
             		adios_read_dimes_fclose(fp);
             		return NULL;
         	}
@@ -243,7 +243,7 @@ ADIOS_GROUP * adios_read_dimes_gopen_byid (ADIOS_FILE *fp, int grpid)
     adios_errno = 0;
     gp = (ADIOS_GROUP *) malloc(sizeof(ADIOS_GROUP));
     if (!gp) {
-        error( err_no_memory, "Could not allocate memory for group info");
+        adios_error (err_no_memory, "Could not allocate memory for group info");
         return NULL;
     }
 
@@ -275,7 +275,7 @@ int adios_read_dimes_get_attr (ADIOS_GROUP * gp, const char * attrname, enum ADI
                     int * size, void ** data)
 {
     /* DIMES does not support attributes */
-    error(err_invalid_attrname, "DIMES read method does not support attributes!");
+    adios_error (err_invalid_attrname, "DIMES read method does not support attributes!");
     *size = 0;
     *type = adios_unknown;
     *data = 0;
@@ -286,7 +286,7 @@ int adios_read_dimes_get_attr_byid (ADIOS_GROUP * gp, int attrid,
                     enum ADIOS_DATATYPES * type, int * size, void ** data)
 {
     /* DIMES does not support attributes */
-    error(err_invalid_attrid, "DIMES read method does not support attributes!");
+    adios_error (err_invalid_attrid, "DIMES read method does not support attributes!");
     *size = 0;
     *type = adios_unknown;
     *data = 0;
@@ -309,7 +309,7 @@ ADIOS_VARINFO * adios_read_dimes_inq_var_byid (ADIOS_GROUP *gp, int varid)
     adios_errno = 0;
     vi = (ADIOS_VARINFO *) malloc(sizeof(ADIOS_VARINFO));
     if (!vi) {
-        error( err_no_memory, "Could not allocate memory for variable info.");
+        adios_error (err_no_memory, "Could not allocate memory for variable info.");
         return NULL;
     }
 
@@ -376,7 +376,7 @@ static int adios_read_dimes_get(const char *varname, enum ADIOS_DATATYPES vartyp
 	}
 	
 	if(err) {
-		error(err_corrupted_variable,"DIMES failed to read variable %s.", varname);
+		adios_error (err_corrupted_variable,"DIMES failed to read variable %s.", varname);
 		return -err_corrupted_variable;
 	}
 	
@@ -443,6 +443,14 @@ int64_t adios_read_dimes_read_var_byid (ADIOS_GROUP    * gp,
                              const uint64_t  * count,
                              void           * data)
 {
-    error( err_invalid_varid, "DIMES does not know variable indicies, only variable names can be used.");
+    adios_error (err_invalid_varid, "DIMES does not know variable indicies, only variable names can be used.");
     return -err_invalid_varid;
 }							
+
+int64_t adios_read_dimes_read_local_var (ADIOS_GROUP * gp, const char * varname,
+                                      int vidx, const uint64_t * start,
+                                      const uint64_t * count, void * data)
+{  
+    adios_error (err_operation_not_supported, "adios_read_local_var() is not supported with DIMES method.");
+    return -adios_errno;
+}
diff --git a/src/read_nssi.c b/src/read_nssi.c
new file mode 100644
index 0000000..4744d91
--- /dev/null
+++ b/src/read_nssi.c
@@ -0,0 +1,653 @@
+/*
+ * ADIOS is freely available under the terms of the BSD license described
+ * in the COPYING file in the top level directory of this source distribution.
+ *
+ * Copyright (c) 2008 - 2009.  UT-BATTELLE, LLC. All rights reserved.
+ */
+
+
+/**************************************************/
+/* Read method for NSSI memory-to-memory coupling */
+/**************************************************/
+
+#include <stdlib.h>
+#include <string.h>
+//#include <errno.h>  /* ENOMEM */
+#include "adios.h"
+#include "bp_utils.h"
+#include "bp_types.h"
+#include "adios_types.h"
+#include "adios_read.h"
+#include "adios_read_hooks.h"
+#include "adios_error.h"
+#include "futils.h"
+#include "globals.h"
+
+#ifdef HAVE_NSSI
+#include "nssi_client.h"
+#include "adios_nssi_args.h"
+#include "adios_nssi_config.h"
+#include "nssi_logger.h"
+#endif
+
+#include "io_timer.h"
+
+
+static uint64_t number_of_fopens = 0;  /* for versioning, works only if one file is fopened (in a loop) in the application */
+
+struct adios_read_nssi_data_struct
+{
+    nssi_request start_calc_req;
+    int          has_outstanding_req;
+    int          default_svc_index;  /* service to use when there is no open file (eg. finalize) */
+
+    char *fname;               // path of file
+    int timestep;              // counting the access
+    int disconnect_at_fclose;  // disconnect from NSSI in fclose()
+
+    uint64_t fd;
+    MPI_Comm group_comm;
+    int      size;
+    int      rank;
+
+    int      svc_index;
+    MPI_Comm collective_op_comm;
+    int      collective_op_size;
+    int      collective_op_rank;
+
+    int8_t use_single_server;
+};
+
+
+///////////////////////////
+// Global Variables
+///////////////////////////
+static int adios_nssi_initialized = 0;
+
+static char *job_id=NULL;
+static int global_rank=-1;
+static int global_size=-1;
+static nssi_service *svcs;
+struct adios_nssi_config nssi_cfg;
+
+//static log_level adios_nssi_debug_level;
+static int DEBUG=0;
+
+
+
+
+/* If init is used, we connect to NSSI here, otherwise we connect in fopen.
+   If multiple fopen..fclose cycles are used, init/finalize must be used too to
+   avoid multiple connection/disconnection in fopen/fclose.
+*/
+int adios_read_nssi_init (MPI_Comm comm)
+{
+    int rc=NSSI_OK;
+    int verbose=5;
+    char logfile[1024];
+    int log_rank;
+    struct adios_read_nssi_method_data_struct *private;
+
+    if (!adios_nssi_initialized) {
+        adios_nssi_initialized = 1;
+    }
+
+    MPI_Comm_rank(MPI_COMM_WORLD, &global_rank);
+    MPI_Comm_size(MPI_COMM_WORLD, &global_size);
+
+    if (DEBUG>3) fprintf(stderr, "rank(%d) enter adios_read_nssi_init\n", global_rank);
+
+#ifdef HAVE_PORTALS
+    nssi_ptl_init(PTL_IFACE_CLIENT, getpid() + 1000);
+    nssi_rpc_init(NSSI_RPC_PTL, NSSI_RPC_XDR);
+#endif
+#ifdef HAVE_INFINIBAND
+    nssi_ib_init(NULL);
+    rc = nssi_rpc_init(NSSI_RPC_IB, NSSI_RPC_XDR);
+#endif
+
+    /* Register the client operations */
+//    NSSI_REGISTER_CLIENT_STUB(ADIOS_READ_INITIALIZE_OP,    adios_read_initialize_args,    void, void);
+    NSSI_REGISTER_CLIENT_STUB(ADIOS_READ_FOPEN_OP,            adios_read_fopen_args,            void, adios_read_fopen_res);
+    NSSI_REGISTER_CLIENT_STUB(ADIOS_READ_FCLOSE_OP,           adios_read_fclose_args,           void, void);
+//    NSSI_REGISTER_CLIENT_STUB(ADIOS_READ_GOPEN_OP,         adios_read_gopen_args,         void, adios_read_gopen_res);
+//    NSSI_REGISTER_CLIENT_STUB(ADIOS_READ_GOPEN_BYID_OP,    adios_read_gopen_byid_args,    void, adios_read_gopen_byid_res);
+//    NSSI_REGISTER_CLIENT_STUB(ADIOS_READ_GCLOSE_OP,        adios_read_gclose_args,        void, adios_read_gclose_res);
+//    NSSI_REGISTER_CLIENT_STUB(ADIOS_READ_GETATTR_OP,       adios_read_getattr_args,       void, adios_read_getattr_res);
+//    NSSI_REGISTER_CLIENT_STUB(ADIOS_READ_GETATTR_BYID_OP,  adios_read_getattr_byid_args,  void, adios_read_getattr_byid_res);
+//    NSSI_REGISTER_CLIENT_STUB(ADIOS_READ_INQVAR_OP,        adios_read_inqvar_args,        void, adios_read_inqvar_res);
+//    NSSI_REGISTER_CLIENT_STUB(ADIOS_READ_INQVAR_BYID_OP,   adios_read_inqvar_byid_args,   void, adios_read_inqvar_byid_res);
+    NSSI_REGISTER_CLIENT_STUB(ADIOS_READ_GET_VARTYPE_SIZE_OP, adios_read_get_vartype_size_args, void, adios_read_get_vartype_size_res);
+    NSSI_REGISTER_CLIENT_STUB(ADIOS_READ_READ_VAR_OP,         adios_read_read_var_args,         void, adios_read_read_var_res);
+//    NSSI_REGISTER_CLIENT_STUB(ADIOS_READ_READ_VAR_BYID_OP, adios_read_read_var_byid_args, void, adios_read_read_var_byid_res);
+//    NSSI_REGISTER_CLIENT_STUB(ADIOS_READ_FINALIZE_OP,      adios_read_finalize_args,      void, void);
+
+    parse_nssi_config(getenv("ADIOS_NSSI_CONFIG_FILE"), &nssi_cfg);
+
+    return(0);
+}
+
+int adios_read_nssi_finalize ()
+{
+    int rc=NSSI_OK;
+    int myrank;
+
+    if (DEBUG>3) fprintf(stderr, "rank(%d) enter adios_read_nssi_finalize\n", global_rank);
+
+    free_nssi_config(&nssi_cfg);
+
+    if (adios_nssi_initialized)
+        adios_nssi_initialized = 0;
+
+
+//    // disconnect from NSSI only if we the reader is connected (the writer not anymore)
+//    if (globals_adios_is_nssi_connected_from_reader() &&
+//        !globals_adios_is_nssi_connected_from_both())
+//    {
+//        nssi_finalize();
+//        DBG_PRINTF("-- %s: disconnected from NSSI\n", __func__);
+//    }
+//    globals_adios_set_nssi_disconnected_from_reader();
+}
+
+ADIOS_FILE * adios_read_nssi_fopen (const char * fname, MPI_Comm comm)
+{
+    int rc=NSSI_OK;
+    ADIOS_FILE * fp;
+    struct adios_read_nssi_data_struct * ds;
+    int i;
+
+    adios_read_fopen_args args;
+    adios_read_fopen_res  res;
+
+    adios_errno = 0;
+
+    if (DEBUG>3) fprintf(stderr, "enter adios_read_nssi_fopen: fname=%s\n", fname);
+
+    ds = (struct adios_read_nssi_data_struct *) malloc (sizeof(struct adios_read_nssi_data_struct));
+    if (!ds) {
+        adios_error (err_no_memory, "Cannot allocate memory for file info.");
+        return(NULL);
+    }
+
+    /* fill out NSSI method specific struct */
+    ds->size = 0;
+    ds->rank = 0;
+    ds->fname = strdup(fname);
+    ds->timestep = 1; /*number_of_fopens+1;  /* Read data of separate versions from NSSI */
+
+    if (DEBUG>3) fprintf(stderr, "global_rank(%d): enter adios_read_nssi_fopen (%s)\n", global_rank, fname);
+
+    ds->group_comm = comm;
+    if (DEBUG>3) fprintf(stderr, "global_rank(%d): adios_read_nssi_fopen: setup group_comm\n", global_rank);
+    if (ds->group_comm != MPI_COMM_NULL) {
+        if (DEBUG>3) fprintf(stderr, "global_rank(%d): adios_read_nssi_fopen: get rank and size\n", global_rank);
+        MPI_Comm_rank(ds->group_comm, &ds->rank);
+        MPI_Comm_size(ds->group_comm, &ds->size);
+        if (DEBUG>3) fprintf(stderr, "global_rank(%d): adios_read_nssi_fopen: size(%d) rank(%d)\n", global_rank, ds->size, ds->rank);
+    } else {
+        ds->group_comm=MPI_COMM_SELF;
+        MPI_Comm_rank(ds->group_comm, &ds->rank);
+        MPI_Comm_size(ds->group_comm, &ds->size);
+    }
+
+    if (ds->size <= nssi_cfg.num_servers) {
+        // there are fewer clients than servers.
+        // assume file-per-process and use a single server for this file.
+        ds->use_single_server=TRUE;
+        if (ds->size < global_size) {
+            // a subset of all clients is writing
+            ds->svc_index = ((global_rank/ds->size)%nssi_cfg.num_servers);
+        } else {
+            ds->svc_index = 0;
+        }
+    } else {
+        ds->use_single_server=FALSE;
+        if ((ds->size%nssi_cfg.num_servers) > 0) {
+            ds->svc_index = ds->rank/((ds->size/nssi_cfg.num_servers)+1);
+        } else {
+            ds->svc_index = ds->rank/(ds->size/nssi_cfg.num_servers);
+        }
+    }
+    if (ds->default_svc_index == -1) {
+        ds->default_svc_index=ds->svc_index;
+    }
+
+    /* create a new communicator for just those clients, who share a default service. */
+    if (DEBUG>3) fprintf(stderr, "global_rank(%d): adios_read_nssi_fopen: before MPI_Comm_split\n", global_rank);
+    MPI_Comm_split(ds->group_comm, ds->svc_index, ds->rank, &ds->collective_op_comm);
+    if (DEBUG>3) fprintf(stderr, "global_rank(%d): adios_read_nssi_fopen: after MPI_Comm_split\n", global_rank);
+    /* find my rank in the new communicator */
+    if (DEBUG>3) fprintf(stderr, "global_rank(%d): adios_read_nssi_fopen: before MPI_Comm_size\n", global_rank);
+    MPI_Comm_size(ds->collective_op_comm, &ds->collective_op_size);
+    if (DEBUG>3) fprintf(stderr, "global_rank(%d): adios_read_nssi_fopen: before MPI_Comm_rank\n", global_rank);
+    MPI_Comm_rank(ds->collective_op_comm, &ds->collective_op_rank);
+
+    if (DEBUG>3) fprintf(stderr, "global_rank(%d) ds->rank(%d) ds->collective_op_rank(%d) default_service(%d)\n", global_rank, ds->rank, ds->collective_op_rank, ds->svc_index);
+
+    svcs=(nssi_service *)calloc(nssi_cfg.num_servers, sizeof(nssi_service));
+    /* !global_rank0 has a preferred server for data transfers.  connect to preferred server.
+     * connect to other servers on-demand.
+     */
+    double GetSvcTime=MPI_Wtime();
+    if (DEBUG>3) fprintf(stderr, "get staging-service: ds->svc_index(%d) nid(%lld) pid(%llu) hostname(%s) port(%d)\n",
+            ds->svc_index,
+            nssi_cfg.nssi_server_ids[ds->svc_index].nid,
+            nssi_cfg.nssi_server_ids[ds->svc_index].pid,
+            nssi_cfg.nssi_server_ids[ds->svc_index].hostname,
+            nssi_cfg.nssi_server_ids[ds->svc_index].port);
+    rc = nssi_get_service(nssi_cfg.nssi_server_ids[ds->svc_index], -1, &svcs[ds->svc_index]);
+    if (rc != NSSI_OK) {
+        fprintf(stderr, "NSSI ERROR: nssi_get_service failed\n");
+        return(NULL);
+    }
+
+    if (job_id==NULL) {
+        if (ds->rank==0) {
+            job_id = getenv("PBS_JOBID");
+            if (job_id == NULL) {
+                fprintf(stderr, "adios_read_nssi_init: unable to determine job id.  defaulting id to \"UNKNOWN_JOB_ID\".\n");
+                job_id = strdup("UNKNOWN_JOB_ID");
+            } else {
+                int len=strlen(job_id)+36+1;
+                job_id=calloc(len,1);
+
+                struct uuid_st;
+                extern int uuid_create   (      struct uuid_st **_uuid);
+                extern int uuid_destroy  (      struct uuid_st  *_uuid);
+                extern int uuid_make     (      struct uuid_st  *_uuid, unsigned int _mode, ...);
+                extern int uuid_export   (const struct uuid_st  *_uuid, unsigned int _fmt,       void **_data_ptr, size_t *_data_len);
+
+                struct uuid_st *uuid;
+                char *uuid_str=NULL;
+                uuid_create(&uuid);
+                uuid_make(uuid, 1);
+                uuid_export(uuid, 1, &uuid_str, NULL);
+                uuid_destroy(uuid);
+
+                sprintf(job_id, "%s.%s", getenv("PBS_JOBID"), uuid_str);
+
+                free(uuid_str);
+
+                MPI_Bcast (job_id, len, MPI_BYTE, 0, ds->group_comm);
+            }
+        } else {
+            job_id = getenv("PBS_JOBID");
+            if (job_id == NULL) {
+                fprintf(stderr, "adios_read_nssi_init: unable to determine job id.  defaulting id to \"UNKNOWN_JOB_ID\".\n");
+                job_id = strdup("UNKNOWN_JOB_ID");
+            } else {
+                int len=strlen(job_id)+36+1;
+                job_id=calloc(len,1);
+
+                MPI_Bcast (job_id, len, MPI_BYTE, 0, ds->group_comm);
+            }
+        }
+    }
+
+    fprintf(stderr, "adios_read_nssi_fopen: job_id=%s\n", job_id);
+
+
+
+    memset(&args, 0, sizeof(args));
+    memset(&res,  0, sizeof(res));
+    args.client_id = strdup(job_id);
+    args.gname = strdup("");
+    args.fname = strdup(ds->fname);
+    args.requested_timestep = ds->timestep;
+
+    Func_Timer("ADIOS_READ_FOPEN_OP",
+            rc = nssi_call_rpc_sync(&svcs[ds->svc_index],
+            ADIOS_READ_FOPEN_OP,
+            &args,
+            NULL,
+            0,
+            &res););
+    free(args.client_id);
+    free(args.gname);
+    free(args.fname);
+    if (rc != NSSI_OK) {
+        fprintf(stderr, "NSSI ERROR: ADIOS_READ_FOPEN_OP failed\n");
+        return(NULL);
+    }
+
+    if (res.fd==-1) {
+        fprintf(stderr, "ADIOS_READ_FOPEN_OP failed: fd=%ld\n", res.fd);
+        return(NULL);
+    }
+    ds->fd = res.fd;
+
+    fp = (ADIOS_FILE *) malloc (sizeof (ADIOS_FILE));
+    if (!fp) {
+        adios_error (err_no_memory, "Cannot allocate memory for file info.");
+        return(NULL);
+    }
+
+    /* fill out ADIOS_FILE struct */
+    fp->fh = (uint64_t) ds;
+    fp->groups_count = 1;
+    fp->vars_count = 0;
+    fp->attrs_count = 0;
+    fp->tidx_start = 0;
+    fp->ntimesteps = 1;
+    fp->file_size = 0;
+    fp->version = 1;
+    fp->endianness = 0; /* FIXME: not always Little Endian. Does it matter? */
+    alloc_namelist (&fp->group_namelist,fp->groups_count);
+    for (i=0;i<fp->groups_count;i++) {
+        if (!fp->group_namelist[i]) {
+            adios_error (err_no_memory, "Could not allocate buffer for %d strings in adios_fopen()", fp->groups_count);
+            adios_read_nssi_fclose(fp);
+            return(NULL);
+        }
+        else  {
+            strcpy(fp->group_namelist[i],"NSSI");
+        }
+    }
+
+    number_of_fopens++;
+
+    if (DEBUG>3) fprintf(stderr, "exit adios_read_nssi_fopen: fname=%s fd=%ld timestep=%ld\n",
+        fname, ds->fd, ds->timestep);
+
+    return(fp);
+}
+
+int adios_read_nssi_fclose (ADIOS_FILE *fp)
+{
+    int rc=NSSI_OK;
+    int i,j;
+
+    adios_read_fclose_args args;
+
+    struct adios_read_nssi_data_struct * ds = (struct adios_read_nssi_data_struct *) fp->fh;
+
+    if (DEBUG>3) fprintf(stderr, "enter adios_read_nssi_fclose: fname=%s\n", ds->fname);
+
+    adios_errno = 0;
+
+    MPI_Barrier(ds->collective_op_comm);
+
+    if (ds->collective_op_rank == 0) {
+        memset(&args, 0, sizeof(args));
+        args.client_id     = strdup(job_id);
+        args.fd            = ds->fd;
+        args.fname         = strdup(ds->fname);
+        args.open_timestep = ds->timestep;
+
+        Func_Timer("ADIOS_READ_FCLOSE_OP",
+                rc = nssi_call_rpc_sync(&svcs[ds->svc_index],
+                        ADIOS_READ_FCLOSE_OP,
+                        &args,
+                        NULL,
+                        0,
+                        NULL););
+        free(args.client_id);
+        free(args.fname);
+        if (rc != NSSI_OK) {
+            fprintf(stderr, "NSSI ERROR: ADIOS_READ_FCLOSE_OP failed\n");
+        }
+    }
+
+    free_namelist ((fp->group_namelist),fp->groups_count);
+    if (ds->fname) { free(ds->fname); ds->fname = 0; }
+    free(ds);
+    free(fp);
+
+    if (DEBUG>3) fprintf(stderr, "exit adios_read_nssi_fclose: fname=%s\n", ds->fname);
+
+    return 0;
+}
+
+/* This function can be called if user places
+   the wrong sequences of dims for a var
+*/
+void adios_read_nssi_reset_dimension_order (ADIOS_FILE *fp, int is_fortran)
+{
+    /* unimplemented */
+}
+
+
+ADIOS_GROUP * adios_read_nssi_gopen (ADIOS_FILE *fp, const char * grpname)
+{
+    /* NSSI has no groups, so any grpname is accepted and the same empty stuff is returned */
+    return adios_read_nssi_gopen_byid(fp, 0);
+}
+
+ADIOS_GROUP * adios_read_nssi_gopen_byid (ADIOS_FILE *fp, int grpid)
+{
+    struct adios_read_nssi_data_struct * ds = (struct adios_read_nssi_data_struct *) fp->fh;
+    ADIOS_GROUP * gp;
+
+    /* NSSI has no groups, so any grpid is accepted and the same empty stuff is returned */
+
+    adios_errno = 0;
+    gp = (ADIOS_GROUP *) malloc(sizeof(ADIOS_GROUP));
+    if (!gp) {
+        adios_error (err_no_memory, "Could not allocate memory for group info");
+        return NULL;
+    }
+
+    /* fill out ADIOS_GROUP struct */
+    gp->grpid = grpid;
+    gp->gh = (uint64_t) 0;
+    gp->fp = fp;
+    gp->vars_count = 0;
+    gp->attrs_count = 0;
+    gp->var_namelist = 0;
+    gp->attr_namelist = 0;
+
+    return gp;
+}
+
+int adios_read_nssi_gclose (ADIOS_GROUP *gp)
+{
+    struct adios_read_nssi_data_struct * ds = (struct adios_read_nssi_data_struct *) gp->fp->fh;
+
+    adios_errno = 0;
+
+    free_namelist ((gp->var_namelist),gp->vars_count);
+    free_namelist ((gp->attr_namelist),gp->attrs_count);
+    free(gp);
+    return 0;
+}
+
+
+
+int adios_read_nssi_get_attr (ADIOS_GROUP * gp, const char * attrname, enum ADIOS_DATATYPES * type,
+                    int * size, void ** data)
+{
+    /* NSSI does not support attributes */
+    adios_error (err_invalid_attrname, "NSSI read method does not support attributes!");
+    *size = 0;
+    *type = adios_unknown;
+    *data = 0;
+    return adios_errno;
+}
+
+int adios_read_nssi_get_attr_byid (ADIOS_GROUP * gp, int attrid,
+                    enum ADIOS_DATATYPES * type, int * size, void ** data)
+{
+    /* NSSI does not support attributes */
+    adios_error (err_invalid_attrid, "NSSI read method does not support attributes!");
+    *size = 0;
+    *type = adios_unknown;
+    *data = 0;
+    return adios_errno;
+}
+
+
+ADIOS_VARINFO * adios_read_nssi_inq_var (ADIOS_GROUP *gp, const char * varname)
+{
+    /* NSSI has no inquiry capability, report somthing dummy */
+    return adios_read_nssi_inq_var_byid(gp, 0);
+}
+
+ADIOS_VARINFO * adios_read_nssi_inq_var_byid (ADIOS_GROUP *gp, int varid)
+{
+    struct adios_read_nssi_data_struct * ds = (struct adios_read_nssi_data_struct *) gp->fp->fh;
+    ADIOS_VARINFO * vi;
+    int i,k;
+
+    adios_errno = 0;
+    vi = (ADIOS_VARINFO *) malloc(sizeof(ADIOS_VARINFO));
+    if (!vi) {
+        adios_error (err_no_memory, "Could not allocate memory for variable info.");
+        return NULL;
+    }
+
+    /* NSSI has no inquiry capability, report somthing dummy */
+    vi->varid = varid;
+    vi->type = adios_unknown;
+    vi->ndim = 0;
+    vi->dims = NULL;
+    vi->timedim = -1;
+    vi->value = NULL;
+    vi->gmin = NULL;
+    vi->gmax = NULL;
+    vi->mins = NULL;
+    vi->maxs = NULL;
+
+    return vi;
+}
+
+void adios_read_nssi_free_varinfo (ADIOS_VARINFO *vp)
+{
+    if (vp) {
+        if (vp->dims)   free(vp->dims);
+        if (vp->value)  free(vp->value);
+        if (vp->gmin && vp->gmin != vp->value)   free(vp->gmin);
+        if (vp->gmax && vp->gmax != vp->value)   free(vp->gmax);
+        if (vp->mins)   free(vp->mins);
+        if (vp->maxs)   free(vp->maxs);
+        free(vp);
+    }
+}
+
+//static int adios_read_nssi_get (const char * varname, enum ADIOS_DATATYPES vartype,
+//                                struct adios_read_nssi_data_struct * ds,
+//                                int * offset, int * readsize, void * data)
+//{
+//
+//    struct obj_data *od;
+//    int elemsize = common_read_type_size(vartype, NULL);
+//    int err;
+//
+//    DBG_PRINTF("-- %s, rank %d: get data: varname=%s version=%d, lb=(%d,%d,%d) ub=(%d,%d,%d)}\n",
+//        __func__, ds->rank, varname, ds->timestep, offset[1], offset[0], offset[2],
+//        offset[1]+readsize[1]-1, offset[0]+readsize[0]-1, offset[2]+readsize[2]-1);
+//
+//    err =  NSSI_get (varname, ds->timestep, elemsize,
+//                     offset[1], offset[0], offset[2],
+//                     offset[1]+readsize[1]-1,
+//                     offset[0]+readsize[0]-1,
+//                     offset[2]+readsize[2]-1,
+//                     data
+//                    );
+//    /*if (err == -ENOMEM) {
+//        adios_error (err_no_memory, "Not enough memory for NSSI to perform NSSI_get()");
+//        return -err_no_memory;
+//    }
+//    else*/ if (err) {
+//        adios_error (err_corrupted_variable, "NSSI failed to read variable %s.", varname);
+//        return -err_corrupted_variable;
+//    }
+//
+//    return 0;
+//}
+
+int64_t adios_read_nssi_read_var (ADIOS_GROUP * gp, const char * varname,
+                        const uint64_t * start, const uint64_t * count,
+                        void * data)
+{
+    int rc=NSSI_OK;
+    int64_t total_size;
+    struct adios_read_nssi_data_struct * ds = (struct adios_read_nssi_data_struct *) gp->fp->fh;
+    enum ADIOS_DATATYPES vartype;
+    int elemsize;
+    int err;
+    int i;
+
+    adios_read_get_vartype_size_args vts_args;
+    adios_read_get_vartype_size_res  vts_res;
+    adios_read_read_var_args args;
+    adios_read_read_var_res  res;
+
+    memset(&vts_args, 0, sizeof(vts_args));
+    memset(&vts_res,  0, sizeof(vts_res));
+    vts_args.fd            = ds->fd;
+    vts_args.open_timestep = ds->timestep;
+    vts_args.client_id     = strdup(job_id);
+    vts_args.vpath         = strdup("");
+    vts_args.vname         = strdup(varname);
+    Func_Timer("ADIOS_READ_GET_VARTYPE_SIZE_OP",
+            rc = nssi_call_rpc_sync(&svcs[ds->svc_index],
+                    ADIOS_READ_GET_VARTYPE_SIZE_OP,
+                    &vts_args,
+                    NULL,
+                    0,
+                    &vts_res););
+    free(vts_args.vpath);
+    free(vts_args.vname);
+    if (rc != NSSI_OK) {
+        fprintf(stderr, "NSSI ERROR: ADIOS_READ_GET_VARTYPE_SIZE_OP failed\n");
+        return(-1);
+    }
+
+    memset(&args, 0, sizeof(args));
+    memset(&res,  0, sizeof(res));
+    args.fd=ds->fd;
+    args.open_timestep = ds->timestep;
+    args.client_id = strdup(job_id);
+    args.vpath=strdup("");
+    args.vname=strdup(varname);
+    total_size = 1;
+    for (i=0; i<3; i++) {
+        args.offsets[i] = (int) start[i];
+        args.counts[i]  = (int) count[i];
+        total_size     *= count[i];
+    }
+    total_size *= vts_res.vartype_size;
+    args.max_read=total_size;
+
+    if (DEBUG>3) fprintf(stderr, "-- %s, rank %d: get data: varname=%s offsets=(%d,%d,%d) counts=(%d,%d,%d) total_size=%ld\n",
+        __func__, ds->rank, varname,
+        args.offsets[0], args.offsets[1], args.offsets[2],
+        args.counts[0], args.counts[1], args.counts[2],
+        total_size);
+
+    Func_Timer("ADIOS_READ_READ_VAR_OP",
+            rc = nssi_call_rpc_sync(&svcs[ds->svc_index],
+                    ADIOS_READ_READ_VAR_OP,
+                    &args,
+                    data,
+                    total_size,
+                    &res););
+    free(args.vpath);
+    free(args.vname);
+    if (rc != NSSI_OK) {
+        fprintf(stderr, "NSSI ERROR: ADIOS_READ_READ_VAR_OP failed\n");
+        return(-1);
+    }
+
+    return(res.bytes_read);
+}
+
+int64_t adios_read_nssi_read_var_byid (ADIOS_GROUP    * gp,
+                             int              varid,
+                             const uint64_t  * start,
+                             const uint64_t  * count,
+                             void           * data)
+{
+    adios_error (err_invalid_varid, "NSSI does not know variable indicies, only variable names can be used.");
+    return -err_invalid_varid;
+}
+
+
+int64_t adios_read_nssi_read_local_var (ADIOS_GROUP * gp, const char * varname,
+                                      int vidx, const uint64_t * start,
+                                      const uint64_t * count, void * data)
+{  
+    adios_error (err_operation_not_supported, "adios_read_local_var() is not supported with NSSI method.");
+    return -adios_errno;
+}
diff --git a/tests/C/Makefile.in b/tests/C/Makefile.in
index c84aa88..1bae90e 100644
--- a/tests/C/Makefile.in
+++ b/tests/C/Makefile.in
@@ -46,6 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -87,6 +88,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -161,6 +166,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -195,6 +202,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/tests/C/config_c.xml b/tests/C/config_c.xml
index 98980cf..fb5bc53 100644
--- a/tests/C/config_c.xml
+++ b/tests/C/config_c.xml
@@ -1,3 +1,4 @@
+<?xml version="1.0"?>
 <adios-config host-language="C">
   <adios-group name="restart" coordination-communicator="comm" time-index="time">
 <!--
@@ -23,13 +24,16 @@
     <attribute name="timestep2" path="/abc" value="1"/>
 -->
 
-    <var name="byte_test_length" type="integer"/>
+    <var name="byte_test_length" type="long"/>
 
     <var name="byte_test" type="byte" dimensions="byte_test_length"/>
   
   </adios-group>
 
-  <transport group="restart" method="MPI">max_storage_targets=672;min_stripe_count=1;max_stripe_count=1;files_number=1;overlap_factor=0;split_target_count=1;split_files_count=max</transport>
+<!--
+  <transport group="restart" method="ADAPTIVE">max_storage_targets=672;max_stripe_count=160;files_number=16;overlap_factor= 0;min_stripe_count=3;split_target_count=3;split_files_count=max</transport>
+-->
+  <transport group="restart" method="MPI">max_storage_targets=144;max_stripe_count=144;files_number=1;overlap_factor= 0;min_stripe_count=1;split_target_count=1;split_files_count=max</transport>
 
   <buffer size-MB="1000" allocate-time="now"/>
 
diff --git a/tests/Fortran/Makefile.in b/tests/Fortran/Makefile.in
index 50b7532..4305d77 100644
--- a/tests/Fortran/Makefile.in
+++ b/tests/Fortran/Makefile.in
@@ -46,6 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -85,6 +86,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -159,6 +164,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -193,6 +200,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 2d6d63b..392ad0c 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -44,6 +44,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -75,6 +76,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -149,6 +154,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -183,6 +190,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/tests/bp_read/Makefile.in b/tests/bp_read/Makefile.in
index 9356397..700d363 100644
--- a/tests/bp_read/Makefile.in
+++ b/tests/bp_read/Makefile.in
@@ -49,6 +49,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -108,6 +109,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -182,6 +187,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -216,6 +223,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/tests/bp_read/bp_read_f.F90 b/tests/bp_read/bp_read_f.F90
index d57e589..18c1e61 100644
--- a/tests/bp_read/bp_read_f.F90
+++ b/tests/bp_read/bp_read_f.F90
@@ -26,16 +26,19 @@ program read_bp_f
     character (len=100), dimension(5000) :: anamelist
     character (len=100), dimension(5000) :: gnamelist
 
-    integer :: ilom,ihip,jlom,jhip,klom,khip
+    integer :: ilom,ihip,jlom,jhip,klom,khip,nx
     integer, dimension(3) :: vstart, readcount
     integer,dimension(48) :: bconds  ! all boundary conditions as one array
     character(20)    :: vname
-    integer          :: one
+    integer          :: one, rank, nproc 
     real*8,dimension(102,66,3)  :: b1
 
     call MPI_Init (ierr)
     comm = MPI_COMM_WORLD
+    call mpi_comm_rank(comm, rank, ierr)
+    call mpi_comm_size(comm, nproc, ierr)
 
+    call adios_set_read_method (1, ierr);
     varchar = ' '
     !call adios_fopen (fh, "/lustre/spider/scratch/pnorbert/TRACKP.bp", comm, ierr)
     !call adios_fopen (fh, "TRACKP_00010.bp", comm, ierr)
@@ -46,7 +49,7 @@ program read_bp_f
     !call adios_fopen (fh, "pgood.bp", comm, ierr)
     !call adios_fopen (fh, "xgc.flowdiag.bp", comm, ierr)
     !call adios_fopen (fh, "xgc.restart.000.03600.bp", comm, ierr)
-    call adios_fopen (fh, "g.bp", comm, gcnt, ierr)
+    call adios_fopen (fh, "adios_global.bp", comm, gcnt, ierr)
     !call adios_fopen (fh, "testbp.bp", comm, ierr)
     !call adios_fopen (fh, "record.bp", comm, ierr)
     !call adios_fopen (fh, "outxz.bp", comm, ierr)
@@ -91,67 +94,76 @@ program read_bp_f
     !write (*,*) "name    ",  "  ndim    ", "    dims"
 
     write (*,*)"-----------------------------"
-    do i=1,vcnt 
-        call adios_inq_var (gh, vnamelist(i), vtype, vrank, dims, timedim, ierr)
-        start(1:10)=0
-        readsize(1:10)=1 
-        totalsize=1
-        do j=1,vrank
-            readsize(j) = dims(j)
-            totalsize=totalsize*dims(j)
-        enddo
-        write (*,'(a," ndims=",i0," type=",i0," size=",i0)') trim(vnamelist(i)),vrank,vtype,totalsize
-        if (vtype == 0) then
-            !if(allocated(varchar)) deallocate(varchar)
-            !allocate(varchar(totalsize))
-            !varchar(1)="!"
-            call adios_read_var (gh, vnamelist(i), start, readsize, varchar, read_bytes)
-        else if (vtype == 2) then
-            !write (*,*) "  totalsize = ", totalsize
-            !if (totalsize == 1) totalsize = 10
-            !if(allocated(varint)) then
-            !    write (*,*) "  dealloc varint"
-            !    deallocate(varint)
-            !endif
-            !write (*,*) "  alloc varint, size = ", totalsize
-            !allocate(varint(totalsize))
-            !write (*,*) "  totalsize = ", totalsize
-            !varint(:)=5
-            !print *, varint(1:10)
-            call adios_read_var (gh, vnamelist(i), start, readsize, varint, read_bytes)
-            print *, varint(1)
-        else if (vtype == 6) then
-            !if(allocated(vardouble)) deallocate(vardouble)
-            !allocate(vardouble(totalsize))
-            call adios_read_var (gh, vnamelist(i), start, readsize, vardouble, read_bytes)
-        else
-            write (*,'(a16,": Only integer or double type is handled here")') trim(vnamelist(i))
-        endif
-        if (vrank == 0) then
-            if (vtype == 0) then
-                write(*,'("    = ",a)') varchar(1:1)
-            else if (vtype == 2) then
-                write(*,'("    = ",i0)') varint(1)
-            else if (vtype == 6) then 
-                write(*,'("    = ",d20.10)') vardouble(1)
-            endif
-        else
-            !write (*,*)"-----------------------------"
-            !write (*,'(a30,t32," dimensions = [",i0,$)') vnamelist(i), dims(1)
-            write (*,'("   dimensions = [",i0,$)') dims(1)
-            do j=2,vrank
-                write (*,'(",",i0,$)') dims(j)
-            enddo
-            if (vtype == 0) then
-                write (*,'("] = ",a)') varchar
-            else
-                write (*,'("]")') 
-            endif
-        endif
-    enddo
+    !do i=1,vcnt 
+    !    call adios_inq_var (gh, vnamelist(i), vtype, vrank, dims, timedim, ierr)
+    !    start(1:10)=0
+    !    readsize(1:10)=1 
+    !    totalsize=1
+    !    do j=1,vrank
+    !        readsize(j) = dims(j)
+    !        totalsize=totalsize*dims(j)
+    !    enddo
+    !    write (*,'(a," ndims=",i0," type=",i0," size=",i0)') trim(vnamelist(i)),vrank,vtype,totalsize
+    !    if (vtype == 0) then
+    !        !if(allocated(varchar)) deallocate(varchar)
+    !        !allocate(varchar(totalsize))
+    !        !varchar(1)="!"
+    !        call adios_read_var (gh, vnamelist(i), start, readsize, varchar, read_bytes)
+    !    else if (vtype == 2) then
+    !        !write (*,*) "  totalsize = ", totalsize
+    !        !if (totalsize == 1) totalsize = 10
+    !        !if(allocated(varint)) then
+    !        !    write (*,*) "  dealloc varint"
+    !        !    deallocate(varint)
+    !        !endif
+    !        !write (*,*) "  alloc varint, size = ", totalsize
+    !        !allocate(varint(totalsize))
+    !        !write (*,*) "  totalsize = ", totalsize
+    !        !varint(:)=5
+    !        !print *, varint(1:10)
+    !        call adios_read_var (gh, vnamelist(i), start, readsize, varint, read_bytes)
+    !        print *, varint(1)
+    !    else if (vtype == 6) then
+    !        !if(allocated(vardouble)) deallocate(vardouble)
+    !        !allocate(vardouble(totalsize))
+    !        call adios_read_var (gh, vnamelist(i), start, readsize, vardouble, read_bytes)
+    !    else
+    !        write (*,'(a16,": Only integer or double type is handled here")') trim(vnamelist(i))
+    !    endif
+    !    if (vrank == 0) then
+    !        if (vtype == 0) then
+    !            write(*,'("    = ",a)') varchar(1:1)
+    !        else if (vtype == 2) then
+    !            write(*,'("    = ",i0)') varint(1)
+    !        else if (vtype == 6) then 
+    !            write(*,'("    = ",d20.10)') vardouble(1)
+    !        endif
+    !    else
+    !        !write (*,*)"-----------------------------"
+    !        !write (*,'(a30,t32," dimensions = [",i0,$)') vnamelist(i), dims(1)
+    !        write (*,'("   dimensions = [",i0,$)') dims(1)
+    !        do j=2,vrank
+    !            write (*,'(",",i0,$)') dims(j)
+    !        enddo
+    !        if (vtype == 0) then
+    !            write (*,'("] = ",a)') varchar
+    !        else
+    !            write (*,'("]")') 
+    !        endif
+    !    endif
+    !enddo
 
+    start(1) = 0
+    start(2) = rank
+    readsize(1) = 10
+    readsize(2) = 1
+    call adios_read_var (gh, "temperature", start, readsize, vardouble, read_bytes)
     call adios_gclose(gh, ierr)
     call adios_fclose(fh, ierr)
 
+    do i=1,4
+      write (*,*) vardouble(i) 
+    enddo
+
     call MPI_Finalize (ierr)
 end program
diff --git a/tests/genarray/Makefile.in b/tests/genarray/Makefile.in
index 72aabf0..d328f2e 100644
--- a/tests/genarray/Makefile.in
+++ b/tests/genarray/Makefile.in
@@ -47,6 +47,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -100,6 +101,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -174,6 +179,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -208,6 +215,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/tests/genarray/genarray.F90 b/tests/genarray/genarray.F90
index d2a5c89..aaa0547 100644
--- a/tests/genarray/genarray.F90
+++ b/tests/genarray/genarray.F90
@@ -1,4 +1,4 @@
-!
+
 !  ADIOS is freely available under the terms of the BSD license described
 !  in the COPYING file in the top level directory of this source distribution.
 !
@@ -22,6 +22,8 @@ module genarray_comm
     character(len=256) :: outputfile, inputfile
     integer :: npx, npy, npz  ! # of processors in x-y-z direction
     integer :: ndx, ndy, ndz  ! size of array per processor
+    integer :: timesteps      ! number of timesteps to write
+    integer :: sleeptime      ! time to sleep between time steps
     logical :: common_size    ! .true.  if common local sizes are given as argument
                               ! .false. if we have to read sizes from a file
 
@@ -43,7 +45,7 @@ module genarray_comm
     integer   :: err
 
     real*8 :: start_time, end_time, total_time,gbs,sz
-    real*8 :: cache_start_time, cache_end_time, cache_total_time
+    real*8 :: io_start_time, io_end_time, io_total_time
 
 
 end module genarray_comm
@@ -64,7 +66,7 @@ program genarray
 
     call processArgs()
     if (rank == 0) then
-        print *,"Output file: "//trim(outputfile)
+        print *,"Output file(s): "//trim(outputfile)//".<step>.bp"
         print '(" Process number        : ",i0," x ",i0," x ",i0)', npx,npy,npz
         if (common_size) then
             print '(" Array size per process: ",i0," x ",i0," x ",i0)', ndx,ndy,ndz
@@ -86,19 +88,7 @@ program genarray
     call determineOffsets()
     call generateLocalArray()
 
-    call MPI_BARRIER(MPI_COMM_WORLD,err)
-    start_time = MPI_WTIME()
     call writeArray()
-    call MPI_BARRIER(MPI_COMM_WORLD,err)
-    end_time = MPI_WTIME()
-    total_time = end_time - start_time
-
-    sz = adios_totalsize * nproc/1024.d0/1024.d0/1024.d0 !size in GB
-    gbs = sz/total_time
-
-    !if (rank==0) write(6,*) total_time
-    if (rank==0) write(6,'(a10,d12.2,2x,d12.2,2x,d12.3)') outputfile,sz,total_time,gbs
-
     ! Terminate
     call MPI_Barrier (MPI_COMM_WORLD, ierr)
     call adios_finalize (rank, ierr)
@@ -176,37 +166,37 @@ subroutine writeArray()
     implicit none
     integer*8 adios_handle, adios_groupsize
     integer adios_err
+    integer :: tstep
+    character(2) :: mode = "w"
+    character(len=256) :: outfilename
     include 'mpif.h'
 
-    call MPI_BARRIER(MPI_COMM_WORLD,adios_err)
-    cache_start_time = MPI_WTIME()
 
-    group = "genarray"
-    call adios_open (adios_handle, group, outputfile, "w", group_comm, adios_err)
+    if (rank==0) print '("Writing: "," filename ",14x,"size(GB)",4x,"io_time(sec)",6x,"GB/s")'
+    do tstep=1,timesteps
+        !if (tstep > 1) mode = "a"
+        double_xyz = tstep + double_xyz
+        call MPI_BARRIER(MPI_COMM_WORLD,adios_err)
+        io_start_time = MPI_WTIME()
+        group = "genarray"
+        write (outfilename,'(a,".",i3.3,".bp")') trim(outputfile),tstep
+        call adios_open (adios_handle, group, outfilename, mode, group_comm, adios_err)
 #include "gwrite_genarray.fh"
-    call MPI_BARRIER(MPI_COMM_WORLD,adios_err)
-    cache_end_time = MPI_WTIME()
-    cache_total_time = cache_end_time - cache_start_time
-
-    sz = adios_totalsize * nproc/1024.d0/1024.d0/1024.d0 !size in GB
-    gbs = sz/cache_total_time
-
-    !if (rank==0) write(6,*) total_time
-    if (rank==0) print '("Writing: ",a10,d12.2,2x,d12.2,2x,d12.3)', outputfile,sz,cache_total_time,gbs
-
-    call adios_start_calculation(adios_err)
-    call adios_end_iteration(adios_err)
-    call adios_stop_calculation(adios_err)
-
-    call adios_close (adios_handle, adios_err)
-
-
+        call adios_close (adios_handle, adios_err)
+        call MPI_BARRIER(MPI_COMM_WORLD,adios_err)
+        io_end_time = MPI_WTIME()
+        io_total_time = io_end_time - io_start_time
+        sz = adios_totalsize * nproc/1024.d0/1024.d0/1024.d0 !size in GB
+        gbs = sz/io_total_time
+        if (rank==0) print '("Writing: ",a20,d12.2,2x,d12.2,2x,d12.3)', outfilename,sz,io_total_time,gbs
+        if (tstep<timesteps) call sleep(sleeptime)
+     end do
 end subroutine writeArray
 
 
 !!***************************
 subroutine usage()
-    print *, "Usage: genarray  output N  M  K  [nx  ny  nz | infile]"
+    print *, "Usage: genarray  output N  M  K  [infile|nx  ny  nz timesteps sleeptime]"
     print *, "output: name of output file"
     print *, "N:      number of processes in X dimension"
     print *, "M:      number of processes in Y dimension"
@@ -215,6 +205,8 @@ subroutine usage()
     print *, "ny:     local array size in Y dimension per processor"
     print *, "nz:     local array size in Z dimension per processor"
     print *, "infile: file that describes nx ny nz for each processor"
+    print *, "timesteps: the total number of timesteps to output" 
+    print *, "sleeptime: the time to sleep (s)"
 end subroutine usage
 
 !!***************************
@@ -231,6 +223,7 @@ subroutine processArgs()
 #endif
 
     character(len=256) :: npx_str, npy_str, npz_str, ndx_str, ndy_str, ndz_str
+    character(len=256) :: time_str,sleep_str
     integer :: numargs
 
     !! process arguments
@@ -253,7 +246,7 @@ subroutine processArgs()
         ndy = 0
         ndz = 0
         common_size = .false.
-    else if (numargs == 7) then
+    else if (numargs == 9) then
         call getarg(5, ndx_str)
         call getarg(6, ndy_str)
         call getarg(7, ndz_str)
@@ -262,6 +255,10 @@ subroutine processArgs()
         read (ndz_str,'(i6)') ndz
         inputfile=char(0)
         common_size = .true.
+        call getarg(8, time_str)
+        call getarg(9, sleep_str)
+        read (time_str,'(i6)') timesteps
+        read (sleep_str,'(i6)') sleeptime
     else
         call usage()
         call exit(1)
diff --git a/tests/genarray/genarray3d.xml b/tests/genarray/genarray3d.xml
index cbb3d55..035a860 100644
--- a/tests/genarray/genarray3d.xml
+++ b/tests/genarray/genarray3d.xml
@@ -25,15 +25,15 @@
 
     <!-- 3D array written by genarray with 1 timesteps -->
     <global-bounds dimensions="gndx,gndy,gndz" offsets="offx,offy,offz">
-        <var name="var1" gwrite="double_xyz" gread="double_xyz" path="/var" type="real*8" dimensions="ndx,ndy,ndz"/>
-        <var name="var2" gwrite="double_xyz" gread="double_xyz" path="/var" type="real*8" dimensions="ndx,ndy,ndz"/>
-        <var name="var3" gwrite="double_xyz" gread="double_xyz" path="/var" type="real*8" dimensions="ndx,ndy,ndz"/>
-        <var name="var4" gwrite="double_xyz" gread="double_xyz" path="/var" type="real*8" dimensions="ndx,ndy,ndz"/>
-        <var name="var5" gwrite="double_xyz" gread="double_xyz" path="/var" type="real*8" dimensions="ndx,ndy,ndz"/>
-        <var name="var6" gwrite="double_xyz" gread="double_xyz" path="/var" type="real*8" dimensions="ndx,ndy,ndz"/>
-        <var name="var7" gwrite="double_xyz" gread="double_xyz" path="/var" type="real*8" dimensions="ndx,ndy,ndz"/>
-        <var name="var8" gwrite="double_xyz" gread="double_xyz" path="/var" type="real*8" dimensions="ndx,ndy,ndz"/>
-        <var name="var9" gwrite="double_xyz" gread="double_xyz" path="/var" type="real*8" dimensions="ndx,ndy,ndz"/>
+        <var name="var1" gwrite="double_xyz" gread="double_xyz" path="/var" type="real*8" dimensions="ndx,ndy,ndz,steps"/>
+        <var name="var2" gwrite="double_xyz" gread="double_xyz" path="/var" type="real*8" dimensions="ndx,ndy,ndz,steps"/>
+        <var name="var3" gwrite="double_xyz" gread="double_xyz" path="/var" type="real*8" dimensions="ndx,ndy,ndz,steps"/>
+        <var name="var4" gwrite="double_xyz" gread="double_xyz" path="/var" type="real*8" dimensions="ndx,ndy,ndz,steps"/>
+        <var name="var5" gwrite="double_xyz" gread="double_xyz" path="/var" type="real*8" dimensions="ndx,ndy,ndz,steps"/>
+        <var name="var6" gwrite="double_xyz" gread="double_xyz" path="/var" type="real*8" dimensions="ndx,ndy,ndz,steps"/>
+        <var name="var7" gwrite="double_xyz" gread="double_xyz" path="/var" type="real*8" dimensions="ndx,ndy,ndz,steps"/>
+        <var name="var8" gwrite="double_xyz" gread="double_xyz" path="/var" type="real*8" dimensions="ndx,ndy,ndz,steps"/>
+        <var name="var9" gwrite="double_xyz" gread="double_xyz" path="/var" type="real*8" dimensions="ndx,ndy,ndz,steps"/>
     </global-bounds>
     <attribute name="description" path="/var/double_xyz"
                value="3D array with 3D decomposition"/>
@@ -41,8 +41,8 @@
 
   </adios-group>
 
-  <method group="genarray" method="MPI"/>
+  <method group="genarray" method="POSIX"/>
 
-  <buffer size-MB="400" allocate-time="now"/>
+  <buffer size-MB="20" allocate-time="now"/>
 
 </adios-config>
diff --git a/tests/suite/Makefile.in b/tests/suite/Makefile.in
index ac7226a..eaefeac 100644
--- a/tests/suite/Makefile.in
+++ b/tests/suite/Makefile.in
@@ -44,6 +44,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -75,6 +76,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -149,6 +154,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -183,6 +190,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/tests/suite/programs/Makefile.in b/tests/suite/programs/Makefile.in
index 181e7d1..6c68570 100644
--- a/tests/suite/programs/Makefile.in
+++ b/tests/suite/programs/Makefile.in
@@ -46,6 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -85,6 +86,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -159,6 +164,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -193,6 +200,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/tests/suite/reference/global_array_no_xml_bpls.txt b/tests/suite/reference/global_array_no_xml_bpls.txt
index fbea359..121f2ad 100644
--- a/tests/suite/reference/global_array_no_xml_bpls.txt
+++ b/tests/suite/reference/global_array_no_xml_bpls.txt
@@ -3,14 +3,14 @@ File info:
   of variables:  4
   of attributes: 0
   time steps:    1 starting from 1
-  file size:     7 KB
+  file size:     24 KB
   bp version:    513
   statistics:    Min / Max / Avg / Std_dev
 
-  integer    /NX           scalar = 10 
-  integer    /G            scalar = 140 
-  integer    /O            scalar = 0 
-  double     /temperature  {140} = 0 / 139 / 69.5 / 40.4135 
+  integer    /NX             scalar = 100 
+  integer    /Global_bounds  scalar = 2100 
+  integer    /Offsets        scalar = 0 
+  double     /temperature    {2100} = 0 / 2099 / 1049.5 / 606.218 
     (0)    0 1 2 3 4 5 6 7 8 9 
     (10)    10 11 12 13 14 15 16 17 18 19 
     (20)    20 21 22 23 24 25 26 27 28 29 
@@ -25,4 +25,200 @@ File info:
     (110)    110 111 112 113 114 115 116 117 118 119 
     (120)    120 121 122 123 124 125 126 127 128 129 
     (130)    130 131 132 133 134 135 136 137 138 139 
+    (140)    140 141 142 143 144 145 146 147 148 149 
+    (150)    150 151 152 153 154 155 156 157 158 159 
+    (160)    160 161 162 163 164 165 166 167 168 169 
+    (170)    170 171 172 173 174 175 176 177 178 179 
+    (180)    180 181 182 183 184 185 186 187 188 189 
+    (190)    190 191 192 193 194 195 196 197 198 199 
+    (200)    200 201 202 203 204 205 206 207 208 209 
+    (210)    210 211 212 213 214 215 216 217 218 219 
+    (220)    220 221 222 223 224 225 226 227 228 229 
+    (230)    230 231 232 233 234 235 236 237 238 239 
+    (240)    240 241 242 243 244 245 246 247 248 249 
+    (250)    250 251 252 253 254 255 256 257 258 259 
+    (260)    260 261 262 263 264 265 266 267 268 269 
+    (270)    270 271 272 273 274 275 276 277 278 279 
+    (280)    280 281 282 283 284 285 286 287 288 289 
+    (290)    290 291 292 293 294 295 296 297 298 299 
+    (300)    300 301 302 303 304 305 306 307 308 309 
+    (310)    310 311 312 313 314 315 316 317 318 319 
+    (320)    320 321 322 323 324 325 326 327 328 329 
+    (330)    330 331 332 333 334 335 336 337 338 339 
+    (340)    340 341 342 343 344 345 346 347 348 349 
+    (350)    350 351 352 353 354 355 356 357 358 359 
+    (360)    360 361 362 363 364 365 366 367 368 369 
+    (370)    370 371 372 373 374 375 376 377 378 379 
+    (380)    380 381 382 383 384 385 386 387 388 389 
+    (390)    390 391 392 393 394 395 396 397 398 399 
+    (400)    400 401 402 403 404 405 406 407 408 409 
+    (410)    410 411 412 413 414 415 416 417 418 419 
+    (420)    420 421 422 423 424 425 426 427 428 429 
+    (430)    430 431 432 433 434 435 436 437 438 439 
+    (440)    440 441 442 443 444 445 446 447 448 449 
+    (450)    450 451 452 453 454 455 456 457 458 459 
+    (460)    460 461 462 463 464 465 466 467 468 469 
+    (470)    470 471 472 473 474 475 476 477 478 479 
+    (480)    480 481 482 483 484 485 486 487 488 489 
+    (490)    490 491 492 493 494 495 496 497 498 499 
+    (500)    500 501 502 503 504 505 506 507 508 509 
+    (510)    510 511 512 513 514 515 516 517 518 519 
+    (520)    520 521 522 523 524 525 526 527 528 529 
+    (530)    530 531 532 533 534 535 536 537 538 539 
+    (540)    540 541 542 543 544 545 546 547 548 549 
+    (550)    550 551 552 553 554 555 556 557 558 559 
+    (560)    560 561 562 563 564 565 566 567 568 569 
+    (570)    570 571 572 573 574 575 576 577 578 579 
+    (580)    580 581 582 583 584 585 586 587 588 589 
+    (590)    590 591 592 593 594 595 596 597 598 599 
+    (600)    600 601 602 603 604 605 606 607 608 609 
+    (610)    610 611 612 613 614 615 616 617 618 619 
+    (620)    620 621 622 623 624 625 626 627 628 629 
+    (630)    630 631 632 633 634 635 636 637 638 639 
+    (640)    640 641 642 643 644 645 646 647 648 649 
+    (650)    650 651 652 653 654 655 656 657 658 659 
+    (660)    660 661 662 663 664 665 666 667 668 669 
+    (670)    670 671 672 673 674 675 676 677 678 679 
+    (680)    680 681 682 683 684 685 686 687 688 689 
+    (690)    690 691 692 693 694 695 696 697 698 699 
+    (700)    700 701 702 703 704 705 706 707 708 709 
+    (710)    710 711 712 713 714 715 716 717 718 719 
+    (720)    720 721 722 723 724 725 726 727 728 729 
+    (730)    730 731 732 733 734 735 736 737 738 739 
+    (740)    740 741 742 743 744 745 746 747 748 749 
+    (750)    750 751 752 753 754 755 756 757 758 759 
+    (760)    760 761 762 763 764 765 766 767 768 769 
+    (770)    770 771 772 773 774 775 776 777 778 779 
+    (780)    780 781 782 783 784 785 786 787 788 789 
+    (790)    790 791 792 793 794 795 796 797 798 799 
+    (800)    800 801 802 803 804 805 806 807 808 809 
+    (810)    810 811 812 813 814 815 816 817 818 819 
+    (820)    820 821 822 823 824 825 826 827 828 829 
+    (830)    830 831 832 833 834 835 836 837 838 839 
+    (840)    840 841 842 843 844 845 846 847 848 849 
+    (850)    850 851 852 853 854 855 856 857 858 859 
+    (860)    860 861 862 863 864 865 866 867 868 869 
+    (870)    870 871 872 873 874 875 876 877 878 879 
+    (880)    880 881 882 883 884 885 886 887 888 889 
+    (890)    890 891 892 893 894 895 896 897 898 899 
+    (900)    900 901 902 903 904 905 906 907 908 909 
+    (910)    910 911 912 913 914 915 916 917 918 919 
+    (920)    920 921 922 923 924 925 926 927 928 929 
+    (930)    930 931 932 933 934 935 936 937 938 939 
+    (940)    940 941 942 943 944 945 946 947 948 949 
+    (950)    950 951 952 953 954 955 956 957 958 959 
+    (960)    960 961 962 963 964 965 966 967 968 969 
+    (970)    970 971 972 973 974 975 976 977 978 979 
+    (980)    980 981 982 983 984 985 986 987 988 989 
+    (990)    990 991 992 993 994 995 996 997 998 999 
+    (1000)    1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 
+    (1010)    1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 
+    (1020)    1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 
+    (1030)    1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 
+    (1040)    1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 
+    (1050)    1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 
+    (1060)    1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 
+    (1070)    1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 
+    (1080)    1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 
+    (1090)    1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 
+    (1100)    1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 
+    (1110)    1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 
+    (1120)    1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 
+    (1130)    1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 
+    (1140)    1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 
+    (1150)    1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 
+    (1160)    1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 
+    (1170)    1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 
+    (1180)    1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 
+    (1190)    1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 
+    (1200)    1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 
+    (1210)    1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 
+    (1220)    1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 
+    (1230)    1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 
+    (1240)    1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 
+    (1250)    1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 
+    (1260)    1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 
+    (1270)    1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 
+    (1280)    1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 
+    (1290)    1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 
+    (1300)    1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 
+    (1310)    1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 
+    (1320)    1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 
+    (1330)    1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 
+    (1340)    1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 
+    (1350)    1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 
+    (1360)    1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 
+    (1370)    1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 
+    (1380)    1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 
+    (1390)    1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 
+    (1400)    1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 
+    (1410)    1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 
+    (1420)    1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 
+    (1430)    1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 
+    (1440)    1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 
+    (1450)    1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 
+    (1460)    1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 
+    (1470)    1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 
+    (1480)    1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 
+    (1490)    1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 
+    (1500)    1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 
+    (1510)    1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 
+    (1520)    1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 
+    (1530)    1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 
+    (1540)    1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 
+    (1550)    1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 
+    (1560)    1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 
+    (1570)    1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 
+    (1580)    1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 
+    (1590)    1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 
+    (1600)    1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 
+    (1610)    1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 
+    (1620)    1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 
+    (1630)    1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 
+    (1640)    1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 
+    (1650)    1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 
+    (1660)    1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 
+    (1670)    1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 
+    (1680)    1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 
+    (1690)    1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 
+    (1700)    1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 
+    (1710)    1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 
+    (1720)    1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 
+    (1730)    1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 
+    (1740)    1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 
+    (1750)    1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 
+    (1760)    1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 
+    (1770)    1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 
+    (1780)    1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 
+    (1790)    1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 
+    (1800)    1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 
+    (1810)    1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 
+    (1820)    1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 
+    (1830)    1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 
+    (1840)    1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 
+    (1850)    1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 
+    (1860)    1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 
+    (1870)    1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 
+    (1880)    1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 
+    (1890)    1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 
+    (1900)    1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 
+    (1910)    1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 
+    (1920)    1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 
+    (1930)    1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 
+    (1940)    1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 
+    (1950)    1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 
+    (1960)    1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 
+    (1970)    1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 
+    (1980)    1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 
+    (1990)    1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 
+    (2000)    2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 
+    (2010)    2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 
+    (2020)    2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 
+    (2030)    2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 
+    (2040)    2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 
+    (2050)    2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 
+    (2060)    2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 
+    (2070)    2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 
+    (2080)    2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 
+    (2090)    2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 
 
diff --git a/tests/suite/reference/global_array_no_xml_read.txt b/tests/suite/reference/global_array_no_xml_read.txt
index bd1f20c..add857e 100644
--- a/tests/suite/reference/global_array_no_xml_read.txt
+++ b/tests/suite/reference/global_array_no_xml_read.txt
@@ -1,3 +1,213 @@
-      0      1      2      3      4      5      6      7      8      9     10     11     12     13     14     15     16     17     18     19     20     21     22     23     24     25     26     27     28     29     30     31     32     33     34     35     36     37     38     39     40     41     42     43     44     45
-     46     47     48     49     50     51     52     53     54     55     56     57     58     59     60     61     62     63     64     65     66     67     68     69     70     71     72     73     74     75     76     77     78     79     80     81     82     83     84     85     86     87     88     89     90     91
-     92     93     94     95     96     97     98     99    100    101    102    103    104    105    106    107    108    109    110    111    112    113    114    115    116    117    118    119    120    121    122    123    124    125    126    127    128    129    130    131    132    133    134    135    136    137    138    139
+ ======== Rank 0 ========== 
+[0000]        0      1      2      3      4      5      6      7      8      9
+[0010]       10     11     12     13     14     15     16     17     18     19
+[0020]       20     21     22     23     24     25     26     27     28     29
+[0030]       30     31     32     33     34     35     36     37     38     39
+[0040]       40     41     42     43     44     45     46     47     48     49
+[0050]       50     51     52     53     54     55     56     57     58     59
+[0060]       60     61     62     63     64     65     66     67     68     69
+[0070]       70     71     72     73     74     75     76     77     78     79
+[0080]       80     81     82     83     84     85     86     87     88     89
+[0090]       90     91     92     93     94     95     96     97     98     99
+[0100]      100    101    102    103    104    105    106    107    108    109
+[0110]      110    111    112    113    114    115    116    117    118    119
+[0120]      120    121    122    123    124    125    126    127    128    129
+[0130]      130    131    132    133    134    135    136    137    138    139
+[0140]      140    141    142    143    144    145    146    147    148    149
+[0150]      150    151    152    153    154    155    156    157    158    159
+[0160]      160    161    162    163    164    165    166    167    168    169
+[0170]      170    171    172    173    174    175    176    177    178    179
+[0180]      180    181    182    183    184    185    186    187    188    189
+[0190]      190    191    192    193    194    195    196    197    198    199
+[0200]      200    201    202    203    204    205    206    207    208    209
+[0210]      210    211    212    213    214    215    216    217    218    219
+[0220]      220    221    222    223    224    225    226    227    228    229
+[0230]      230    231    232    233    234    235    236    237    238    239
+[0240]      240    241    242    243    244    245    246    247    248    249
+[0250]      250    251    252    253    254    255    256    257    258    259
+[0260]      260    261    262    263    264    265    266    267    268    269
+[0270]      270    271    272    273    274    275    276    277    278    279
+[0280]      280    281    282    283    284    285    286    287    288    289
+[0290]      290    291    292    293    294    295    296    297    298    299
+[0300]      300    301    302    303    304    305    306    307    308    309
+[0310]      310    311    312    313    314    315    316    317    318    319
+[0320]      320    321    322    323    324    325    326    327    328    329
+[0330]      330    331    332    333    334    335    336    337    338    339
+[0340]      340    341    342    343    344    345    346    347    348    349
+[0350]      350    351    352    353    354    355    356    357    358    359
+[0360]      360    361    362    363    364    365    366    367    368    369
+[0370]      370    371    372    373    374    375    376    377    378    379
+[0380]      380    381    382    383    384    385    386    387    388    389
+[0390]      390    391    392    393    394    395    396    397    398    399
+[0400]      400    401    402    403    404    405    406    407    408    409
+[0410]      410    411    412    413    414    415    416    417    418    419
+[0420]      420    421    422    423    424    425    426    427    428    429
+[0430]      430    431    432    433    434    435    436    437    438    439
+[0440]      440    441    442    443    444    445    446    447    448    449
+[0450]      450    451    452    453    454    455    456    457    458    459
+[0460]      460    461    462    463    464    465    466    467    468    469
+[0470]      470    471    472    473    474    475    476    477    478    479
+[0480]      480    481    482    483    484    485    486    487    488    489
+[0490]      490    491    492    493    494    495    496    497    498    499
+[0500]      500    501    502    503    504    505    506    507    508    509
+[0510]      510    511    512    513    514    515    516    517    518    519
+[0520]      520    521    522    523    524    525    526    527    528    529
+[0530]      530    531    532    533    534    535    536    537    538    539
+[0540]      540    541    542    543    544    545    546    547    548    549
+[0550]      550    551    552    553    554    555    556    557    558    559
+[0560]      560    561    562    563    564    565    566    567    568    569
+[0570]      570    571    572    573    574    575    576    577    578    579
+[0580]      580    581    582    583    584    585    586    587    588    589
+[0590]      590    591    592    593    594    595    596    597    598    599
+[0600]      600    601    602    603    604    605    606    607    608    609
+[0610]      610    611    612    613    614    615    616    617    618    619
+[0620]      620    621    622    623    624    625    626    627    628    629
+[0630]      630    631    632    633    634    635    636    637    638    639
+[0640]      640    641    642    643    644    645    646    647    648    649
+[0650]      650    651    652    653    654    655    656    657    658    659
+[0660]      660    661    662    663    664    665    666    667    668    669
+[0670]      670    671    672    673    674    675    676    677    678    679
+[0680]      680    681    682    683    684    685    686    687    688    689
+[0690]      690    691    692    693    694    695    696    697    698    699
+ ======== Rank 1 ========== 
+[0700]      700    701    702    703    704    705    706    707    708    709
+[0710]      710    711    712    713    714    715    716    717    718    719
+[0720]      720    721    722    723    724    725    726    727    728    729
+[0730]      730    731    732    733    734    735    736    737    738    739
+[0740]      740    741    742    743    744    745    746    747    748    749
+[0750]      750    751    752    753    754    755    756    757    758    759
+[0760]      760    761    762    763    764    765    766    767    768    769
+[0770]      770    771    772    773    774    775    776    777    778    779
+[0780]      780    781    782    783    784    785    786    787    788    789
+[0790]      790    791    792    793    794    795    796    797    798    799
+[0800]      800    801    802    803    804    805    806    807    808    809
+[0810]      810    811    812    813    814    815    816    817    818    819
+[0820]      820    821    822    823    824    825    826    827    828    829
+[0830]      830    831    832    833    834    835    836    837    838    839
+[0840]      840    841    842    843    844    845    846    847    848    849
+[0850]      850    851    852    853    854    855    856    857    858    859
+[0860]      860    861    862    863    864    865    866    867    868    869
+[0870]      870    871    872    873    874    875    876    877    878    879
+[0880]      880    881    882    883    884    885    886    887    888    889
+[0890]      890    891    892    893    894    895    896    897    898    899
+[0900]      900    901    902    903    904    905    906    907    908    909
+[0910]      910    911    912    913    914    915    916    917    918    919
+[0920]      920    921    922    923    924    925    926    927    928    929
+[0930]      930    931    932    933    934    935    936    937    938    939
+[0940]      940    941    942    943    944    945    946    947    948    949
+[0950]      950    951    952    953    954    955    956    957    958    959
+[0960]      960    961    962    963    964    965    966    967    968    969
+[0970]      970    971    972    973    974    975    976    977    978    979
+[0980]      980    981    982    983    984    985    986    987    988    989
+[0990]      990    991    992    993    994    995    996    997    998    999
+[1000]     1000   1001   1002   1003   1004   1005   1006   1007   1008   1009
+[1010]     1010   1011   1012   1013   1014   1015   1016   1017   1018   1019
+[1020]     1020   1021   1022   1023   1024   1025   1026   1027   1028   1029
+[1030]     1030   1031   1032   1033   1034   1035   1036   1037   1038   1039
+[1040]     1040   1041   1042   1043   1044   1045   1046   1047   1048   1049
+[1050]     1050   1051   1052   1053   1054   1055   1056   1057   1058   1059
+[1060]     1060   1061   1062   1063   1064   1065   1066   1067   1068   1069
+[1070]     1070   1071   1072   1073   1074   1075   1076   1077   1078   1079
+[1080]     1080   1081   1082   1083   1084   1085   1086   1087   1088   1089
+[1090]     1090   1091   1092   1093   1094   1095   1096   1097   1098   1099
+[1100]     1100   1101   1102   1103   1104   1105   1106   1107   1108   1109
+[1110]     1110   1111   1112   1113   1114   1115   1116   1117   1118   1119
+[1120]     1120   1121   1122   1123   1124   1125   1126   1127   1128   1129
+[1130]     1130   1131   1132   1133   1134   1135   1136   1137   1138   1139
+[1140]     1140   1141   1142   1143   1144   1145   1146   1147   1148   1149
+[1150]     1150   1151   1152   1153   1154   1155   1156   1157   1158   1159
+[1160]     1160   1161   1162   1163   1164   1165   1166   1167   1168   1169
+[1170]     1170   1171   1172   1173   1174   1175   1176   1177   1178   1179
+[1180]     1180   1181   1182   1183   1184   1185   1186   1187   1188   1189
+[1190]     1190   1191   1192   1193   1194   1195   1196   1197   1198   1199
+[1200]     1200   1201   1202   1203   1204   1205   1206   1207   1208   1209
+[1210]     1210   1211   1212   1213   1214   1215   1216   1217   1218   1219
+[1220]     1220   1221   1222   1223   1224   1225   1226   1227   1228   1229
+[1230]     1230   1231   1232   1233   1234   1235   1236   1237   1238   1239
+[1240]     1240   1241   1242   1243   1244   1245   1246   1247   1248   1249
+[1250]     1250   1251   1252   1253   1254   1255   1256   1257   1258   1259
+[1260]     1260   1261   1262   1263   1264   1265   1266   1267   1268   1269
+[1270]     1270   1271   1272   1273   1274   1275   1276   1277   1278   1279
+[1280]     1280   1281   1282   1283   1284   1285   1286   1287   1288   1289
+[1290]     1290   1291   1292   1293   1294   1295   1296   1297   1298   1299
+[1300]     1300   1301   1302   1303   1304   1305   1306   1307   1308   1309
+[1310]     1310   1311   1312   1313   1314   1315   1316   1317   1318   1319
+[1320]     1320   1321   1322   1323   1324   1325   1326   1327   1328   1329
+[1330]     1330   1331   1332   1333   1334   1335   1336   1337   1338   1339
+[1340]     1340   1341   1342   1343   1344   1345   1346   1347   1348   1349
+[1350]     1350   1351   1352   1353   1354   1355   1356   1357   1358   1359
+[1360]     1360   1361   1362   1363   1364   1365   1366   1367   1368   1369
+[1370]     1370   1371   1372   1373   1374   1375   1376   1377   1378   1379
+[1380]     1380   1381   1382   1383   1384   1385   1386   1387   1388   1389
+[1390]     1390   1391   1392   1393   1394   1395   1396   1397   1398   1399
+ ======== Rank 2 ========== 
+[1400]     1400   1401   1402   1403   1404   1405   1406   1407   1408   1409
+[1410]     1410   1411   1412   1413   1414   1415   1416   1417   1418   1419
+[1420]     1420   1421   1422   1423   1424   1425   1426   1427   1428   1429
+[1430]     1430   1431   1432   1433   1434   1435   1436   1437   1438   1439
+[1440]     1440   1441   1442   1443   1444   1445   1446   1447   1448   1449
+[1450]     1450   1451   1452   1453   1454   1455   1456   1457   1458   1459
+[1460]     1460   1461   1462   1463   1464   1465   1466   1467   1468   1469
+[1470]     1470   1471   1472   1473   1474   1475   1476   1477   1478   1479
+[1480]     1480   1481   1482   1483   1484   1485   1486   1487   1488   1489
+[1490]     1490   1491   1492   1493   1494   1495   1496   1497   1498   1499
+[1500]     1500   1501   1502   1503   1504   1505   1506   1507   1508   1509
+[1510]     1510   1511   1512   1513   1514   1515   1516   1517   1518   1519
+[1520]     1520   1521   1522   1523   1524   1525   1526   1527   1528   1529
+[1530]     1530   1531   1532   1533   1534   1535   1536   1537   1538   1539
+[1540]     1540   1541   1542   1543   1544   1545   1546   1547   1548   1549
+[1550]     1550   1551   1552   1553   1554   1555   1556   1557   1558   1559
+[1560]     1560   1561   1562   1563   1564   1565   1566   1567   1568   1569
+[1570]     1570   1571   1572   1573   1574   1575   1576   1577   1578   1579
+[1580]     1580   1581   1582   1583   1584   1585   1586   1587   1588   1589
+[1590]     1590   1591   1592   1593   1594   1595   1596   1597   1598   1599
+[1600]     1600   1601   1602   1603   1604   1605   1606   1607   1608   1609
+[1610]     1610   1611   1612   1613   1614   1615   1616   1617   1618   1619
+[1620]     1620   1621   1622   1623   1624   1625   1626   1627   1628   1629
+[1630]     1630   1631   1632   1633   1634   1635   1636   1637   1638   1639
+[1640]     1640   1641   1642   1643   1644   1645   1646   1647   1648   1649
+[1650]     1650   1651   1652   1653   1654   1655   1656   1657   1658   1659
+[1660]     1660   1661   1662   1663   1664   1665   1666   1667   1668   1669
+[1670]     1670   1671   1672   1673   1674   1675   1676   1677   1678   1679
+[1680]     1680   1681   1682   1683   1684   1685   1686   1687   1688   1689
+[1690]     1690   1691   1692   1693   1694   1695   1696   1697   1698   1699
+[1700]     1700   1701   1702   1703   1704   1705   1706   1707   1708   1709
+[1710]     1710   1711   1712   1713   1714   1715   1716   1717   1718   1719
+[1720]     1720   1721   1722   1723   1724   1725   1726   1727   1728   1729
+[1730]     1730   1731   1732   1733   1734   1735   1736   1737   1738   1739
+[1740]     1740   1741   1742   1743   1744   1745   1746   1747   1748   1749
+[1750]     1750   1751   1752   1753   1754   1755   1756   1757   1758   1759
+[1760]     1760   1761   1762   1763   1764   1765   1766   1767   1768   1769
+[1770]     1770   1771   1772   1773   1774   1775   1776   1777   1778   1779
+[1780]     1780   1781   1782   1783   1784   1785   1786   1787   1788   1789
+[1790]     1790   1791   1792   1793   1794   1795   1796   1797   1798   1799
+[1800]     1800   1801   1802   1803   1804   1805   1806   1807   1808   1809
+[1810]     1810   1811   1812   1813   1814   1815   1816   1817   1818   1819
+[1820]     1820   1821   1822   1823   1824   1825   1826   1827   1828   1829
+[1830]     1830   1831   1832   1833   1834   1835   1836   1837   1838   1839
+[1840]     1840   1841   1842   1843   1844   1845   1846   1847   1848   1849
+[1850]     1850   1851   1852   1853   1854   1855   1856   1857   1858   1859
+[1860]     1860   1861   1862   1863   1864   1865   1866   1867   1868   1869
+[1870]     1870   1871   1872   1873   1874   1875   1876   1877   1878   1879
+[1880]     1880   1881   1882   1883   1884   1885   1886   1887   1888   1889
+[1890]     1890   1891   1892   1893   1894   1895   1896   1897   1898   1899
+[1900]     1900   1901   1902   1903   1904   1905   1906   1907   1908   1909
+[1910]     1910   1911   1912   1913   1914   1915   1916   1917   1918   1919
+[1920]     1920   1921   1922   1923   1924   1925   1926   1927   1928   1929
+[1930]     1930   1931   1932   1933   1934   1935   1936   1937   1938   1939
+[1940]     1940   1941   1942   1943   1944   1945   1946   1947   1948   1949
+[1950]     1950   1951   1952   1953   1954   1955   1956   1957   1958   1959
+[1960]     1960   1961   1962   1963   1964   1965   1966   1967   1968   1969
+[1970]     1970   1971   1972   1973   1974   1975   1976   1977   1978   1979
+[1980]     1980   1981   1982   1983   1984   1985   1986   1987   1988   1989
+[1990]     1990   1991   1992   1993   1994   1995   1996   1997   1998   1999
+[2000]     2000   2001   2002   2003   2004   2005   2006   2007   2008   2009
+[2010]     2010   2011   2012   2013   2014   2015   2016   2017   2018   2019
+[2020]     2020   2021   2022   2023   2024   2025   2026   2027   2028   2029
+[2030]     2030   2031   2032   2033   2034   2035   2036   2037   2038   2039
+[2040]     2040   2041   2042   2043   2044   2045   2046   2047   2048   2049
+[2050]     2050   2051   2052   2053   2054   2055   2056   2057   2058   2059
+[2060]     2060   2061   2062   2063   2064   2065   2066   2067   2068   2069
+[2070]     2070   2071   2072   2073   2074   2075   2076   2077   2078   2079
+[2080]     2080   2081   2082   2083   2084   2085   2086   2087   2088   2089
+[2090]     2090   2091   2092   2093   2094   2095   2096   2097   2098   2099
diff --git a/tests/suite/reference/global_array_time_bpls.txt b/tests/suite/reference/global_array_time_bpls.txt
index d1b5360..d83ba92 100644
--- a/tests/suite/reference/global_array_time_bpls.txt
+++ b/tests/suite/reference/global_array_time_bpls.txt
@@ -1,15 +1,17 @@
 File info:
   of groups:     1
-  of variables:  4
+  of variables:  6
   of attributes: 1
   time steps:    13 starting from 1
-  file size:     104 KB
+  file size:     153 KB
   bp version:    513
   statistics:    Min / Max / Avg / Std_dev
 
-Group temperature:
+Group restart:
   integer    /NX                       scalar = 10 
+  integer    /NY                       scalar = 1 
   integer    /size                     scalar = 9 
   integer    /rank                     scalar = 0 
   double     /temperature              {13, 9, 10} = 100 / 1389 / 744.5 / 375.067 
+  double     /pressure                 {13, 9, 1} = 1000 / 13008 / 7004 / 3741.66 
   string     /temperature/description  attr   = "Global array written from 'size' processes over several timesteps"
diff --git a/tests/suite/tests/07_global_array_no_xml.sh b/tests/suite/tests/07_global_array_no_xml.sh
index c6e866e..f900573 100755
--- a/tests/suite/tests/07_global_array_no_xml.sh
+++ b/tests/suite/tests/07_global_array_no_xml.sh
@@ -43,7 +43,7 @@ if [ $? != 0 ]; then
 fi
 
 echo "Run C adios_read_global_no_xml"
-$MPIRUN $NP_MPIRUN $READPROCS ./adios_read_global_no_xml | sort > c_read.txt
+$MPIRUN $NP_MPIRUN $READPROCS ./adios_read_global_no_xml > c_read.txt
 EX=$?
 if [ $? != 0 ]; then
     echo "ERROR: C version of adios_read_global_no_xml exited with $EX"
diff --git a/utils/Makefile.am b/utils/Makefile.am
index dd75545..e0f4c27 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -1,6 +1,6 @@
 SUBDIRS= gpp bpdump bp2ascii bpsplit bpls
 if BUILD_WRITE
-SUBDIRS += adios_lint
+SUBDIRS += adios_lint bp2bp
 endif
 if HAVE_HDF5
 SUBDIRS += bp2h5
diff --git a/utils/Makefile.in b/utils/Makefile.in
index 236428a..b378c69 100644
--- a/utils/Makefile.in
+++ b/utils/Makefile.in
@@ -35,7 +35,7 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
- at BUILD_WRITE_TRUE@am__append_1 = adios_lint
+ at BUILD_WRITE_TRUE@am__append_1 = adios_lint bp2bp
 @HAVE_HDF5_TRUE at am__append_2 = bp2h5
 @HAVE_NETCDF_TRUE at am__append_3 = bp2ncd
 subdir = utils
@@ -47,6 +47,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -72,13 +73,17 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
 	uninstall-recursive
 ETAGS = etags
 CTAGS = ctags
-DIST_SUBDIRS = gpp bpdump bp2ascii bpsplit bpls adios_lint bp2h5 \
+DIST_SUBDIRS = gpp bpdump bp2ascii bpsplit bpls adios_lint bp2bp bp2h5 \
 	bp2ncd
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -153,6 +158,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -187,6 +194,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/utils/adios_lint/Makefile.am b/utils/adios_lint/Makefile.am
index 4bca84d..5059430 100644
--- a/utils/adios_lint/Makefile.am
+++ b/utils/adios_lint/Makefile.am
@@ -6,10 +6,10 @@ AUTOMAKE_OPTIONS = no-dependencies
 bin_PROGRAMS=adios_lint
 
 adios_lint_SOURCES = adios_lint.c
-adios_lint_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_SEQ_CPPFLAGS) $(ADIOSLIB_SEQ_CFLAGS)
-adios_lint_LDFLAGS = $(ADIOSLIB_SEQ_LDFLAGS)
+adios_lint_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_INT_CPPFLAGS) $(ADIOSLIB_INT_CFLAGS)
+adios_lint_LDFLAGS = $(ADIOSLIB_INT_LDFLAGS)
 adios_lint_LDADD = $(top_builddir)/src/libadios_internal_nompi.a 
-adios_lint_LDADD += $(ADIOSLIB_SEQ_LDADD)
+adios_lint_LDADD += $(ADIOSLIB_INT_LDADD)
 
 if USE_PARALLEL_COMPILER
     CC=$(MPICC)
diff --git a/utils/adios_lint/Makefile.in b/utils/adios_lint/Makefile.in
index 212d54d..dbfb83e 100644
--- a/utils/adios_lint/Makefile.in
+++ b/utils/adios_lint/Makefile.in
@@ -46,6 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -90,6 +91,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -166,6 +171,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -200,6 +207,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
@@ -305,10 +315,10 @@ target_alias = @target_alias@
 INCLUDES = $(all_includes) -I$(top_builddir)/src
 AUTOMAKE_OPTIONS = no-dependencies
 adios_lint_SOURCES = adios_lint.c
-adios_lint_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_SEQ_CPPFLAGS) $(ADIOSLIB_SEQ_CFLAGS)
-adios_lint_LDFLAGS = $(ADIOSLIB_SEQ_LDFLAGS)
+adios_lint_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_INT_CPPFLAGS) $(ADIOSLIB_INT_CFLAGS)
+adios_lint_LDFLAGS = $(ADIOSLIB_INT_LDFLAGS)
 adios_lint_LDADD = $(top_builddir)/src/libadios_internal_nompi.a \
-	$(ADIOSLIB_SEQ_LDADD)
+	$(ADIOSLIB_INT_LDADD)
 all: all-am
 
 .SUFFIXES:
diff --git a/utils/bp2ascii/Makefile.am b/utils/bp2ascii/Makefile.am
index 2555871..9202a1f 100644
--- a/utils/bp2ascii/Makefile.am
+++ b/utils/bp2ascii/Makefile.am
@@ -6,10 +6,10 @@ AUTOMAKE_OPTIONS = no-dependencies
 bin_PROGRAMS = bp2ascii
 
 bp2ascii_SOURCES = bp2ascii.c 
-bp2ascii_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_SEQ_CPPFLAGS) $(ADIOSLIB_SEQ_CFLAGS)
-bp2ascii_LDFLAGS = $(ADIOSLIB_SEQ_LDFLAGS)
+bp2ascii_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_INT_CPPFLAGS) $(ADIOSLIB_INT_CFLAGS)
+bp2ascii_LDFLAGS = $(ADIOSLIB_INT_LDFLAGS)
 bp2ascii_LDADD = $(top_builddir)/src/libadios_internal_nompi.a
-bp2ascii_LDADD += $(ADIOSLIB_SEQ_LDADD)
+bp2ascii_LDADD += $(ADIOSLIB_INT_LDADD)
 
 if USE_PARALLEL_COMPILER
     CC=$(MPICC)
diff --git a/utils/bp2ascii/Makefile.in b/utils/bp2ascii/Makefile.in
index 490b56e..503b85c 100644
--- a/utils/bp2ascii/Makefile.in
+++ b/utils/bp2ascii/Makefile.in
@@ -46,6 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -89,6 +90,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -165,6 +170,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -199,6 +206,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
@@ -304,10 +314,10 @@ target_alias = @target_alias@
 INCLUDES = $(all_includes) -I$(top_builddir)/src
 AUTOMAKE_OPTIONS = no-dependencies
 bp2ascii_SOURCES = bp2ascii.c 
-bp2ascii_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_SEQ_CPPFLAGS) $(ADIOSLIB_SEQ_CFLAGS)
-bp2ascii_LDFLAGS = $(ADIOSLIB_SEQ_LDFLAGS)
+bp2ascii_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_INT_CPPFLAGS) $(ADIOSLIB_INT_CFLAGS)
+bp2ascii_LDFLAGS = $(ADIOSLIB_INT_LDFLAGS)
 bp2ascii_LDADD = $(top_builddir)/src/libadios_internal_nompi.a \
-	$(ADIOSLIB_SEQ_LDADD)
+	$(ADIOSLIB_INT_LDADD)
 all: all-am
 
 .SUFFIXES:
diff --git a/utils/bp2bp/Makefile.am b/utils/bp2bp/Makefile.am
new file mode 100644
index 0000000..12c24b7
--- /dev/null
+++ b/utils/bp2bp/Makefile.am
@@ -0,0 +1,19 @@
+INCLUDES = $(all_includes)
+INCLUDES += -I$(top_builddir)/src
+
+AUTOMAKE_OPTIONS = no-dependencies
+
+bin_PROGRAMS = bp2bp
+
+bp2bp_SOURCES = bp2bp.c
+bp2bp_CPPFLAGS = $(ADIOSLIB_CPPFLAGS) $(ADIOSLIB_CFLAGS) $(ADIOSLIB_EXTRA_CPPFLAGS) 
+bp2bp_LDFLAGS = $(ADIOSLIB_LDFLAGS) 
+bp2bp_LDADD =  $(top_builddir)/src/libadios.a $(ADIOSLIB_LDADD)
+
+
+#if USE_PARALLEL_COMPILER
+CC=$(MPICC)
+CXX=$(MPICXX)
+#endif
+
+
diff --git a/utils/bp2ascii/Makefile.in b/utils/bp2bp/Makefile.in
similarity index 90%
copy from utils/bp2ascii/Makefile.in
copy to utils/bp2bp/Makefile.in
index 490b56e..1921198 100644
--- a/utils/bp2ascii/Makefile.in
+++ b/utils/bp2bp/Makefile.in
@@ -36,9 +36,9 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-bin_PROGRAMS = bp2ascii$(EXEEXT)
-subdir = utils/bp2ascii
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+bin_PROGRAMS = bp2bp$(EXEEXT)
+subdir = utils/bp2bp
+DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_datatap.m4 \
@@ -46,6 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -64,10 +65,10 @@ CONFIG_CLEAN_FILES =
 am__installdirs = "$(DESTDIR)$(bindir)"
 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(bin_PROGRAMS)
-am_bp2ascii_OBJECTS = bp2ascii-bp2ascii.$(OBJEXT)
-bp2ascii_OBJECTS = $(am_bp2ascii_OBJECTS)
+am_bp2bp_OBJECTS = bp2bp-bp2bp.$(OBJEXT)
+bp2bp_OBJECTS = $(am_bp2bp_OBJECTS)
 am__DEPENDENCIES_1 =
-bp2ascii_DEPENDENCIES = $(top_builddir)/src/libadios_internal_nompi.a \
+bp2bp_DEPENDENCIES = $(top_builddir)/src/libadios.a \
 	$(am__DEPENDENCIES_1)
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
 depcomp =
@@ -80,8 +81,8 @@ LTCOMPILE = $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS) \
 CCLD = $(CC)
 LINK = $(LIBTOOL) --tag=CC --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
 	$(AM_LDFLAGS) $(LDFLAGS) -o $@
-SOURCES = $(bp2ascii_SOURCES)
-DIST_SOURCES = $(bp2ascii_SOURCES)
+SOURCES = $(bp2bp_SOURCES)
+DIST_SOURCES = $(bp2bp_SOURCES)
 ETAGS = etags
 CTAGS = ctags
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -89,6 +90,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -115,15 +120,15 @@ BUILD_FORTRAN_FALSE = @BUILD_FORTRAN_FALSE@
 BUILD_FORTRAN_TRUE = @BUILD_FORTRAN_TRUE@
 BUILD_WRITE_FALSE = @BUILD_WRITE_FALSE@
 BUILD_WRITE_TRUE = @BUILD_WRITE_TRUE@
-CC = @CC@
- at USE_PARALLEL_COMPILER_TRUE@CC = $(MPICC)
+
+#if USE_PARALLEL_COMPILER
+CC = $(MPICC)
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CSH = @CSH@
-CXX = @CXX@
- at USE_PARALLEL_COMPILER_TRUE@CXX = $(MPICXX)
+CXX = $(MPICXX)
 CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
 CXXFLAGS = @CXXFLAGS@
@@ -165,6 +170,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -199,6 +206,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
@@ -303,11 +313,10 @@ sysconfdir = @sysconfdir@
 target_alias = @target_alias@
 INCLUDES = $(all_includes) -I$(top_builddir)/src
 AUTOMAKE_OPTIONS = no-dependencies
-bp2ascii_SOURCES = bp2ascii.c 
-bp2ascii_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_SEQ_CPPFLAGS) $(ADIOSLIB_SEQ_CFLAGS)
-bp2ascii_LDFLAGS = $(ADIOSLIB_SEQ_LDFLAGS)
-bp2ascii_LDADD = $(top_builddir)/src/libadios_internal_nompi.a \
-	$(ADIOSLIB_SEQ_LDADD)
+bp2bp_SOURCES = bp2bp.c
+bp2bp_CPPFLAGS = $(ADIOSLIB_CPPFLAGS) $(ADIOSLIB_CFLAGS) $(ADIOSLIB_EXTRA_CPPFLAGS) 
+bp2bp_LDFLAGS = $(ADIOSLIB_LDFLAGS) 
+bp2bp_LDADD = $(top_builddir)/src/libadios.a $(ADIOSLIB_LDADD)
 all: all-am
 
 .SUFFIXES:
@@ -321,9 +330,9 @@ $(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
 	      exit 1;; \
 	  esac; \
 	done; \
-	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  utils/bp2ascii/Makefile'; \
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu  utils/bp2bp/Makefile'; \
 	cd $(top_srcdir) && \
-	  $(AUTOMAKE) --gnu  utils/bp2ascii/Makefile
+	  $(AUTOMAKE) --gnu  utils/bp2bp/Makefile
 .PRECIOUS: Makefile
 Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
 	@case '$?' in \
@@ -369,9 +378,9 @@ clean-binPROGRAMS:
 	  echo " rm -f $$p $$f"; \
 	  rm -f $$p $$f ; \
 	done
-bp2ascii$(EXEEXT): $(bp2ascii_OBJECTS) $(bp2ascii_DEPENDENCIES) 
-	@rm -f bp2ascii$(EXEEXT)
-	$(LINK) $(bp2ascii_LDFLAGS) $(bp2ascii_OBJECTS) $(bp2ascii_LDADD) $(LIBS)
+bp2bp$(EXEEXT): $(bp2bp_OBJECTS) $(bp2bp_DEPENDENCIES) 
+	@rm -f bp2bp$(EXEEXT)
+	$(LINK) $(bp2bp_LDFLAGS) $(bp2bp_OBJECTS) $(bp2bp_LDADD) $(LIBS)
 
 mostlyclean-compile:
 	-rm -f *.$(OBJEXT)
@@ -388,11 +397,11 @@ distclean-compile:
 .c.lo:
 	$(LTCOMPILE) -c -o $@ $<
 
-bp2ascii-bp2ascii.o: bp2ascii.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bp2ascii_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bp2ascii-bp2ascii.o `test -f 'bp2ascii.c' || echo '$(srcdir)/'`bp2ascii.c
+bp2bp-bp2bp.o: bp2bp.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bp2bp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bp2bp-bp2bp.o `test -f 'bp2bp.c' || echo '$(srcdir)/'`bp2bp.c
 
-bp2ascii-bp2ascii.obj: bp2ascii.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bp2ascii_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bp2ascii-bp2ascii.obj `if test -f 'bp2ascii.c'; then $(CYGPATH_W) 'bp2ascii.c'; else $(CYGPATH_W) '$(srcdir)/bp2ascii.c'; fi`
+bp2bp-bp2bp.obj: bp2bp.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bp2bp_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bp2bp-bp2bp.obj `if test -f 'bp2bp.c'; then $(CYGPATH_W) 'bp2bp.c'; else $(CYGPATH_W) '$(srcdir)/bp2bp.c'; fi`
 
 mostlyclean-libtool:
 	-rm -f *.lo
@@ -570,6 +579,7 @@ uninstall-am: uninstall-binPROGRAMS uninstall-info-am
 	pdf pdf-am ps ps-am tags uninstall uninstall-am \
 	uninstall-binPROGRAMS uninstall-info-am
 
+#endif
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/utils/bp2bp/README b/utils/bp2bp/README
new file mode 100644
index 0000000..c57f9f4
--- /dev/null
+++ b/utils/bp2bp/README
@@ -0,0 +1,2 @@
+converts bp file to bp file in serial
+this will use the MPI method to write...
diff --git a/utils/bp2bp/bp2bp.c b/utils/bp2bp/bp2bp.c
new file mode 100644
index 0000000..4e18ff0
--- /dev/null
+++ b/utils/bp2bp/bp2bp.c
@@ -0,0 +1,963 @@
+/*
+ * in the COPYING file in the top level directory of this source distribution.
+ *
+ * Copyright (c) 2008 - 2009.  UT-BATTELLE, LLC. All rights reserved.
+ */
+
+/* ADIOS bp2bp utility
+ *  read all variables and attributes from
+ *    all groups in a BP file and output this to a adios file
+ *
+ * This is a sequential program.
+ */
+
+
+/* Now we have to get the last plane section working, to divide up any way we want.
+   Then we can divide up the pieces with not just the last dimension, but also the
+   dimension before that.... I.e. we can can make larger chunks....
+   The idea is that we want as few chunks as possible, given the total number of procs
+   which will read in the the data
+ */
+
+#ifndef _GNU_SOURCE
+#   define _GNU_SOURCE
+#endif
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <getopt.h>
+#include <errno.h>
+#include <limits.h>   // LONG_MAX36
+
+#include <math.h>     // NAN
+#include <libgen.h>   // basename
+#include <regex.h>    // regular expression matching
+#include <fnmatch.h>  // shell pattern matching
+
+#include "mpi.h"
+#include "adios_read.h"
+#include "adios_types.h"
+#include "adios.h"
+
+
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
+
+MPI_Comm   comm = MPI_COMM_WORLD;
+int 	   gflag = 10;
+
+
+#define MAX_DIMS 100
+#define DEBUG 0
+#define PERFORMANCE_CHECK 0
+#define verbose 1
+#define TIMING 100
+
+void checkOverflow(int loc, ADIOS_VARINFO* v, uint64_t* s, uint64_t* c);
+int getTypeInfo( enum ADIOS_DATATYPES adiosvartype, int* elemsize);
+void rS(ADIOS_VARINFO* v, uint64_t* s, uint64_t by, int rank);
+void calcC(uint64_t chunk_size, ADIOS_VARINFO* v, uint64_t* c);
+uint64_t calcChunkSize(uint64_t total_size, uint64_t mne, int np);
+uint64_t checkBound(ADIOS_VARINFO* v, uint64_t* s, uint64_t* c, uint64_t* uc, uint64_t chunk_size);
+void arrCopy(uint64_t* from, uint64_t* to);
+
+int main (int argc, char ** argv) {
+	//For varriable definitions:
+	//gbounds = global bounds string, lbounds = local bounds string, offs = offset string, tstring = temp string to hold temperary stuff
+	char       gbounds[1007], lbounds[1007], offs[1007],tstring[100];
+	//size = number of cores,  gidx = adios group index
+	int        rank, size, gidx, i, j, k, ii;
+	enum       ADIOS_DATATYPES attr_type;
+	//data = pointer to read-in data
+	void       * data = NULL;
+	uint64_t   s[] = {0,0,0,0,0,0,0,0,0,0};  //starting offset
+	uint64_t   c[] = {1,1,1,1,1,1,1,1,1,1};  //chunk block array
+	uint64_t   bytes_read = 0;
+	int        element_size;
+	int64_t    new_adios_group, m_adios_file;
+	uint64_t   var_size;  //portion_bound,
+	uint64_t   adios_groupsize, adios_totalsize;
+	int        err;
+	int        read_buffer;        //possible maximum size you the user would like for each chunk in MB
+	int		   write_buffer = 1536;  //actual buffer size you use in MB
+	int        itime;
+	int        WRITEME=1;
+	uint64_t   chunk_size;   //chunk size in # of elements
+	MPI_Init(&argc,&argv);
+	MPI_Comm_rank(comm,&rank);
+	MPI_Comm_size(comm,&size);
+
+	// timing numbers
+	// we will time:
+	// 0: adios_open, adios_group_size
+	// 1: the total time to read in the data
+	// 2: times around each write (will only work if we do NOT buffer....
+	// 3: the time in the close
+	// 4: fopen, fclose
+	// 5: total time
+	// timers: the total I/O time
+	int        timers = 6;
+	double     start_time[timers], end_time[timers], total_time[timers];
+
+	if (TIMING==100) {
+		for (itime=0;itime<timers;itime++) {
+			start_time[itime] = 0;
+			end_time[itime] = 0;
+			total_time[itime]=0;
+		}
+		//MPI_Barrier(MPI_COMM_WORLD);
+		start_time[5] = MPI_Wtime();
+
+
+	}
+
+	if(rank==0)
+		printf("converting...\n");
+
+	if (argc < 5) {
+		if (rank==0) printf("Usage: %s <BP-file> <ADIOS-file> read_buffer(MB) write_buffer(MB) METHOD (LUSTRE_strip_count) (LUSTRE_strip_size) (LUSTRE_block_size)\n", argv[0]);
+		return 1;
+	}
+
+
+
+	if(TIMING==100)
+		start_time[4] = MPI_Wtime();
+	ADIOS_FILE * f = adios_fopen (argv[1], MPI_COMM_SELF);
+	if(TIMING==100){
+		end_time[4] = MPI_Wtime();
+		total_time[4] = end_time[4]-start_time[4];
+	}
+	adios_init_noxml(); // no xml will be used to write the new adios file
+	read_buffer = atoi(argv[3]);
+	write_buffer = atoi(argv[4]);
+	adios_allocate_buffer (ADIOS_BUFFER_ALLOC_NOW, write_buffer); // allocate MB buffer
+
+
+
+	if (f == NULL) {
+		printf("rank=%d, file cant be opened\n", rank);
+		if (DEBUG) printf ("%s\n", adios_errmsg());
+		return -1;
+	}
+
+
+	for (gidx = 0; gidx < f->groups_count; gidx++) {    //group part
+		adios_groupsize = 0;
+		ADIOS_GROUP * g = adios_gopen (f, f->group_namelist[gidx]);
+
+
+		if (g == NULL) {
+			if (DEBUG) printf ("%s\n", adios_errmsg());
+			printf("rank %d: group cannot be opened.\n", rank);
+			return -1;
+		}
+		/* First create all of the groups */
+		// now I need to create this group in the file that will be written
+
+		adios_declare_group(&new_adios_group,f->group_namelist[gidx],"",adios_flag_yes);
+
+
+		if(strcmp(argv[5],"MPI_LUSTRE")!=0)   //see whether or not the user uses MPI_LUSTRE method
+			adios_select_method (new_adios_group, argv[5], "", "");  //non-MPI_LUSTRE methods... like MPI, POSIX....
+		else{
+			char lustre_pars[1000];
+			strcpy(lustre_pars, "");
+			strcat(lustre_pars, "stripe_count=");
+			sprintf(tstring, "%d", atoi(argv[6]));
+			strcat(lustre_pars, tstring);
+			strcat(lustre_pars, ",stripe_size=");
+			sprintf(tstring, "%d", atoi(argv[7]));
+			strcat(lustre_pars, tstring);
+			strcat(lustre_pars, ",block_size=");
+			sprintf(tstring, "%d", atoi(argv[8]));
+			strcat(lustre_pars, tstring);
+
+			if(rank==0)
+				printf("lustre_pars=%s\n", lustre_pars);
+
+			adios_select_method (new_adios_group, argv[5], lustre_pars, "");  //Use MPI Lustre method
+
+		}
+
+
+
+		// variable definition part
+		for (i = 0; i < g->vars_count; i++) {
+		//for (i = 14; i < 15; i++) { // just for testing 1 variable output....
+			ADIOS_VARINFO * v = adios_inq_var_byid (g, i);
+
+			if (v->ndim == 0) {   // scalars: every process does them the same.
+				adios_define_var(new_adios_group,g->var_namelist[i],"",v->type,0,0,0);
+				err = getTypeInfo( v->type, &element_size);    //element_size is size per element based on its type
+				if(v->type == adios_string){  //special case when the scalar is string.
+					adios_groupsize+= strlen(v->value);
+				}else
+					adios_groupsize+= element_size;
+			} else { // vector variables
+
+				err = getTypeInfo( v->type, &element_size);
+				var_size=1;
+				for (ii=0;ii<v->ndim;ii++) {
+					var_size*=v->dims[ii];
+				}
+				uint64_t total_size = var_size;  //total_size tells you the total number of elements in the current vector variable
+				var_size*=element_size; //var_size tells you the size of the current vector variable in bytess
+
+				//re-initialize the s and c variables
+				for(j=0; j<v->ndim; j++){
+					s[j] = 0;
+					c[j] = 1;
+				}
+
+				//find the approximate chunk_size you would like to use.
+				chunk_size = calcChunkSize(total_size, read_buffer*1024*1024/element_size, size);
+
+				//set the chunk block array with the total size as close to chunk_size as possible
+				calcC(chunk_size, v, c);
+
+				chunk_size = 1;
+				for(ii=0; ii<v->ndim; ii++)			//reset chunk_size based on the created c. Now the chunk_size is exact.
+					chunk_size *= c[ii];
+
+				//current step points to where the process is in processing the vector. First sets with respect to rank.
+				uint64_t current_step = rank*chunk_size;
+
+				//First advance the starting point s by current_step. Of course, you don't do it if the current_step exceeds total_size.
+				if(current_step<total_size)
+					rS(v, s, current_step, rank);
+
+				uint64_t elements_defined = 0;  //First, the number of elements you have defined is 0.
+
+				//You (the process) process your part of the vector when your current_step is smaller than the total_size
+				while(current_step < total_size)
+				{
+					//ts, temporary s, is introduced for the sake of the inner do while loop below. Copy s to ts.
+					uint64_t ts[] = {0,0,0,0,0,0,0,0,0,0};
+					arrCopy(s, ts);
+
+					//for every outer while iteration, you always have the whole chunk_size remained to process.
+					uint64_t remain_chunk = chunk_size;
+					if(current_step+chunk_size>total_size) //except when you are nearing the end of the vector....
+						remain_chunk = total_size-current_step;
+
+					//tc, temporary c, is introduced for the sake of the inner do while loop below. Copy s to tc.
+					uint64_t tc[] = {1,1,1,1,1,1,1,1,1,1};
+					arrCopy(c, tc);
+
+					do{
+						//how much of the remain chunk you wanna process? initially you think you can do all of it....
+						uint64_t used_chunk = remain_chunk;
+
+						//you feel like you should process the vector with tc block size, but given ts, you might go over bound.
+						uint64_t uc[] = {1,1,1,1,1,1,1,1,1,1};
+						//so you verify it by setting a new legit chunck block uc, and getting a new remain_chunk.
+						remain_chunk = checkBound(v, ts, tc, uc, remain_chunk);
+
+						//you check whether or not ts+uc goes over the bound. This is just checking to make sure there's no error.
+						//Thereotically, there should be no problem at all.
+						checkOverflow(0, v, ts, uc);
+
+
+						//the below code fragment simply calculates gbounds, and sets place holders for lbounds and offs.
+						strcpy(gbounds,"");
+						strcpy(lbounds,"");
+						strcpy(offs,"");
+
+						for(j=0; j<v->ndim-1; j++){
+							sprintf(tstring, "%d,", (int)v->dims[j]);
+							strcat(gbounds, tstring);
+							sprintf(tstring, "LIN%d,", j);
+							strcat(lbounds, tstring);
+							sprintf(tstring, "OAK%d,", j);
+							strcat(offs, tstring);
+						}
+
+						sprintf(tstring, "%d", (int)v->dims[v->ndim-1]);
+						strcat(gbounds, tstring);
+						sprintf(tstring, "LIN%d", v->ndim-1);
+						strcat(lbounds, tstring);
+						sprintf(tstring, "OAK%d", v->ndim-1);
+						strcat(offs, tstring);
+
+						//sprintf(tstring, "%d", v->ndim);
+						for(j=0; j<v->ndim; j++){
+							sprintf(tstring, "LIN%d", j);
+							adios_define_var(new_adios_group, tstring, "", adios_unsigned_long, 0, 0, 0);
+							sprintf(tstring, "OAK%d", j);
+							adios_define_var(new_adios_group, tstring, "", adios_unsigned_long, 0, 0, 0);
+						}
+
+						adios_define_var(new_adios_group,g->var_namelist[i],"",v->type,lbounds,gbounds,offs);
+
+
+						if (DEBUG){
+							strcpy(lbounds,"");
+							strcpy(offs,"");
+							for(j=0; j<v->ndim; j++){
+								sprintf(tstring, "%lld,", ts[j]);
+								strcat(offs, tstring);
+								sprintf(tstring, "%lld,", uc[j]);
+								strcat(lbounds, tstring);
+							}
+
+							printf("rank=%d, name=%s, gbounds=%s: lbounds=%s: offs=%s \n",rank,g->var_namelist[i],gbounds, lbounds, offs);
+						}
+
+						used_chunk -= remain_chunk; //you get the actual used_chunk here.
+						elements_defined += used_chunk;
+						if(remain_chunk!=0){
+							rS(v, ts, used_chunk, rank);  //advance ts by used_chunk.
+							for(k=0; k<10; k++)
+								tc[k] = 1;
+							calcC(remain_chunk, v, tc);   //based on the remain_chunk, calculate new tc chunk block remained to process.
+						}
+
+						adios_groupsize+= used_chunk*element_size+2*v->ndim*8;
+
+					}while(remain_chunk!=0);
+
+					current_step += size*chunk_size;  //once a whole chunk_size is processed, advance the current_step in roll-robin manner.
+
+					if(current_step<total_size){   //advance s in the same way.
+						rS(v, s, size*chunk_size, rank);
+					}
+				}
+
+				//beside checkOverflow above, here you check whether or not the total number of elements processed across processes matches
+				//the total number of elements in the original vector.
+				if(DEBUG){
+					uint64_t* sb = (uint64_t *) malloc(sizeof(uint64_t));
+					uint64_t* rb = (uint64_t *) malloc(sizeof(uint64_t));
+					sb[0] = elements_defined;
+					MPI_Reduce(sb,rb,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,0, comm);
+
+					if(rank==0 && rb[0]!=total_size)
+						printf("some array define mismatch. please use debug mode\n");
+					free(sb); free(rb);
+				}
+			}
+		} // finished declaring all of the variables
+
+
+		// Now we can define the attributes....
+		for (i = 0; i < g->attrs_count; i++) {
+			enum ADIOS_DATATYPES atype;
+			int  asize;
+			void *adata;
+			adios_get_attr_byid (g, i, &atype, &asize, &adata);
+			// if (DEBUG) printf("attribute name=%s\n",g->attr_namelist[i]);
+			adios_define_attribute(new_adios_group,g->attr_namelist[i],"",atype,adata,0);
+		}
+
+
+
+		/*------------------------------ NOW WE WRITE -------------------------------------------- */
+		// Now we have everything declared... now we need to write them out!!!!!!
+		if (WRITEME==1) {
+			// open up the file for writing....
+			if (DEBUG) printf("rank=%d, opening file = %s, with group %s, size=%lld\n",rank,argv[2],f->group_namelist[gidx],adios_groupsize);
+
+			if(TIMING==100)
+				start_time[0] = MPI_Wtime();
+
+			adios_open(&m_adios_file, f->group_namelist[gidx],argv[2],"w",&comm);
+			adios_group_size( m_adios_file, adios_groupsize, &adios_totalsize);
+
+			//get both the total adios_totalsize and total adios_groupsize summed across processes.
+			uint64_t* sb = (uint64_t *) malloc(sizeof(uint64_t));;
+			uint64_t* rb = (uint64_t *) malloc(sizeof(uint64_t));
+			sb[0] = adios_groupsize;
+			MPI_Reduce(sb,rb,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,0, comm);
+
+			uint64_t* sb2 = (uint64_t *) malloc(sizeof(uint64_t));;
+			uint64_t* rb2 = (uint64_t *) malloc(sizeof(uint64_t));
+			sb2[0] = adios_totalsize;
+			MPI_Reduce(sb2,rb2,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,0, comm);
+			if(rank==0){
+				printf("total adios_totalsize = %lld\n", *rb2);
+				printf("total adios_groupsize = %lld\n", *rb);
+			}
+			free(sb); free(rb); free(sb2); free(rb2);
+
+			if (TIMING==100) {
+				end_time[0] = MPI_Wtime();
+				total_time[0]+=end_time[0] - start_time[0];    //variable definition time taken
+			}
+
+			// now we have to write out the variables.... since they are all declared now
+			// This will be the place we actually write out the data!!!!!!!!
+			for (i = 0; i < g->vars_count; i++) {
+			//for (i = 14; i < 15;i++) {
+				ADIOS_VARINFO * v = adios_inq_var_byid (g, i);
+				if (v->ndim == 0) {
+
+					if (TIMING==100) {
+						start_time[2] = MPI_Wtime();
+					}
+					adios_write(m_adios_file,g->var_namelist[i],v->value);
+					if (TIMING==100) {
+						end_time[2] = MPI_Wtime();
+						total_time[2]+=end_time[2] - start_time[2];     //IO write time...
+					}
+				} else {
+					for(j=0; j<v->ndim; j++){
+						s[j] = 0;
+						c[j] = 1;
+					}
+					err = getTypeInfo( v->type, &element_size);
+
+					uint64_t total_size = 1;
+					for (ii=0;ii<v->ndim;ii++)
+						total_size*=v->dims[ii];
+
+					chunk_size = calcChunkSize(total_size, read_buffer*1024*1024/element_size, size);
+					calcC(chunk_size, v, c);
+					chunk_size = 1;
+					for(ii=0; ii<v->ndim; ii++)
+						chunk_size *= c[ii];
+
+
+					uint64_t current_step = rank*chunk_size;
+					if(current_step<total_size)
+						rS(v, s, current_step, rank);
+
+					uint64_t elements_written = 0;
+
+					while(current_step < total_size)
+					{
+						uint64_t ts[] = {0,0,0,0,0,0,0,0,0,0};
+						arrCopy(s, ts);
+						uint64_t remain_chunk = chunk_size;
+						if(current_step+chunk_size>total_size)
+							remain_chunk = total_size-current_step;
+						uint64_t tc[] = {1,1,1,1,1,1,1,1,1,1};
+						arrCopy(c, tc);
+
+						do{
+							uint64_t uc[] = {1,1,1,1,1,1,1,1,1,1};
+							uint64_t used_chunk = remain_chunk;
+							remain_chunk = checkBound(v, ts, tc, uc, remain_chunk);
+
+							checkOverflow(1, v, ts, uc);
+
+							used_chunk -= remain_chunk;
+							elements_written += used_chunk;
+
+							//allocated space for data read-in
+							data = (void *) malloc(used_chunk*element_size);
+
+							if (TIMING==100) {
+								start_time[1] = MPI_Wtime();
+							}
+							if(PERFORMANCE_CHECK) printf("rank=%d, read start\n",rank);
+							bytes_read = adios_read_var_byid(g,v->varid,ts,uc,data);
+							if(PERFORMANCE_CHECK) printf("rank=%d, read end\n",rank);
+							if (TIMING==100) {
+								end_time[1] = MPI_Wtime();
+								total_time[1]+=end_time[1] -start_time[1];      //IO read time
+							}
+
+							if (DEBUG)
+								printf ("ADIOS WRITE: rank=%d, name=%s datasize=%d\n",rank,g->var_namelist[i],bytes_read);
+
+
+							if (TIMING==100) {
+								start_time[2] = MPI_Wtime();
+							}
+							if (DEBUG){
+								printf("rank=%d, write ts=",rank);
+								int k;
+								for(k=0; k<v->ndim; k++)
+									printf("%d,", ts[k]);
+								printf("  uc=");
+								for(k=0; k<v->ndim; k++)
+									printf("%d,", uc[k]);
+								printf("\n");
+							}
+
+							//local bounds and offets placeholders are not written out with actual values.
+							if(PERFORMANCE_CHECK) printf("rank=%d, adios write start\n", rank);
+							for(k=0; k<v->ndim; k++){
+								sprintf(tstring, "LIN%d", k);
+								adios_write(m_adios_file, tstring, &uc[k]);
+								sprintf(tstring, "OAK%d", k);
+								adios_write(m_adios_file, tstring, &ts[k]);
+							}
+							adios_write(m_adios_file,g->var_namelist[i],data);
+							if(PERFORMANCE_CHECK) printf("rank=%d, adios write end\n", rank);
+
+
+							if (TIMING==100) {
+								end_time[2] = MPI_Wtime();
+								total_time[2]+=end_time[2] - start_time[2];   //IO write time
+							}
+
+							free(data);
+
+
+							if(remain_chunk!=0){
+								rS(v, ts, used_chunk, rank);
+								for(k=0; k<10; k++)
+									tc[k] = 1;
+								calcC(remain_chunk, v, tc);
+							}
+
+						}while(remain_chunk!=0);
+
+						current_step += size*chunk_size;
+
+						if(current_step<total_size)
+							rS(v, s, size*chunk_size,rank);
+					}
+
+					if(DEBUG){
+						uint64_t* sb = (uint64_t *) malloc(sizeof(uint64_t));;
+						uint64_t* rb = (uint64_t *) malloc(sizeof(uint64_t));
+						sb[0] = elements_written;
+						MPI_Reduce(sb,rb,1,MPI_UNSIGNED_LONG_LONG,MPI_SUM,0, comm);
+						if(rank==0 && rb[0]!=total_size)
+							printf("some array read mismatch. please use debug mode\n");
+						free(sb); free(rb);
+					}
+				}
+			}// end of the writing of the variable..
+			if (TIMING==100) {
+				start_time[3] = MPI_Wtime();
+			}
+			if(PERFORMANCE_CHECK) printf("rank=%d, adios_close start\n", rank);
+			adios_close(m_adios_file);
+			if(PERFORMANCE_CHECK) printf("rank=%d, adios_close end\n", rank);
+			if (TIMING==100) {
+				end_time[3] = MPI_Wtime();
+				total_time[3]+=end_time[3] - start_time[3];
+			}
+			adios_gclose(g);
+		} //end of WRITEME
+	} // end of all of the groups
+
+	if(rank==0)
+		printf("conversion done!\n");
+
+	if(TIMING==100)
+		start_time[4] = MPI_Wtime();
+	adios_fclose(f);
+	if(TIMING==100){
+		end_time[4] = MPI_Wtime();
+		total_time[4] = total_time[4]+end_time[4]-start_time[4];
+	}
+	adios_finalize(rank);
+
+
+	// now, we write out the timing data, for each category, we give max, min, avg, std, all in seconds, across all processes.
+	if(TIMING==100){
+
+		// 0: adios_open, adios_group_size
+		// 1: the total time to read in the data
+		// 2: times around each write (will only work if we do NOT buffer....
+		// 3: the time in the close
+		// 4: fopen, fclose
+		// 5: total time
+		end_time[5] = MPI_Wtime();
+		total_time[5] = end_time[5] - start_time[5];
+
+		double sb[7];
+		sb[0] = total_time[1]; sb[1] = total_time[4];   //read_var, fopen+fclose
+		sb[2] = sb[0]+sb[1];
+		sb[3] = total_time[0]; sb[4] = total_time[2]+total_time[3]; //adios_open+adios_group_size, write+close
+		sb[5] = sb[3]+sb[4];
+		sb[6] = total_time[5]; //total
+
+		double * rb;
+
+		if(rank==0)
+			rb = (double *)malloc(size*7*sizeof(double));
+		//MPI_Barrier(comm);
+		MPI_Gather(sb, 7, MPI_DOUBLE, rb, 7, MPI_DOUBLE, 0, comm);
+
+		if(rank==0){
+			double read_avg1 = 0;
+			double read_avg2 = 0;
+			double tread_avg = 0;
+			double write_avg1 = 0;
+			double write_avg2 = 0;
+			double twrite_avg = 0;
+			double total_avg = 0;
+			for(j=0; j<size; j++){
+				read_avg1 += rb[7*j];
+				read_avg2 += rb[7*j+1];
+				tread_avg += rb[7*j+2];
+				write_avg1 += rb[7*j+3];
+				write_avg2 += rb[7*j+4];
+				twrite_avg += rb[7*j+5];
+				total_avg += rb[7*j+6];
+			}
+			read_avg1 /= size;
+			read_avg2 /= size;
+			tread_avg /= size;
+			write_avg1 /= size;
+			write_avg2 /= size;
+			twrite_avg /= size;
+			total_avg /= size;
+
+			double read1_max = rb[0];
+			double read1_min = rb[0];
+			double read1_std = rb[0]-read_avg1; read1_std *= read1_std;
+
+			double read2_max = rb[1];
+			double read2_min = rb[1];
+			double read2_std = rb[1]-read_avg2; read2_std *= read2_std;
+
+			double tread_max = rb[2];
+			double tread_min = rb[2];
+			double tread_std = rb[2]-tread_avg; tread_std *= tread_std;
+
+			double write1_max = rb[3];
+			double write1_min = rb[3];
+			double write1_std = rb[3]-write_avg1; write1_std *= write1_std;
+
+			double write2_max = rb[4];
+			double write2_min = rb[4];
+			double write2_std = rb[4]-write_avg2; write2_std *= write2_std;
+
+			double twrite_max = rb[5];
+			double twrite_min = rb[5];
+			double twrite_std = rb[5]-twrite_avg; twrite_std *= twrite_std;
+
+			double total_max = rb[6];
+			double total_min = rb[6];
+			double total_std = rb[6]-total_avg; total_std *= total_std;
+
+			for(j=1; j<size; j++){
+				if(rb[7*j]>read1_max)
+					read1_max = rb[7*j];
+				else if(rb[7*j]<read1_min)
+					read1_min = rb[7*j];
+				double std = rb[7*j]-read_avg1; std *= std;
+				read1_std += std;
+
+				if(rb[7*j+1]>read2_max)
+					read2_max = rb[7*j+1];
+				else if(rb[7*j+1]<read2_min)
+					read2_min = rb[7*j+1];
+				std = rb[7*j+1]-read_avg2; std *= std;
+				read2_std += std;
+
+				if(rb[7*j+2]>tread_max)
+					tread_max = rb[7*j+2];
+				else if(rb[7*j+2]<tread_min)
+					tread_min = rb[7*j+2];
+				std = rb[7*j+2]-tread_avg; std *= std;
+				tread_std += std;
+
+				if(rb[7*j+3]>write1_max)
+					write1_max = rb[7*j+3];
+				else if(rb[7*j+3]<write1_min)
+					write1_min = rb[7*j+3];
+				std = rb[7*j+3]-write_avg1; std *= std;
+				write1_std += std;
+
+				if(rb[7*j+4]>write2_max)
+					write2_max = rb[7*j+4];
+				else if(rb[7*j+4]<write2_min)
+					write2_min = rb[7*j+4];
+				std = rb[7*j+4]-write_avg2; std *= std;
+				write2_std += std;
+
+				if(rb[7*j+5]>twrite_max)
+					twrite_max = rb[7*j+5];
+				else if(rb[7*j+5]<twrite_min)
+					twrite_min = rb[7*j+5];
+				std = rb[7*j+5]-twrite_avg; std *= std;
+				twrite_std += std;
+
+				if(rb[7*j+6]>total_max)
+					total_max = rb[7*j+6];
+				else if(rb[7*j+6]<total_min)
+					total_min = rb[7*j+6];
+				std = rb[7*j+6]-total_avg; std *= std;
+				total_std += std;
+			}
+			read1_std /= size;  read1_std = sqrt(read1_std);
+			read2_std /= size;  read2_std = sqrt(read2_std);
+			tread_std /= size;	tread_std = sqrt(tread_std);
+			write1_std /= size; write1_std = sqrt(write1_std);
+			write2_std /= size; write2_std = sqrt(write2_std);
+			twrite_std /= size;	twrite_std = sqrt(twrite_std);
+			total_std /= size; total_std = sqrt(total_std);
+
+			printf("---type---                       max\tmin\tavg\tstd\n");
+			printf("---read_var---                   %lf\t%lf\t%lf\t%lf\n", read1_max, read1_min, read_avg1, read1_std);
+			printf("---fopen+fclose---               %lf\t%lf\t%lf\t%lf\n", read2_max, read2_min, read_avg2, read2_std);
+			printf("---total_read---                 %lf\t%lf\t%lf\t%lf\n", tread_max, tread_min, tread_avg, tread_std);
+			printf("---adios_open+adios_groupsize--- %lf\t%lf\t%lf\t%lf\n", write1_max, write1_min, write_avg1, write1_std);
+			printf("---write+close---                %lf\t%lf\t%lf\t%lf\n", write2_max, write2_min, write_avg2, write2_std);
+			printf("---total_write---                %lf\t%lf\t%lf\t%lf\n", twrite_max, twrite_min, twrite_avg, twrite_std);
+			printf("---total---                      %lf\t%lf\t%lf\t%lf\n", total_max, total_min, total_avg, total_std);
+			free(rb);
+
+		}
+
+	}
+
+	//	if (TIMING==100 && rank==0) {
+	//		printf("------------------------------------------------------------------\n");
+	//		printf("Define variables     = %lf\n",total_time[0]);
+	//		printf("Read   variables     = %lf\n",total_time[1]);
+	//		printf("Write  variables     = %lf\n",total_time[2]);
+	//		printf("Close File for write = %lf\n",total_time[3]);
+	//		printf("Total write time     = %lf\n",total_time[2] + total_time[3]);
+	//		for (itime=0;itime<timers-1;itime++)
+	//			total_time[timers-1]+=total_time[itime];
+	//		printf("Total I/O time       = %lf\n",total_time[timers-1]);
+	//	}
+	MPI_Finalize();
+
+
+	return(0);
+}
+
+//check whether or not s+c goes over the global bound of v
+//input:
+//loc (tell you whether the overflow occurs, var definition or read/write)
+//v (var info)
+//s (offsets array)
+//c (chunk block / local bounds array)
+
+void checkOverflow(int loc, ADIOS_VARINFO* v, uint64_t* s, uint64_t* c) {
+	int j;
+	for(j=0; j<v->ndim; j++){
+		if(s[j]+c[j]>v->dims[j]){
+			if(loc==0)
+				printf("in define: ");
+			else //loc == 1
+				printf("in read/write: ");
+			printf("bound overflow happened. use debug mode\n");
+		}
+	}
+}
+
+//tell you what the size per element is based on the type
+//input:
+//adiosvartype (variable type structure)
+//elemsize (pointer to the element size that you should set)
+//output:
+//tells you whether or not the adiosvartype is known.
+
+int getTypeInfo( enum ADIOS_DATATYPES adiosvartype, int* elemsize){
+
+	switch(adiosvartype) {
+	case adios_unsigned_byte:
+		*elemsize = 1;
+		break;
+	case adios_byte:
+		*elemsize = 1;
+		break;
+	case adios_string:
+		*elemsize = 1;
+		break;
+
+	case adios_unsigned_short:
+		*elemsize = 2;
+		break;
+	case adios_short:
+		*elemsize = 2;
+		break;
+
+	case adios_unsigned_integer:
+		*elemsize = 4;
+		break;
+	case adios_integer:
+		*elemsize = 4;
+		break;
+
+	case adios_unsigned_long:
+		*elemsize = 8;
+		break;
+	case adios_long:
+		*elemsize = 8;
+		break;
+
+	case adios_real:
+		*elemsize = 4;
+		break;
+
+	case adios_double:
+		*elemsize = 8;
+		break;
+
+	case adios_complex:
+		*elemsize = 8;
+		break;
+
+	case adios_double_complex:
+		*elemsize = 16;
+		break;
+
+	case adios_long_double: // do not know how to print
+		//*elemsize = 16;
+	default:
+		return 1;
+	}
+	return 0;
+}
+
+
+//advance s by "by" number of elements.
+//NOTE: you have to first make sure "by" doesn't go over "s" yourself. The function doesn't check this. If not, it could lead to error.
+//input:
+//v (variable info pointer)
+//s (offset array pointer to start from)
+//by (by how much elements do you want to advance?)
+//rank (rank of your process)
+
+void rS(ADIOS_VARINFO* v, uint64_t* s, uint64_t by, int rank){
+
+	int q;
+	uint64_t bulk = 1;
+
+	for(q=1; q<v->ndim; q++)
+		bulk *= v->dims[q];
+
+	for(q=0; q<v->ndim; q++){
+
+		//if(bulk == 0)
+		//break;
+
+		if(by == 0)
+			break;
+
+		uint64_t inc = by/bulk;
+
+		if(inc >= 1){
+
+			if(s[q]+inc<v->dims[q]){
+				s[q] += inc;
+			}else{
+				//s[q-1]++;
+
+				uint64_t r = 1;
+				while(1){
+					if(s[q-r]+1 < v->dims[q-r]){
+						s[q-r]++;
+						break;
+					}else{
+						s[q-r] = 0;
+						r++;
+					}
+				}
+
+				uint64_t uinc = v->dims[q]-s[q];
+				uint64_t new_inc = inc - uinc;
+				s[q] = new_inc;
+			}
+			by -= inc*bulk;
+
+		}
+
+
+		if(q+1<v->ndim)
+			bulk /= v->dims[q+1];
+	}
+
+}
+
+
+//set chunk array block "c" based on the advised chunk_size
+//NOTE: c has to be all 1's; otherwise, there would be error.
+//input:
+//chunk_size (advised chunk_size)
+//v (variable info pointer)
+//c (chunk array block you want to set)
+
+void calcC(uint64_t chunk_size, ADIOS_VARINFO* v, uint64_t* c){
+	int i;
+	uint64_t tot = 1;
+	uint64_t t;
+	for(i=v->ndim-1; i>=0; i--){
+
+		if(v->dims[i]*tot<=chunk_size){
+			c[i] = v->dims[i];
+			tot *= v->dims[i];
+		}else{
+			t = chunk_size/tot;
+			c[i] = t;
+			break;
+		}
+	}
+
+}
+
+
+//Calculate rough best estimate for chunk_size
+//Input:
+//total_size (total number of elements in the array)
+//mne (maximum number of elements per for the chunk_size)
+//np (number of cores you have)
+//Output:
+//chunk_size (in terms of the number of elements)
+
+uint64_t calcChunkSize(uint64_t total_size, uint64_t mne, int np){
+
+	uint64_t chunk_size = 0;
+	if((total_size/np) <= mne)
+		chunk_size = total_size/np;
+	else
+		chunk_size = mne;
+
+	if(chunk_size<1)
+		chunk_size = 1;
+
+	return chunk_size;
+
+}
+
+//based on the the theoretical c you want to use, this function gives the real c, "uc" that you can use for the local bounds,
+//without going out of the global bounds, starting from offset s
+//NOTE: uc has to be all 1's
+//Input:
+//v (variable info pointer)
+//s (offset pointer)
+//c (chunk array block you want to use)
+//uc (real chunk array calculated that you can use as local bounds)
+//chunk_size (basically the product of dimensions of c)
+//Output:
+//remain_chunk (the number of elements still left to process after you process uc block of elements)
+
+uint64_t checkBound(ADIOS_VARINFO* v, uint64_t* s, uint64_t* c, uint64_t* uc, uint64_t chunk_size){
+	int i;
+	uint64_t remain_chunk = chunk_size;
+	int used_chunk = 1;
+	for(i=v->ndim-1;i>=0;i--){
+		if(s[i]+c[i]-1>=v->dims[i]){
+			uc[i] = v->dims[i]-s[i];
+			break;
+		}
+		uc[i] = c[i];
+	}
+
+	int j;
+
+	for(j=0; j<v->ndim; j++)
+		used_chunk *= uc[j];
+	remain_chunk -= used_chunk;
+
+	return remain_chunk;
+
+}
+
+
+//copy elements from "from" to "to"
+
+void arrCopy(uint64_t* from, uint64_t* to){
+	int i;
+	for(i=0; i<10; i++)
+		to[i] = from[i];
+}
diff --git a/utils/bp2h5/Makefile.am b/utils/bp2h5/Makefile.am
index 1570845..c0d9ac8 100644
--- a/utils/bp2h5/Makefile.am
+++ b/utils/bp2h5/Makefile.am
@@ -5,16 +5,15 @@ AUTOMAKE_OPTIONS = no-dependencies
 
 bin_PROGRAMS = bp2h5
 
-bp2h5_SOURCES = bp2h5.c hw-utils.c
+bp2h5_SOURCES = bp2h5.c
+bp2h5_CPPFLAGS = -DH5_USE_16_API $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSREADLIB_SEQ_CPPFLAGS) $(ADIOSREADLIB_SEQ_CFLAGS ) $(HDF5_CPPFLAGS)
+bp2h5_LDFLAGS = $(ADIOSREADLIB_SEQ_LDFLAGS)  $(HDF5_LDFLAGS)
+bp2h5_LDADD = $(top_builddir)/src/libadiosread_nompi.a 
 
-bp2h5_CPPFLAGS = -DH5_USE_16_API $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_SEQ_CPPFLAGS) $(ADIOSLIB_SEQ_CFLAGS)
-bp2h5_LDFLAGS = $(ADIOSLIB_SEQ_LDFLAGS) -static-libtool-libs
-bp2h5_LDADD = $(top_builddir)/src/libadios_internal_nompi.a
-bp2h5_LDADD += $(ADIOSLIB_SEQ_LDADD)
+bp2h5_LDADD += $(ADIOSREADLIB_SEQ_LDADD) 
+bp2h5_LDADD += $(HDF5_LIBS)
+
+#CC=$(MPICC)
+#CXX=$(MPICXX)
 
-EXTRA_DIST = hw-utils.h
-if USE_PARALLEL_COMPILER
-    CC=$(MPICC)
-    CXX=$(MPICXX)
-endif
 
diff --git a/utils/bp2h5/Makefile.in b/utils/bp2h5/Makefile.in
index f12e09a..c0f329d 100644
--- a/utils/bp2h5/Makefile.in
+++ b/utils/bp2h5/Makefile.in
@@ -46,6 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -64,11 +65,11 @@ CONFIG_CLEAN_FILES =
 am__installdirs = "$(DESTDIR)$(bindir)"
 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
 PROGRAMS = $(bin_PROGRAMS)
-am_bp2h5_OBJECTS = bp2h5-bp2h5.$(OBJEXT) bp2h5-hw-utils.$(OBJEXT)
+am_bp2h5_OBJECTS = bp2h5-bp2h5.$(OBJEXT)
 bp2h5_OBJECTS = $(am_bp2h5_OBJECTS)
 am__DEPENDENCIES_1 =
-bp2h5_DEPENDENCIES = $(top_builddir)/src/libadios_internal_nompi.a \
-	$(am__DEPENDENCIES_1)
+bp2h5_DEPENDENCIES = $(top_builddir)/src/libadiosread_nompi.a \
+	$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
 depcomp =
 am__depfiles_maybe =
@@ -89,6 +90,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -116,14 +121,12 @@ BUILD_FORTRAN_TRUE = @BUILD_FORTRAN_TRUE@
 BUILD_WRITE_FALSE = @BUILD_WRITE_FALSE@
 BUILD_WRITE_TRUE = @BUILD_WRITE_TRUE@
 CC = @CC@
- at USE_PARALLEL_COMPILER_TRUE@CC = $(MPICC)
 CCDEPMODE = @CCDEPMODE@
 CFLAGS = @CFLAGS@
 CPP = @CPP@
 CPPFLAGS = @CPPFLAGS@
 CSH = @CSH@
 CXX = @CXX@
- at USE_PARALLEL_COMPILER_TRUE@CXX = $(MPICXX)
 CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
 CXXFLAGS = @CXXFLAGS@
@@ -165,6 +168,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -199,6 +204,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
@@ -303,12 +311,11 @@ sysconfdir = @sysconfdir@
 target_alias = @target_alias@
 INCLUDES = $(all_includes) -I$(top_builddir)/src
 AUTOMAKE_OPTIONS = no-dependencies
-bp2h5_SOURCES = bp2h5.c hw-utils.c
-bp2h5_CPPFLAGS = -DH5_USE_16_API $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_SEQ_CPPFLAGS) $(ADIOSLIB_SEQ_CFLAGS)
-bp2h5_LDFLAGS = $(ADIOSLIB_SEQ_LDFLAGS) -static-libtool-libs
-bp2h5_LDADD = $(top_builddir)/src/libadios_internal_nompi.a \
-	$(ADIOSLIB_SEQ_LDADD)
-EXTRA_DIST = hw-utils.h
+bp2h5_SOURCES = bp2h5.c
+bp2h5_CPPFLAGS = -DH5_USE_16_API $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSREADLIB_SEQ_CPPFLAGS) $(ADIOSREADLIB_SEQ_CFLAGS ) $(HDF5_CPPFLAGS)
+bp2h5_LDFLAGS = $(ADIOSREADLIB_SEQ_LDFLAGS)  $(HDF5_LDFLAGS)
+bp2h5_LDADD = $(top_builddir)/src/libadiosread_nompi.a \
+	$(ADIOSREADLIB_SEQ_LDADD) $(HDF5_LIBS)
 all: all-am
 
 .SUFFIXES:
@@ -395,12 +402,6 @@ bp2h5-bp2h5.o: bp2h5.c
 bp2h5-bp2h5.obj: bp2h5.c
 	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bp2h5_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bp2h5-bp2h5.obj `if test -f 'bp2h5.c'; then $(CYGPATH_W) 'bp2h5.c'; else $(CYGPATH_W) '$(srcdir)/bp2h5.c'; fi`
 
-bp2h5-hw-utils.o: hw-utils.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bp2h5_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bp2h5-hw-utils.o `test -f 'hw-utils.c' || echo '$(srcdir)/'`hw-utils.c
-
-bp2h5-hw-utils.obj: hw-utils.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bp2h5_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bp2h5-hw-utils.obj `if test -f 'hw-utils.c'; then $(CYGPATH_W) 'hw-utils.c'; else $(CYGPATH_W) '$(srcdir)/hw-utils.c'; fi`
-
 mostlyclean-libtool:
 	-rm -f *.lo
 
@@ -577,6 +578,9 @@ uninstall-am: uninstall-binPROGRAMS uninstall-info-am
 	pdf pdf-am ps ps-am tags uninstall uninstall-am \
 	uninstall-binPROGRAMS uninstall-info-am
 
+
+#CC=$(MPICC)
+#CXX=$(MPICXX)
 # Tell versions [3.59,3.63) of GNU make to not export all variables.
 # Otherwise a system limit (for SysV at least) may be exceeded.
 .NOEXPORT:
diff --git a/utils/bp2h5/README b/utils/bp2h5/README
index 5fe158d..ad8f1c0 100644
--- a/utils/bp2h5/README
+++ b/utils/bp2h5/README
@@ -1,91 +1 @@
-08/07/2008 by zf2:
-Changes made:
-1. Migrate to new BP format.
-2. -c option is removed. host-language information is extracted from header.
-3. Known issue: cannot handle attribute whose value is a var.
-
-06/11/2008 by zf2:
-
-Changes made: 
-1. Replace br_get_next_element_general() with br_get_next_element_specific() 
-   for parsing bp files. br_get_next_element_general() uses a fix-sized buffer
-   for reading dataset and scalar data values. br_get_next_element_specific() 
-   has a pre_element_fetch callback to allocate read buffer on demand before 
-   reading. 
-
-2. Add a set of config flags to customize the converter:
-   - array_dim_order_fortran: 
-      transpose array dimension order if using Fortran convention; otherwise 
-      keep order unchanged.
-   - attr_str_ds_fortran: convert string-typed dataset attribute to HDF5 type
-      H5T_FORTRAN_S1 if using Fortran convention; otherwise convert to 
-      HDF5 type H5T_C_S1_g.
-   - attr_str_gp_fortran: 
-      convert string-typed group attribute to HDF5 type H5T_FORTRAN_S1 if using
-      Fortran convention; otherwise convert to HDF5 type H5T_C_S1_g.
-   - scalar_dataspace: 
-      write scalar variable/attribute in a scalar dataspace or in a single 
-      element array.
-
-3. Add two command line options to set above-mentioned config flag
-   -c config_file, --config=config_file:  
-   If the host-language parameter in config file is "Fortran", then set 
-   array_dim_order_fortran, attr_str_ds_fortran and attr_str_gp_fortran to use
-   Fortran convention; otherwise set them to use C convention
-   --scalar_as_array: 
-   If this option is specified, then set scalar_dataspace to write scalar 
-   variable/attribute in a single element array. If not specified, a scalar 
-   variable/attribute is written in a scalar dataspace. 
-
-4. Fix a bug in hw_dset(): check dims [0].global_bound to decide if a dataset
-   has global bounds, instead of dims [i].global_bound (line: 141)       
-
-5. Add install target in Makefile. 
-
-Known Issues:
-1. Although br_get_next_element_specific() can re-allocate read buffer when 
-   needed, it still requires to read in all bytes at once. This may be 
-   impossible for very large datasets. The root cause of this is that the 
-   br_read_buffer() function in br-utils.c in ADIOS makes a single read() call. 
-
-2. bp2h5 assumes that when writing an attribute, the dataset/group to which 
-   this attribute is attached is already creaded in h5 file. If this is not 
-   the case, bp2h5 would create a single-element-array dataset and attach the 
-   attribute to it. This is a bug. However, since currently all bp file writing
-   routines (including those in adios_posix, adios_mpi, and adios_mpi_cio) 
-   write all vars before writing attributes, this bug is never touched. 
-
-
-TODO:
-1. Since HDF5 provides a rich set of data types, the mapping of ADIOS data 
-   types to HDF5 data types is not deterministic. Currently the mapping is 
-   hard-coded, but it may need to be more flexible. 
-
-2. More careful error checking and handling.
-
-Usage:
-
-bp2h5:
-    Convert a bp file to h5 file.
-
-USAGE: bp2h5 [OPTION] bp_file [h5_file]
-
-    bp2h5 converts an bp file nameed by bp_file to a h5 file named by h5_file.
-    If h5_file is not specified, the generated h5 file is named by the basename
-    of bp_file suffixed by ".h5".
-
-OPTION:
-    -c config_file, --config=config_file
-        (Optional) Specify the XML config file which defines ADIOS groups in bp
-         file. If not specified, the default is "./config.xml"
-    --scalar_as_array
-        (Optional) Write a scalar variable or attribute in a single-element
-        array. If not specified, a scalar variable/attribute is written in a
-        scalar dataspace.
-    -V, --verbose
-        (Optional) Print detailed information during conversion.
-    -h, --help
-        (Optional) Print usage information and exit.
-
-
-
+converts bp file to hdf5 in serial
diff --git a/utils/bp2h5/bp2h5.c b/utils/bp2h5/bp2h5.c
index fe65e58..9fdf363 100644
--- a/utils/bp2h5/bp2h5.c
+++ b/utils/bp2h5/bp2h5.c
@@ -1,115 +1,618 @@
-/* 
+/*  
  * ADIOS is freely available under the terms of the BSD license described
  * in the COPYING file in the top level directory of this source distribution.
  *
  * Copyright (c) 2008 - 2009.  UT-BATTELLE, LLC. All rights reserved.
  */
 
+/* ADIOS bp2h5v2 utility 
+ *  read all variables and attributes from 
+ *    all groups in a BP file and output this to a hdf5 file
+ *
+ * This is a sequential program.
+ */
+
+
+#ifndef _GNU_SOURCE
+#   define _GNU_SOURCE
+#endif
+
+
+#include <stdlib.h>
 #include <stdio.h>
+#include <stdint.h>
+#include <unistd.h>
 #include <string.h>
-#include <stdlib.h>
-#include "hw-utils.h"
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <getopt.h>
+#include <errno.h>
+#include <limits.h>   // LONG_MAX
+#include <math.h>     // NAN
+#include <libgen.h>   // basename
+#include <regex.h>    // regular expression matching
+#include <fnmatch.h>  // shell pattern matching
 
-void print_usage() 
-{
-    printf("bp2h5:\n");
-    printf("    Convert a bp file to h5 file.\n");
-    printf("\nUSAGE: bp2h5 [OPTION] bp_file [h5_file]\n\n");
-    printf("    bp2h5 converts a bp file named by bp_file to a h5 file named by h5_file.\n");
-    printf("    If h5_file is not specified, the generated h5 file is named by the basename\n"
-           "    of bp_file suffixed by \".h5\".\n");
-    printf("\nOPTION:\n");
-    printf("    --scalar_as_array\n");
-    printf("        (Optional) Write a scalar variable or attribute in a single-element \n"
-           "        array. If not specified, a scalar variable/attribute is written in a\n"
-           "        scalar dataspace.\n");
-    printf("    -V, --verbose\n");
-    printf("        (Optional) Print detailed information during conversion.\n");
-    printf("    -h, --help\n");
-    printf("        (Optional) Print usage information and exit.\n");
-    printf("\n");
-}
+#include "adios_read.h"
+#include "adios_types.h"
 
-/*
- * parse_cmdline() function parses command line arguments. 
- * It returns 0 if no error is encountered and -1 otherwise.
- */
-int parse_cmdline(int argc, char **argv
-                 ,char **bp_filename
-				 ,char **h5_filename
-				 ,enum scalar_convention *scalar_as_array
-				 ,enum verbose_level *verb                   
-                 ) 
+#include "hdf5.h"
+//#include "hdf5_hl.h"
+
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
+
+typedef int bool;
+#define false 0
+#define true  1
+
+bool noindex = false;              // do no print array indices with data
+bool printByteAsChar = false;      // print 8 bit integer arrays as string
+bool formatgiven = false;           // true if format string is provided as argument
+int  ncols = 6; // how many values to print in one row (only for -p)
+char format[32];            // format string for one data element (e.g. %6.2f)
+
+hid_t       HDF5_FILE;
+
+
+//#define MAX_BUFFERSIZE 81 
+#define MAX_BUFFERSIZE 10485760
+#define MAX_DIMS 20
+#define GMAX 100 
+#define DEBUG 0
+#define verbose 1
+
+
+int  istart[MAX_DIMS], icount[MAX_DIMS], ndimsspecified=0;
+
+
+int bp_getH5TypeId(enum ADIOS_DATATYPES type, hid_t* h5_type_id);
+int getTypeInfo( enum ADIOS_DATATYPES adiosvartype, int* elemsize);
+int readVar(ADIOS_GROUP *gp, ADIOS_VARINFO *vi, const char * name);
+const char * value_to_string (enum ADIOS_DATATYPES type, void * data, int idx);
+char** bp_dirparser(char *str, int *nLevel);
+
+int main (int argc, char ** argv)  
 {
-    int i = 1;
-    int found_bp_file = 0;
-    int found_h5_file = 0;
-    int found_config_file = 0;
-    
-    *scalar_as_array = USE_SCALAR;
-    *verb = NO_INFO;
-
-    if(argc < 2) {
-        print_usage();
-        return -1;
+    char        filename [256]; 
+    int         rank, size, gidx, i, j, k,l;
+    MPI_Comm    comm_dummy = 0;  /* MPI_Comm is defined through adios_read.h */
+    enum ADIOS_DATATYPES attr_type;
+    void      * data = NULL;
+    uint64_t    start[] = {0,0,0,0,0,0,0,0,0,0};
+    uint64_t    count[MAX_DIMS], hcount[MAX_DIMS], bytes_read = 0;
+    herr_t      h5_err;
+    char        h5name[256],aname[256],fname[256];
+    int         dims [MAX_DIMS];
+    int         h5rank[MAX_DIMS];
+    int         h5i, level;
+    hid_t       grp_id [GMAX+1], space_id, dataset_id;
+    hid_t       memspace_id, dataspace_id, att_id;
+    char        ** grp_name;
+    hid_t       type_id;
+    hid_t       h5_type_id;
+    hsize_t     adims;
+
+    if (argc < 2) {
+        printf("Usage: %s <BP-file> <HDF5-file>\n", argv[0]);
+        return 1;
     }
-    
-    while (i < argc) {
-        if(!strcmp(argv[i], "--scalar-as_array")) {
-            *scalar_as_array = USE_SINGLE_ELE_ARRAY;
-        }
-        else if(!strcmp(argv[i], "--verbose") || !strcmp(argv[i], "-V")) {
-            //fprintf(stderr, "i:%d\n",i);
-            //fprintf(stderr, "verbose:%d\n",*verb);
-            *verb = LIST_INFO;
-            //*verb = atoi(argv[i+1]);
-            i=i+1;
-        }
-        else if(!strcmp(argv[i], "-h") || !strcmp(argv[i], "--help")) {
-            print_usage();
-            exit(0);
-        }
-        else if(!found_bp_file) {
-            *bp_filename = argv[i];
-            found_bp_file = 1;
-        }
-        else if(found_bp_file && !found_h5_file) {
-            *h5_filename = argv[i];
-            found_h5_file = 1;
-        }
-        else {
-            // unknown arguments
-            fprintf(stderr, "Error in parsing command line: unknown argument %s\n\n", argv[i]);
-            print_usage();
+
+    h5_err = H5Eset_auto(NULL, NULL );
+    ADIOS_FILE * f = adios_fopen (argv[1], comm_dummy);
+    HDF5_FILE = H5Fcreate(argv[2],H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
+
+
+    if (f == NULL) {
+        if (DEBUG) printf ("%s\n", adios_errmsg());
+	return -1;
+    }
+    /* For all groups */
+    for (gidx = 0; gidx < f->groups_count; gidx++) {
+        if (DEBUG) printf("Group %s:\n", f->group_namelist[gidx]);
+        ADIOS_GROUP * g = adios_gopen (f, f->group_namelist[gidx]);
+        if (g == NULL) {
+            if (DEBUG) printf ("%s\n", adios_errmsg());
             return -1;
         }
-        i ++;
-    }
+/* First create all of the groups */
+        grp_id [0] = HDF5_FILE;
+        for (i = 0; i < g->vars_count; i++) {
+             ADIOS_VARINFO * v = adios_inq_var_byid (g, i);
+             strcpy(h5name,g->var_namelist[i]);
+             grp_name = bp_dirparser (h5name, &level);
+             for (j = 0; j < level-1; j++) {
+                grp_id [j + 1] = H5Gopen (grp_id [j], grp_name [j]);
+                if (grp_id [j + 1] < 0) {
+                   grp_id [j + 1] = H5Gcreate (grp_id [j], grp_name [j], 0);
+                }
+             }
+             for (j=1; j<level; j++) {
+                  H5Gclose(grp_id[j]);
+             }
+        }
+/* Now we can write data into these scalars */        
+        /* For all variables */
+        if (DEBUG) printf("  Variables=%d:\n", g->vars_count);
+        for (i = 0; i < g->vars_count; i++) {
+             ADIOS_VARINFO * v = adios_inq_var_byid (g, i);
 
-    if(!found_bp_file) {
-        fprintf(stderr, "Error in parsing command line: bp_file not provided\n");
-        print_usage();
-        return -1;
-    }
+            uint64_t total_size = adios_type_size (v->type, v->value);
+            for (j = 0; j < v->ndim; j++)
+                total_size *= v->dims[j];
+            strcpy(h5name,g->var_namelist[i]);
+            if (DEBUG) printf("    %-9s  %s", adios_type_to_string(v->type), g->var_namelist[i]);
+            h5_err = bp_getH5TypeId (v->type, &h5_type_id);
+            if (v->type==adios_string) H5Tset_size(h5_type_id,strlen(v->value)); 
+            if (v->ndim == 0) {
+                /* Scalars do not need to be read in, we get it from the metadata
+                   when using adios_inq_var */
+                if (DEBUG) printf(" = %s\n", value_to_string(v->type, v->value, 0));
+                 // add the hdf5 dataset, these are scalars
+                for (h5i = 0;h5i<MAX_DIMS;h5i++) 
+                   count[0] = 0;
+                count[0] = 1; // we are writing just 1 element, RANK=1
+                h5_err = bp_getH5TypeId (v->type, &h5_type_id);
+                H5LTmake_dataset(HDF5_FILE,h5name,1,count,h5_type_id,v->value);
+            } else {
+
+                    h5_err = readVar(g, v,  h5name);
+            }
+            adios_free_varinfo (v);
+        } /* variables */
+
+        /* For all attributes */
+        if (DEBUG) printf("  Attributes=%d:\n", g->attrs_count);
+        for (i = 0; i < g->attrs_count; i++) {
+            enum ADIOS_DATATYPES atype;
+            int  asize;
+	    void *adata;
+            adios_get_attr_byid (g, i, &atype, &asize, &adata);
+            grp_name = bp_dirparser (g->attr_namelist[i], &level);
+            strcpy(aname,grp_name[level-1]); 
+// the name of the attribute is the last in the array
+// we then need to concat the rest together
+            strcpy(fname,"/");
+            for (j=0;j<level-1;j++) {
+              strcat(fname,grp_name[j]); 
+            }
+            h5_err = bp_getH5TypeId (atype, &h5_type_id);
+
+            // let's create the attribute
+            adims = 1;
+            if (atype==adios_string) H5Tset_size(h5_type_id,strlen(adata)); 
+            space_id = H5Screate(H5S_SCALAR); // just a scalar
+            att_id = H5Acreate(HDF5_FILE, g->attr_namelist[i], h5_type_id, space_id,H5P_DEFAULT);
+            h5_err = H5Awrite(att_id, h5_type_id, adata);
+            h5_err = H5Aclose(att_id);
+            h5_err = H5Sclose(space_id);
+
+            if (DEBUG) printf("    %-9s  %s = %s\n", adios_type_to_string(atype), 
+                    g->attr_namelist[i], value_to_string(atype, adata, 0));
+            free(adata);
+        } /* attributes */
+
+        adios_gclose (g);
+    } /* groups */
+
+    adios_fclose (f);
+    h5_err =  H5Fclose(HDF5_FILE);
 
     return 0;
 }
 
-int main (int argc, char ** argv)
+
+const char * value_to_string (enum ADIOS_DATATYPES type, void * data, int idx)
 {
-    char *bp_filename = NULL;
-    char *h5_filename = NULL;
-    enum scalar_convention scalar_as_array;
-    enum verbose_level verb;
-
-    // parse cmdline options
-    if(parse_cmdline(argc, argv, &bp_filename, &h5_filename,
-                &scalar_as_array, &verb)) {
-        return -1;
+    static char s [100];
+    s [0] = 0;
+
+
+    switch (type)
+    {
+        case adios_unsigned_byte:
+            sprintf (s, "%u", ((uint8_t *) data)[idx]);
+            break;
+
+        case adios_byte:
+            sprintf (s, "%d", ((int8_t *) data)[idx]);
+            break;
+
+        case adios_short:
+            sprintf (s, "%hd", ((int16_t *) data)[idx]);
+            break;
+
+        case adios_unsigned_short:
+            sprintf (s, "%hu", ((uint16_t *) data)[idx]);
+            break;
+
+        case adios_integer:
+            sprintf (s, "%d", ((int32_t *) data)[idx]);
+            break;
+
+        case adios_unsigned_integer:
+            sprintf (s, "%u", ((uint32_t *) data)[idx]);
+            break;
+
+        case adios_long:
+            sprintf (s, "%lld", ((int64_t *) data)[idx]);
+            break;
+
+        case adios_unsigned_long:
+            sprintf (s, "%llu", ((uint64_t *) data)[idx]);
+            break;
+
+        case adios_real:
+            sprintf (s, "%g", ((float *) data)[idx]);
+            break;
+
+        case adios_double:
+            sprintf (s, "%lg", ((double *) data)[idx]);
+            break;
+
+        case adios_long_double:
+            sprintf (s, "%Lg", ((long double *) data)[idx]);
+            break;
+
+        case adios_string:
+            return (char*) ((char *)data+idx);
+            break;
+
+        case adios_complex:
+            sprintf (s, "(%g, %g)", 
+                    ((float *) data)[2*idx], ((float *) data)[2*idx+1]);
+            break;
+
+        case adios_double_complex:
+            sprintf (s, "(%lg, %lg)", 
+                    ((double *) data)[2*idx], ((double *) data)[2*idx+1]);
+            break;
     }
 
+    return s;
+}
 
-    initialize_bp2h5(USE_FORTRAN, USE_FORTRAN, USE_FORTRAN, USE_FORTRAN, scalar_as_array, verb);
-    // generate h5 file
-    return hw_makeh5(bp_filename, h5_filename);
+char** bp_dirparser(char *str, int *nLevel)
+{
+  char **grp_name;
+  char *pch;
+  int idx = 0, len=0;
+  char *tmpstr;
+  tmpstr= (char *)malloc(1*(strlen(str)+1));
+  strcpy(tmpstr,str);
+  pch = strtok(tmpstr,"/");
+  grp_name = (char **)malloc(GMAX);
+  while(pch!=NULL && *pch!=' ')
+  {
+
+     len = strlen(pch);
+     grp_name[idx]  = (char *)malloc((len+1)*1);
+     grp_name[idx][0]='\0';
+     strcat(grp_name[idx],pch);
+     pch=strtok(NULL,"/");
+     idx=idx+1;
+  }
+  *nLevel = idx;
+  free(tmpstr);
+  return grp_name;
 }
+
+int readVar(ADIOS_GROUP *gp, ADIOS_VARINFO *vi, const char * name)
+{
+  int i,j;
+  uint64_t start_t[MAX_DIMS], count_t[MAX_DIMS]; // processed <0 values in start/count
+  uint64_t s[MAX_DIMS], c[MAX_DIMS]; // for block reading of smaller chunks
+  hsize_t  h5_start[MAX_DIMS], h5_count[MAX_DIMS], h5_stride[MAX_DIMS];
+  hsize_t  h5_dims[MAX_DIMS];
+  uint64_t nelems;         // number of elements to read
+  int      elemsize;            // size in bytes of one element
+  uint64_t st, ct;
+  void     *data;
+  uint64_t sum;           // working var to sum up things
+  int      maxreadn;     // max number of elements to read once up to a limit (10MB of data)
+  int      actualreadn;       // our decision how much to read at once
+  int      readn[MAX_DIMS];   // how big chunk to read in in each dimension?
+  int64_t  bytes_read;     // retval from adios_get_var()
+  int      incdim;            // used in incremental reading in
+  hid_t    grp_id, space_id, dataset, global_memspace, dataspace;
+  hid_t    local_memspace, h5_ndim ;
+  hid_t    h5_err;
+  hid_t    h5_type_id;
+
+
+  if (getTypeInfo(vi->type, &elemsize)) {
+    fprintf(stderr, "Adios type %d (%s) not supported in bpls. var=%s\n", 
+	    vi->type, adios_type_to_string(vi->type), name);
+    return 10;
+  }
+
+   h5_err = bp_getH5TypeId (vi->type, &h5_type_id);
+   h5_ndim = (hsize_t) vi->ndim;
+   for (j=0;j<h5_ndim;j++)
+       h5_dims[j] = vi->dims[j];
+// create the hdf5 dataspace.
+ 
+  // create the counter arrays with the appropriate lengths
+  // transfer start and count arrays to format dependent arrays
+  for (j=0; j<vi->ndim; j++)  {
+      icount[j]=-1;
+      h5_stride[j]= (hsize_t) 1;
+  }
+  nelems = 1;
+  for (j=0; j<vi->ndim; j++) {
+    if (istart[j] < 0)  // negative index means last-|index|
+      st = vi->dims[j]+istart[j];
+    else
+      st = istart[j];
+    if (icount[j] < 0)  // negative index means last-|index|+1-start
+      ct = vi->dims[j]+icount[j]+1-st;
+    else
+      ct = icount[j];
+    if (verbose>2) 
+      printf("    j=%d, st=%llu ct=%llu\n", j, st, ct);
+    start_t[j] = st;
+    count_t[j] = ct;
+    nelems *= ct;
+    if (verbose>1) 
+      printf("    s[%d]=%llu, c[%d]=%llu, n=%llu\n", j, start_t[j], j, count_t[j], nelems);
+  }
+  if (verbose>1) {
+    printf(" total size of data to read = %llu\n", nelems*elemsize);
+  }
+  maxreadn = MAX_BUFFERSIZE/elemsize;
+  if (nelems < maxreadn)
+	  maxreadn = nelems;
+  // special case: string. Need to use different elemsize
+  if (vi->type == adios_string) {
+    if (vi->value)
+      elemsize = strlen(vi->value)+1;
+    maxreadn = elemsize;
+  }
+  // allocate data array
+  data = (void *) malloc (maxreadn*elemsize); // SAK: don't want the +8.... 
+  //+8 for just to be sure
+
+  // determine strategy how to read in:
+  //  - at once
+  //  - loop over 1st dimension
+  //  - loop over 1st & 2nd dimension
+  //  - etc
+  if (verbose>1) printf("Read size strategy:\n");
+  sum = (uint64_t) 1;
+  actualreadn = (uint64_t) 1;
+  for (i=vi->ndim-1; i>=0; i--) {
+    if (sum >= (uint64_t) maxreadn) {
+      readn[i] = 1;
+    } else {
+      readn[i] = maxreadn / (int)sum; // sum is small for 4 bytes here
+      // this may be over the max count for this dimension
+      if (readn[i] > count_t[i]) 
+	readn[i] = count_t[i];
+    }
+    if (verbose>1) printf("    dim %d: read %d elements\n", i, readn[i]);
+    sum = sum * (uint64_t) count_t[i];
+    actualreadn = actualreadn * readn[i];
+  }
+  if (verbose>1) printf("    read %d elements at once, %lld in total (nelems=%lld)\n", actualreadn, sum, nelems);
+
+
+  // init s and c
+  for (j=0; j<vi->ndim; j++) {
+    s[j]=start_t[j];
+    c[j]=readn[j];
+    h5_count[j] = (hsize_t) c[j];
+    h5_start[j] = (hsize_t) s[j];
+  }
+
+  // read until read all 'nelems' elements
+  sum = 0;
+  while (sum < nelems) {
+
+    // how many elements do we read in next?
+    actualreadn = 1;
+    for (j=0; j<vi->ndim; j++) 
+      actualreadn *= c[j];
+
+    if (verbose>2) {
+      printf("adios_read_var name=%s ", name);
+      //PRINT_DIMS("  start", s, vi->ndim, j); 
+      //PRINT_DIMS("  count", c, vi->ndim, j); 
+      printf("  read %d elems\n", actualreadn);
+    }
+
+    // read a slice finally
+    bytes_read = adios_read_var_byid (gp, vi->varid, s, c, data); 
+
+    if (bytes_read < 0) {
+      fprintf(stderr, "Error when reading variable %s. errno=%d : %s \n", name, adios_errno, adios_errmsg());
+      free(data);
+      return 11;
+    }
+
+// now we must place this inside the hdf5 file... we know the offset (s)
+// we know the count, c
+// we know the global rank v->ndim
+// we know the global dimensions v->dims
+
+// get the hdf5 calls for writing the hyperslab.....
+
+    dataset = H5Dopen(HDF5_FILE,name);
+    if (dataset> 0) {
+       global_memspace = H5Dget_space(dataset);
+       hid_t rank_old = H5Sget_simple_extent_ndims(global_memspace);
+       hsize_t *maxdims = (hsize_t *) malloc (h5_ndim * sizeof (hsize_t));
+       h5_err = H5Sget_simple_extent_dims(global_memspace,maxdims,NULL);
+       free(maxdims);
+    } else {
+       global_memspace = H5Screate_simple (h5_ndim, h5_dims, NULL);
+       hid_t cparms = H5Pcreate(H5P_DATASET_CREATE);
+       h5_err = H5Pset_chunk(cparms,h5_ndim,h5_count);
+   
+       dataset = H5Dcreate(HDF5_FILE,name,h5_type_id, global_memspace,cparms);
+       H5Pclose(cparms);
+    }
+
+    local_memspace = H5Screate_simple (h5_ndim, h5_count, NULL);
+     for (j=0;j<vi->ndim;j++) 
+
+    h5_err =  H5Sselect_hyperslab (global_memspace, H5S_SELECT_SET
+                                  ,h5_start, h5_stride, h5_count, NULL);
+
+    h5_err = H5Dwrite(dataset,h5_type_id,local_memspace,global_memspace,H5P_DEFAULT, data);
+    H5Sclose(local_memspace);
+    H5Dclose(dataset);
+    //H5Tclose(h5_type_id);
+
+    if (verbose>2) printf("  read %lld bytes\n", bytes_read);
+
+    // print slice
+
+    // prepare for next read
+    sum += actualreadn;
+    incdim=1; // largest dim should be increased 
+    for (j=vi->ndim-1; j>=0; j--) {
+      if (incdim==1) {
+	if (s[j]+c[j] == start_t[j]+count_t[j]) {
+	  // reached the end of this dimension
+	  s[j] = start_t[j];
+	  c[j] = readn[j];
+          h5_count[j] = (hsize_t) c[j];
+          h5_start[j] = (hsize_t) s[j];
+           
+	  incdim = 1; // next smaller dim can increase too
+	} else {
+	  // move up in this dimension up to total count
+	  s[j] += readn[j];
+          h5_start[j] = (hsize_t) s[j];
+	  if (s[j]+c[j] > start_t[j]+count_t[j]) {
+	    // do not reach over the limit
+	    c[j] = start_t[j]+count_t[j]-s[j];
+            h5_count[j] = (hsize_t) c[j];
+	  }
+	  incdim = 0;
+	}
+      }
+    }
+  } // end while sum < nelems
+  H5Sclose(global_memspace);
+
+  free(data);
+  return 0;
+}
+
+int getTypeInfo( enum ADIOS_DATATYPES adiosvartype, int* elemsize)
+{
+  switch(adiosvartype) {
+  case adios_unsigned_byte:
+    *elemsize = 1;
+    break;
+  case adios_byte:
+    *elemsize = 1;
+    break;
+  case adios_string:
+    *elemsize = 1;
+    break;
+
+  case adios_unsigned_short:  
+    *elemsize = 2;
+    break;
+  case adios_short:
+    *elemsize = 2;
+    break;
+
+  case adios_unsigned_integer:
+    *elemsize = 4;
+    break;
+  case adios_integer:    
+    *elemsize = 4;
+    break;
+
+  case adios_unsigned_long:
+    *elemsize = 8;
+    break;
+  case adios_long:        
+    *elemsize = 8;
+    break;
+
+  case adios_real:
+    *elemsize = 4;
+    break;
+
+  case adios_double:
+    *elemsize = 8;
+    break;
+
+  case adios_complex:  
+    *elemsize = 8;
+    break;
+
+  case adios_double_complex:
+    *elemsize = 16;
+    break;
+
+  case adios_long_double: // do not know how to print
+    //*elemsize = 16;
+  default:
+    return 1;
+  }
+  return 0;
+}
+
+static int nextcol=0;  // column index to start with (can have lines split in two calls)
+
+int bp_getH5TypeId(enum ADIOS_DATATYPES type, hid_t* h5_type_id)
+{
+    int size, status=0;
+
+    switch (type)
+    {
+        case adios_byte:
+            *h5_type_id = H5Tcopy(H5T_NATIVE_CHAR);
+            break;
+        case adios_string:
+             *h5_type_id = H5Tcopy(H5T_C_S1);
+            break;
+        case adios_real:
+            *h5_type_id = H5Tcopy(H5T_NATIVE_FLOAT);
+            break;
+        case adios_double:
+            *h5_type_id = H5Tcopy(H5T_NATIVE_DOUBLE);
+            break;
+        case adios_long_double:
+            *h5_type_id = H5Tcopy(H5T_NATIVE_LDOUBLE);
+            break;
+        case adios_unsigned_byte:
+            *h5_type_id = H5Tcopy(H5T_NATIVE_UINT8);
+            break;
+        case adios_unsigned_short:
+            *h5_type_id = H5Tcopy(H5T_NATIVE_UINT16);
+            break;
+        case adios_unsigned_integer:
+            *h5_type_id = H5Tcopy(H5T_NATIVE_UINT32);
+            break;
+        case adios_unsigned_long:
+            *h5_type_id = H5Tcopy(H5T_NATIVE_UINT64);
+            break;
+        case adios_short:
+            *h5_type_id = H5Tcopy(H5T_NATIVE_INT16);
+            break;
+        case adios_integer:
+            *h5_type_id = H5Tcopy(H5T_NATIVE_INT32);
+            break;
+        case adios_long:
+            *h5_type_id = H5Tcopy(H5T_NATIVE_INT64);
+            break;
+        case adios_complex:
+        case adios_double_complex:
+            fprintf(stderr, "Error in mapping ADIOS Data Types to HDF5: complex not supported yet.\n");
+            status = -1;
+            break;
+        case adios_unknown:
+        default:
+            fprintf(stderr, "Error in mapping ADIOS Data Types to HDF5: unknown data type.\n");
+            status = -1;
+    }
+    return status;
+}
+
diff --git a/utils/bp2h5/hw-utils.c b/utils/bp2h5/hw-utils.c
deleted file mode 100644
index 14da586..0000000
--- a/utils/bp2h5/hw-utils.c
+++ /dev/null
@@ -1,1665 +0,0 @@
-/* 
- * ADIOS is freely available under the terms of the BSD license described
- * in the COPYING file in the top level directory of this source distribution.
- *
- * Copyright (c) 2008 - 2009.  UT-BATTELLE, LLC. All rights reserved.
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
-#include "stdint.h"
-#include <signal.h>
-#include <sys/types.h>
-#include "adios_types.h"
-#include "adios_transport_hooks.h"
-#include "adios_bp_v1.h"
-//#include "adios_internals.h"
-#include "hw-utils.h"
-
-#define NUM_GP 24
-#define  MAX_RANK 10 * 5
-#define STRLEN 1000 
-struct var_dim
-{
-    uint16_t id;
-    uint64_t rank;
-    uint64_t offset;
-};
-
-/*
- * Global config variables to set the convenstion of conversion
- */
-
-/*
- * array to dataset convention (transpose array dimension order if using Fortran)
- */
-enum lang_convention array_dim_order_fortran = USE_FORTRAN;
-
-/*
- * string-typed scalar/dataset write convention
- */
-enum lang_convention var_str_fortran = USE_FORTRAN;
-
-/*
- * string-typed dataset attribute write convention
- */
-enum lang_convention attr_str_ds_fortran = USE_FORTRAN;
-
-/*
- * string-typed group attribute write convention
- */
-enum lang_convention attr_str_gp_fortran = USE_FORTRAN;
-
-/* 
- * scalar var/attribute write convention
- */
-enum scalar_convention scalar_dataspace = USE_SCALAR;
-
-/*
- * initialization flag
- */
-int bp2h5_initialized = 0;
-
-/*
- * verbose level flag
- */
-const char * value_to_string (enum ADIOS_DATATYPES type, void * data);
-enum verbose_level verbose = NO_INFO;
-void set_lang_convention(enum ADIOS_FLAG host_language_fortran)
-{
-    if(host_language_fortran == adios_flag_yes) {
-        array_dim_order_fortran = USE_FORTRAN;
-        var_str_fortran = USE_FORTRAN;
-        attr_str_ds_fortran = USE_FORTRAN;
-        attr_str_gp_fortran = USE_FORTRAN;
-    }
-    else {
-        // otherwise assume host language is C
-        array_dim_order_fortran = USE_C;
-        var_str_fortran = USE_C;
-        attr_str_ds_fortran = USE_C;
-        attr_str_gp_fortran = USE_C;
-    }
-}
-
-/*
- * Parse path of var/attribute
- *
- * (copied from binpack-utils.c; this function
- * is no longer included in libadios.a or 
- * libadios_int.a)
- */ 
-char** bp_dirparser(char *str, int *nLevel)
-{
-  char **grp_name;
-  char *pch;
-  int idx = 0, len=0;
-  char *tmpstr;
-  tmpstr= (char *)malloc(1*(strlen(str)+1));
-  strcpy(tmpstr,str);
-  pch = strtok(tmpstr,"/");
-  grp_name = (char **)malloc(NUM_GP*1);
-  while(pch!=NULL && *pch!=' ')
-  {
-
-     len = strlen(pch);
-     grp_name[idx]  = (char *)malloc((len+1)*1);
-     grp_name[idx][0]='\0';
-     strcat(grp_name[idx],pch);
-     pch=strtok(NULL,"/");
-     idx=idx+1;
-  }
-  *nLevel = idx;
-  free(tmpstr);
-  return grp_name;
-}
-
-void print_process_group_header (uint64_t num
-                      ,struct adios_process_group_header_struct_v1 * pg_header
-                      );
-void print_vars_header (struct adios_vars_header_struct_v1 * vars_header)
-{
-    printf ("\tVars Count: %u\n", vars_header->count);
-}
-void copy_buffer(struct adios_bp_buffer_struct_v1 *dest
-                ,struct adios_bp_buffer_struct_v1 *src) {
-
-    memcpy (dest, src, sizeof(struct adios_bp_buffer_struct_v1));
-}
-
-/*
- * Initialization
- * initialize_bp2h5() sets config variables and allocate
- * internal read buffer.
- * It returns 0 if no error and -1 otherwise
- */
-int initialize_bp2h5(enum lang_convention array_dim_order,
-                     enum lang_convention var_str,
-                     enum lang_convention attr_str_ds,
-                     enum lang_convention attr_str_gp,
-                     enum scalar_convention scalar_ds,
-                     enum verbose_level verb 
-                     )
-{
-    if(!bp2h5_initialized) {
-        array_dim_order_fortran = array_dim_order;
-        var_str_fortran = var_str;
-        attr_str_ds_fortran = attr_str_ds;
-        attr_str_gp_fortran = attr_str_gp;
-        scalar_dataspace = scalar_ds;
-        verbose = verb;
-        bp2h5_initialized = 1;
-    }
-
-    return 0;
-}
-
-void hw_free2D (char ** grp_name, int level)
-{
-    int i;
-
-    for (i = 0; i < level; i++)
-    {
-        free (grp_name [i]);
-        grp_name [i] = NULL;
-    }
-
-    free (grp_name);
-}
-
-/*
- * Convert bp file fnamein to a h5 file fnameout
- */
-int hw_makeh5 (char * fnamein, char * fnameout)
-{
-    char * tmpstr;
-    int size;
-    int i,j;
-    int rc;
-    uint64_t element_size = 0;
-    struct adios_bp_element_struct * element = NULL;
-
-    // initialization
-    if(!bp2h5_initialized && 
-        (initialize_bp2h5(USE_FORTRAN, USE_FORTRAN, USE_FORTRAN, USE_FORTRAN, USE_SCALAR,NO_INFO))) {
-        return -1;
-    }
-
-    // open bp file for read
-    struct adios_bp_buffer_struct_v1 * b = 0, * b0 = 0;
-    uint32_t version = 0;
-
-    b = malloc (sizeof (struct adios_bp_buffer_struct_v1));
-    b0 = malloc (sizeof (struct adios_bp_buffer_struct_v1));
-    adios_buffer_struct_init (b);
-
-    rc = adios_posix_open_read_internal (fnamein, "", b);
-    if (!rc) {
-        fprintf (stderr, "Error in open bp file: cannot open %s file!\n", fnamein);
-        return -1;
-    }
-
-    tmpstr = strdup (fnamein);
-    size = strlen (fnamein);
-    tmpstr [size - 2] = 'h';
-    tmpstr [size - 1] = '5';
-    if(!fnameout) {
-        fnameout=tmpstr;
-    }
-
-    // create h5 file
-    hid_t h5file_id;
-    hid_t root_id;
-    h5file_id = H5Fcreate (fnameout, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
-    root_id = H5Gopen (h5file_id, "/");
-
-    // read and parse footer
-    adios_posix_read_version (b);
-    adios_parse_version (b, &version);
-
-    struct adios_index_process_group_struct_v1 * pg_root = 0;
-    struct adios_index_process_group_struct_v1 * pg = 0;
-    struct adios_index_var_struct_v1 * vars_root = 0;
-    struct adios_index_attribute_struct_v1 * attrs_root = 0;
-
-    // read and parse index
-    adios_posix_read_index_offsets (b);
-    adios_parse_index_offsets_v1 (b);
-
-    adios_posix_read_process_group_index (b);
-    adios_parse_process_group_index_v1 (b, &pg_root);
-
-    adios_posix_read_vars_index (b);
-    adios_parse_vars_index_v1 (b, &vars_root);
-    adios_posix_read_attributes_index (b);
-    adios_parse_attributes_index_v1 (b, &attrs_root);
-    /* xxx.bp --> xxx.h5
-     * parse element from bp file and write to hdf5 file
-     */
-    uint64_t element_num = 0;
-    uint64_t pg_num = 0;
-    pg = pg_root;
-    int var_dims_count = 0;
-    struct var_dim * var_dims = 0;
-    while (pg) {
-
-        struct adios_process_group_header_struct_v1 pg_header;
-        struct adios_vars_header_struct_v1 vars_header;
-        struct adios_attributes_header_struct_v1 attrs_header;
-
-        struct adios_var_header_struct_v1 var_header;
-        struct adios_var_payload_struct_v1 var_payload;
-        struct adios_attribute_struct_v1 attribute;
-
-        // setup where to read the process group from (and size)
-        b->read_pg_offset = pg->offset_in_file;
-        if (pg->next) {
-            b->read_pg_size =   pg->next->offset_in_file
-                - pg->offset_in_file;
-        }
-        else {
-            b->read_pg_size =   b->pg_index_offset
-                - pg->offset_in_file;
-        }
-        adios_posix_read_process_group (b);
-        adios_parse_process_group_header_v1 (b, &pg_header);
-        adios_parse_vars_header_v1 (b, &vars_header);
-
-        set_lang_convention(pg_header.host_language_fortran);
-        uint64_t length_of_var;
-        // process each var in current process group
-        if (element_num%2 == 0) {
-            var_dims = realloc (var_dims, (vars_header.count)
-                    * sizeof (struct var_dim)
-                    );
-            for (i = 0; i < vars_header.count; i++) {
-                var_payload.payload = 0;
-                copy_buffer(b0,b); 
-                length_of_var = *(uint64_t *) (b->buff + b->offset);
-                adios_parse_var_data_header_v1 (b, &var_header);
-
-                if (   var_header.is_dim == adios_flag_yes
-                    || var_header.dims == 0) {
-                    if (!var_payload.payload) { 
-                        var_payload.payload = malloc (var_header.payload_size);
-                        adios_parse_var_data_payload_v1 (b, &var_header, &var_payload
-                                ,var_header.payload_size
-                                );
-                        var_dims [var_dims_count].id = var_header.id;
-                        var_dims [var_dims_count].rank = *(uint32_t *)
-                            var_payload.payload;
-                        var_dims [var_dims_count].offset = b0->offset; 
-                    }
-                    else {
-                        //printf("payload malloc : %s %d\n",__FILE__,__LINE__);
-                        //return;
-                    }
-                }
-                else {
-                    var_dims [var_dims_count].id = var_header.id;
-                    var_dims [var_dims_count].rank = 0;
-                    var_dims [var_dims_count].offset = b0->offset; 
-                }
-
-                var_dims_count ++;
-                copy_buffer(b,b0); 
-                b->offset = b->offset+length_of_var;
-                if (var_payload.payload) {
-                    free (var_payload.payload);
-                    var_payload.payload = 0;
-                }
-                /*
-                   printf("var id=%d name=%s rank=%d offset=%llu\n", 
-                   var_header.id, 
-                   var_header.name,
-                   var_dims[var_dims_count-1].rank,
-                   var_dims[var_dims_count-1].offset);
-                   */		
-            }
-            adios_parse_attributes_header_v1 (b, &attrs_header);
-            for (i = 0; i < attrs_header.count; i++) {
-                adios_parse_attribute_v1 (b, &attribute);
-                var_dims = realloc (var_dims, (var_dims_count+1)
-                        * sizeof (struct var_dim)
-                        );
-                if (attribute.is_var == adios_flag_yes) {
-                    var_dims [var_dims_count].id = attribute.var_id;
-                    var_dims [var_dims_count].rank = 0;
-                    var_dims [var_dims_count].offset = 0;
-                    for (j=0; j<var_dims_count;j++) {
-                        if (attribute.var_id == var_dims [j].id) {
-                            var_dims [var_dims_count].id = attribute.id;
-                            var_dims [var_dims_count].rank = var_dims [j].rank;
-                            var_dims [var_dims_count].offset = var_dims [j].offset;
-                            /*
-                               printf("attribute: %s  vid= %llu rank: %llu\n",attribute.name,
-                               attribute.id,var_dims[var_dims_count].rank);
-                               */
-                            j = var_dims_count;
-                        }
-                    }
-                }
-                else {
-                    var_dims [var_dims_count].id = attribute.id;
-            var_dims [var_dims_count].rank = 0;
-            var_dims [var_dims_count].offset = 0;
-            switch(attribute.type) { 
-                case adios_unsigned_short:
-                    var_dims [var_dims_count].rank = (uint64_t)*((unsigned short*) attribute.value);
-                    break;
-                case adios_unsigned_integer:
-                    var_dims [var_dims_count].rank = (uint64_t) *((unsigned int *) attribute.value);
-                    break;
-                case adios_unsigned_long:
-                    var_dims [var_dims_count].rank = (uint64_t) *((unsigned long*) attribute.value);
-                    break;
-                case adios_short:
-                    var_dims [var_dims_count].rank = (uint64_t)*((short*) attribute.value);
-                    break;
-                case adios_integer:
-                    var_dims [var_dims_count].rank = (uint64_t) *((int *) attribute.value);
-                    break;
-                case adios_long:
-                    var_dims [var_dims_count].rank = (uint64_t) *((long *) attribute.value);
-                    break;
-                case adios_byte:
-                case adios_unsigned_byte:
-                case adios_string:
-                    break;
-                case adios_complex:
-                case adios_double_complex:
-                    fprintf(stderr, "Error in mapping ADIOS Data Types to HDF5: complex not supported yet.\n");
-                    break;
-                case adios_unknown:
-                default:
-                    fprintf(stderr, "Error in mapping ADIOS Data Types to HDF5: unknown data type.\n");
-            }
-        }
-        var_dims_count ++;
-            }
-        }
-        // write to h5 file
-        // make sure the buffer is big enough or send in null
-        else {
-            if (verbose >= LIST_INFO) {
-                printf("-------------------------------------------\n");
-                printf("total vars: %d, pg timeindex: %d\n",
-                        vars_header.count, 
-                        pg->time_index);
-            }
-            for (i = 0; i < vars_header.count; i++) {
-                var_payload.payload = 0;
-                adios_parse_var_data_header_v1 (b, &var_header);
-                if (var_header.dims) {
-                    if (verbose >= LIST_INFO)
-                        printf("\t%3d) dataset : %s\n",i,var_header.name);
-                    uint64_t element = 0;
-                    struct adios_dimension_struct_v1 * d = var_header.dims;
-                    int i = 0, ranks = 0, c = 0;
-                    uint64_t * dims,* global_dims,* offsets;
-                    while (d) {
-                        ranks++;
-                        d = d->next;
-                    }
-                    //adios_parse_var_data_payload_v1 (b, &var_header, NULL, 0);
-                    // get local dimensions
-                    dims = (uint64_t *) malloc (8 * ranks);
-                    memset (dims, 0, 8 * ranks);
-
-                    d = var_header.dims;
-                    uint64_t * dims_t = dims;
-
-                    while (d) {
-                        if (d->dimension.var_id != 0) {
-                            for (i = 0; i < var_dims_count; i++) {
-                                //printf("%s: %d %llu \n",var_header.name,
-                        //i,var_dims [i].rank); 
-                        if (var_dims [i].id == d->dimension.var_id){ 
-                            *dims_t = var_dims [i].rank; 
-                            i = var_dims_count+1;
-                        }
-                    }
-                }
-                else { 
-                    *dims_t = d->dimension.rank;
-                }
-                d = d->next;
-                dims_t++;
-            }
-            // get global dimensions
-            global_dims = (uint64_t *) malloc (8 * ranks);
-            memset (global_dims, 0, 8 * ranks);
-
-            d = var_header.dims;
-            dims_t = global_dims;
-
-            while (d) {
-                if (d->global_dimension.var_id != 0) {
-                    for (i = 0; i < var_dims_count; i++) {
-                        if (var_dims [i].id == \
-                                d->global_dimension.var_id) {
-                            *dims_t = var_dims [i].rank;
-                            i = var_dims_count+1;
-                        }
-                    }
-                }
-                else
-                    *dims_t = d->global_dimension.rank;
-                d = d->next;
-                dims_t++;
-            }
-
-            // get offsets
-		    offsets = (uint64_t *) malloc (8 * ranks);
-		    memset (offsets, 0, 8 * ranks);
-
-		    d = var_header.dims;
-		    dims_t = offsets;
-
-            while (d) {
-                if (d->local_offset.var_id != 0) {
-                    for (i = 0; i < var_dims_count; i++) {
-                        if (var_dims [i].id == d->local_offset.var_id) {
-                            *dims_t = var_dims [i].rank;
-                            i = var_dims_count+1;
-                        }
-                    }
-                }
-                else {
-                    *dims_t = d->local_offset.rank;
-                }
-                d = d->next;
-                dims_t++;
-            }
-
-            var_payload.payload = malloc (var_header.payload_size);
-            adios_parse_var_data_payload_v1 (b, &var_header, &var_payload
-                    ,var_header.payload_size
-                    );
-            // now ready to write dataset to h5 file
-            /*
-               if (!strcmp(var_header.name,"nextnode") ||
-               !strcmp(var_header.name,"itheta0") )
-               printf("==============\n");
-               printf("  %s\n",var_header.name);
-               printf("==============\n");
-            printf("%d %d %d %d\n",ranks, global_dims[0],dims[0],offsets[0]); 
-            printf("%d %d %d %d\n",ranks, global_dims[1],dims[1],offsets[1]); 
-            printf("%d %d %d %d\n",ranks, global_dims[2],dims[2],offsets[2]); 
-            printf("%d %d %d %d\n",ranks, global_dims[3],dims[3],offsets[3]); 
-            */
-            hw_dset(root_id, var_header.path, var_header.name, 
-                    var_payload.payload,var_header.type, 
-                    ranks, dims, global_dims, offsets,
-                    pg->time_index
-                   );      
-
-		    free(dims);
-		    free(global_dims);
-		    free(offsets);
-		}
-		else {
-                    // scalar var
-		    if (verbose >= LIST_INFO)
-	                    fprintf(stderr, "\t%3d) scalar  : %s\n",i,var_header.name);
-		    if (!var_payload.payload) 
-                        var_payload.payload = malloc (var_header.payload_size);
-		    adios_parse_var_data_payload_v1 (b, &var_header, &var_payload
-                                                    ,var_header.payload_size
-                                                    );
-	            hw_scalar (root_id, var_header.path, var_header.name
-                              ,var_payload.payload
-			      ,var_header.type
-                              ,0
-			      );     
-		}
-                if (var_payload.payload) {
-                    free(var_payload.payload);
-                    var_payload.payload = 0;
-                }
-            }
-            adios_parse_attributes_header_v1 (b, &attrs_header);
-                // process each attribute in current process group
-            for (i = 0; i < attrs_header.count; i++) {
-                adios_parse_attribute_v1 (b, &attribute);
-		// write to h5 file
-		if(attribute.is_var == adios_flag_no) {
-                    switch(attribute.type) { 
-		        case adios_string:
-		            hw_attr_str_ds (root_id, attribute.path, attribute.name, attribute.value);
-			    break;
-			case adios_byte:
-		            hw_attr_str_ds (root_id, attribute.path, attribute.name, attribute.value);
-			    break;
-			case adios_real:
-			case adios_double:
-			case adios_long_double:
-			case adios_unsigned_byte:
-			case adios_unsigned_short:
-			case adios_unsigned_integer:
-			case adios_unsigned_long:
-			case adios_short:
-			case adios_integer:
-			case adios_long:
-                            hw_attr_num_ds (root_id, attribute.path, attribute.name, attribute.value
-                                           ,attribute.type
-                                           );
-			    break;
-                        case adios_complex:
-			case adios_double_complex:
-		            fprintf(stderr, "Error in mapping ADIOS Data Types to HDF5: complex not supported yet.\n");
-			    break;
-			case adios_unknown:
-			default:
-			    fprintf(stderr, "Error in mapping ADIOS Data Types to HDF5: unknown data type.\n");
-		    }
-		}
-		else {
-                    for (j = vars_header.count; j <var_dims_count; j++) {
-                        //printf("id=%d rank=%d %llu\n",attribute.var_id,attribute.var_id,var_dims[j].offset);
-		       if (attribute.id== var_dims[j].id) { 
-                            if (var_dims[j].rank> 0) {
-                                //printf("\tattribute %s -> id (%d): %d\n",
-                                //     attribute.name,attribute.var_id, var_dims[j].rank);
-                                //printf("\tattribute %s -> id (%d):value (%llu)\n"
-                                //      ,attribute.name
-                                //      ,attribute.id
-                                //      ,var_dims[j].rank);
-		                hw_attr_num_ds (root_id, attribute.path, attribute.name
-                                              ,&var_dims[j].rank,adios_long); 
-			    //case adios_byte:
-	                    }
-		            else {
-                                //printf("\tattribute %s/%s -> id (%d)\n"
-                                //      ,attribute.path
-                                //      ,attribute.name
-                                //      ,attribute.id);
-                                copy_buffer(b0,b);
-                                b0->offset = var_dims[j].offset; 
-                                adios_parse_var_data_header_v1 (b0, &var_header);
-                                if (!var_payload.payload) { 
-		                    var_payload.payload = malloc (var_header.payload_size);
-		                    adios_parse_var_data_payload_v1 (b0, &var_header, &var_payload
-				                             ,var_header.payload_size
-				    );
-                                    if (var_header.type==adios_byte || var_header.type==adios_string)
-                                        //printf("\t varname: %s %d %s\n"
-                                        //      , var_header.name
-                                        //      , var_header.type
-                                        //      , var_payload.payload);
-                                        hw_attr_str_ds (root_id, attribute.path
-                                                       ,attribute.name
-                                                       ,var_payload.payload);
-                                    else
-		                        hw_attr_num_ds (root_id, attribute.path
-                                                       ,attribute.name
-                                                       ,var_payload.payload,var_header.type);
-                                    if (var_payload.payload)
-                                        free(var_payload.payload);
-		                    //hw_attr_num_ds (root_id, attribute.path, attribute.name
-                                    //        ,var_header.type, var_payload.payload);
-	                        }
-	                    }
-                         }
-	            }
-	        }
-            }
-	    var_dims_count = 0;
-            pg = pg->next;
-        }
-        element_num ++;
-	element_num = element_num%2;
-    }
-    if (var_dims) 
-        free (var_dims);
-
-    if (tmpstr)
-	free (tmpstr);
-    adios_posix_close_internal (b);
-    hid_t h5_status;
-    h5_status = H5Gclose (root_id);
-    h5_status = H5Fclose (h5file_id);
-    return 0;
-}
-
-/*
- * Write dataset to h5 file
- */
-void hw_dset(hid_t root_id, 
-             char * dirstr, 
-             char * name, 
-             void * data,
-             enum ADIOS_DATATYPES type, 
-             int rank,
-             uint64_t *dims,
-             uint64_t *global_dims,
-             uint64_t *offsets,
-             uint32_t time_index 
-            )
-{
-    H5Eset_auto (NULL,NULL);
-    char ** grp_name;
-    int level;
-    int i;
-    hid_t grp_id [NUM_GP + 1];
-    grp_id [0] = root_id;
-    grp_name = bp_dirparser (dirstr, &level);
-    
-    for (i = 0; i < level; i++)
-    {
-        grp_id [i + 1] = H5Gopen (grp_id [i],grp_name [i]);
-        if (grp_id [i + 1] < 0)
-        {
-            grp_id [i + 1] = H5Gcreate (grp_id [i], grp_name [i], 0);
-        }
-    }
-
-    if (global_dims[0]) {
-
-        hid_t dataspace;
-        hid_t memspace;
-        hid_t dataset;
-        hid_t type_id;
-
-        herr_t h5_status;
-
-        h5_status = bp_getH5TypeId (type, &type_id, data);
-         
-    	/*
-        hsize_t * global_h5dims;
-        hsize_t * local_h5dims;
-        hsize_t * start;
-        hsize_t * stride;
-
-        global_h5dims = (hsize_t *) malloc (rank * sizeof (hsize_t));
-        local_h5dims = (hsize_t *) malloc (rank * sizeof (hsize_t));
-        start = (hsize_t *) malloc (rank * sizeof (hsize_t));
-        stride = (hsize_t *) malloc (rank * sizeof (hsize_t));
-        */
-
-        hsize_t global_h5dims[10];
-        hsize_t local_h5dims[10];
-        hsize_t start[10];
-        hsize_t stride[10];
-
-        int i, time_idx;
-        if(array_dim_order_fortran == USE_FORTRAN) {
-            int reverse_i; 
-            time_idx=-1;
-            // transpose dimension order for Fortran arrays
-            for (i = 0; i < rank; i++) {
-                reverse_i = rank - 1 - i;
-                global_h5dims [reverse_i] = global_dims[i];
-                local_h5dims [reverse_i] = dims[i];
-                start [reverse_i] = offsets[i];
-                stride [reverse_i] = 1;
-                if (dims[i]==0) {
-                    if (verbose >= LIST_INFO)
-                        fprintf(stderr, "timeindex=%d rank=%d\n",i, rank);
-                    time_idx = reverse_i;
-                    local_h5dims[reverse_i]=1;
-                }
-            }
-            if (time_idx == 0) {
-                if (global_h5dims[time_idx]!=0) {
-                    for (i=0;i<rank-1;i++) {
-                        global_h5dims[i+1] = global_h5dims[i];
-                        start[i+1] = start[i];
-                    }
-                    global_h5dims[time_idx] = 1;
-                }
-                else if (global_h5dims[time_idx]==0 &&
-                        local_h5dims[time_idx]!=0) {
-/*
-                    for (i=rank-1;i>0;i--) {
-                        local_h5dims[i] = local_h5dims[i-1];
-                    }
-*/
-                    local_h5dims[0] = 1;
-                }
-            }
-            if (time_idx == rank-1 && global_h5dims[time_idx]==0) {
-                global_h5dims[time_idx] = 1;
-                start[time_idx] = 0;
-            }
-        }
-        else if(array_dim_order_fortran == USE_C) {
-            time_idx=-1;
-            for (i = 0; i < rank; i++) {
-                global_h5dims[i] = global_dims[i];
-                local_h5dims[i] = dims[i];
-                start [i] = offsets[i];
-                stride [i] = 1;
-		if (dims[i]==0) {
-                    time_idx = i;
-		    local_h5dims[i]=1;
-		}
-            }
-            if (time_idx == 0 && global_h5dims[time_idx]!=0) {
-	        for (i=rank-1;i>0;i--) {
-                    global_h5dims [i] = global_h5dims[i-1];
-                    start[i] = start[i-1];
-                }
-
-		global_h5dims[time_idx] = 1;
-		start[time_idx] = 0;
-            }
-            if (time_idx == rank-1 && global_h5dims[time_idx]==0) {
-	        for (i=rank-1;i>0;i--) {
-                    global_h5dims [i] = global_h5dims[i-1];
-                    local_h5dims [i] = local_h5dims[i-1];
-                    start[i] = start[i-1];
-                }
-                time_idx=0;
-		global_h5dims[time_idx] = 1;
-		start[time_idx] = 0;
-            }
-        }
-
-        dataset = H5Dopen (grp_id [level], name);
-        if (dataset>0) {
-		dataspace = H5Dget_space(dataset);
-		int rank_old = H5Sget_simple_extent_ndims(dataspace);
-		if (rank_old!=rank && dataspace>0) {
-			printf("rank doesnot match!\n");
-			H5Sclose(dataspace);
-			return;
-		}
-		hsize_t *maxdims = (hsize_t *) malloc (rank * sizeof (hsize_t));
-		h5_status = H5Sget_simple_extent_dims(dataspace,maxdims,NULL);
-                if(time_idx>=0) {  
-			global_h5dims[time_idx] = time_index;
-			start[time_idx] = time_index-1;
-			stride[time_idx] = 1;
-			if (maxdims[time_idx] < global_h5dims[time_idx]) {
-				if (verbose >= DEBUG_INFO)
-					fprintf(stderr, "%d %d now extend the dataset!\n", 
-							maxdims[time_idx],
-							global_h5dims[time_idx]);
-				h5_status = H5Dextend (dataset, global_h5dims);
-				if (h5_status<0)
-					fprintf(stderr, "H5Dextent has error!\n");
-				h5_status=H5Dclose(dataset);
-				dataset = H5Dopen (grp_id [level], name);
-				dataspace = H5Dget_space(dataset);
-			}
-		}
-                free (maxdims);
-        }
-        else {
-		global_h5dims[time_idx] = 1;
-		dataspace = H5Screate_simple (rank, global_h5dims, NULL);
-		if (dataspace < 0)
-			fprintf(stderr, "dataspace is not created!\n");
-    		hid_t cparms = H5Pcreate(H5P_DATASET_CREATE);
-    		h5_status = H5Pset_chunk(cparms,rank,local_h5dims);
-		dataset = H5Dcreate (grp_id [level], name, type_id
-				,dataspace,cparms
-				);
-		H5Pclose(cparms);
-		if (dataset< 0)
-			fprintf(stderr, "dataset is not created!\n");
-        } 
-
-        if (verbose >= LIST_INFO) {
-		for (i=0;i<rank;i++) 
-			fprintf(stderr,"\t     [%d]:\tg(%d)c(%d)o(%d)\n",
-				i, global_h5dims[i],local_h5dims[i],start[i]);
-	}
-
-        memspace = H5Screate_simple (rank, local_h5dims, NULL);
-        if (memspace< 0)
-            fprintf(stderr, "memspace is not created!\n");
-	h5_status = H5Sselect_hyperslab (dataspace, H5S_SELECT_SET
-                                  ,start, stride, local_h5dims, NULL
-                                  );
-	if (h5_status< 0)
-		fprintf(stderr, "H5Sselect_hyperslab returns error!\n");
-	h5_status = H5Dwrite (dataset, type_id, memspace, dataspace
-                             ,H5P_DEFAULT, data
-                             );
-	if (h5_status< 0)
-		fprintf(stderr, "dataset is not written! (err=%d)\n", h5_status);
-
-        H5Sclose (memspace);
-        H5Sclose (dataspace);
-        H5Dclose (dataset);
-        H5Tclose (type_id);
-	/*
-        free(global_h5dims);
-        free(local_h5dims);
-        free(start);
-        free(stride);
-	*/
-    }
-    else {
-        hsize_t * h5dims;
-        h5dims = (hsize_t *) malloc (rank * sizeof (hsize_t));    
-        if(array_dim_order_fortran == USE_FORTRAN) { 
-            // transpose dimension order for Fortran arrays
-            int i, time_idx, upper;
-            for (i = 0; i < rank; i++) {
-                h5dims [rank-1-i] = (hsize_t) dims[i];
-	     }
-        }
-        else if(array_dim_order_fortran == USE_C) {
-            int i;
-            for (i = 0; i < rank; i++)
-                h5dims [i] = (hsize_t) dims[i];
-        }
-
-        if(verbose >= DEBUG_INFO) {
-            int i;
-            for (i = 0; i < rank; i++) {
-                fprintf(stderr, "  Dataspace index = %d dimension = %d \n"
-                       ,i
-                       ,h5dims[i]
-                       );
-            }
-        }
-        hw_dataset (grp_id [level], name, data, type, rank, h5dims);
-        for (i = 1; i < level + 1; i++)
-            H5Gclose (grp_id [i]);
-
-        free (h5dims);
-    }
-    hw_free2D (grp_name, level);
-}
-
-/*
- * Write a scalar var to h5 file
- */
-void hw_scalar (hid_t root_id, char * dirstr, char * name, void * data
-               ,enum ADIOS_DATATYPES type, int append
-               )
-{
-    H5Eset_auto (NULL, NULL);
-    char ** grp_name;
-    int level;
-    int i;
-    int ndims = 1;
-    hid_t grp_id [NUM_GP + 1];
-    hsize_t dims [] = {1};
-    
-    grp_id [0] = root_id;
-    grp_name = bp_dirparser (dirstr, &level);
-    
-    for (i = 0; i < level; i++)
-    {
-        grp_id [i + 1] = H5Gopen (grp_id [i], grp_name [i]);
-        if (grp_id [i + 1] < 0) {
-            grp_id [i + 1] = H5Gcreate (grp_id [i], grp_name [i], 0);
-        }
-    }
-
-    if(scalar_dataspace == USE_SCALAR) {
-        // write in a scalar
-        hw_scalar_as_scalar (grp_id [level], name, data, type, append);
-    }
-    else if(scalar_dataspace == USE_SINGLE_ELE_ARRAY) {
-        // write in a single-element array
-        hw_scalar_as_array (grp_id [level], name, data, type, ndims, dims, append);
-    }
-
-    for (i = 1; i < level + 1; i++)
-        H5Gclose (grp_id [i]);
-
-    hw_free2D (grp_name, level);
-}
-
-/*
- * Write a scalar var to h5 file as a scalar
- */
-void hw_scalar_as_scalar (hid_t parent_id, char * name, void * data
-                 ,enum ADIOS_DATATYPES type, int append
-                 )
-{
-    hid_t h5_dataset_id;
-    hid_t h5_dataspace;
-    hid_t h5_type_id;
-    int status;
-    herr_t h5_status;
-
-    status = bp_getH5TypeId (type, &h5_type_id, data);
-    if(status == 0 && h5_type_id > 0)
-    {
-        h5_dataspace = H5Screate(H5S_SCALAR);
-        if (h5_dataspace > 0) 
-        {
-            h5_dataset_id = H5Dcreate (parent_id, name, h5_type_id
-                                      ,h5_dataspace, H5P_DEFAULT
-                                      );
-            if (h5_dataset_id > 0)
-            {
-                
-                status = H5Dwrite (h5_dataset_id, h5_type_id, H5S_ALL
-                                  ,H5S_ALL, H5P_DEFAULT, data
-                                  );
-                status = H5Dclose (h5_dataset_id);
-            }
-            else
-            {
-                if (append)
-                {
-                    h5_dataset_id = H5Dopen(parent_id, name);
-                    if (h5_dataset_id > 0)
-                    {
-                        h5_status = H5Dwrite (h5_dataset_id, h5_type_id, H5S_ALL
-                                             ,H5S_ALL, H5P_DEFAULT, data
-                                             );
-                        status = H5Sclose (h5_dataset_id);
-                    }
-                }
-            }
-            status = H5Sclose (h5_dataspace);
-        }
-        H5Tclose (h5_type_id);
-    }
-
-    return;
-}
-
-/*
- * Write a scalar var to h5 file as a single-element array
- */
-void hw_scalar_as_array (hid_t parent_id, char * name, void * data
-                 ,enum ADIOS_DATATYPES type, int ndims, hsize_t * dims
-                 ,int append
-                 )
-{
-    hid_t h5_dataset_id;
-    hid_t h5_dataspace;
-    hid_t h5_type_id;
-    int status;
-    herr_t h5_status;
-
-    status = bp_getH5TypeId (type, &h5_type_id, data);
-    if(status == 0 && h5_type_id > 0)
-    {
-        h5_dataspace = H5Screate_simple (ndims, dims, NULL);
-        if (h5_dataspace > 0) 
-        {
-            h5_dataset_id = H5Dcreate (parent_id, name, h5_type_id
-                                      ,h5_dataspace, H5P_DEFAULT
-                                      );
-            if (h5_dataset_id > 0)
-            {
-                
-                status = H5Dwrite (h5_dataset_id, h5_type_id, H5S_ALL
-                                  ,H5S_ALL, H5P_DEFAULT, data
-                                  );
-                status = H5Dclose (h5_dataset_id);
-            }
-            else
-            {
-                if (append)
-                {
-                    h5_dataset_id = H5Dopen(parent_id, name);
-                    if (h5_dataset_id > 0)
-                    {
-                        h5_status = H5Dwrite (h5_dataset_id, h5_type_id, H5S_ALL
-                                             ,H5S_ALL, H5P_DEFAULT, data
-                                             );
-                        status = H5Sclose (h5_dataset_id);
-                    }
-                }
-            }
-            status = H5Sclose (h5_dataspace);
-        }
-        H5Tclose (h5_type_id);
-    }
-
-    return;
-}
-
-/*
- * hw_attr_str_gp() writes string-typed group attribute 
- * hw_attr_str_gp() finds the group to which the attribute is attached and
- * writes the attribute. 
- */
-void hw_attr_str_gp (hid_t root_id, char * dirstr, char * aname, char * aval)
-{
-    H5Eset_auto (NULL, NULL);
-    char ** grp_name;
-    int level;
-    int i;
-    hid_t grp_id [NUM_GP + 1];
-
-    grp_id [0] = root_id;
-    grp_name = bp_dirparser (dirstr, &level);
-    
-    for (i = 0; i < level; i++)
-    {
-        grp_id [i + 1] = H5Gopen (grp_id [i], grp_name [i]);
-        if (grp_id [i + 1] < 0)
-        {
-            grp_id [i + 1] = H5Gcreate (grp_id [i], grp_name [i], 0);
-        }
-    }
-
-    hw_string_attr_gp_internal (grp_id [level], aname, aval);
-
-    for (i = 1; i < level; i++)
-        H5Gclose (grp_id [i]);
-
-    hw_free2D (grp_name, level);
-}
-
-/*
- * hw_attr_str_ds() writes string-typed dataset attribute 
- * hw_attr_str_ds() finds the dataset to which the attribute is attached and
- * writes the attribute. 
- */
-void hw_attr_str_ds (hid_t root_id, char * dirstr, char * aname, char * aval)
-{
-    H5Eset_auto (NULL, NULL);
-
-    char ** grp_name;
-    int level;
-    int i;
-    hid_t grp_id [NUM_GP + 1];
-    hid_t dataset_id;
-    hid_t type_id;
-    hid_t space_id;
-    hsize_t dims [] = {1};
-
-    grp_id [0] = root_id;
-    
-    grp_name = bp_dirparser (dirstr, &level);
-    
-    for (i = 0; i < level; i++)
-    {
-        grp_id [i + 1] = H5Gopen (grp_id [i], grp_name [i]);
-        if (grp_id [i + 1] < 0)
-        {
-            grp_id [i + 1] = H5Gcreate (grp_id [i], grp_name [i], 0);
-        }
-    }
-    if (grp_id[level] > 0) {
-        hw_string_attr_gp_internal (grp_id [level], aname, aval);
-
-        for (i = 1; i < level; i++)
-            H5Gclose (grp_id [i]);
-
-        hw_free2D (grp_name, level);
-        return;
-    }
-    for (i = 0; i < level - 1; i++) {
-        grp_id [i + 1] = H5Gopen (grp_id [i], grp_name [i]);
-	if (grp_id [i + 1] < 0) {
-            grp_id [i + 1] = H5Gcreate (grp_id [i], grp_name [i], 0);
-        }
-    }
-    
-    dataset_id = H5Dopen (grp_id [level - 1], grp_name [level - 1]);
-     
-    type_id = H5Tcopy (H5T_NATIVE_INT);
-    if (dataset_id == -1)
-    {
-        // BUG:
-        // create a dataset if the dataset specified by path doesn't exist
-        // actually this code never get executed because ADIOS always writes
-        // all vars before writing attributes
-        // in case the dataset does not exist, then there is no way to ensure
-        // the dataspace is single element array
-        // FIX:
-        // delay attribute write until corresponding dataset is written
-        //fprintf(stderr, "Warning in writing h5 file: you hit a bug (%s: %d)\n", __FILE__, __LINE__);
-
-        space_id = H5Screate_simple (1, dims, NULL);
-        dataset_id = H5Dcreate (grp_id [level - 1], grp_name [level - 1]
-                               ,type_id, space_id, H5P_DEFAULT
-                               );
-        if(dataset_id==-1)
-           hw_attr_str_gp (root_id, dirstr, aname, aval);
-    }
-   
-    if(dataset_id>0) hw_string_attr_ds_internal (dataset_id, aname, aval);
-
-    H5Dclose (dataset_id);
-    for (i = 1; i < level; i++)
-        H5Gclose (grp_id [i]);
-
-    hw_free2D (grp_name, level);
-}
-
-/*
- * String-typed group attribute is converted to hdf5 dataset attribute 
- * in C convention or Fortran convention. 
- */
-void hw_string_attr_gp_internal (hid_t parent_id, const char *name,const char *value)
-{
-    if(attr_str_gp_fortran == USE_C) {
-        hw_string_attr_c(parent_id, name, value);   
-    }
-    else if(attr_str_gp_fortran == USE_FORTRAN) {
-        hw_string_attr_f(parent_id, name, value);    
-    }
-}
-
-/*
- * String-typed dataset attribute is converted to hdf5 dataset attribute 
- * in C convention or Fortran convention. 
- */
-void hw_string_attr_ds_internal (hid_t parent_id, const char *name,const char *value)
-{
-    if(attr_str_ds_fortran == USE_C) {
-        hw_string_attr_c(parent_id, name, value);   
-    }
-    else if(attr_str_ds_fortran == USE_FORTRAN) {
-        hw_string_attr_f(parent_id, name, value);    
-    }
-}
-
-/*
- * Write string-typed attribute in C convention
- */
-void hw_string_attr_c (hid_t parent_id, const char *name,const char *value)
-{
-    hid_t dspace_id,dtype_id,attr_id;
-    dspace_id = H5Screate(H5S_SCALAR);
-    if(dspace_id>0)
-    {
-        dtype_id = H5Tcopy(H5T_C_S1_g);
-        if(dtype_id>0)
-        {
-            H5Tset_size(dtype_id,strlen(value)+1);
-            attr_id = H5Acreate(parent_id,name,dtype_id,dspace_id,H5P_DEFAULT);
-            if(attr_id>0)
-            {
-                H5Awrite(attr_id,dtype_id,value);
-                H5Aclose(attr_id);
-            }
-            H5Tclose(dtype_id);
-        }
-        H5Sclose(dspace_id);
-    }
-
-    return;
-}
-
-/*
- * Write string-typed attribute in Fortran convention
- */
-void hw_string_attr_f (hid_t parent_id, const char *name,const char *value)
-{
-    hid_t dspace_id, dtype_id, attr_id;
-    hsize_t adims[1] = {1};
-
-    dspace_id = H5Screate(H5S_SCALAR);
-    //dspace_id = H5Screate_simple(1, adims, NULL);
-    if(dspace_id > 0)
-    {
-        dtype_id = H5Tcopy(H5T_C_S1_g);
-        //dtype_id = H5Tcopy(H5T_FORTRAN_S1); // Fortran string
-        if(dtype_id > 0)
-        {
-            //H5Tset_size(dtype_id, strlen(value));
-            H5Tset_size(dtype_id,strlen(value)+1);
-            attr_id = H5Acreate(parent_id, name, dtype_id, dspace_id, H5P_DEFAULT);
-            if(attr_id > 0)
-            {
-                H5Awrite(attr_id, dtype_id, value);
-                H5Aclose(attr_id);
-            }
-            H5Tclose(dtype_id);
-        }
-        H5Sclose(dspace_id);
-    }
-
-    return;
-}
-
-/*
- * hw_attr_num_gp() writes numeric-typed group attribute 
- * hw_attr_num_gp() finds the group to which the attribute is attached and
- * writes the attribute. 
- */
-void hw_attr_num_gp(hid_t root_id, char *dirstr, char *aname, void *avalue, enum ADIOS_DATATYPES type)
-{
-    H5Eset_auto(NULL,NULL);
-    char **grp_name;
-    int level,i;
-    hid_t grp_id[NUM_GP+1];
-
-    grp_id[0] = root_id;
-    grp_name = bp_dirparser(dirstr,&level);
-    
-    for(i=0;i<level;i++)
-    {
-        grp_id[i+1] = H5Gopen(grp_id[i],grp_name[i]);
-        if(grp_id[i+1]<0)
-        {
-            grp_id[i+1] = H5Gcreate(grp_id[i],grp_name[i], 0);
-        }
-    }
-
-    hw_scalar_attr(grp_id[level], aname, avalue,type);
-
-    for(i=1;i<level;i++)
-        H5Gclose(grp_id[i]);
-
-    hw_free2D(grp_name,level);
-}
-
-/*
- * hw_attr_num_ds() writes numeric-typed dataset attribute 
- * hw_attr_num_ds() finds the dataset to which the attribute is attached and
- * writes the attribute. 
- */
-void hw_attr_num_ds(hid_t root_id, char *dirstr, char *aname, void *avalue, enum ADIOS_DATATYPES type)
-{
-    H5Eset_auto(NULL,NULL);
-    char **grp_name;
-    int level,i;
-    hid_t grp_id[NUM_GP+1],dataset_id,type_id, space_id;
-    hsize_t dims[]={1};
-
-    grp_id[0] = root_id;
-    
-    grp_name = bp_dirparser(dirstr,&level);
-    for(i=0;i<level;i++)
-    {
-        grp_id[i+1] = H5Gopen(grp_id[i],grp_name[i]);
-        if(grp_id[i+1]<0)
-        {
-            grp_id[i+1] = H5Gcreate(grp_id[i],grp_name[i], 0);
-        }
-    }
-
-    if (grp_id[level] > 0) {    
-        hw_scalar_attr(grp_id[level], aname, avalue,type);
-        for(i=1;i<level;i++)
-            H5Gclose(grp_id[i]);
-        hw_free2D(grp_name,level);
-        return; 
-    }
-    
-    for (i = 0; i < level - 1; i++) {
-        grp_id [i + 1] = H5Gopen (grp_id [i], grp_name [i]);
-	if (grp_id [i + 1] < 0) {
-            grp_id [i + 1] = H5Gcreate (grp_id [i], grp_name [i], 0);
-        }
-    }
-    
-    dataset_id = H5Dopen(grp_id[level-1],grp_name[level-1]);
-    
-    if(dataset_id==-1)
-    {
-        // BUG:
-        // create a dataset if the dataset specified by path doesn't exist
-        // actually this code never get executed because ADIOS always writes
-        // all vars before writing attributes
-        // in case the dataset does not exist, then there is no way to ensure
-        // the dataspace is single element array
-        // FIX:
-        // delay attribute write until corresponding dataset is written
-        fprintf(stderr, "Warning in writing h5 file: you hit a bug (%s: %d)\n", __FILE__, __LINE__);
-
-        type_id = H5Tcopy(H5T_NATIVE_INT);
-        space_id = H5Screate_simple(1,dims,NULL);
-        dataset_id = H5Dcreate(grp_id[level-1],grp_name[level-1],type_id,space_id,H5P_DEFAULT);
-        if(dataset_id==-1)
-        {
-           printf("hit group att!%d\n",type);
-           if(type==adios_string)
-              hw_attr_str_gp (root_id, dirstr, aname, avalue);
-           else
-              hw_attr_num_gp (root_id, dirstr, aname, avalue,type);
-        }
-    }
-
-    if(dataset_id>0)
-    {
-       hw_scalar_attr(dataset_id, aname, avalue,type);
-      //printf("%s: dataset_id:%d, %s\n",grp_name[0],dataset_id,aname);
-       H5Dclose(dataset_id);
-    }
-
-
-    for(i=1;i<level;i++)
-        H5Gclose(grp_id[i]);
-
-    hw_free2D(grp_name,level);
-}
-
-/*
- * Write an integer attribute as a scalar or a single-element-array
- */
-void hw_scalar_attr( hid_t parent_id, const char *name, void *value,enum ADIOS_DATATYPES type)
-{
-    if(scalar_dataspace == USE_SCALAR) {
-        hw_scalar_attr_scalar (parent_id, name, value, type);
-    }
-    else if(scalar_dataspace == USE_SINGLE_ELE_ARRAY){
-        hw_scalar_attr_array (parent_id, name, value, type);
-    }
-}
-
-/*
- * Write an integer attribute to a h5 file as a scalar
- *
- * Edited from the AVS example file src/hdf5/examp/write_struct.c
- */
-void hw_scalar_attr_scalar ( hid_t parent_id, const char *name, void *value, enum ADIOS_DATATYPES type)
-{
-    hid_t h5_dspace_id, h5_attr_id, h5_type_id;
-    int status;
-    herr_t h5_status;
-  
-    h5_dspace_id = H5Screate( H5S_SCALAR );
-    if( h5_dspace_id > 0 ) 
-    {
-        status = bp_getH5TypeId( type, &h5_type_id, value );
-        if ( status == 0 && h5_type_id > 0 ) 
-        {
-            h5_attr_id = H5Acreate( parent_id, name, h5_type_id,h5_dspace_id, H5P_DEFAULT );
-            if( h5_attr_id > 0 ) 
-            {
-                h5_status = H5Awrite( h5_attr_id, h5_type_id, value );
-                if (h5_status < 0)
-                    fprintf(stderr, "Failed to write an attribute (%s) to the h5 file!\n",name);
-                H5Aclose( h5_attr_id );     /* close attribute */
-            }
-            H5Sclose( h5_dspace_id );       /* close dataspace */
-        }
-        H5Tclose( h5_type_id );
-    }
-    return;
-}
-
-/*
- * Write an integer attribute to a h5 file as a single-element-array
- */
-void hw_scalar_attr_array ( hid_t parent_id, const char *name, void *value, enum ADIOS_DATATYPES type)
-{
-    hid_t h5_dspace_id, h5_attr_id, h5_type_id;
-    int status;
-    herr_t h5_status;
-    hsize_t dims[1] = {1};
-  
-    h5_dspace_id = H5Screate_simple(1, dims, NULL);
-    if( h5_dspace_id > 0 ) 
-    {
-        status = bp_getH5TypeId( type, &h5_type_id, value );
-        if ( status == 0 && h5_type_id > 0 ) 
-        {
-            h5_attr_id = H5Acreate( parent_id, name, h5_type_id, h5_dspace_id, H5P_DEFAULT );
-            if( h5_attr_id > 0 ) 
-            {
-                h5_status = H5Awrite( h5_attr_id, h5_type_id, value );
-                if (h5_status < 0)
-                    fprintf(stderr, "Failed to write an attribute (%s) to the h5 file!\n", name);
-                H5Aclose( h5_attr_id );     /* close attribute */
-            }
-            H5Sclose( h5_dspace_id );       /* close dataspace */
-        }
-        H5Tclose( h5_type_id );
-    }
-    return;
-}
-
-/*
- * Write an array as a dataset to a h5 file 
- */
-void hw_dataset(hid_t parent_id, char* name, void* data,enum ADIOS_DATATYPES type, int rank, hsize_t * dims)
-{
-    hid_t dataset_id, dataspace, cparms, type_id,filespace;    
-    int i,rank_old, time_idx;
-    herr_t h5_status;
-    hsize_t *offset;
-    hsize_t *maxdims;
-    maxdims = (hsize_t*)malloc(sizeof(hsize_t)*rank);
-    offset = (hsize_t*)malloc(sizeof(hsize_t)*rank);
-/*
-    for (i=0;i<rank;i++) {
-	time_idx = dims[i];
-        dims[i] = time_idx;
-    }
-*/
-    cparms = H5Pcreate(H5P_DATASET_CREATE);
-
-    for(i=0;i<rank;i++) {
-        maxdims[i] = H5S_UNLIMITED;    
-        offset[i] = 0;
-    }
-    for (i=0;i<rank;i++) {
-	if (dims[i]==0) {
-	    dims[i]=1;
-	    break;
-	}
-    }
-
-    h5_status = H5Pset_chunk(cparms,rank,dims);
-
-    time_idx = i; 
-
-    h5_status = bp_getH5TypeId(type, &type_id, data);
-    if(h5_status == 0 && type_id>0) {
-        dataset_id = H5Dopen(parent_id,name);
-        if(dataset_id<0) {
-            dataspace = H5Screate_simple(rank, dims, NULL);
-            if(dataspace>0 && h5_status==0) {
-                dataset_id = H5Dcreate(parent_id, name, type_id, dataspace,cparms);
-		if (dataset_id < 0) {
-			dataset_id = H5Gopen (parent_id, name);
-			if (dataset_id > 0) {
-				H5Gunlink(parent_id,name);	
-                		dataset_id = H5Dcreate(parent_id, name, type_id, dataspace,cparms);
-			}
-		}
-                if(dataset_id<0) {
-			fprintf(stderr, "Dataset %s Creation failed!\n",name);
-                    H5Sclose(dataspace);
-                    return;
-                }
-                h5_status = H5Dextend (dataset_id, dims);
-                filespace = H5Dget_space(dataset_id);
-                h5_status = H5Sselect_hyperslab(filespace,H5S_SELECT_SET,offset,NULL,dims,NULL);
-                h5_status = H5Dwrite(dataset_id,type_id,dataspace,filespace,H5P_DEFAULT,data);
-            }
-        }
-        else {
-            filespace = H5Dget_space(dataset_id);
-            rank_old = H5Sget_simple_extent_ndims(filespace);
-            if(rank_old!=rank && filespace>0) {
-                H5Sclose(filespace);
-                return;
-            }
-            h5_status = H5Sget_simple_extent_dims(filespace,maxdims,NULL);
-            if (time_idx<rank) {
-                if (verbose >= DEBUG_INFO) 
- 			printf("\ttime step: %d\n",maxdims[i]);
-                offset[time_idx] = maxdims[time_idx];
-                maxdims [time_idx] += dims[time_idx];
-            }
-            h5_status = H5Dextend (dataset_id, maxdims);
-            filespace = H5Dget_space(dataset_id);
-            int ret_rank = H5Sget_simple_extent_dims(filespace,maxdims,NULL);
-            if(verbose >= DEBUG_INFO) {
-                printf("parent_id=%d,dataset_id=%d, name=%s,filespace=%d\n",\
-                        parent_id,dataset_id, name,filespace);
-            }
-
-            h5_status = H5Sselect_hyperslab(filespace,H5S_SELECT_SET,offset,NULL,dims,NULL);
-            dataspace = H5Screate_simple(rank, dims, NULL);
-            h5_status = H5Dwrite(dataset_id,type_id,dataspace,filespace,H5P_DEFAULT,data);
-        }
-        if(dataset_id>0) {
-            h5_status = H5Dclose(dataset_id);
-	}
-        if(dataspace>0)
-            h5_status = H5Sclose(dataspace);
-        if(filespace>0)
-            h5_status = H5Sclose(filespace);
-    }
-    h5_status=H5Tclose(type_id);
-    h5_status=H5Pclose(cparms);
-    free(maxdims);
-    free(offset);
-    return;
-}
-
-/*
- * Maps bp datatypes to h5 datatypes 
- *
- * The Mapping is according to HDF5 Reference Manual
- * (http://hdf.ncsa.uiuc.edu/HDF5/doc1.6/Datatypes.html)
- */
-int bp_getH5TypeId(enum ADIOS_DATATYPES type, hid_t* h5_type_id, void * val)
-{
-    int size, status=0;
-
-    switch (type)
-    {
-        case adios_byte:
-            *h5_type_id = H5Tcopy(H5T_NATIVE_CHAR);
-            break;
-        case adios_string:
-            if(var_str_fortran == USE_FORTRAN) {
-                *h5_type_id = H5Tcopy(H5T_FORTRAN_S1);
-            }
-            else { // otherwise assume C
-                *h5_type_id = H5Tcopy(H5T_C_S1_g);
-            }
-            break;
-        case adios_real:
-            *h5_type_id = H5Tcopy(H5T_NATIVE_FLOAT);
-            break;
-        case adios_double:
-            *h5_type_id = H5Tcopy(H5T_NATIVE_DOUBLE);
-            break;
-        case adios_long_double:
-            *h5_type_id = H5Tcopy(H5T_NATIVE_LDOUBLE);
-            break;
-        case adios_unsigned_byte:
-            *h5_type_id = H5Tcopy(H5T_NATIVE_UINT8);
-            break;
-        case adios_unsigned_short:
-            *h5_type_id = H5Tcopy(H5T_NATIVE_UINT16);
-            break;
-        case adios_unsigned_integer:
-            *h5_type_id = H5Tcopy(H5T_NATIVE_UINT32);
-            break;
-        case adios_unsigned_long:
-            *h5_type_id = H5Tcopy(H5T_NATIVE_UINT64);
-            break;
-        case adios_short:
-            *h5_type_id = H5Tcopy(H5T_NATIVE_INT16);
-            break;
-        case adios_integer:
-            *h5_type_id = H5Tcopy(H5T_NATIVE_INT32);
-            break;
-        case adios_long:
-            *h5_type_id = H5Tcopy(H5T_NATIVE_INT64);
-            break;
-        case adios_complex:
-        case adios_double_complex:
-            fprintf(stderr, "Error in mapping ADIOS Data Types to HDF5: complex not supported yet.\n");
-            status = -1;
-            break;
-        case adios_unknown:
-        default:
-            fprintf(stderr, "Error in mapping ADIOS Data Types to HDF5: unknown data type.\n");
-            status = -1;
-    }
-    return status;
-}
-
-const char * value_to_string (enum ADIOS_DATATYPES type, void * data)
-{
-    static char s [100];
-    s [0] = 0;
-
-    switch (type)
-    {
-        case adios_unsigned_byte:
-            sprintf (s, "%u", *(((uint8_t *) data)));
-            break;
-
-        case adios_byte:
-            sprintf (s, "%d", *(((int8_t *) data)));
-            break;
-
-        case adios_short:
-            sprintf (s, "%hd", *(((int16_t *) data)));
-            break;
-
-        case adios_unsigned_short:
-            sprintf (s, "%uh", *(((uint16_t *) data)));
-            break;
-
-        case adios_integer:
-            sprintf (s, "%d", *(((int32_t *) data)));
-            break;
-
-        case adios_unsigned_integer:
-            sprintf (s, "%u", *(((uint32_t *) data)));
-            break;
-
-        case adios_long:
-            sprintf (s, "%lld", *(((int64_t *) data)));
-            break;
-
-        case adios_unsigned_long:
-            sprintf (s, "%llu", *(((uint64_t *) data)));
-            break;
-
-        case adios_real:
-            sprintf (s, "%f", *(((float *) data)));
-            break;
-
-        case adios_double:
-            sprintf (s, "%le", *(((double *) data)));
-            break;
-
-        case adios_long_double:
-            sprintf (s, "%Le", *(((long double *) data)));
-            break;
-        case adios_string:
-            sprintf (s, "%s", ((char *) data));
-            break;
-
-        case adios_complex:
-            sprintf (s, "(%f %f)", *(((float *) data) + 0)
-                                 , *(((float *) data) + 1)
-                    );
-            break;
-
-        case adios_double_complex:
-            sprintf (s, "(%lf %lf)", *(((double *) data) + 0)
-                                   , *(((double *) data) + 1)
-                    );
-            break;
-    }
-
-    return s;
-}
-
-void print_process_group_header (uint64_t num
-                      ,struct adios_process_group_header_struct_v1 * pg_header
-                      )
-{
-    int i;
-    struct adios_method_info_struct_v1 * m;
-
-    printf ("Process Group: %llu\n", num);
-    printf ("\tGroup Name: %s\n", pg_header->name);
-    printf ("\tHost Language Fortran?: %c\n"
-           ,(pg_header->host_language_fortran == adios_flag_yes ? 'Y' : 'N')
-           );
-    printf ("\tCoordination Var Member ID: %d\n", pg_header->coord_var_id);
-    printf ("\tTime Name: %s\n", pg_header->time_index_name);
-    printf ("\tTime: %d\n", pg_header->time_index);
-    printf ("\tMethods used in output: %d\n", pg_header->methods_count);
-    m = pg_header->methods;
-    while (m)
-    {
-        printf ("\t\tMethod ID: %d\n", m->id);
-        printf ("\t\tMethod Parameters: %s\n", m->parameters);
-
-        m = m->next;
-    }
-}
-
diff --git a/utils/bp2h5/hw-utils.h b/utils/bp2h5/hw-utils.h
deleted file mode 100644
index 948b0ec..0000000
--- a/utils/bp2h5/hw-utils.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/* 
- * ADIOS is freely available under the terms of the BSD license described
- * in the COPYING file in the top level directory of this source distribution.
- *
- * Copyright (c) 2008 - 2009.  UT-BATTELLE, LLC. All rights reserved.
- */
-
-#ifndef HW_UTILS_H
-#define HW_UTILS_H 1
-
-#include "stdint.h"
-#include "hdf5.h"
-#include "adios_types.h"
-
-enum lang_convention {
-    USE_FORTRAN = 1,
-    USE_C = 2
-};
-
-enum scalar_convention {
-    USE_SCALAR = 1,
-    USE_SINGLE_ELE_ARRAY = 2
-};
-
-enum verbose_level {
-    NO_INFO = 0,
-    LIST_INFO = 1,    
-    DEBUG_INFO = 2   
-};
-
-/*
- * Initialization
- * initialize_bp2h5() sets config variables and allocate
- * internal read buffer.
- * It returns 0 if no error and -1 otherwise
- */
-int initialize_bp2h5(enum lang_convention array_dim_order,
-                     enum lang_convention var_str,
-                     enum lang_convention attr_str_ds,
-                     enum lang_convention attr_str_gp,
-                     enum scalar_convention scalar_ds,
-                     enum verbose_level verb
-                     );
-
-/*
- * Convert bp file fnamein to a h5 file fnameout
- */
-int hw_makeh5(char *filename, char *filename1);
-
-/*
- * String-typed dataset attribute is converted to hdf5 dataset attribute 
- * in C convention or Fortran convention. 
- */
-void hw_string_attr_ds_internal ( hid_t parent_id, const char *name,const char *value);
-
-/*
- * String-typed group attribute is converted to hdf5 dataset attribute 
- * in C convention or Fortran convention. 
- */
-void hw_string_attr_gp_internal (hid_t parent_id, const char *name,const char *value);
-
-/*
- * Write string-typed attribute in Fortran convention
- */
-void hw_string_attr_f (hid_t parent_id, const char *name,const char *value);
-
-/*
- * Write string-typed attribute in C convention
- */
-void hw_string_attr_c (hid_t parent_id, const char *name,const char *value);
-
-/*
- * Write an integer attribute as a scalar or a single-element-array
- */
-void hw_scalar_attr(hid_t parent_id, const char *name, void *value,enum ADIOS_DATATYPES type);
-
-/*
- * Write an integer attribute to an h5 file as a scalar
- *
- * Edited from the AVS example file src/hdf5/examp/write_struct.c
- */
-void hw_scalar_attr_scalar ( hid_t parent_id, const char *name, void *value, enum ADIOS_DATATYPES type);
-
-/*
- * Write an integer attribute to an h5 file as a single-element-array
- */
-void hw_scalar_attr_array ( hid_t parent_id, const char *name, void *value, enum ADIOS_DATATYPES type);
-
-/*
- * Write dataset to h5 file
- */
-/*
- * Write dataset to h5 file
- */
-void hw_dset (hid_t root_id, char * dirstr, char * name, void * data
-             ,enum ADIOS_DATATYPES type, int rank
-             ,uint64_t *dims
-             ,uint64_t *global_dims
-             ,uint64_t *offsets
-             ,uint32_t time_index 
-             );
-
-/*
- * Write a scalar var to h5 file as a scalar
- */
-void hw_scalar_as_scalar (hid_t parent_id, char * name, void * data
-                 ,enum ADIOS_DATATYPES type, int append
-                 );
-
-/*
- * Write a scalar var to h5 file as a single-element array
- */
-void hw_scalar_as_array (hid_t parent_id, char * name, void * data
-                 ,enum ADIOS_DATATYPES type, int ndims, hsize_t * dims
-                 ,int append
-                 );
-
-/*
- * write a scalar var to h5 file
- */
-void hw_scalar (hid_t root_id, char * dirstr, char * name, void * data
-               ,enum ADIOS_DATATYPES type, int append
-               );
-
-/*
- * hw_attr_str_ds() writes string-typed dataset attribute 
- * hw_attr_str_ds() finds the dataset to which the attribute is attached and
- * writes the attribute. 
- */
-void hw_attr_str_ds (hid_t root_id, char * dirstr, char * aname, char * aval);
-
-/*
- * hw_attr_num_ds() writes numeric-typed dataset attribute 
- * hw_attr_num_ds() finds the dataset to which the attribute is attached and
- * writes the attribute. 
- */
-void hw_attr_num_ds(hid_t root_id, char *dirstr, char *aname, void *avalue, enum ADIOS_DATATYPES type);
-
-/*
- * hw_attr_str_gp() writes string-typed group attribute 
- * hw_attr_str_gp() finds the group to which the attribute is attached and
- * writes the attribute. 
- */
-void hw_attr_str_gp (hid_t root_id, char * dirstr, char * aname, char * aval);
-
-/*
- * hw_attr_num_gp() writes numeric-typed group attribute 
- * hw_attr_num_gp() finds the group to which the attribute is attached and
- * writes the attribute. 
- */
-void hw_attr_num_gp(hid_t root_id, char *dirstr, char *aname, void *avalue, enum ADIOS_DATATYPES type);
-
-/*
- * Write an array as a dataset to an h5 file 
- */
-void hw_dataset(hid_t parent_id, char* name, void* data,enum ADIOS_DATATYPES type, int ndims, hsize_t * dims);
-
-/*
- * Maps bp datatypes to h5 datatypes 
- */
- int bp_getH5TypeId(enum ADIOS_DATATYPES type, hid_t* h5_type_id, void * val);
-
-#endif
diff --git a/utils/bp2ncd/Makefile.am b/utils/bp2ncd/Makefile.am
index 0abe030..37ff99a 100644
--- a/utils/bp2ncd/Makefile.am
+++ b/utils/bp2ncd/Makefile.am
@@ -7,13 +7,18 @@ bin_PROGRAMS = bp2ncd
 
 bp2ncd_SOURCES = bp2ncd.c
 
-bp2ncd_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_SEQ_CPPFLAGS) $(ADIOSLIB_SEQ_CFLAGS)
-bp2ncd_LDFLAGS = $(ADIOSLIB_SEQ_LDFLAGS) -static-libtool-libs
-bp2ncd_LDADD = $(top_builddir)/src/libadios_internal_nompi.a
-bp2ncd_LDADD += $(ADIOSLIB_SEQ_LDADD)
-
-EXTRA_DIST = bp2ncd.h
 if USE_PARALLEL_COMPILER
     CC=$(MPICC)
     CXX=$(MPICXX)
+    bp2ncd_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_CPPFLAGS)
+    bp2ncd_CFLAGS = $(ADIOSLIB_CFLAGS) 
+    bp2ncd_LDFLAGS = $(ADIOSLIB_LDFLAGS) -static-libtool-libs
+    bp2ncd_LDADD = $(top_builddir)/src/libadios.a $(ADIOSLIB_LDADD)
+else
+    bp2ncd_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_INT_CPPFLAGS) $(ADIOSLIB_INT_CFLAGS)
+    bp2ncd_LDFLAGS = $(ADIOSLIB_INT_LDFLAGS) -static-libtool-libs
+    bp2ncd_LDADD = $(top_builddir)/src/libadios_internal_nompi.a
+    bp2ncd_LDADD += $(ADIOSLIB_INT_LDADD)
 endif
+
+EXTRA_DIST = bp2ncd.h
diff --git a/utils/bp2ncd/Makefile.in b/utils/bp2ncd/Makefile.in
index 4b56509..84121f4 100644
--- a/utils/bp2ncd/Makefile.in
+++ b/utils/bp2ncd/Makefile.in
@@ -46,6 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -67,8 +68,11 @@ PROGRAMS = $(bin_PROGRAMS)
 am_bp2ncd_OBJECTS = bp2ncd-bp2ncd.$(OBJEXT)
 bp2ncd_OBJECTS = $(am_bp2ncd_OBJECTS)
 am__DEPENDENCIES_1 =
-bp2ncd_DEPENDENCIES = $(top_builddir)/src/libadios_internal_nompi.a \
-	$(am__DEPENDENCIES_1)
+ at USE_PARALLEL_COMPILER_FALSE@bp2ncd_DEPENDENCIES = $(top_builddir)/src/libadios_internal_nompi.a \
+ at USE_PARALLEL_COMPILER_FALSE@	$(am__DEPENDENCIES_1)
+ at USE_PARALLEL_COMPILER_TRUE@bp2ncd_DEPENDENCIES =  \
+ at USE_PARALLEL_COMPILER_TRUE@	$(top_builddir)/src/libadios.a \
+ at USE_PARALLEL_COMPILER_TRUE@	$(am__DEPENDENCIES_1)
 DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
 depcomp =
 am__depfiles_maybe =
@@ -89,6 +93,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -165,6 +173,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -199,6 +209,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
@@ -304,10 +317,14 @@ target_alias = @target_alias@
 INCLUDES = $(all_includes) -I$(top_builddir)/src
 AUTOMAKE_OPTIONS = no-dependencies
 bp2ncd_SOURCES = bp2ncd.c
-bp2ncd_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_SEQ_CPPFLAGS) $(ADIOSLIB_SEQ_CFLAGS)
-bp2ncd_LDFLAGS = $(ADIOSLIB_SEQ_LDFLAGS) -static-libtool-libs
-bp2ncd_LDADD = $(top_builddir)/src/libadios_internal_nompi.a \
-	$(ADIOSLIB_SEQ_LDADD)
+ at USE_PARALLEL_COMPILER_FALSE@bp2ncd_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_INT_CPPFLAGS) $(ADIOSLIB_INT_CFLAGS)
+ at USE_PARALLEL_COMPILER_TRUE@bp2ncd_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_CPPFLAGS)
+ at USE_PARALLEL_COMPILER_TRUE@bp2ncd_CFLAGS = $(ADIOSLIB_CFLAGS) 
+ at USE_PARALLEL_COMPILER_FALSE@bp2ncd_LDFLAGS = $(ADIOSLIB_INT_LDFLAGS) -static-libtool-libs
+ at USE_PARALLEL_COMPILER_TRUE@bp2ncd_LDFLAGS = $(ADIOSLIB_LDFLAGS) -static-libtool-libs
+ at USE_PARALLEL_COMPILER_FALSE@bp2ncd_LDADD = $(top_builddir)/src/libadios_internal_nompi.a \
+ at USE_PARALLEL_COMPILER_FALSE@	$(ADIOSLIB_INT_LDADD)
+ at USE_PARALLEL_COMPILER_TRUE@bp2ncd_LDADD = $(top_builddir)/src/libadios.a $(ADIOSLIB_LDADD)
 EXTRA_DIST = bp2ncd.h
 all: all-am
 
@@ -390,10 +407,10 @@ distclean-compile:
 	$(LTCOMPILE) -c -o $@ $<
 
 bp2ncd-bp2ncd.o: bp2ncd.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bp2ncd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bp2ncd-bp2ncd.o `test -f 'bp2ncd.c' || echo '$(srcdir)/'`bp2ncd.c
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bp2ncd_CPPFLAGS) $(CPPFLAGS) $(bp2ncd_CFLAGS) $(CFLAGS) -c -o bp2ncd-bp2ncd.o `test -f 'bp2ncd.c' || echo '$(srcdir)/'`bp2ncd.c
 
 bp2ncd-bp2ncd.obj: bp2ncd.c
-	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bp2ncd_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o bp2ncd-bp2ncd.obj `if test -f 'bp2ncd.c'; then $(CYGPATH_W) 'bp2ncd.c'; else $(CYGPATH_W) '$(srcdir)/bp2ncd.c'; fi`
+	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(bp2ncd_CPPFLAGS) $(CPPFLAGS) $(bp2ncd_CFLAGS) $(CFLAGS) -c -o bp2ncd-bp2ncd.obj `if test -f 'bp2ncd.c'; then $(CYGPATH_W) 'bp2ncd.c'; else $(CYGPATH_W) '$(srcdir)/bp2ncd.c'; fi`
 
 mostlyclean-libtool:
 	-rm -f *.lo
diff --git a/utils/bpdump/Makefile.am b/utils/bpdump/Makefile.am
index 2097f88..2f639fb 100644
--- a/utils/bpdump/Makefile.am
+++ b/utils/bpdump/Makefile.am
@@ -6,10 +6,10 @@ AUTOMAKE_OPTIONS = no-dependencies
 bin_PROGRAMS = bpdump
 
 bpdump_SOURCES = bpdump.c
-bpdump_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_SEQ_CPPFLAGS) $(ADIOSLIB_SEQ_CFLAGS)
-bpdump_LDFLAGS = $(ADIOSLIB_SEQ_LDFLAGS)
+bpdump_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_INT_CPPFLAGS) $(ADIOSLIB_INT_CFLAGS)
+bpdump_LDFLAGS = $(ADIOSLIB_INT_LDFLAGS)
 bpdump_LDADD = $(top_builddir)/src/libadios_internal_nompi.a
-bpdump_LDADD += $(ADIOSLIB_SEQ_LDADD)
+bpdump_LDADD += $(ADIOSLIB_INT_LDADD)
 
 if USE_PARALLEL_COMPILER
     CC=$(MPICC)
diff --git a/utils/bpdump/Makefile.in b/utils/bpdump/Makefile.in
index f678994..cb9ae8a 100644
--- a/utils/bpdump/Makefile.in
+++ b/utils/bpdump/Makefile.in
@@ -46,6 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -89,6 +90,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -165,6 +170,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -199,6 +206,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
@@ -304,10 +314,10 @@ target_alias = @target_alias@
 INCLUDES = $(all_includes) -I$(top_builddir)/src
 AUTOMAKE_OPTIONS = no-dependencies
 bpdump_SOURCES = bpdump.c
-bpdump_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_SEQ_CPPFLAGS) $(ADIOSLIB_SEQ_CFLAGS)
-bpdump_LDFLAGS = $(ADIOSLIB_SEQ_LDFLAGS)
+bpdump_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_INT_CPPFLAGS) $(ADIOSLIB_INT_CFLAGS)
+bpdump_LDFLAGS = $(ADIOSLIB_INT_LDFLAGS)
 bpdump_LDADD = $(top_builddir)/src/libadios_internal_nompi.a \
-	$(ADIOSLIB_SEQ_LDADD)
+	$(ADIOSLIB_INT_LDADD)
 all: all-am
 
 .SUFFIXES:
diff --git a/utils/bpdump/bpdump.c b/utils/bpdump/bpdump.c
index 208e73e..4101b58 100644
--- a/utils/bpdump/bpdump.c
+++ b/utils/bpdump/bpdump.c
@@ -1002,10 +1002,7 @@ void print_vars_index (struct adios_index_var_struct_v1 * vars_root)
         {
             printf ("\tOffset(%llu)", vars_root->characteristics [i].offset);
             printf ("\tPayload Offset(%llu)", vars_root->characteristics [i].payload_offset);
-            if (vars_root->characteristics [i].file_name)
-            {
-                printf ("\tFile Name(%s)", vars_root->characteristics [i].file_name);
-            }
+            printf ("\tFile Index(%d)", vars_root->characteristics [i].file_index);
             printf ("\tTime Index(%d)", vars_root->characteristics [i].time_index);
 
     		/* NCSU - Print min, max */
@@ -1126,10 +1123,7 @@ void print_attributes_index
         {
             printf ("\t\tOffset(%llu)", attrs_root->characteristics [i].offset);
             printf ("\t\tPayload Offset(%llu)", attrs_root->characteristics [i].payload_offset);
-            if (attrs_root->characteristics [i].file_name)
-            {
-                printf ("\t\tFile Name(%s)", attrs_root->characteristics [i].file_name);
-            }
+            printf ("\t\tFile Index(%d)", attrs_root->characteristics [i].file_index);
             printf ("\t\tTime Index(%d)", attrs_root->characteristics [i].time_index);
 
     		/* NCSU - Print min, max  */
diff --git a/utils/bpls/Makefile.in b/utils/bpls/Makefile.in
index db00a88..c3fbaf1 100644
--- a/utils/bpls/Makefile.in
+++ b/utils/bpls/Makefile.in
@@ -46,6 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -89,6 +90,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -163,6 +168,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -197,6 +204,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/utils/bpls/bpls.c b/utils/bpls/bpls.c
index 1e17f36..2ab1329 100644
--- a/utils/bpls/bpls.c
+++ b/utils/bpls/bpls.c
@@ -207,6 +207,7 @@ int main( int argc, char *argv[] ) {
                 readattrs = true;
                 break;
             case 'n':
+                errno = 0;
                 tmp = strtol(optarg, (char **)NULL, 0);
                 if (errno) {
                     fprintf(stderr, "Error: could not convert --columns value: %s\n", optarg);
@@ -240,6 +241,7 @@ int main( int argc, char *argv[] ) {
                 break;
                 /*
                    case 't':
+                   errno = 0;
                    tmp = strtol(optarg, (char **)NULL, 0);
                    if (errno) {
                    fprintf(stderr, "Error: could not convert --time value: %s\n", optarg);
@@ -1173,9 +1175,9 @@ int print_data_characteristics(void * min, void * max, double * avg, double * st
 
     switch(adiosvartype) {
         case adios_unsigned_byte:
-            if (min) fprintf(outf,(f ? format : "%10hhu  "), ((unsigned char *) min));
+            if (min) fprintf(outf,(f ? format : "%10hhu  "), * ((unsigned char *) min));
             else fprintf(outf, "      null  ");
-            if (max) fprintf(outf,(f ? format : "%10hhu  "), ((unsigned char *) max));
+            if (max) fprintf(outf,(f ? format : "%10hhu  "), * ((unsigned char *) max));
             else fprintf(outf, "      null  ");
             if (avg) fprintf(outf, "%10.2f  ", * avg);
             else fprintf(outf, "      null  ");
@@ -1183,9 +1185,9 @@ int print_data_characteristics(void * min, void * max, double * avg, double * st
             else fprintf(outf, "      null  ");
             break;
         case adios_byte:
-            if (min) fprintf(outf,(f ? format : "%10hhd  "), ((char *) min));
+            if (min) fprintf(outf,(f ? format : "%10hhd  "), * ((char *) min));
             else fprintf(outf, "      null  ");
-            if (max) fprintf(outf,(f ? format : "%10hhd  "), ((char *) max));
+            if (max) fprintf(outf,(f ? format : "%10hhd  "), * ((char *) max));
             else fprintf(outf, "      null  ");
             if (avg) fprintf(outf, "%10.2f  ", * avg);
             else fprintf(outf, "      null  ");
@@ -1259,7 +1261,6 @@ int print_data_characteristics(void * min, void * max, double * avg, double * st
             break;
 
         case adios_real:
-        case adios_double:
             if (min) fprintf(outf,(f ? format : "%10.2g  "), (* (float *) min));
             else fprintf(outf, "      null  ");
             if (max) fprintf(outf,(f ? format : "%10.2g  "), (* (float *) max));
@@ -1269,6 +1270,16 @@ int print_data_characteristics(void * min, void * max, double * avg, double * st
             if (std_dev) fprintf(outf, "%10.2g  ", * std_dev);
             else fprintf(outf, "      null  ");
             break;
+        case adios_double:
+            if (min) fprintf(outf,(f ? format : "%10.2g  "), (* (double *) min));
+            else fprintf(outf, "      null  ");
+            if (max) fprintf(outf,(f ? format : "%10.2g  "), (* (double *) max));
+            else fprintf(outf, "      null  ");
+            if (avg) fprintf(outf, "%10.2g  ", * avg);
+            else fprintf(outf, "      null  ");
+            if (std_dev) fprintf(outf, "%10.2g  ", * std_dev);
+            else fprintf(outf, "      null  ");
+            break;
 
         case adios_long_double:
             //fprintf(outf,(f ? format : "%g "), ((double *) data)[item]);
diff --git a/utils/bpsplit/Makefile.am b/utils/bpsplit/Makefile.am
index 09e66b1..bb7556c 100644
--- a/utils/bpsplit/Makefile.am
+++ b/utils/bpsplit/Makefile.am
@@ -6,22 +6,22 @@ AUTOMAKE_OPTIONS = no-dependencies
 bin_PROGRAMS = bpsplit bpappend bpgettime
 
 bpsplit_SOURCES = bpsplit.c
-bpsplit_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_SEQ_CPPFLAGS) $(ADIOSLIB_SEQ_CFLAGS)
-bpsplit_LDFLAGS = $(ADIOSLIB_SEQ_LDFLAGS)
+bpsplit_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_INT_CPPFLAGS) $(ADIOSLIB_INT_CFLAGS)
+bpsplit_LDFLAGS = $(ADIOSLIB_INT_LDFLAGS)
 bpsplit_LDADD = $(top_builddir)/src/libadios_internal_nompi.a 
-bpsplit_LDADD += $(ADIOSLIB_SEQ_LDADD)
+bpsplit_LDADD += $(ADIOSLIB_INT_LDADD)
 
 bpappend_SOURCES = bpappend.c
-bpappend_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_SEQ_CPPFLAGS) $(ADIOSLIB_SEQ_CFLAGS)
-bpappend_LDFLAGS = $(ADIOSLIB_SEQ_LDFLAGS)
+bpappend_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_INT_CPPFLAGS) $(ADIOSLIB_INT_CFLAGS)
+bpappend_LDFLAGS = $(ADIOSLIB_INT_LDFLAGS)
 bpappend_LDADD = $(top_builddir)/src/libadios_internal_nompi.a
-bpappend_LDADD += $(ADIOSLIB_SEQ_LDADD)
+bpappend_LDADD += $(ADIOSLIB_INT_LDADD)
 
 bpgettime_SOURCES = bpgettime.c
-bpgettime_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_SEQ_CPPFLAGS) $(ADIOSLIB_SEQ_CFLAGS)
-bpgettime_LDFLAGS = $(ADIOSLIB_SEQ_LDFLAGS)
+bpgettime_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_INT_CPPFLAGS) $(ADIOSLIB_INT_CFLAGS)
+bpgettime_LDFLAGS = $(ADIOSLIB_INT_LDFLAGS)
 bpgettime_LDADD = $(top_builddir)/src/libadios_internal_nompi.a
-bpgettime_LDADD += $(ADIOSLIB_SEQ_LDADD)
+bpgettime_LDADD += $(ADIOSLIB_INT_LDADD)
 
 if USE_PARALLEL_COMPILER
     CC=$(MPICC)
diff --git a/utils/bpsplit/Makefile.in b/utils/bpsplit/Makefile.in
index ab93e50..9f9e1c0 100644
--- a/utils/bpsplit/Makefile.in
+++ b/utils/bpsplit/Makefile.in
@@ -46,6 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -99,6 +100,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -175,6 +180,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -209,6 +216,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
@@ -314,20 +324,20 @@ target_alias = @target_alias@
 INCLUDES = $(all_includes) -I$(top_builddir)/src
 AUTOMAKE_OPTIONS = no-dependencies
 bpsplit_SOURCES = bpsplit.c
-bpsplit_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_SEQ_CPPFLAGS) $(ADIOSLIB_SEQ_CFLAGS)
-bpsplit_LDFLAGS = $(ADIOSLIB_SEQ_LDFLAGS)
+bpsplit_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_INT_CPPFLAGS) $(ADIOSLIB_INT_CFLAGS)
+bpsplit_LDFLAGS = $(ADIOSLIB_INT_LDFLAGS)
 bpsplit_LDADD = $(top_builddir)/src/libadios_internal_nompi.a \
-	$(ADIOSLIB_SEQ_LDADD)
+	$(ADIOSLIB_INT_LDADD)
 bpappend_SOURCES = bpappend.c
-bpappend_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_SEQ_CPPFLAGS) $(ADIOSLIB_SEQ_CFLAGS)
-bpappend_LDFLAGS = $(ADIOSLIB_SEQ_LDFLAGS)
+bpappend_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_INT_CPPFLAGS) $(ADIOSLIB_INT_CFLAGS)
+bpappend_LDFLAGS = $(ADIOSLIB_INT_LDFLAGS)
 bpappend_LDADD = $(top_builddir)/src/libadios_internal_nompi.a \
-	$(ADIOSLIB_SEQ_LDADD)
+	$(ADIOSLIB_INT_LDADD)
 bpgettime_SOURCES = bpgettime.c
-bpgettime_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_SEQ_CPPFLAGS) $(ADIOSLIB_SEQ_CFLAGS)
-bpgettime_LDFLAGS = $(ADIOSLIB_SEQ_LDFLAGS)
+bpgettime_CPPFLAGS = $(ADIOSLIB_EXTRA_CPPFLAGS) $(ADIOSLIB_INT_CPPFLAGS) $(ADIOSLIB_INT_CFLAGS)
+bpgettime_LDFLAGS = $(ADIOSLIB_INT_LDFLAGS)
 bpgettime_LDADD = $(top_builddir)/src/libadios_internal_nompi.a \
-	$(ADIOSLIB_SEQ_LDADD)
+	$(ADIOSLIB_INT_LDADD)
 all: all-am
 
 .SUFFIXES:
diff --git a/utils/gpp/Makefile.in b/utils/gpp/Makefile.in
index de318e7..21d24ca 100644
--- a/utils/gpp/Makefile.in
+++ b/utils/gpp/Makefile.in
@@ -46,6 +46,7 @@ am__aclocal_m4_deps = $(top_srcdir)/config/ac_dart.m4 \
 	$(top_srcdir)/config/ac_dmalloc.m4 \
 	$(top_srcdir)/config/ac_hdf5.m4 \
 	$(top_srcdir)/config/ac_infiniband.m4 \
+	$(top_srcdir)/config/ac_lustre.m4 \
 	$(top_srcdir)/config/ac_mxml.m4 \
 	$(top_srcdir)/config/ac_nc4par.m4 \
 	$(top_srcdir)/config/ac_netcdf.m4 \
@@ -71,6 +72,10 @@ ACLOCAL = @ACLOCAL@
 ADIOSLIB_CFLAGS = @ADIOSLIB_CFLAGS@
 ADIOSLIB_CPPFLAGS = @ADIOSLIB_CPPFLAGS@
 ADIOSLIB_EXTRA_CPPFLAGS = @ADIOSLIB_EXTRA_CPPFLAGS@
+ADIOSLIB_INT_CFLAGS = @ADIOSLIB_INT_CFLAGS@
+ADIOSLIB_INT_CPPFLAGS = @ADIOSLIB_INT_CPPFLAGS@
+ADIOSLIB_INT_LDADD = @ADIOSLIB_INT_LDADD@
+ADIOSLIB_INT_LDFLAGS = @ADIOSLIB_INT_LDFLAGS@
 ADIOSLIB_LDADD = @ADIOSLIB_LDADD@
 ADIOSLIB_LDFLAGS = @ADIOSLIB_LDFLAGS@
 ADIOSLIB_SEQ_CFLAGS = @ADIOSLIB_SEQ_CFLAGS@
@@ -145,6 +150,8 @@ HAVE_HDF5_FALSE = @HAVE_HDF5_FALSE@
 HAVE_HDF5_TRUE = @HAVE_HDF5_TRUE@
 HAVE_INFINIBAND_FALSE = @HAVE_INFINIBAND_FALSE@
 HAVE_INFINIBAND_TRUE = @HAVE_INFINIBAND_TRUE@
+HAVE_LUSTRE_FALSE = @HAVE_LUSTRE_FALSE@
+HAVE_LUSTRE_TRUE = @HAVE_LUSTRE_TRUE@
 HAVE_MPI_FALSE = @HAVE_MPI_FALSE@
 HAVE_MPI_TRUE = @HAVE_MPI_TRUE@
 HAVE_MXML_FALSE = @HAVE_MXML_FALSE@
@@ -179,6 +186,9 @@ LIBS = @LIBS@
 LIBTOOL = @LIBTOOL@
 LN_S = @LN_S@
 LTLIBOBJS = @LTLIBOBJS@
+LUSTRE_CPPFLAGS = @LUSTRE_CPPFLAGS@
+LUSTRE_LDFLAGS = @LUSTRE_LDFLAGS@
+LUSTRE_LIBS = @LUSTRE_LIBS@
 MAKEINFO = @MAKEINFO@
 MPICC = @MPICC@
 MPICXX = @MPICXX@
diff --git a/utils/gpp/gpp.py b/utils/gpp/gpp.py
index db8efc8..00caa64 100755
--- a/utils/gpp/gpp.py
+++ b/utils/gpp/gpp.py
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
 import os
 import sys
 import xml.dom.minidom
@@ -13,7 +13,33 @@ def callback(arg, dirname,fnames):
             or filename.endswith(".f95") or filename.endswith(".c")):
            arg.append(filename)
 
+
+def checkXML (config_file, path):
+    if path == '':
+        adios_lint = 'adios_lint '
+    else:
+        adios_lint = path + '/adios_lint '
+    rv = os.system (adios_lint + config_file)
+    if rv == 0:
+        return 'success'
+    elif rv == 32512:  # System unable to find adios_lint command
+        print "Unable to find adios_lint. Proceeding with code generation."
+        return 'success'
+    else:
+        print "gpp.py failed."
+        return 'failure'
+
+
 def main(argv=None):
+
+    if len (sys.argv) != 2:
+        print 'Usage: gpp.py <config file>\n'
+        return 1
+
+    check_val = checkXML (sys.argv[1], os.path.dirname(sys.argv[0])) 
+    if check_val != 'success':
+        return 1
+
     global vardict
     vardict = xmlparser.getVarlistFromXML(sys.argv[1])
     for fname in vardict:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/adios.git



More information about the debian-science-commits mailing list