summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pablo/HDFIOTrace.h12
-rw-r--r--pablo/HDFmpioProtos.h40
-rw-r--r--pablo/Makefile.in109
-rw-r--r--pablo/PabloHDF.c1464
-rw-r--r--pablo/PabloHDF_MPIO.c1364
-rw-r--r--pablo/PabloHDF_RT.c9
-rw-r--r--pablo/PabloHDF_SDDF.c14
-rw-r--r--pablo/ProcIDs.h7
-rw-r--r--pablo/ProcTrace.h4
-rw-r--r--pablo/READ_ME19
10 files changed, 1777 insertions, 1265 deletions
diff --git a/pablo/HDFIOTrace.h b/pablo/HDFIOTrace.h
index 6e41612..4124dda 100644
--- a/pablo/HDFIOTrace.h
+++ b/pablo/HDFIOTrace.h
@@ -131,7 +131,7 @@ int HDFtraceFSETPOS( FILE *stream, const fpos_t *position ) ;
void HDFtraceREWIND( FILE *stream ) ;
ssize_t HDFtraceWRITE( int fd, const void *buf, size_t nbytes );
size_t HDFtraceFWRITE( const void *, size_t , size_t , FILE * );
-int HDFtracePUTS( char *s ) ;
+int HDFtracePUTS( const char *s ) ;
int HDFtraceFPUTC( int c, FILE *stream ) ;
int HDFtraceFPUTS( const char *s, FILE *stream ) ;
@@ -293,6 +293,7 @@ void HDFtraceIOEnd ( int, double, char * );
#include "HDFmpioProtos.h"
+/*
#ifdef MPI_File_open
#undef MPI_File_open
#endif
@@ -410,10 +411,13 @@ void HDFtraceIOEnd ( int, double, char * );
#define MPI_File_set_atomicity HDF_MPI_File_set_atomicity
#define MPI_File_get_atomicity HDF_MPI_File_get_atomicity
#define MPI_File_sync HDF_MPI_File_sync
-#endif /* HAVE_PARALLEL */
-#endif /* HAVE_PARALLEL */
+#endif
+*/
+#endif
+#endif
#ifdef __cplusplus
}
-#endif
+
+#endif /* HAVE_PARALLEL */
#endif /* HDFIOTRACE conditional */
diff --git a/pablo/HDFmpioProtos.h b/pablo/HDFmpioProtos.h
index 5a08c4e..886983d 100644
--- a/pablo/HDFmpioProtos.h
+++ b/pablo/HDFmpioProtos.h
@@ -1,3 +1,42 @@
+#ifdef PCF_BUILD
+#define MPI_File_open PCF_MPI_File_open
+#define MPI_File_close PCF_MPI_File_close
+#define MPI_File_set_size PCF_MPI_File_set_size
+#define MPI_File_get_size PCF_MPI_File_get_size
+#define MPI_File_set_view PCF_MPI_File_set_view
+#define MPI_File_get_view PCF_MPI_File_get_view
+#define MPI_File_read_at PCF_MPI_File_read_at
+#define MPI_File_read_at_all PCF_MPI_File_read_at_all
+#define MPI_File_write_at PCF_MPI_File_write_at
+#define MPI_File_write_at_all PCF_MPI_File_write_at_all
+#define MPI_File_sync PCF_MPI_File_sync
+
+int PCF_MPI_File_open( MPI_Comm comm, char *filename, int amode,
+ MPI_Info info, MPI_File *fh );
+int PCF_MPI_File_close( MPI_File *fh );
+int PCF_MPI_File_delete( char *filename, MPI_Info info );
+int PCF_MPI_File_set_size( MPI_File fh, MPI_Offset size );
+int PCF_MPI_File_get_size( MPI_File fh, MPI_Offset *size );
+int PCF_MPI_File_set_view( MPI_File fh, MPI_Offset disp, MPI_Datatype etype,
+ MPI_Datatype filetype, char *datarep,
+ MPI_Info info );
+int PCF_MPI_File_get_view( MPI_File fh, MPI_Offset *disp,
+ MPI_Datatype *etype, MPI_Datatype *filetype,
+ char *datarep );
+int PCF_MPI_File_read_at( MPI_File fh, MPI_Offset offset, void *buf,
+ int count, MPI_Datatype datatype,
+ MPI_Status *status );
+int PCF_MPI_File_read_at_all( MPI_File fh, MPI_Offset offset, void *buf,
+ int count, MPI_Datatype datatype,
+ MPI_Status *status );
+int PCF_MPI_File_write_at( MPI_File fh, MPI_Offset offset, void *buf,
+ int count, MPI_Datatype datatype,
+ MPI_Status *status );
+int PCF_MPI_File_write_at_all( MPI_File fh, MPI_Offset offset, void *buf,
+ int count, MPI_Datatype datatype,
+ MPI_Status *status );
+int PCF_MPI_File_sync( MPI_File fh );
+#else
#define MPI_File_open HDF_MPI_File_open
#define MPI_File_close HDF_MPI_File_close
#define MPI_File_set_size HDF_MPI_File_set_size
@@ -35,3 +74,4 @@ int HDF_MPI_File_write_at_all( MPI_File fh, MPI_Offset offset, void *buf,
int count, MPI_Datatype datatype,
MPI_Status *status );
int HDF_MPI_File_sync( MPI_File fh );
+#endif /* PCF_BUILD */
diff --git a/pablo/Makefile.in b/pablo/Makefile.in
index c70c933..0617169 100644
--- a/pablo/Makefile.in
+++ b/pablo/Makefile.in
@@ -9,6 +9,7 @@ top_builddir=..
srcdir=@srcdir@
@COMMENCE@
TRACE=perl ../bin/trace
+.SUFFIXES: .c .o .lo .x
###############################################################################
## MODIFICATONS FOR CREATING THE PABLO INSTRUMENTED LIBRARY libhdf5-inst.a
## For Pablo instrumenation of parallel code, remove the # from in front of
@@ -19,7 +20,8 @@ TRACE=perl ../bin/trace
###############################################################################
#PABLO_MPIO_FLAGS = -DH5_HAVE_PARALLEL -DH5_HAVE_MPIOTRACE
PABLO_INC = $(PABLO_TRACELIB)/include
-PABLO_FLAGS = -I. -I../src -I$(PABLO_INC) -DH5_HAVE_PABLO $(PABLO_MPIO_FLAGS)
+PABLO_FLAGS = -I../src -I$(PABLO_INC) -DH5_HAVE_PABLO $(PABLO_MPIO_FLAGS)
+CPPFLAGS=-I. -I. -I../src -DH5_DEBUG_API -DNDEBUG $(PABLO_FLAGS) -D$(PABLO_BLD)_BUILD
## This is our main target:
LIB=libhdf5-inst.a
@@ -45,17 +47,15 @@ LIB_SRC= \
H5FDlog.c H5Gnode.c H5Olayout.c H5Spoint.c \
H5FDmpio.c H5Gstab.c H5Omtime.c H5Sselect.c
-PABLO_OBJ = PabloHDF.o PabloHDF_RT.o PabloHDF_SDDF.o
+PABLO_OBJ = PabloHDF.o PabloHDF_RT.o PabloHDF_SDDF.o PabloHDF_MPIO.o
-LIB_COBJ = $(LIB_SRC:.c=.o)
+LIB_XOBJ = $(LIB_SRC:.c=.x)
+LIB_COBJ = $(LIB_XOBJ:.x=.o)
LIB_OBJ = $(PABLO_OBJ) $(LIB_COBJ)
-lib_obj: $(LIB_OBJ)
-copy_src:
- cp ../src/*.c .
- touch ../src/*.c
- touch *.c
- touch copy_src
+.c.x:
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c ../src/$*.c -o $*.o
+ cp $*.o $@
# 'vpath' directive is only supported in gmake, take out - QAK
#vpath %.c $(shell echo $(SRCDIRS) | sed 's/ /:/g')
@@ -74,8 +74,8 @@ PABLO_HDR = HDFentryNames.h HDFidList.h ProcIDs.h HDFTrace.h ProcTrace.h \
## makefile.
##
lib: $(LIB)
-$(LIB): $(LIB_OBJ)
- $(AR) -rc $@ *.o
+$(LIB): $(PABLO_OBJ) $(LIB_XOBJ)
+ $(AR) -rc $@ $(LIB_OBJ)
$(RANLIB) $@
##
## Dummy this out so that there is no redundant make of the library
@@ -116,14 +116,14 @@ uninstall:
## remove things like object files but not libraries or executables.
##
mostlyclean:
- $(RM) $(LIB_OBJ) $(TEST_OBJ) $(PROG_OBJ) $(MOSTLYCLEAN)
+ $(RM) $(LIB_OBJ) $(LIB_XOBJ) $(TEST_OBJ) $(PROG_OBJ) $(MOSTLYCLEAN)
## Like `mostlyclean' except it also removes the final targets: things like
## libraries and executables. This target doesn't remove any file that
## is part of the HDF5 distribution.
##
clean: mostlyclean
- $(RM) $(LIB) $(TESTS) $(PROGS) $(CLEAN) $(PABLO_CLEAN) H*.c copy_src
+ $(RM) $(LIB) $(TESTS) $(PROGS) $(CLEAN) $(PABLO_CLEAN) H*.c
## Like `clean' except it also removes files that were created by running
## configure. If you've unpacked the source and built HDF5 without creating
@@ -142,11 +142,9 @@ distclean: clean
maintainer-clean: distclean
$(RM) *~ core core.* *.core *.bak *.contrib gmon.out
-.c.o:
- $(CC) $(CFLAGS) $(CPPFLAGS) $(PABLO_FLAGS) -c $<
.c.lo:
- @$(LT_COMPILE) $(CFLAGS) $(CPPFLAGS) $(PABLO_FLAGS) -c $<
+ @$(LT_COMPILE) $(CFLAGS) $(CPPFLAGS) -c ../src/$*.c $<
PABLO_INCLUDES = HDFentryNames.h HDFidList.h ProcIDs.h HDFTrace.h ProcTrace.h \
@@ -188,14 +186,85 @@ ProcTrace.inc: HDFidList.h
echo " parameter (NoTrace = 4)" >> $@
-PabloHDF.o: PabloHDF.c $(PABLO_INCLUDES) copy_src
+PabloHDF.o: PabloHDF.c $(PABLO_INCLUDES)
$(CC) -g $(CFLAGS) $(CPPFLAGS) $(PABLO_FLAGS) -c $<
-PabloHDF_RT.o: PabloHDF_RT.c $(PABLO_INCLUDES) copy_src
+PabloHDF_RT.o: PabloHDF_RT.c $(PABLO_INCLUDES)
+ $(CC) $(CFLAGS) $(CPPFLAGS) $(PABLO_FLAGS) -c $<
+
+PabloHDF_SDDF.o: PabloHDF_SDDF.c $(PABLO_INCLUDES)
$(CC) $(CFLAGS) $(CPPFLAGS) $(PABLO_FLAGS) -c $<
-PabloHDF_SDDF.o: PabloHDF_SDDF.c $(PABLO_INCLUDES) copy_src
+PabloHDF_MPIO.o: PabloHDF_MPIO.c $(PABLO_INCLUDES)
$(CC) $(CFLAGS) $(CPPFLAGS) $(PABLO_FLAGS) -c $<
-PabloHDFff.o: PabloHDFff.f $(PABLO_INCLUDES) copy_src
+PabloHDFff.o: PabloHDFff.f $(PABLO_INCLUDES)
$(F77) $(FFLAGS) -O -c PabloHDFff.f
+
+H5.c: ../src/H5.c
+H5A.c: ../src/H5A.c
+H5AC.c: ../src/H5AC.c
+H5B.c: ../src/H5B.c
+H5D.c: ../src/H5D.c
+H5E.c: ../src/H5E.c
+H5F.c: ../src/H5F.c
+H5FD.c: ../src/H5FD.c
+H5FDcore.c: ../src/H5FDcore.c
+H5FDdpss.c: ../src/H5FDdpss.c
+H5FDfamily.c: ../src/H5FDfamily.c
+H5FDgass.c: ../src/H5FDgass.c
+H5FDlog.c: ../src/H5FDlog.c
+H5FDmpio.c: ../src/H5FDmpio.c
+H5FDmulti.c: ../src/H5FDmulti.c
+H5FDsec2.c: ../src/H5FDsec2.c
+H5FDsrb.c: ../src/H5FDsrb.c
+H5FDstdio.c: ../src/H5FDstdio.c
+H5FDstream.c: ../src/H5FDstream.c
+H5FL.c: ../src/H5FL.c
+H5Farray.c: ../src/H5Farray.c
+H5Fcontig.c: ../src/H5Fcontig.c
+H5Fistore.c: ../src/H5Fistore.c
+H5Fseq.c: ../src/H5Fseq.c
+H5G.c: ../src/H5G.c
+H5Gent.c: ../src/H5Gent.c
+H5Gnode.c: ../src/H5Gnode.c
+H5Gstab.c: ../src/H5Gstab.c
+H5HG.c: ../src/H5HG.c
+H5HL.c: ../src/H5HL.c
+H5I.c: ../src/H5I.c
+H5MF.c: ../src/H5MF.c
+H5MM.c: ../src/H5MM.c
+H5O.c: ../src/H5O.c
+H5Oattr.c: ../src/H5Oattr.c
+H5Ocomp.c: ../src/H5Ocomp.c
+H5Ocont.c: ../src/H5Ocont.c
+H5Odtype.c: ../src/H5Odtype.c
+H5Oefl.c: ../src/H5Oefl.c
+H5Ofill.c: ../src/H5Ofill.c
+H5Olayout.c: ../src/H5Olayout.c
+H5Omtime.c: ../src/H5Omtime.c
+H5Oname.c: ../src/H5Oname.c
+H5Onull.c: ../src/H5Onull.c
+H5Osdspace.c: ../src/H5Osdspace.c
+H5Oshared.c: ../src/H5Oshared.c
+H5Ostab.c: ../src/H5Ostab.c
+H5P.c: ../src/H5P.c
+H5R.c: ../src/H5R.c
+H5S.c: ../src/H5S.c
+H5Sall.c: ../src/H5Sall.c
+H5Shyper.c: ../src/H5Shyper.c
+H5Smpio.c: ../src/H5Smpio.c
+H5Snone.c: ../src/H5Snone.c
+H5Spoint.c: ../src/H5Spoint.c
+H5Sselect.c: ../src/H5Sselect.c
+H5T.c: ../src/H5T.c
+H5TB.c: ../src/H5TB.c
+H5TS.c: ../src/H5TS.c
+H5Tbit.c: ../src/H5Tbit.c
+H5Tconv.c: ../src/H5Tconv.c
+H5Tinit.c: ../src/H5Tinit.c
+H5Tvlen.c: ../src/H5Tvlen.c
+H5V.c: ../src/H5V.c
+H5Z.c: ../src/H5Z.c
+H5Zdeflate.c: ../src/H5Zdeflate.c
+H5detect.c: ../src/H5detect.c
diff --git a/pablo/PabloHDF.c b/pablo/PabloHDF.c
index d78cf07..aa11d85 100644
--- a/pablo/PabloHDF.c
+++ b/pablo/PabloHDF.c
@@ -112,6 +112,10 @@ int HDFtrace3OPEN( const char *, int, mode_t );
typedef unsigned int mode_t;
#endif
+#ifdef H5_HAVE_PARALLEL
+#define HAVE_MPIO
+#endif
+
int OUTPUT_SWITCH = 1;
int *procTrace;
extern void preInitIOTrace( void );
@@ -126,11 +130,27 @@ extern void preInitIOTrace( void );
#define ID_timeStamp 9999
#define DUMMY_HDF 10000
-#ifdef H5_HAVE_PARALLEL
-#include "mpi.h"
-int HDF_get_Bytes( MPI_Datatype datatype, int count );
-#endif /* H5_HAVE_PARALLEL*/
+extern char HDFprocNames[][40] = {
+"noName",
+"noName",
+"noName",
+"noName",
+"noName",
+#include "HDFentryNames.h"
+"HDF_LAST_ENTRY"
+};
+
+void startHDFtraceEvent (int );
+void endHDFtraceEvent (int , int , char *, int );
+
+#ifdef TRACELIB_BUILD
+#undef PCF_BUILD
+#endif
+#ifdef PCF_BUILD
+void hdfCaptureInit( const char* name, int captureType );
+void hdfCaptureEnd( void );
+#else
void HDFinitTrace_RT ( const char *, int );
void HDFinitTrace_SDDF ( const char *, int );
void hinittracex_ ( char [], int *, int[], int *,unsigned * );
@@ -138,17 +158,13 @@ void hdfendtrace_ ( void ) ;
void HDFendTrace_RT (int);
void HDFendTrace_SDDF(int);
void HDFfinalTimeStamp( void );
-void startHDFtraceEvent (int );
-int computeProcMask (int eventID);
-int computePacketTag(int eventID);
-void endHDFtraceEvent (int , int , char *, int );
void HDFtraceEvent_RT ( int , HDFsetInfo *, unsigned );
void HDFtraceIOEvent( int , void *, unsigned );
extern int IOtracingEnabled;
extern int suppressMPIOtrace;
char *hdfRecordPointer;
-double WriteTotals = 0.0;
-double ReadTotals = 0.0;
+#endif
+
/*======================================================================*
// NAME *
// HDFinitTrace -- initialize HDF tracing *
@@ -164,6 +180,7 @@ double ReadTotals = 0.0;
// RETURNS *
// None. *
//======================================================================*/
+#ifndef PCF_BUILD
/*======================================================================*
// fortran to C interface. *
// This is called from hdfinittracef_ *
@@ -249,9 +266,12 @@ hinittracex_( char *file,
exit (-1);
}
}
-void HDFinitTrace( const char *traceFileName, int id_flag, ... )
+#endif /* PCF_BUILD */
+void
+HDFinitTrace( const char *traceFileName, int id_flag, ... )
{
- int i, nIDs;
+ int i;
+ int nIDs;
va_list ap;
/*===================================================================*
@@ -280,7 +300,7 @@ void HDFinitTrace( const char *traceFileName, int id_flag, ... )
//===================================================================*/
nIDs = 0;
va_start( ap, id_flag );
- while ( id_flag > NO_TRACE )
+ while ( id_flag > LAST_TRACE_TYPE )
{
procTrace[id_flag] = 1;
++nIDs;
@@ -298,6 +318,9 @@ void HDFinitTrace( const char *traceFileName, int id_flag, ... )
procTrace[i] = 1;
}
}
+#ifdef PCF_BUILD
+ hdfCaptureInit( traceFileName, OUTPUT_SWITCH );
+#else
suppressMPIOtrace = TRUE;
if ( OUTPUT_SWITCH == RUNTIME_TRACE
|| OUTPUT_SWITCH == MPI_RUNTIME_TRACE )
@@ -324,6 +347,7 @@ void HDFinitTrace( const char *traceFileName, int id_flag, ... )
fprintf(stderr," Exiting Program. <<\n");
exit (-1);
}
+#endif /* PCF_BUILD */
}
/*======================================================================*
// NAME *
@@ -339,6 +363,9 @@ void hdfendtrace_( void )
}
void HDFendTrace(void)
{
+#ifdef PCF_BUILD
+ hdfCaptureEnd();
+#else
if ( OUTPUT_SWITCH == RUNTIME_TRACE
|| OUTPUT_SWITCH == MPI_RUNTIME_TRACE )
{
@@ -349,9 +376,13 @@ void HDFendTrace(void)
{
HDFendTrace_RT( OUTPUT_SWITCH );
}
+#endif /* PCF_BUILD */
}
void startHDFtraceEvent(int eventID)
{
+#ifdef PCF_BUILD
+ traceHDFentryEvent( eventID ) ;
+#else
if ( OUTPUT_SWITCH == RUNTIME_TRACE
|| OUTPUT_SWITCH == MPI_RUNTIME_TRACE )
{
@@ -361,9 +392,13 @@ void startHDFtraceEvent(int eventID)
{
HDFtraceEvent_RT( eventID, NULL, 0 ) ;
}
+#endif /* PCF_BUILD */
}
void endHDFtraceEvent(int eventID, int setID, char *setName, int IDtype )
{
+#ifdef PCF_BUILD
+ traceHDFexitEvent( eventID );
+#else
HDFsetInfo info;
info.setID = setID;
info.setName = setName;
@@ -383,7 +418,43 @@ void endHDFtraceEvent(int eventID, int setID, char *setName, int IDtype )
fprintf(stderr,"invalid OUTPUT_SWITCH %d, IDtype = %d\n",
OUTPUT_SWITCH, IDtype ) ;
}
+#endif /* PCF_BUILD */
+}
+#ifdef PCF_BUILD
+void
+hdfCaptureInit( const char* name, int captureType )
+{
+ int procNum;
+ HDF_get_NodeNum( &procNum );
+ basePerformanceInit( name, procNum );
+ genericBaseInit( captureType, procNum );
+ unixIObaseInit( captureType, procNum );
+#ifdef HAVE_MPIO
+ mpiIObaseInit( captureType, procNum );
+#endif
+ hdfBaseInit( captureType,
+ procNum,
+ ID_HDF_Last_Entry,
+ HDFprocNames );
}
+void
+hdfCaptureEnd( void )
+{
+ int i;
+ timeStamp();
+ for ( i = 0; i < NUM_HDF_IDS; ++i )
+ {
+ procTrace[i] = 0;
+ }
+ hdfBaseEnd();
+#ifdef HAVE_MPIO
+ mpiIObaseEnd();
+#endif
+ unixIObaseEnd();
+ genericBaseEnd();
+ basePerformanceEnd();
+}
+#endif /* PCF_BUILD */
/*****************************************************************************/
/* The HDFtraceXXXX routines are substitutes for the standard I/O routines. */
/* When libhdf5-inst.a is compiled, macros in HDFTrace.h substitute the name */
@@ -401,9 +472,13 @@ void endHDFtraceEvent(int eventID, int setID, char *setName, int IDtype )
/*+ Mode = -1 +*/
/*+ +*/
/*****************************************************************************/
-FILE*HDFtraceFOPEN( const char *filename, const char *type )
+FILE*
+HDFtraceFOPEN( const char *filename, const char *type )
{
FILE *fp;
+#ifdef PCF_BUILD
+ fp = (FILE *)traceFOPEN( filename, type );
+#else
int fd, id;
int flags = 0;
struct open_args openArgs;
@@ -471,7 +546,7 @@ FILE*HDFtraceFOPEN( const char *filename, const char *type )
{
HDFtraceIOEvent( fopenEndID, (void *) &id, int_SIZE );
}
-
+#endif /* PCF_BUILD */
return( fp );
}
@@ -485,8 +560,11 @@ FILE*HDFtraceFOPEN( const char *filename, const char *type )
int
HDFtraceCREAT( const char *path, mode_t mode )
{
- struct open_args openArgs;
int fd;
+#ifdef PCF_BUILD
+ fd = traceCREAT( path, mode );
+#else
+ struct open_args openArgs;
int id;
if ( IOtracingEnabled ) {
@@ -503,7 +581,7 @@ HDFtraceCREAT( const char *path, mode_t mode )
if ( IOtracingEnabled ) {
HDFtraceIOEvent( openEndID, (void *) &id, int_SIZE );
}
-
+#endif /* PCF_BUILD */
return( fd );
}
@@ -517,9 +595,13 @@ HDFtraceCREAT( const char *path, mode_t mode )
/*+ record Flush (fflushBeginID) +*/
/*+ +*/
/*****************************************************************************/
-int HDFtraceFFLUSH( FILE *stream )
+int
+HDFtraceFFLUSH( FILE *stream )
{
int ret;
+#ifdef PCF_BUILD
+ ret = traceFFLUSH( stream );
+#else
int id;
int fd;
@@ -555,7 +637,7 @@ int HDFtraceFFLUSH( FILE *stream )
* is moved to EOF if it isn't there already. We don't account for that
* in our file positioning information.
*/
-
+#endif /* PCF_BUILD */
return( ret );
}
@@ -573,6 +655,9 @@ int
HDFtraceFCLOSE( FILE *stream )
{
int ret;
+#ifdef PCF_BUILD
+ ret = traceFCLOSE( stream );
+#else
int id;
int fd = fileno( stream );
@@ -588,6 +673,7 @@ HDFtraceFCLOSE( FILE *stream )
{
HDFtraceIOEvent( fcloseEndID, (void *) 0, 0 );
}
+#endif /* PCF_BUILD */
return( ret );
}
@@ -602,8 +688,11 @@ HDFtraceFCLOSE( FILE *stream )
int
HDFtrace3OPEN( const char *path, int flags, mode_t mode )
{
- struct open_args openArgs;
int fd;
+#ifdef PCF_BUILD
+ fd = trace3OPEN( path, flags, mode );
+#else
+ struct open_args openArgs;
int id;
if ( IOtracingEnabled )
@@ -622,6 +711,7 @@ HDFtrace3OPEN( const char *path, int flags, mode_t mode )
{
HDFtraceIOEvent( openEndID, (char *) &id, int_SIZE );
}
+#endif /* PCF_BUILD */
return( fd );
}
@@ -637,6 +727,9 @@ int
HDFtraceCLOSE( int fd )
{
int ret;
+#ifdef PCF_BUILD
+ ret = traceCLOSE( fd );
+#else
int id;
if ( IOtracingEnabled )
@@ -651,6 +744,7 @@ HDFtraceCLOSE( int fd )
{
HDFtraceIOEvent( closeEndID, (void *) 0, 0 );
}
+#endif /* PCF_BUILD */
return( ret );
}
@@ -670,8 +764,11 @@ HDFtraceCLOSE( int fd )
ssize_t
HDFtraceREAD( int fd, void *buf, size_t nbyte )
{
- struct read_write_args readArgs;
ssize_t ret;
+#ifdef PCF_BUILD
+ ret = traceREAD( fd, buf, nbyte );
+#else
+ struct read_write_args readArgs;
int bytes;
CLOCK t1, t2, incDur;
@@ -688,7 +785,6 @@ HDFtraceREAD( int fd, void *buf, size_t nbyte )
ret = read( fd, buf, nbyte );
t2 = getClock();
incDur = clockSubtract(t2,t1);
- ReadTotals += clockToSeconds( incDur );
if ( IOtracingEnabled )
{
@@ -702,6 +798,7 @@ HDFtraceREAD( int fd, void *buf, size_t nbyte )
}
HDFtraceIOEvent( readEndID, (void *) &bytes, int_SIZE );
}
+#endif /* PCF_BUILD */
return( ret );
}
@@ -719,8 +816,11 @@ HDFtraceREAD( int fd, void *buf, size_t nbyte )
size_t
HDFtraceFREAD( void *ptr, size_t size, size_t nitems, FILE *stream )
{
- struct read_write_args readArgs;
size_t ret;
+#ifdef PCF_BUILD
+ ret = traceFREAD( ptr, size, nitems, stream );
+#else
+ struct read_write_args readArgs;
int nbytes;
int fd = fileno( stream );
CLOCK t1, t2, incDur;
@@ -737,7 +837,6 @@ HDFtraceFREAD( void *ptr, size_t size, size_t nitems, FILE *stream )
ret = fread( ptr, size, nitems, stream );
t2 = getClock();
incDur = clockSubtract(t2,t1);
- ReadTotals += clockToSeconds( incDur );
if ( IOtracingEnabled )
{
@@ -751,11 +850,10 @@ HDFtraceFREAD( void *ptr, size_t size, size_t nitems, FILE *stream )
}
HDFtraceIOEvent( freadEndID, (void *) &nbytes, int_SIZE );
}
+#endif /* PCF_BUILD */
return( ret );
}
-
-
/*****************************************************************************/
/*+ Seek routines +*/
/*+ ------------- +*/
@@ -769,8 +867,11 @@ HDFtraceFREAD( void *ptr, size_t size, size_t nitems, FILE *stream )
off_t
HDFtraceLSEEK( int fd, off_t offset, int whence )
{
- struct seek_args seekArgs;
off_t ret;
+#ifdef PCF_BUILD
+ ret = traceLSEEK( fd, offset, whence );
+#else
+ struct seek_args seekArgs;
long arg;
if ( IOtracingEnabled )
@@ -789,6 +890,7 @@ HDFtraceLSEEK( int fd, off_t offset, int whence )
arg = (long) ret;
HDFtraceIOEvent( lseekEndID, (void *)&arg, long_SIZE );
}
+#endif /* PCF_BUILD */
return( ret );
}
@@ -803,8 +905,11 @@ HDFtraceLSEEK( int fd, off_t offset, int whence )
int
HDFtraceFSEEK( FILE *stream, long offset, int whence )
{
- struct seek_args seekArgs;
int ret;
+#ifdef PCF_BUILD
+ ret = traceFSEEK( stream, offset, whence );
+#else
+ struct seek_args seekArgs;
long arg;
int fd = fileno( stream );
@@ -824,6 +929,7 @@ HDFtraceFSEEK( FILE *stream, long offset, int whence )
arg = ftell( stream );
HDFtraceIOEvent( fseekEndID, (void *)&arg, long_SIZE );
}
+#endif /* PCF_BUILD */
return( ret );
}
@@ -839,8 +945,11 @@ HDFtraceFSEEK( FILE *stream, long offset, int whence )
int
HDFtraceFSETPOS( FILE stream, const fpos_t *position )
{
- struct seek_args seekArgs;
int ret;
+#ifdef PCF_BUILD
+ ret = traceFSETPOS( stream, position );
+#else
+ struct seek_args seekArgs;
long arg;
int fd = fileno( stream );
@@ -860,6 +969,7 @@ HDFtraceFSETPOS( FILE stream, const fpos_t *position )
arg = (long) *position;
HDFtraceIOEvent( fsetposEndID, (void *)&arg, long_SIZE );
}
+#endif /* PCF_BUILD */
return( ret );
}
@@ -874,10 +984,14 @@ HDFtraceFSETPOS( FILE stream, const fpos_t *position )
/*+ Whence = SEEK_SET +*/
/*+ +*/
/*****************************************************************************/
-void HDFtraceREWIND( FILE *stream )
+void
+HDFtraceREWIND( FILE *stream )
{
- struct seek_args seekArgs;
+#ifdef PCF_BUILD
+ traceREWIND( stream );
+#else
long arg;
+ struct seek_args seekArgs;
int fd = fileno( stream );
if ( IOtracingEnabled )
@@ -896,6 +1010,7 @@ void HDFtraceREWIND( FILE *stream )
arg = 0;
HDFtraceIOEvent( rewindEndID, (void *)&arg, long_SIZE );
}
+#endif /* PCF_BUILD */
return;
}
@@ -912,10 +1027,14 @@ void HDFtraceREWIND( FILE *stream )
/*+ Cause = -1 +*/
/*+ +*/
/*****************************************************************************/
-ssize_t HDFtraceWRITE( int fd, const void *buf, size_t nbyte )
+ssize_t
+HDFtraceWRITE( int fd, const void *buf, size_t nbyte )
{
- struct read_write_args writeArgs;
ssize_t ret;
+#ifdef PCF_BUILD
+ ret = traceWRITE( fd, buf, nbyte );
+#else
+ struct read_write_args writeArgs;
int bytes;
CLOCK t1, t2, incDur;
@@ -932,7 +1051,6 @@ ssize_t HDFtraceWRITE( int fd, const void *buf, size_t nbyte )
ret = write( fd, buf, nbyte );
t2 = getClock();
incDur = clockSubtract(t2,t1);
- WriteTotals += clockToSeconds( incDur );
if ( IOtracingEnabled )
{
@@ -946,6 +1064,7 @@ ssize_t HDFtraceWRITE( int fd, const void *buf, size_t nbyte )
}
HDFtraceIOEvent( writeEndID, (void *) &bytes, int_SIZE );
}
+#endif /* PCF_BUILD */
return( ret );
}
@@ -963,8 +1082,11 @@ size_t
HDFtraceFWRITE(const void *ptr,size_t size,size_t nitems,FILE *stream )
{
- struct read_write_args writeArgs;
size_t ret;
+#ifdef PCF_BUILD
+ ret = traceFWRITE( ptr, size, nitems, stream );
+#else
+ struct read_write_args writeArgs;
int nbytes;
int fd = fileno( stream );
CLOCK t1, t2, incDur;
@@ -982,8 +1104,6 @@ HDFtraceFWRITE(const void *ptr,size_t size,size_t nitems,FILE *stream )
ret = fwrite( ptr, size, nitems, stream );
t2 = getClock();
incDur = clockSubtract(t2,t1);
- WriteTotals += clockToSeconds( incDur );
-
if ( IOtracingEnabled )
{
@@ -997,27 +1117,29 @@ HDFtraceFWRITE(const void *ptr,size_t size,size_t nitems,FILE *stream )
}
HDFtraceIOEvent( fwriteEndID, (void *) &nbytes, int_SIZE );
}
+#endif /* PCF_BUILD */
return( ret );
}
-
/*****************************************************************************/
/*+ Routine: int HDFtracePUTS( char *s ) +*/
-/*+ substitute for puts() +*/
+/*+ substitute for puts() +*/
/*+ generates fwriteBeginID, fwriteEndID +*/
-/*+ record Write (fwriteBeginID) +*/
-/*+ Number Variables = 1 +*/
-/*+ Cause = -1 +*/
-/*+ +*/
+/*+ record Write (fwriteBeginID) +*/
+/*+ Number Variables = 1 +*/
+/*+ Cause = -1 +*/
+/*+ +*/
/*****************************************************************************/
-int
-HDFtracePUTS( char *s )
+int
+HDFtracePUTS( const char *s )
{
- struct read_write_args writeArgs;
int ret;
int fd = fileno( stdout );
-
- if ( IOtracingEnabled )
+#ifdef PCF_BUILD
+ tracePUTS( s );
+#else
+ struct read_write_args writeArgs;
+ if ( IOtracingEnabled )
{
writeArgs.fileID = c_mappedID( fd );
writeArgs.numVariables = 1;
@@ -1028,14 +1150,15 @@ HDFtracePUTS( char *s )
ret = puts( s );
- if ( IOtracingEnabled )
+ if ( IOtracingEnabled )
{
HDFtraceIOEvent( fwriteEndID, (void *) &ret, int_SIZE );
}
+#endif
return( ret );
}
-
+
/*****************************************************************************/
/*+ Routine: int HDFtraceFPUTC( int c, FILE *stream ) +*/
/*+ substitute for fputc() +*/
@@ -1048,8 +1171,11 @@ HDFtracePUTS( char *s )
int
HDFtraceFPUTC( int c, FILE *stream )
{
- struct read_write_args writeArgs;
int ret;
+#ifdef PCF_BUILD
+ ret = traceFPUTC( c, stream );
+#else
+ struct read_write_args writeArgs;
int nbytes = char_SIZE;
int fd = fileno( stream );
@@ -1072,72 +1198,92 @@ HDFtraceFPUTC( int c, FILE *stream )
HDFtraceIOEvent( fwriteEndID, (void *) &nbytes, int_SIZE );
}
}
-
- return( ret );
+#endif /* PCF_BUILD */
+ return( ret );
}
/*****************************************************************************/
/*+ Routine: int HDFtraceFPUTS( char *s, FILE *stream ) +*/
-/*+ substitute for fputs() +*/
+/*+ substitute for fputs() +*/
/*+ generates fwriteBeginID, fwriteEndID +*/
-/*+ record Write (fwriteBeginID) +*/
-/*+ Number Variables = 1 +*/
-/*+ Cause = -1 +*/
-/*+ +*/
+/*+ record Write (fwriteBeginID) +*/
+/*+ Number Variables = 1 +*/
+/*+ Cause = -1 +*/
+/*+ +*/
/*****************************************************************************/
int HDFtraceFPUTS( const char *s, FILE *stream )
{
- struct read_write_args writeArgs;
- int ret;
- int fd = fileno( stream );
+ int ret;
+ int fd = fileno( stream );
- if ( IOtracingEnabled ) {
- writeArgs.fileID = c_mappedID( fd );
- writeArgs.numVariables = 1;
- writeArgs.cause = -1;
+#ifdef PCF_BUILD
+ ret = traceFPUTS( s, stream );
+#else
+ struct read_write_args writeArgs;
+ if ( IOtracingEnabled )
+ {
+ writeArgs.fileID = c_mappedID( fd );
+ writeArgs.numVariables = 1;
+ writeArgs.cause = -1;
- HDFtraceIOEvent(fwriteBeginID, (void *)&writeArgs, sizeof(writeArgs));
- }
+ HDFtraceIOEvent(fwriteBeginID, (void *)&writeArgs, sizeof(writeArgs));
+ }
- ret = fputs( s, stream );
+ ret = fputs( s, stream );
- if ( IOtracingEnabled ) {
- HDFtraceIOEvent( fwriteEndID, (void *) &ret, int_SIZE );
- }
+ if ( IOtracingEnabled )
+ {
+ HDFtraceIOEvent( fwriteEndID, (void *) &ret, int_SIZE );
+ }
+#endif /* PCF_BUILD */
- return( ret );
+ return( ret );
}
-void *HDFtraceMALLOC(size_t bytes )
+
+void*
+HDFtraceMALLOC(size_t bytes )
{
- void *ptr;
- int byte_req;
- byte_req = (int)bytes;
- if ( IOtracingEnabled ) {
- HDFtraceIOEvent ( ID_malloc, NULL, 0 );
- }
+ void *ptr;
+#ifdef PCF_BUILD
+ ptr = (void *)traceMALLOC( bytes );
+#else
+ int byte_req;
+ byte_req = (int)bytes;
+ if ( IOtracingEnabled )
+ {
+ HDFtraceIOEvent ( ID_malloc, NULL, 0 );
+ }
- ptr = malloc( bytes );
+ ptr = malloc( bytes );
- if ( IOtracingEnabled ) {
- HDFtraceIOEvent ( -ID_malloc, &byte_req, sizeof(int) );
- }
+ if ( IOtracingEnabled )
+ {
+ HDFtraceIOEvent ( -ID_malloc, &byte_req, sizeof(int) );
+ }
+#endif /* PCF_BUILD */
- return ptr ;
+ return ptr ;
}
-void HDFtraceIOEvent( int eventType, void *dataPtr, unsigned dataLen )
+#ifndef PCF_BUILD
+void
+HDFtraceIOEvent( int eventType, void *dataPtr, unsigned dataLen )
{
- if ( OUTPUT_SWITCH == RUNTIME_TRACE
- || OUTPUT_SWITCH == MPI_RUNTIME_TRACE ) {
- traceEvent( eventType, dataPtr, dataLen );
- } else {
- HDFtraceEvent_RT( eventType, (HDFsetInfo *)dataPtr, dataLen );
- }
+ if ( OUTPUT_SWITCH == RUNTIME_TRACE
+ || OUTPUT_SWITCH == MPI_RUNTIME_TRACE )
+ {
+ traceEvent( eventType, dataPtr, dataLen );
+ }
+ else
+ {
+ HDFtraceEvent_RT( eventType, (HDFsetInfo *)dataPtr, dataLen );
+ }
}
/*======================================================================*
// record the final time stamp *
//======================================================================*/
-void HDFfinalTimeStamp( void )
+void
+HDFfinalTimeStamp( void )
{
CLOCK currentTime;
double seconds;
@@ -1177,7 +1323,8 @@ void HDFfinalTimeStamp( void )
// the elements of procTrace corresponding to HDF files will be *
// turned on, in which case all HDF procedures will be traced. *
//======================================================================*/
-void PabloHDFTrace( int ID )
+void
+PabloHDFTrace( int ID )
{
int i;
if ( procTrace == NULL ) {
@@ -1201,1133 +1348,4 @@ void PabloHDFTrace( int ID )
exit (-1);
}
}
-#ifdef H5_HAVE_PARALLEL
-#include "MPIO_Trace.h"
-#include "MPIO_EventArgs.h"
-#include "MPIO_Data.h"
-
-/* Global variable declarations and definitions. */
-static int HDFlocalNode = 0;
-int HDFmyNode;
-int myHDFid = 3;
-/* Function prototypes */
-int HDF_get_mode( int );
-int HDF_get_source( int );
-int HDF_get_comm( MPI_Comm );
-int HDF_get_Datatype( MPI_Datatype );
-int HDF_get_DataRep( char* );
-int HDF_get_Bytes( MPI_Datatype, int );
-
-/* Get the mode at the file openning */
-int HDF_get_mode( int amode )
-{
- if( amode == MPI_MODE_RDONLY || amode == MPI_MODE_RDWR ||
- amode == MPI_MODE_WRONLY || amode == MPI_MODE_CREATE ||
- amode == MPI_MODE_EXCL || amode == MPI_MODE_DELETE_ON_CLOSE ||
- amode == MPI_MODE_UNIQUE_OPEN ||
- /* amode == MPI_MODE_SEQUENTIAL || */
- amode == MPI_MODE_APPEND )
- return amode;
- else
- return PABLO_MPI_MODE_NULL;
-}
-
-/* Get the node number */
-int HDF_get_source( int source )
-{
- if ( source == MPI_ANY_SOURCE ) {
- return PABLO_MPI_ANYSOURCE;
- }
-
- if ( source == MPI_PROC_NULL ) {
- return PABLO_MPI_PROCNULL;
- }
-
- else {
- return source;
- }
-}
-
-/* get the communicator ID */
-/* this is dummy for compatability with MPIO Traceing */
-int HDF_get_comm( MPI_Comm in_comm )
-{
- return 0;
-}
-/* Get the MPI_Datatype (mapped to a integer) */
-int HDF_get_Datatype( MPI_Datatype datatype )
-{
- /* elementary datatypes (C) */
- if ( datatype == MPI_CHAR )
- return PABLO_MPI_CHAR;
- else if ( datatype == MPI_SHORT )
- return PABLO_MPI_SHORT;
- else if ( datatype == MPI_INT )
- return PABLO_MPI_INT;
- else if ( datatype == MPI_LONG )
- return PABLO_MPI_LONG;
- else if ( datatype == MPI_UNSIGNED_CHAR )
- return PABLO_MPI_UNSIGNED_CHAR;
- else if ( datatype == MPI_UNSIGNED_SHORT )
- return PABLO_MPI_UNSIGNED_SHORT;
- else if ( datatype == MPI_UNSIGNED )
- return PABLO_MPI_UNSIGNED;
- else if ( datatype == MPI_UNSIGNED_LONG )
- return PABLO_MPI_UNSIGNED_LONG;
- else if ( datatype == MPI_FLOAT )
- return PABLO_MPI_FLOAT;
- else if ( datatype == MPI_DOUBLE )
- return PABLO_MPI_DOUBLE;
- else if ( datatype == MPI_LONG_DOUBLE )
- return PABLO_MPI_LONG_DOUBLE;
-
- /* elementary datatypes (FORTRAN) */
-#ifdef MPI_INTEGER
- else if ( datatype == MPI_INTEGER )
- return PABLO_MPI_INTEGER;
-#endif
-#ifdef MPI_REAL
- else if ( datatype == MPI_REAL )
- return PABLO_MPI_REAL;
-#endif
-#ifdef MPI_DOUBLE_PRECISION
- else if ( datatype == MPI_DOUBLE_PRECISION )
- return PABLO_MPI_DOUBLE_PRECISION;
-#endif
-#ifdef MPI_COMPLEX
- else if ( datatype == MPI_COMPLEX )
- return PABLO_MPI_COMPLEX;
-#endif
-#ifdef MPI_DOUBLE_COMPLEX
- else if ( datatype == MPI_DOUBLE_COMPLEX )
- return PABLO_MPI_DOUBLE_COMPLEX;
-#endif
-#ifdef MPI_LOGICAL
- else if ( datatype == MPI_LOGICAL )
- return PABLO_MPI_LOGICAL;
-#endif
-#ifdef MPI_CHARACTER
- else if ( datatype == MPI_CHARACTER )
- return PABLO_MPI_CHARACTER;
-#endif
-
- /* other datatypes (C, Fortran).*/
- else if ( datatype == MPI_BYTE )
- return PABLO_MPI_BYTE;
- else if ( datatype == MPI_PACKED )
- return PABLO_MPI_PACKED;
- else if ( datatype == MPI_LB )
- return PABLO_MPI_LB;
- else if ( datatype == MPI_UB )
- return PABLO_MPI_UB;
-
-
- /* reduction datatypes (C). */
- else if ( datatype == MPI_FLOAT_INT )
- return PABLO_MPI_FLOAT_INT;
- else if ( datatype == MPI_DOUBLE_INT )
- return PABLO_MPI_DOUBLE_INT;
- else if ( datatype == MPI_LONG_INT )
- return PABLO_MPI_LONG_INT;
- else if ( datatype == MPI_2INT )
- return PABLO_MPI_2INT;
- else if ( datatype == MPI_SHORT_INT )
- return PABLO_MPI_SHORT_INT;
- else if ( datatype == MPI_LONG_DOUBLE_INT )
- return PABLO_MPI_LONG_DOUBLE_INT;
-
- /* Reduction datatypes (FORTRAN) */
-#ifdef MPI_2REAL
- else if ( datatype == MPI_2REAL )
- return PABLO_MPI_2REAL;
-#endif
-#ifdef MPI_2DOUBLE_PRECISION
- else if ( datatype == MPI_2DOUBLE_PRECISION )
- return PABLO_MPI_2DOUBLE_PRECISION;
-#endif
-#ifdef MPI_2INTEGER
- else if ( datatype == MPI_2INTEGER )
- return PABLO_MPI_2INTEGER;
-#endif
-
-#ifdef MPI_2COMPLEX
- else if ( datatype == MPI_2COMPLEX )
- return PABLO_MPI_2COMPLEX;
-#endif
-#ifdef MPI_2DOUBLE_COMPLEX
- else if ( datatype == MPI_2DOUBLE_COMPLEX )
- return PABLO_MPI_2DOUBLE_COMPLEX;
-#endif
-
-/* optional datatypes (C).*/
-#ifdef MPI_LONG_LONG_INT
- else if ( datatype == MPI_LONG_LONG_INT )
- return PABLO_MPI_LONG_LONG_INT;
-#endif
- else if ( datatype == MPI_DATATYPE_NULL )
- return PABLO_MPI_DATATYPE_NULL;
- else
- return PABLO_MPI_USER_DEF;
-}
-
-/* data representations */
-int HDF_get_DataRep( char* datarep )
-{
- if ( !strcmp( datarep, "native" ) )
- return PABLO_MPI_NATIVE;
- else if ( !strcmp( datarep, "internal" ) )
- return PABLO_MPI_INTERNAL;
- else if ( !strcmp( datarep, "external32" ) )
- return PABLO_MPI_EXTERNAL32;
- else
- return (-1);
-}
-
-/*****************************************************************************/
-/* The routines below are there to bypass the MPI I/O Tracing. When MPI I/O */
-/* tracing is done with a nonstandard MPI I/O implementation, problems can */
-/* occur in linking and in data recording. */
-/* For each of the MPI I/O routines MPI_File_xxx used in HDF, there are two */
-/* entries: HDF_MPI_File_xxx and PabloMPI_File_xxx. Macros replace the */
-/* MPI_File_xxx call with HDF_MPI_File_xxx. */
-/* If SUMMARY Tracing is used */
-/* HDF_MPI_File_xxx routine will record entry data in a table, call the */
-/* IF RUNTIME Tracing is used */
-/* HDF_MPI_File_xxx routine calls PabloMPI_File_xxx. This routine writes */
-/* data to the trace file, calls the standard MPI_File_xxx routine, then */
-/* records exit data to a trace file. */
-/* The PabloMPI_File_xxx functionality could have been incorporated into the */
-/* HDF_MPI_File_xxx routine, but was not done so for expediency. */
-/*****************************************************************************/
-int PabloMPI_File_open( MPI_Comm comm,
- char *filename,
- int amode,
- MPI_Info info,
- MPI_File *fh ) ;
-
-int PabloMPI_File_close( MPI_File *fh ) ;
-
-int PabloMPI_File_set_size( MPI_File fh, MPI_Offset size ) ;
-
-int PabloMPI_File_get_size( MPI_File fh, MPI_Offset *size ) ;
-
-int PabloMPI_File_set_view( MPI_File fh,
- MPI_Offset disp,
- MPI_Datatype etype,
- MPI_Datatype filetype,
- char *datarep,
- MPI_Info info ) ;
-
-int PabloMPI_File_get_view( MPI_File fh,
- MPI_Offset *disp,
- MPI_Datatype *etype,
- MPI_Datatype *filetype,
- char *datarep ) ;
-
-int PabloMPI_File_read_at( MPI_File fh,
- MPI_Offset offset,
- void *buf,
- int count,
- MPI_Datatype datatype,
- MPI_Status *status ) ;
-
-int PabloMPI_File_read_at_all( MPI_File fh,
- MPI_Offset offset,
- void *buf,
- int count,
- MPI_Datatype datatype,
- MPI_Status *status ) ;
-
-int PabloMPI_File_write_at( MPI_File fh,
- MPI_Offset offset,
- void *buf,
- int count,
- MPI_Datatype datatype,
- MPI_Status *status ) ;
-
-int PabloMPI_File_write_at_all( MPI_File fh,
- MPI_Offset offset,
- void *buf,
- int count,
- MPI_Datatype datatype,
- MPI_Status *status ) ;
-
-int
-PabloMPI_File_sync( MPI_File fh ) ;
-
-/*======================================================================*
-// Pass call through to regular MPIO entry except in case of Real Time *
-// tracing. *
-// Note: The regular MPIO entry may or may not be instrumented. *
-//======================================================================*/
-int HDF_MPI_File_open( MPI_Comm comm, char *filename, int amode,
- MPI_Info info, MPI_File *fh )
-{
- int returnVal;
- HDFsetInfo dataPtr;
- int dataLen;
-
- if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE )
- {
- returnVal = PabloMPI_File_open( comm, filename, amode, info, fh );
- }
- else
- {
- dataLen = sizeof( HDFsetInfo );
- dataPtr.setID = 0;
- dataPtr.setName = (char *)malloc( strlen(filename) + 1);
- strcpy( dataPtr.setName , filename );
- HDFtraceEvent_RT( HDFmpiOpenID, &dataPtr, dataLen );
- returnVal = MPI_File_open( comm, filename, amode, info, fh );
- dataPtr.setID = (long)fh;
- HDFtraceEvent_RT( -HDFmpiOpenID, &dataPtr, dataLen );
- }
- return returnVal;
-}
-
-
-
-/*======================================================================*
-// Pass call through to regular MPIO entry except in case of Real Time *
-// tracing. *
-// Note: The regular MPIO entry may or may not be instrumented. *
-//======================================================================*/
-int HDF_MPI_File_close( MPI_File *fh )
-{
- int returnVal;
- HDFsetInfo dataPtr;
- int dataLen;
-
- if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE )
- {
- returnVal = PabloMPI_File_close( fh );
- }
- else
- {
- dataLen = sizeof( HDFsetInfo );
- dataPtr.setID = (long)fh;
- dataPtr.setName = NULL;
- HDFtraceEvent_RT( HDFmpiCloseID, &dataPtr, dataLen );
- returnVal = MPI_File_close( fh );
- HDFtraceEvent_RT( -HDFmpiCloseID, &dataPtr, dataLen );
- free( dataPtr.setName );
- }
- return returnVal;
-}
-
-
-/*======================================================================*
-// Pass call through to regular MPIO entry except in case of Real Time *
-// tracing. *
-// Note: The regular MPIO entry may or may not be instrumented. *
-//======================================================================*/
-int HDF_MPI_File_set_size( MPI_File fh, MPI_Offset size )
-{
- int returnVal;
- HDFsetInfo dataPtr;
- int dataLen;
-
- if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE )
- {
- returnVal = PabloMPI_File_set_size( fh, size );
- }
- else
- {
- dataLen = 1;
- dataPtr.setID = (long)fh;
- HDFtraceEvent_RT( HDFmpiSetSizeID,&dataPtr,dataLen );
- returnVal = MPI_File_set_size( fh, size );
- HDFtraceEvent_RT( -HDFmpiSetSizeID, &dataPtr, dataLen );
- }
- return returnVal;
-}
-
-/*======================================================================*
-// Pass call through to regular MPIO entry except in case of Real Time *
-// tracing. *
-// Note: The regular MPIO entry may or may not be instrumented. *
-//======================================================================*/
-int HDF_MPI_File_get_size( MPI_File fh, MPI_Offset *size )
-{
- int returnVal;
- HDFsetInfo dataPtr;
- int dataLen;
-
- if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
- returnVal = PabloMPI_File_get_size( fh, size);
- } else {
- dataLen = 1;
- dataPtr.setID = (long)fh;
- HDFtraceEvent_RT( HDFmpiGetSizeID,
- &dataPtr,dataLen );
- returnVal = MPI_File_get_size( fh, size);
- HDFtraceEvent_RT( -HDFmpiGetSizeID,
- &dataPtr,dataLen );
- }
- return returnVal;
-}
-
-/*======================================================================*
-// Pass call through to regular MPIO entry except in case of Real Time *
-// tracing. *
-// Note: The regular MPIO entry may or may not be instrumented. *
-//======================================================================*/
-int HDF_MPI_File_set_view( MPI_File fh, MPI_Offset disp, MPI_Datatype etype,
- MPI_Datatype filetype, char *datarep, MPI_Info info )
-{
- int returnVal;
- HDFsetInfo dataPtr;
- int dataLen;
-
- if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
- returnVal = PabloMPI_File_set_view( fh, disp, etype, filetype,
- datarep, info );
- } else {
- dataLen = 1;
- dataPtr.setID = (long)fh;
- HDFtraceEvent_RT( HDFmpiSetViewID,
- &dataPtr,dataLen );
- returnVal = MPI_File_set_view( fh, disp, etype, filetype,
- datarep, info );
- HDFtraceEvent_RT( -HDFmpiSetViewID,
- &dataPtr,dataLen );
- }
- return returnVal;
-}
-
-/*======================================================================*
-// Pass call through to regular MPIO entry except in case of Real Time *
-// tracing. *
-// Note: The regular MPIO entry may or may not be instrumented. *
-//======================================================================*/
-int HDF_MPI_File_get_view( MPI_File fh, MPI_Offset *disp, MPI_Datatype *etype,
- MPI_Datatype *filetype, char *datarep )
-{
- int returnVal;
- HDFsetInfo dataPtr;
- int dataLen;
-
- if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE )
- {
- returnVal = PabloMPI_File_get_view(fh, disp, etype, filetype, datarep);
- }
- else
- {
- dataLen = 1;
- dataPtr.setID = (long)fh;
- HDFtraceEvent_RT( HDFmpiSetViewID,
- &dataPtr,dataLen );
- returnVal = MPI_File_get_view(fh, disp, etype, filetype, datarep);
- HDFtraceEvent_RT( -HDFmpiSetViewID, &dataPtr,dataLen );
- returnVal = MPI_File_get_view(fh, disp, etype, filetype, datarep);
-
- }
- return returnVal;
-}
-
-/*======================================================================*
-// Pass call through to regular MPIO entry except in case of Real Time *
-// tracing. *
-// Note: The regular MPIO entry may or may not be instrumented. *
-//======================================================================*/
-int HDF_MPI_File_read_at( MPI_File fh, MPI_Offset offset, void *buf,
- int count, MPI_Datatype datatype, MPI_Status *status )
-{
- int returnVal;
- HDFsetInfo dataPtr;
- int dataLen;
- int rCount;
-
- if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
- returnVal = PabloMPI_File_read_at( fh, offset, buf, count, datatype,
- status );
- } else {
- dataLen = sizeof(dataPtr);
- dataPtr.setID = (long)fh;
- dataPtr.numBytes = HDF_get_Bytes( datatype, count );
- HDFtraceEvent_RT( HDFmpiReadAtID,
- &dataPtr,dataLen );
- returnVal = MPI_File_read_at( fh, offset, buf, count, datatype,
- status );
- MPI_Get_count(status,datatype,&rCount);
- if ( rCount < 0 || rCount > count )
- {
- dataPtr.numBytes = -1;
- }
- else
- {
- dataPtr.numBytes = HDF_get_Bytes( datatype, rCount );
- }
- HDFtraceEvent_RT( -HDFmpiReadAtID,
- &dataPtr,dataLen );
- }
- return returnVal;
-}
-
-/*======================================================================*
-// Pass call through to regular MPIO entry except in case of Real Time *
-// tracing. *
-// Note: The regular MPIO entry may or may not be instrumented. *
-//======================================================================*/
-int HDF_MPI_File_read_at_all( MPI_File fh, MPI_Offset offset, void *buf,
- int count, MPI_Datatype datatype, MPI_Status *status )
-{
-
- int returnVal;
- HDFsetInfo dataPtr;
- int dataLen;
- int rCount;
-
- if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
- returnVal = PabloMPI_File_read_at_all( fh, offset, buf,
- count, datatype, status );
- } else {
- dataLen = sizeof(dataPtr);
- dataPtr.setID = (long)fh;
- dataPtr.numBytes = HDF_get_Bytes( datatype, count );
- HDFtraceEvent_RT( HDFmpiReadAtAllID,
- &dataPtr,dataLen );
- returnVal = MPI_File_read_at_all( fh, offset, buf,
- count, datatype, status );
- MPI_Get_count(status,datatype,&rCount);
- if ( rCount < 0 || rCount > count )
- {
- dataPtr.numBytes = -1;
- }
- else
- {
- dataPtr.numBytes = HDF_get_Bytes( datatype, rCount );
- }
- HDFtraceEvent_RT( -HDFmpiReadAtAllID,
- &dataPtr,dataLen );
- }
- return returnVal;
-}
-
-/*======================================================================*
-// Pass call through to regular MPIO entry except in case of Real Time *
-// tracing. *
-// Note: The regular MPIO entry may or may not be instrumented. *
-//======================================================================*/
-int HDF_MPI_File_write_at( MPI_File fh, MPI_Offset offset, void *buf,
- int count, MPI_Datatype datatype, MPI_Status *status )
-{
-
- int returnVal;
- HDFsetInfo dataPtr;
- int dataLen;
- int rCount;
-
- if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE )
- {
- returnVal = PabloMPI_File_write_at( fh, offset, buf, count, datatype,
- status );
- }
- else
- {
- dataLen = sizeof(dataPtr);
- dataPtr.setID = (long)fh;
- dataPtr.numBytes = HDF_get_Bytes( datatype, count );
- HDFtraceEvent_RT( HDFmpiWriteAtID, &dataPtr,dataLen );
- returnVal = MPI_File_write_at( fh, offset, buf, count, datatype,
- status );
- MPI_Get_count(status,datatype,&rCount);
- if ( rCount < 0 || rCount > count )
- {
- dataPtr.numBytes = -1;
- }
- else
- {
- dataPtr.numBytes = HDF_get_Bytes( datatype, rCount );
- }
- HDFtraceEvent_RT( -HDFmpiWriteAtID, &dataPtr,dataLen );
- }
- return returnVal;
-}
-
-/*======================================================================*
-// Pass call through to regular MPIO entry except in case of Real Time *
-// tracing. *
-// Note: The regular MPIO entry may or may not be instrumented. *
-//======================================================================*/
-int HDF_MPI_File_write_at_all( MPI_File fh, MPI_Offset offset, void *buf,
- int count, MPI_Datatype datatype, MPI_Status *status )
-{
- int returnVal;
- HDFsetInfo dataPtr;
- int dataLen;
- int numBytes;
-
- if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
- returnVal = PabloMPI_File_write_at_all( fh, offset, buf,
- count, datatype, status );
- } else {
- dataLen = sizeof(dataPtr);
- dataPtr.setID = (long)fh;
- dataPtr.numBytes = HDF_get_Bytes( datatype, count );
- HDFtraceEvent_RT( HDFmpiWriteAtAllID,
- &dataPtr,dataLen );
- returnVal = MPI_File_write_at_all( fh, offset, buf,
- count, datatype, status );
- if ( returnVal == MPI_SUCCESS )
- {
- numBytes = HDF_get_Bytes( datatype, count );
- }
- else
- {
- numBytes = -1;
- }
- dataPtr.numBytes = numBytes;
- HDFtraceEvent_RT( -HDFmpiWriteAtAllID,
- &dataPtr,dataLen );
- }
- return returnVal;
-}
-
-/*======================================================================*
-// Pass call through to regular MPIO entry except in case of Real Time *
-// tracing. *
-// Note: The regular MPIO entry may or may not be instrumented. *
-//======================================================================*/
-int HDF_MPI_File_sync( MPI_File fh )
-{
- int returnVal;
- HDFsetInfo dataPtr;
- int dataLen;
-
- if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
- returnVal = PabloMPI_File_sync ( fh );
- } else {
- dataLen = 1;
- dataPtr.setID = (long)fh;
- HDFtraceEvent_RT( HDFmpiSyncID,
- &dataPtr,dataLen );
- returnVal = MPI_File_sync ( fh );
- HDFtraceEvent_RT( -HDFmpiSyncID,
- &dataPtr,dataLen );
- }
- return returnVal;
-}
-
-int HDF_get_Bytes( MPI_Datatype datatype, int count )
-{
- int nm_bytes;
-
- MPI_Type_size( datatype, &nm_bytes );
- return( nm_bytes * count );
-}
-
-int
-PabloMPI_File_open( MPI_Comm comm,
- char *filename,
- int amode,
- MPI_Info info,
- MPI_File *fh )
-{
- int returnVal;
-
- struct mpiOpenBeginArgs mpiOpenBeginArguments;
- struct mpiOpenEndArgs mpiOpenEndArguments;
-
-#ifdef DEBUG
- fprintf( debugFile, "MPI_File_open\n" );
- fflush( debugFile );
-#endif /* DEBUG */
-
- MPI_Comm_rank( comm, &HDFlocalNode );
- MPI_Comm_rank( MPI_COMM_WORLD, &HDFmyNode );
-
- mpiOpenBeginArguments.localNode = HDF_get_source( HDFlocalNode );
- mpiOpenBeginArguments.globalNode = HDFmyNode;
- mpiOpenBeginArguments.communicatorID = HDF_get_comm( comm );
- mpiOpenBeginArguments.mode = amode;
- strcpy( mpiOpenBeginArguments.fileName, filename );
-
- /* Generate entry record */
- HDFtraceIOEvent( mpiOpenBeginID, (char *) &mpiOpenBeginArguments,
- sizeof( mpiOpenBeginArguments ) );
-
- returnVal = MPI_File_open( comm, filename, amode, info, fh );
-
- mpiOpenEndArguments.localNode = HDF_get_source( HDFlocalNode );
- mpiOpenEndArguments.globalNode = HDFmyNode;
- /* the fileID is mapped to the fp's address */
- myHDFid++;
- mpiOpenEndArguments.fileID = myHDFid;
-
- /* Generate exit record */
- HDFtraceIOEvent( mpiOpenEndID, (char *) &mpiOpenEndArguments,
- sizeof( mpiOpenEndArguments ) );
-
- return returnVal;
-}
-
-int
-PabloMPI_File_close( MPI_File *fh )
-{
- int returnVal;
-
- struct mpiCloseBeginArgs mpiCloseBeginArguments;
- struct mpiCloseEndArgs mpiCloseEndArguments;
-
-#ifdef DEBUG
- fprintf( debugFile, "MPI_File_close\n" );
- fflush( debugFile );
-#endif /* DEBUG */
-
- mpiCloseBeginArguments.localNode = HDFlocalNode;
- mpiCloseBeginArguments.globalNode = HDFmyNode;
- mpiCloseBeginArguments.fileID = myHDFid;
-
- /* Generate entry record */
- HDFtraceIOEvent( mpiCloseBeginID, (char *) &mpiCloseBeginArguments,
- sizeof( mpiCloseBeginArguments ) );
-
- returnVal = MPI_File_close( fh );
-
- mpiCloseEndArguments.localNode = HDFlocalNode;
- mpiCloseEndArguments.globalNode = HDFmyNode;
- mpiCloseEndArguments.fileID = myHDFid;
-
- /* Generate exit record */
- HDFtraceIOEvent( mpiCloseEndID, (char *) &mpiCloseEndArguments,
- sizeof( mpiCloseEndArguments ) );
-
- return returnVal;
-}
-
-int
-PabloMPI_File_set_size( MPI_File fh, MPI_Offset size )
-{
- int returnVal;
-
- struct mpiSetSizeBeginArgs mpiSetSizeBeginArguments;
- struct mpiSetSizeEndArgs mpiSetSizeEndArguments;
-
-#ifdef DEBUG
- fprintf( debugFile, "MPI_File_set_size\n" );
- fflush( debugFile );
-#endif /* DEBUG */
-
- mpiSetSizeBeginArguments.localNode = HDFlocalNode;
- mpiSetSizeBeginArguments.globalNode = HDFmyNode;
- /* mpiSetSizeBeginArguments.fileID = (long) (&fh); */
- mpiSetSizeBeginArguments.fileID = myHDFid;
-
- mpiSetSizeBeginArguments.fileSize = (long) size;
-
- /* Generate entry record */
- HDFtraceIOEvent( mpiSetSizeBeginID, (char *) &mpiSetSizeBeginArguments,
- sizeof( mpiSetSizeBeginArguments ) );
-
- returnVal = MPI_File_set_size( fh, size );
-
- mpiSetSizeEndArguments.localNode = HDFlocalNode;
- mpiSetSizeEndArguments.globalNode = HDFmyNode;
- /* mpiSetSizeEndArguments.fileID = (long) ( &fh ); */
- mpiSetSizeEndArguments.fileID = myHDFid;
-
- /* Generate entry record */
- HDFtraceIOEvent( mpiSetSizeEndID, (char *) &mpiSetSizeEndArguments,
- sizeof( mpiSetSizeEndArguments ) );
-
- return returnVal;
-}
-
-int
-PabloMPI_File_get_size( MPI_File fh, MPI_Offset *size )
-{
- int returnVal;
-
- struct mpiGetSizeBeginArgs mpiGetSizeBeginArguments;
- struct mpiGetSizeEndArgs mpiGetSizeEndArguments;
-
-#ifdef DEBUG
- fprintf( debugFile, "MPI_File_get_size\n" );
- fflush( debugFile );
-#endif /* DEBUG */
-
- mpiGetSizeBeginArguments.localNode = HDFlocalNode;
- mpiGetSizeBeginArguments.globalNode = HDFmyNode;
- /* mpiGetSizeBeginArguments.fileID = (long) (&fh); */
- mpiGetSizeBeginArguments.fileID = myHDFid;
-
- /* Generate entry record */
- HDFtraceIOEvent( mpiGetSizeBeginID, (char *) &mpiGetSizeBeginArguments,
- sizeof( mpiGetSizeBeginArguments ) );
-
- returnVal = MPI_File_get_size( fh, size);
-
- mpiGetSizeEndArguments.localNode = HDFlocalNode;
- mpiGetSizeEndArguments.globalNode = HDFmyNode;
- /* mpiGetSizeEndArguments.fileID = (long) ( &fh ); */
- mpiGetSizeEndArguments.fileID = myHDFid;
-
- mpiGetSizeEndArguments.fileSize = (long) (*size);
-
- /* Generate entry record */
- HDFtraceIOEvent( mpiGetSizeEndID, (char *) &mpiGetSizeEndArguments,
- sizeof( mpiGetSizeEndArguments ) );
-
- return returnVal;
-}
-
-int
-PabloMPI_File_set_view( MPI_File fh,
- MPI_Offset disp,
- MPI_Datatype etype,
- MPI_Datatype filetype,
- char *datarep,
- MPI_Info info )
-{
- int returnVal;
-
- struct mpiSetViewBeginArgs mpiSetViewBeginArguments;
- struct mpiSetViewEndArgs mpiSetViewEndArguments;
-
-#ifdef DEBUG
- fprintf( debugFile, "MPI_File_set_view\n" );
- fflush( debugFile );
-#endif /* DEBUG */
-
- mpiSetViewBeginArguments.localNode = HDFlocalNode;
- mpiSetViewBeginArguments.globalNode = HDFmyNode;
- /* mpiSetViewBeginArguments.fileID = (long) ( &fh ); */
- mpiSetViewBeginArguments.fileID = myHDFid;
-
- mpiSetViewBeginArguments.disp = (long) ( disp );
- mpiSetViewBeginArguments.etype = HDF_get_Datatype( etype );
- mpiSetViewBeginArguments.fileType = HDF_get_Datatype( filetype );
- mpiSetViewBeginArguments.dataRep = HDF_get_DataRep( datarep );
-
- /* Generate entry record */
- HDFtraceIOEvent( mpiSetViewBeginID, (char *) &mpiSetViewBeginArguments,
- sizeof( mpiSetViewBeginArguments ) );
-
- returnVal = MPI_File_set_view( fh, disp, etype, filetype,
- datarep, info );
-
- mpiSetViewEndArguments.localNode = HDFlocalNode;
- mpiSetViewEndArguments.globalNode = HDFmyNode;
- /* mpiSetViewEndArguments.fileID = (long) ( &fh ); */
- mpiSetViewEndArguments.fileID = myHDFid;
-
- /* Generate entry record */
- HDFtraceIOEvent( mpiSetViewEndID, (char *) &mpiSetViewEndArguments,
- sizeof( mpiSetViewEndArguments ) );
-
- return returnVal;
-}
-
-int
-PabloMPI_File_get_view( MPI_File fh,
- MPI_Offset *disp,
- MPI_Datatype *etype,
- MPI_Datatype *filetype,
- char *datarep )
-{
- int returnVal;
-
- struct mpiGetViewBeginArgs mpiGetViewBeginArguments;
- struct mpiGetViewEndArgs mpiGetViewEndArguments;
-
-#ifdef DEBUG
- fprintf( debugFile, "MPI_File_get_view\n" );
- fflush( debugFile );
-#endif /* DEBUG */
-
- mpiGetViewBeginArguments.localNode = HDFlocalNode;
- mpiGetViewBeginArguments.globalNode = HDFmyNode;
- /* mpiGetViewBeginArguments.fileID = (long) ( &fh ); */
- mpiGetViewBeginArguments.fileID = myHDFid;
-
- /* Generate entry record */
- HDFtraceIOEvent( mpiGetViewBeginID, (char *) &mpiGetViewBeginArguments,
- sizeof( mpiGetViewBeginArguments ) );
-
- returnVal = MPI_File_get_view( fh, disp, etype, filetype, datarep );
-
- mpiGetViewEndArguments.localNode = HDFlocalNode;
- mpiGetViewEndArguments.globalNode = HDFmyNode;
- /* mpiGetViewEndArguments.fileID = (long) ( &fh ); */
- mpiGetViewEndArguments.fileID = myHDFid;
-
- mpiGetViewEndArguments.disp = (long) ( *disp );
- mpiGetViewEndArguments.etype = HDF_get_Datatype( *etype );
- mpiGetViewEndArguments.fileType = HDF_get_Datatype( *filetype );
- mpiGetViewEndArguments.dataRep = HDF_get_DataRep( datarep );
-
- /* Generate entry record */
- HDFtraceIOEvent( mpiGetViewEndID, (char *) &mpiGetViewEndArguments,
- sizeof( mpiGetViewEndArguments ) );
-
- return returnVal;
-}
-
-int
-PabloMPI_File_read_at( MPI_File fh,
- MPI_Offset offset,
- void *buf,
- int count,
- MPI_Datatype datatype,
- MPI_Status *status )
-{
- int returnVal, bcount;
-
- struct mpiReadAtBeginArgs mpiReadAtBeginArguments;
- struct mpiReadAtEndArgs mpiReadAtEndArguments;
-
-#ifdef DEBUG
- fprintf( debugFile, "MPI_File_read_at\n" );
- fflush( debugFile );
-#endif /* DEBUG */
-
- mpiReadAtBeginArguments.localNode = HDFlocalNode;
- mpiReadAtBeginArguments.globalNode = HDFmyNode;
- /* mpiReadAtBeginArguments.fileID = (long) ( &fh ); */
- mpiReadAtBeginArguments.fileID = myHDFid;
-
- mpiReadAtBeginArguments.offset = (long) ( offset );
- mpiReadAtBeginArguments.count = count;
- mpiReadAtBeginArguments.dataType = HDF_get_Datatype( datatype );
- mpiReadAtBeginArguments.numBytes = HDF_get_Bytes( datatype, count );
-
-
- /* Generate entry record */
- HDFtraceIOEvent( mpiReadAtBeginID, (char *) &mpiReadAtBeginArguments,
- sizeof( mpiReadAtBeginArguments ) );
-
- returnVal = MPI_File_read_at( fh, offset, buf, count, datatype, status );
-
- mpiReadAtEndArguments.localNode = HDFlocalNode;
- mpiReadAtEndArguments.globalNode = HDFmyNode;
- /* mpiReadAtEndArguments.fileID = (long) ( &fh ); */
- mpiReadAtEndArguments.fileID = myHDFid;
-
- MPI_Get_count( status, datatype, &bcount );
- if ( bcount < 0 || bcount > count )
- {
- mpiReadAtEndArguments.rCount = -1;
- mpiReadAtEndArguments.numBytes = -1;
- }
- else
- {
- mpiReadAtEndArguments.rCount = bcount;
- mpiReadAtEndArguments.numBytes = HDF_get_Bytes( datatype, bcount );
- }
- /* Generate entry record */
- HDFtraceIOEvent( mpiReadAtEndID, (char *) &mpiReadAtEndArguments,
- sizeof( mpiReadAtEndArguments ) );
-
- return returnVal;
-}
-
-int
-PabloMPI_File_read_at_all( MPI_File fh,
- MPI_Offset offset,
- void *buf,
- int count,
- MPI_Datatype datatype,
- MPI_Status *status )
-{
- int returnVal, bcount;
-
- struct mpiReadAtAllBeginArgs mpiReadAtAllBeginArguments;
- struct mpiReadAtAllEndArgs mpiReadAtAllEndArguments;
-
-#ifdef DEBUG
- fprintf( debugFile, "MPI_File_read_at_all\n" );
- fflush( debugFile );
-#endif /* DEBUG */
-
- mpiReadAtAllBeginArguments.localNode = HDFlocalNode;
- mpiReadAtAllBeginArguments.globalNode = HDFmyNode;
- /* mpiReadAtAllBeginArguments.fileID = (long) ( &fh ); */
- mpiReadAtAllBeginArguments.fileID = myHDFid;
-
- mpiReadAtAllBeginArguments.offset = (long) ( offset );
- mpiReadAtAllBeginArguments.count = count;
- mpiReadAtAllBeginArguments.dataType = HDF_get_Datatype( datatype );
- mpiReadAtAllBeginArguments.numBytes = HDF_get_Bytes( datatype, count );
-
- /* Generate entry record */
- HDFtraceIOEvent( mpiReadAtAllBeginID, (char *) &mpiReadAtAllBeginArguments,
- sizeof( mpiReadAtAllBeginArguments ) );
-
- returnVal = MPI_File_read_at_all( fh, offset, buf,
- count, datatype, status );
-
- mpiReadAtAllEndArguments.localNode = HDFlocalNode;
- mpiReadAtAllEndArguments.globalNode = HDFmyNode;
- /* mpiReadAtAllEndArguments.fileID = (long) ( &fh ); */
- mpiReadAtAllEndArguments.fileID = myHDFid;
-
- MPI_Get_count( status, datatype, &bcount );
- if ( bcount < 0 || bcount > count )
- {
- mpiReadAtAllEndArguments.rCount = -1;
- mpiReadAtAllEndArguments.numBytes = -1;
- }
- else
- {
- mpiReadAtAllEndArguments.rCount = bcount;
- mpiReadAtAllEndArguments.numBytes = HDF_get_Bytes( datatype, bcount );
- }
-
- /* Generate entry record */
- HDFtraceIOEvent( mpiReadAtAllEndID, (char *) &mpiReadAtAllEndArguments,
- sizeof( mpiReadAtAllEndArguments ) );
-
- return returnVal;
-}
-
-int
-PabloMPI_File_write_at( MPI_File fh,
- MPI_Offset offset,
- void *buf,
- int count,
- MPI_Datatype datatype,
- MPI_Status *status )
-{
- int returnVal, bcount;
-
- struct mpiWriteAtBeginArgs mpiWriteAtBeginArguments;
- struct mpiWriteAtEndArgs mpiWriteAtEndArguments;
-
-#ifdef DEBUG
- fprintf( debugFile, "MPI_File_write_at\n" );
- fflush( debugFile );
-#endif /* DEBUG */
-
- mpiWriteAtBeginArguments.localNode = HDFlocalNode;
- mpiWriteAtBeginArguments.globalNode = HDFmyNode;
- /* mpiWriteAtBeginArguments.fileID = (long) ( &fh ); */
- mpiWriteAtBeginArguments.fileID = myHDFid;
-
- mpiWriteAtBeginArguments.offset = (long) ( offset );
- mpiWriteAtBeginArguments.count = count;
- mpiWriteAtBeginArguments.dataType = HDF_get_Datatype( datatype );
- mpiWriteAtBeginArguments.numBytes = HDF_get_Bytes( datatype, count );
-
- /* Generate entry record */
- HDFtraceIOEvent( mpiWriteAtBeginID, (char *) &mpiWriteAtBeginArguments,
- sizeof( mpiWriteAtBeginArguments ) );
-
- returnVal = MPI_File_write_at( fh, offset, buf, count,
- datatype, status );
-
- mpiWriteAtEndArguments.localNode = HDFlocalNode;
- mpiWriteAtEndArguments.globalNode = HDFmyNode;
- /* mpiWriteAtEndArguments.fileID = (long) ( &fh ); */
- mpiWriteAtEndArguments.fileID = myHDFid;
-
- MPI_Get_count( status, datatype, &bcount );
- mpiWriteAtEndArguments.wCount = bcount;
- mpiWriteAtEndArguments.numBytes = HDF_get_Bytes( datatype, bcount );
-
- /* Generate entry record */
- HDFtraceIOEvent( mpiWriteAtEndID, (char *) &mpiWriteAtEndArguments,
- sizeof( mpiWriteAtEndArguments ) );
-
- return returnVal;
-}
-
-int
-PabloMPI_File_write_at_all( MPI_File fh,
- MPI_Offset offset,
- void *buf,
- int count,
- MPI_Datatype datatype,
- MPI_Status *status )
-{
- int returnVal, bcount;
- int numBytes;
-
- struct mpiWriteAtAllBeginArgs mpiWriteAtAllBeginArguments;
- struct mpiWriteAtAllEndArgs mpiWriteAtAllEndArguments;
-
-#ifdef DEBUG
- fprintf( debugFile, "MPI_File_write_at\n" );
- fflush( debugFile );
-#endif /* DEBUG */
-
- mpiWriteAtAllBeginArguments.localNode = HDFlocalNode;
- mpiWriteAtAllBeginArguments.globalNode = HDFmyNode;
- /* mpiWriteAtAllBeginArguments.fileID = (long) ( &fh ); */
- mpiWriteAtAllBeginArguments.fileID = myHDFid;
-
- mpiWriteAtAllBeginArguments.offset = (long) ( offset );
- mpiWriteAtAllBeginArguments.count = count;
- mpiWriteAtAllBeginArguments.dataType = HDF_get_Datatype( datatype );
- mpiWriteAtAllBeginArguments.numBytes = HDF_get_Bytes( datatype, count );
-
- /* Generate entry record */
- HDFtraceIOEvent( mpiWriteAtAllBeginID, (char *) &mpiWriteAtAllBeginArguments,
- sizeof( mpiWriteAtAllBeginArguments ) );
-
- returnVal = MPI_File_write_at_all( fh, offset, buf,
- count, datatype, status );
-
- mpiWriteAtAllEndArguments.localNode = HDFlocalNode;
- mpiWriteAtAllEndArguments.globalNode = HDFmyNode;
- /* mpiWriteAtAllEndArguments.fileID = (long) ( &fh ); */
- mpiWriteAtAllEndArguments.fileID = myHDFid;
-
- if ( returnVal == MPI_SUCCESS )
- {
- bcount = count;
- numBytes = HDF_get_Bytes( datatype, count );
- }
- else
- {
- bcount = -1;
- numBytes = -1;
- }
- mpiWriteAtAllEndArguments.wCount = bcount;
- mpiWriteAtAllEndArguments.numBytes = numBytes;
-
- /* Generate entry record */
- HDFtraceIOEvent( mpiWriteAtAllEndID, (char *) &mpiWriteAtAllEndArguments,
- sizeof( mpiWriteAtAllEndArguments ) );
-
- return returnVal;
-}
-
-int
-PabloMPI_File_sync( MPI_File fh )
-{
- int returnVal;
-
- struct mpiSyncBeginArgs mpiSyncBeginArguments;
- struct mpiSyncEndArgs mpiSyncEndArguments;
-
-#ifdef DEBUG
- fprintf( debugFile, "MPI_File_sync\n" );
- fflush( debugFile );
-#endif /* DEBUG */
-
- mpiSyncBeginArguments.localNode = HDFlocalNode;
- mpiSyncBeginArguments.globalNode = HDFmyNode;
- /* mpiSyncBeginArguments.fileID = (long) ( &fh ); */
- mpiSyncBeginArguments.fileID = myHDFid;
-
- /* Generate entry record */
- HDFtraceIOEvent( mpiSyncBeginID,
- (char *) &mpiSyncBeginArguments,
- sizeof( mpiSyncBeginArguments ) );
-
- returnVal = MPI_File_sync ( fh );
-
- mpiSyncEndArguments.localNode = HDFlocalNode;
- mpiSyncEndArguments.globalNode = HDFmyNode;
- /* mpiSyncEndArguments.fileID = (long) ( &fh ); */
- mpiSyncEndArguments.fileID = myHDFid;
-
- /* Generate entry record */
- HDFtraceIOEvent( mpiSyncEndID, (char *) &mpiSyncEndArguments,
- sizeof( mpiSyncEndArguments ) );
-
- return returnVal;
-}
-
-#endif /* H5_HAVE_PARALLEL */
+#endif /* PCF_BUILD */
diff --git a/pablo/PabloHDF_MPIO.c b/pablo/PabloHDF_MPIO.c
new file mode 100644
index 0000000..0eee178
--- /dev/null
+++ b/pablo/PabloHDF_MPIO.c
@@ -0,0 +1,1364 @@
+/*
+ * This file is an extension to NCSA HDF to enable the use of the
+ * Pablo trace library.
+ *
+ * Developed by: The TAPESTRY Parallel Computing Laboratory
+ * University of Illinois at Urbana-Champaign
+ * Department of Computer Science
+ * 1304 W. Springfield Avenue
+ * Urbana, IL 61801
+ *
+ * Copyright (c) 1995
+ * The University of Illinois Board of Trustees.
+ * All Rights Reserved.
+ *
+ * PABLO is a registered trademark of
+ * The Board of Trustees of the University of Illinois
+ * registered in the U.S. Patent and Trademark Office.
+ *
+ * Author: George Xin Zhou (xzhou@cs.uiuc.edu)
+ * Contributing Author: Jonathan M. Reid (jreid@cs.uiuc.edu)
+ *
+ * Project Manager and Principal Investigator:
+ * Daniel A. Reed (reed@cs.uiuc.edu)
+ *
+ * Funded by: National Aeronautics and Space Administration under NASA
+ * Contracts NAG-1-613 and USRA 5555-22 and by the Advanced Research
+ * Projects Agency under ARPA contracts DAVT63-91-C-0029 and
+ * DABT63-93-C-0040.
+ *
+ */
+/*======================================================================*
+// File: PabloHDF_MPIO.c *
+// Purpose: support use of Pablo trace library to analyze MPIO calls *
+// within HDF calls *
+// Most of the code is conditionally compiled dependent on the compiler *
+// flag HAVE_H5_PARALLEL which is set in the Makefile in thie hdf/pablo *
+// directory. *
+// Contents
+// HDF_get_NodeNum *
+//
+// HDF_get_mode *
+// returns the node number *
+//
+// HDF_get_source *
+//
+// HDF_get_comm
+//
+// HDF_get_Datatype
+//
+// HDF_get_DataRep
+//
+// int HDF_get_Bytes
+//
+// int PabloMPI_File_open
+//
+// int PabloMPI_File_close
+//
+// int PabloMPI_File_set_size
+//
+// int PabloMPI_File_get_size
+//
+// int PabloMPI_File_set_view
+//
+// int PabloMPI_File_get_view
+//
+// int PabloMPI_File_read_at
+//
+// int PabloMPI_File_read_at_all
+//
+// int PabloMPI_File_write_at
+//
+// int PabloMPI_File_write_at_all
+//
+// int PabloMPI_File_sync
+//
+// int HDF_MPI_File_open
+//
+// int HDF_MPI_File_close
+//
+// int HDF_MPI_File_set_size
+//
+// int HDF_MPI_File_get_size
+//
+// int HDF_MPI_File_set_view
+//
+// int HDF_MPI_File_get_view
+//
+// int HDF_MPI_File_read_at
+//
+// int HDF_MPI_File_read_at_all
+//
+// int HDF_MPI_File_write_at
+//
+// int HDF_MPI_File_write_at_all
+//
+// int HDF_MPI_File_sync
+//
+//======================================================================*/
+#ifdef H5_HAVE_PARALLEL
+#include "mpi.h"
+/************************************************************************/
+/* Return the node number. */
+/************************************************************************/
+void HDF_get_NodeNum( int* nodeNum )
+{
+ MPI_Comm_rank( MPI_COMM_WORLD, nodeNum );
+}
+#ifdef _BUILD
+#include "HDFTrace.h"
+#include "ProcTrace.h"
+#include "ProcIDs.h"
+#include "MPIO_Trace.h"
+#include "MPIO_EventArgs.h"
+#include "MPIO_Data.h"
+
+extern int OUTPUT_SWITCH;
+/* Global variable declarations and definitions. */
+static int HDFlocalNode = 0;
+int HDFmyNode;
+int myHDFid = 3;
+/* Function prototypes */
+int HDF_get_mode( int );
+int HDF_get_source( int );
+int HDF_get_comm( MPI_Comm );
+int HDF_get_Datatype( MPI_Datatype );
+int HDF_get_DataRep( char* );
+int HDF_get_Bytes( MPI_Datatype, int );
+
+/* Get the mode at the file openning */
+int
+HDF_get_mode( int amode )
+{
+ if( amode == MPI_MODE_RDONLY || amode == MPI_MODE_RDWR ||
+ amode == MPI_MODE_WRONLY || amode == MPI_MODE_CREATE ||
+ amode == MPI_MODE_EXCL || amode == MPI_MODE_DELETE_ON_CLOSE ||
+ amode == MPI_MODE_UNIQUE_OPEN ||
+ /* amode == MPI_MODE_SEQUENTIAL || */
+ amode == MPI_MODE_APPEND )
+ return amode;
+ else
+ return PABLO_MPI_MODE_NULL;
+}
+
+/* Get the node number */
+int
+HDF_get_source( int source )
+{
+ if ( source == MPI_ANY_SOURCE ) {
+ return PABLO_MPI_ANYSOURCE;
+ }
+
+ if ( source == MPI_PROC_NULL ) {
+ return PABLO_MPI_PROCNULL;
+ }
+
+ else {
+ return source;
+ }
+}
+
+/* get the communicator ID */
+/* this is dummy for compatability with MPIO Traceing */
+int
+HDF_get_comm( MPI_Comm in_comm )
+{
+ return 0;
+}
+/* Get the MPI_Datatype (mapped to a integer) */
+int HDF_get_Datatype( MPI_Datatype datatype )
+{
+ /* elementary datatypes (C) */
+ if ( datatype == MPI_CHAR )
+ return PABLO_MPI_CHAR;
+ else if ( datatype == MPI_SHORT )
+ return PABLO_MPI_SHORT;
+ else if ( datatype == MPI_INT )
+ return PABLO_MPI_INT;
+ else if ( datatype == MPI_LONG )
+ return PABLO_MPI_LONG;
+ else if ( datatype == MPI_UNSIGNED_CHAR )
+ return PABLO_MPI_UNSIGNED_CHAR;
+ else if ( datatype == MPI_UNSIGNED_SHORT )
+ return PABLO_MPI_UNSIGNED_SHORT;
+ else if ( datatype == MPI_UNSIGNED )
+ return PABLO_MPI_UNSIGNED;
+ else if ( datatype == MPI_UNSIGNED_LONG )
+ return PABLO_MPI_UNSIGNED_LONG;
+ else if ( datatype == MPI_FLOAT )
+ return PABLO_MPI_FLOAT;
+ else if ( datatype == MPI_DOUBLE )
+ return PABLO_MPI_DOUBLE;
+ else if ( datatype == MPI_LONG_DOUBLE )
+ return PABLO_MPI_LONG_DOUBLE;
+
+ /* elementary datatypes (FORTRAN) */
+#ifdef MPI_INTEGER
+ else if ( datatype == MPI_INTEGER )
+ return PABLO_MPI_INTEGER;
+#endif
+#ifdef MPI_REAL
+ else if ( datatype == MPI_REAL )
+ return PABLO_MPI_REAL;
+#endif
+#ifdef MPI_DOUBLE_PRECISION
+ else if ( datatype == MPI_DOUBLE_PRECISION )
+ return PABLO_MPI_DOUBLE_PRECISION;
+#endif
+#ifdef MPI_COMPLEX
+ else if ( datatype == MPI_COMPLEX )
+ return PABLO_MPI_COMPLEX;
+#endif
+#ifdef MPI_DOUBLE_COMPLEX
+ else if ( datatype == MPI_DOUBLE_COMPLEX )
+ return PABLO_MPI_DOUBLE_COMPLEX;
+#endif
+#ifdef MPI_LOGICAL
+ else if ( datatype == MPI_LOGICAL )
+ return PABLO_MPI_LOGICAL;
+#endif
+#ifdef MPI_CHARACTER
+ else if ( datatype == MPI_CHARACTER )
+ return PABLO_MPI_CHARACTER;
+#endif
+
+ /* other datatypes (C, Fortran).*/
+ else if ( datatype == MPI_BYTE )
+ return PABLO_MPI_BYTE;
+ else if ( datatype == MPI_PACKED )
+ return PABLO_MPI_PACKED;
+ else if ( datatype == MPI_LB )
+ return PABLO_MPI_LB;
+ else if ( datatype == MPI_UB )
+ return PABLO_MPI_UB;
+
+
+ /* reduction datatypes (C). */
+ else if ( datatype == MPI_FLOAT_INT )
+ return PABLO_MPI_FLOAT_INT;
+ else if ( datatype == MPI_DOUBLE_INT )
+ return PABLO_MPI_DOUBLE_INT;
+ else if ( datatype == MPI_LONG_INT )
+ return PABLO_MPI_LONG_INT;
+ else if ( datatype == MPI_2INT )
+ return PABLO_MPI_2INT;
+ else if ( datatype == MPI_SHORT_INT )
+ return PABLO_MPI_SHORT_INT;
+ else if ( datatype == MPI_LONG_DOUBLE_INT )
+ return PABLO_MPI_LONG_DOUBLE_INT;
+
+ /* Reduction datatypes (FORTRAN) */
+#ifdef MPI_2REAL
+ else if ( datatype == MPI_2REAL )
+ return PABLO_MPI_2REAL;
+#endif
+#ifdef MPI_2DOUBLE_PRECISION
+ else if ( datatype == MPI_2DOUBLE_PRECISION )
+ return PABLO_MPI_2DOUBLE_PRECISION;
+#endif
+#ifdef MPI_2INTEGER
+ else if ( datatype == MPI_2INTEGER )
+ return PABLO_MPI_2INTEGER;
+#endif
+
+#ifdef MPI_2COMPLEX
+ else if ( datatype == MPI_2COMPLEX )
+ return PABLO_MPI_2COMPLEX;
+#endif
+#ifdef MPI_2DOUBLE_COMPLEX
+ else if ( datatype == MPI_2DOUBLE_COMPLEX )
+ return PABLO_MPI_2DOUBLE_COMPLEX;
+#endif
+
+/* optional datatypes (C).*/
+#ifdef MPI_LONG_LONG_INT
+ else if ( datatype == MPI_LONG_LONG_INT )
+ return PABLO_MPI_LONG_LONG_INT;
+#endif
+ else if ( datatype == MPI_DATATYPE_NULL )
+ return PABLO_MPI_DATATYPE_NULL;
+ else
+ return PABLO_MPI_USER_DEF;
+}
+
+/* data representations */
+int HDF_get_DataRep( char* datarep )
+{
+ if ( !strcmp( datarep, "native" ) )
+ return PABLO_MPI_NATIVE;
+ else if ( !strcmp( datarep, "internal" ) )
+ return PABLO_MPI_INTERNAL;
+ else if ( !strcmp( datarep, "external32" ) )
+ return PABLO_MPI_EXTERNAL32;
+ else
+ return (-1);
+}
+
+/*****************************************************************************/
+/* The routines below are there to bypass the MPI I/O Tracing. When MPI I/O */
+/* tracing is done with a nonstandard MPI I/O implementation, problems can */
+/* occur in linking and in data recording. */
+/* For each of the MPI I/O routines MPI_File_xxx used in HDF, there are two */
+/* entries: HDF_MPI_File_xxx and PabloMPI_File_xxx. Macros replace the */
+/* MPI_File_xxx call with HDF_MPI_File_xxx. */
+/* If SUMMARY Tracing is used */
+/* HDF_MPI_File_xxx routine will record entry data in a table, call the */
+/* IF RUNTIME Tracing is used */
+/* HDF_MPI_File_xxx routine calls PabloMPI_File_xxx. This routine writes */
+/* data to the trace file, calls the standard MPI_File_xxx routine, then */
+/* records exit data to a trace file. */
+/* The PabloMPI_File_xxx functionality could have been incorporated into the */
+/* HDF_MPI_File_xxx routine, but was not done so for expediency. */
+/*****************************************************************************/
+int PabloMPI_File_open( MPI_Comm comm,
+ char *filename,
+ int amode,
+ MPI_Info info,
+ MPI_File *fh ) ;
+
+int PabloMPI_File_close( MPI_File *fh ) ;
+
+int PabloMPI_File_set_size( MPI_File fh, MPI_Offset size ) ;
+
+int PabloMPI_File_get_size( MPI_File fh, MPI_Offset *size ) ;
+
+int PabloMPI_File_set_view( MPI_File fh,
+ MPI_Offset disp,
+ MPI_Datatype etype,
+ MPI_Datatype filetype,
+ char *datarep,
+ MPI_Info info ) ;
+
+int PabloMPI_File_get_view( MPI_File fh,
+ MPI_Offset *disp,
+ MPI_Datatype *etype,
+ MPI_Datatype *filetype,
+ char *datarep ) ;
+
+int PabloMPI_File_read_at( MPI_File fh,
+ MPI_Offset offset,
+ void *buf,
+ int count,
+ MPI_Datatype datatype,
+ MPI_Status *status ) ;
+
+int PabloMPI_File_read_at_all( MPI_File fh,
+ MPI_Offset offset,
+ void *buf,
+ int count,
+ MPI_Datatype datatype,
+ MPI_Status *status ) ;
+
+int PabloMPI_File_write_at( MPI_File fh,
+ MPI_Offset offset,
+ void *buf,
+ int count,
+ MPI_Datatype datatype,
+ MPI_Status *status ) ;
+
+int PabloMPI_File_write_at_all( MPI_File fh,
+ MPI_Offset offset,
+ void *buf,
+ int count,
+ MPI_Datatype datatype,
+ MPI_Status *status ) ;
+
+int PabloMPI_File_sync( MPI_File fh ) ;
+
+/*======================================================================*
+// Pass call through to regular MPIO entry except in case of Real Time *
+// tracing. *
+// Note: The regular MPIO entry may or may not be instrumented. *
+//======================================================================*/
+int
+HDF_MPI_File_open( MPI_Comm comm,
+ char *filename,
+ int amode,
+ MPI_Info info,
+ MPI_File *fh )
+{
+ int returnVal;
+ HDFsetInfo dataPtr;
+ int dataLen;
+
+ if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE )
+ {
+ returnVal = PabloMPI_File_open( comm, filename, amode, info, fh );
+ }
+ else
+ {
+ dataLen = sizeof( HDFsetInfo );
+ dataPtr.setID = 0;
+ dataPtr.setName = (char *)malloc( strlen(filename) + 1);
+ strcpy( dataPtr.setName , filename );
+ HDFtraceEvent_RT( HDFmpiOpenID, &dataPtr, dataLen );
+ returnVal = MPI_File_open( comm, filename, amode, info, fh );
+ dataPtr.setID = (long)fh;
+ HDFtraceEvent_RT( -HDFmpiOpenID, &dataPtr, dataLen );
+ }
+ return returnVal;
+}
+
+
+
+/*======================================================================*
+// Pass call through to regular MPIO entry except in case of Real Time *
+// tracing. *
+// Note: The regular MPIO entry may or may not be instrumented. *
+//======================================================================*/
+int
+HDF_MPI_File_close( MPI_File *fh )
+{
+ int returnVal;
+ HDFsetInfo dataPtr;
+ int dataLen;
+
+ if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE )
+ {
+ returnVal = PabloMPI_File_close( fh );
+ }
+ else
+ {
+ dataLen = sizeof( HDFsetInfo );
+ dataPtr.setID = (long)fh;
+ dataPtr.setName = NULL;
+ HDFtraceEvent_RT( HDFmpiCloseID, &dataPtr, dataLen );
+ returnVal = MPI_File_close( fh );
+ HDFtraceEvent_RT( -HDFmpiCloseID, &dataPtr, dataLen );
+ free( dataPtr.setName );
+ }
+ return returnVal;
+}
+
+
+/*======================================================================*
+// Pass call through to regular MPIO entry except in case of Real Time *
+// tracing. *
+// Note: The regular MPIO entry may or may not be instrumented. *
+//======================================================================*/
+int
+HDF_MPI_File_set_size( MPI_File fh, MPI_Offset size )
+{
+ int returnVal;
+ HDFsetInfo dataPtr;
+ int dataLen;
+
+ if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE )
+ {
+ returnVal = PabloMPI_File_set_size( fh, size );
+ }
+ else
+ {
+ dataLen = 1;
+ dataPtr.setID = (long)fh;
+ HDFtraceEvent_RT( HDFmpiSetSizeID,&dataPtr,dataLen );
+ returnVal = MPI_File_set_size( fh, size );
+ HDFtraceEvent_RT( -HDFmpiSetSizeID, &dataPtr, dataLen );
+ }
+ return returnVal;
+}
+
+/*======================================================================*
+// Pass call through to regular MPIO entry except in case of Real Time *
+// tracing. *
+// Note: The regular MPIO entry may or may not be instrumented. *
+//======================================================================*/
+int
+HDF_MPI_File_get_size( MPI_File fh, MPI_Offset *size )
+{
+ int returnVal;
+ HDFsetInfo dataPtr;
+ int dataLen;
+
+ if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE ) {
+ returnVal = PabloMPI_File_get_size( fh, size);
+ } else {
+ dataLen = 1;
+ dataPtr.setID = (long)fh;
+ HDFtraceEvent_RT( HDFmpiGetSizeID,
+ &dataPtr,dataLen );
+ returnVal = MPI_File_get_size( fh, size);
+ HDFtraceEvent_RT( -HDFmpiGetSizeID,
+ &dataPtr,dataLen );
+ }
+ return returnVal;
+}
+
+/*======================================================================*
+// Pass call through to regular MPIO entry except in case of Real Time *
+// tracing. *
+// Note: The regular MPIO entry may or may not be instrumented. *
+//======================================================================*/
+int
+HDF_MPI_File_set_view( MPI_File fh,
+ MPI_Offset disp,
+ MPI_Datatype etype,
+ MPI_Datatype filetype,
+ char *datarep,
+ MPI_Info info )
+{
+ int returnVal;
+ HDFsetInfo dataPtr;
+ int dataLen;
+
+ if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE )
+ {
+ returnVal = PabloMPI_File_set_view( fh, disp, etype, filetype,
+ datarep, info );
+ }
+ else
+ {
+ dataLen = 1;
+ dataPtr.setID = (long)fh;
+ HDFtraceEvent_RT( HDFmpiSetViewID,
+ &dataPtr,dataLen );
+ returnVal = MPI_File_set_view( fh, disp, etype, filetype,
+ datarep, info );
+ HDFtraceEvent_RT( -HDFmpiSetViewID,
+ &dataPtr,dataLen );
+ }
+ return returnVal;
+}
+
+/*======================================================================*
+// Pass call through to regular MPIO entry except in case of Real Time *
+// tracing. *
+// Note: The regular MPIO entry may or may not be instrumented. *
+//======================================================================*/
+int
+HDF_MPI_File_get_view( MPI_File fh,
+ MPI_Offset *disp,
+ MPI_Datatype *etype,
+ MPI_Datatype *filetype,
+ char *datarep )
+{
+ int returnVal;
+ HDFsetInfo dataPtr;
+ int dataLen;
+
+ if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE )
+ {
+ returnVal = PabloMPI_File_get_view(fh, disp, etype, filetype, datarep);
+ }
+ else
+ {
+ dataLen = 1;
+ dataPtr.setID = (long)fh;
+ HDFtraceEvent_RT( HDFmpiSetViewID, &dataPtr,dataLen );
+ returnVal = MPI_File_get_view(fh, disp, etype, filetype, datarep);
+ HDFtraceEvent_RT( -HDFmpiSetViewID, &dataPtr,dataLen );
+ returnVal = MPI_File_get_view(fh, disp, etype, filetype, datarep);
+
+ }
+ return returnVal;
+}
+
+/*======================================================================*
+// Pass call through to regular MPIO entry except in case of Real Time *
+// tracing. *
+// Note: The regular MPIO entry may or may not be instrumented. *
+//======================================================================*/
+int HDF_MPI_File_read_at( MPI_File fh,
+ MPI_Offset offset,
+ void *buf,
+ int count,
+ MPI_Datatype datatype,
+ MPI_Status *status )
+{
+ int returnVal;
+ HDFsetInfo dataPtr;
+ int dataLen;
+ int rCount;
+
+ if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE )
+ {
+ returnVal = PabloMPI_File_read_at( fh,
+ offset,
+ buf,
+ count,
+ datatype,
+ status );
+ }
+ else
+ {
+ dataLen = sizeof(dataPtr);
+ dataPtr.setID = (long)fh;
+ dataPtr.numBytes = HDF_get_Bytes( datatype, count );
+ HDFtraceEvent_RT( HDFmpiReadAtID,
+ &dataPtr,dataLen );
+ returnVal = MPI_File_read_at( fh,
+ offset,
+ buf,
+ count,
+ datatype,
+ status );
+ MPI_Get_count(status,datatype,&rCount);
+ if ( rCount < 0 || rCount > count )
+ {
+ dataPtr.numBytes = -1;
+ }
+ else
+ {
+ dataPtr.numBytes = HDF_get_Bytes( datatype, rCount );
+ }
+ HDFtraceEvent_RT( -HDFmpiReadAtID,
+ &dataPtr,dataLen );
+ }
+ return returnVal;
+}
+
+/*======================================================================*
+// Pass call through to regular MPIO entry except in case of Real Time *
+// tracing. *
+// Note: The regular MPIO entry may or may not be instrumented. *
+//======================================================================*/
+int
+HDF_MPI_File_read_at_all( MPI_File fh,
+ MPI_Offset offset,
+ void *buf,
+ int count,
+ MPI_Datatype datatype,
+ MPI_Status *status )
+{
+
+ int returnVal;
+ HDFsetInfo dataPtr;
+ int dataLen;
+ int rCount;
+
+ if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE )
+ {
+ returnVal = PabloMPI_File_read_at_all( fh,
+ offset,
+ buf,
+ count,
+ datatype,
+ status );
+ }
+ else
+ {
+ dataLen = sizeof(dataPtr);
+ dataPtr.setID = (long)fh;
+ dataPtr.numBytes = HDF_get_Bytes( datatype, count );
+ HDFtraceEvent_RT( HDFmpiReadAtAllID,
+ &dataPtr,dataLen );
+ returnVal = MPI_File_read_at_all( fh,
+ offset,
+ buf,
+ count,
+ datatype,
+ status );
+ MPI_Get_count(status,datatype,&rCount);
+ if ( rCount < 0 || rCount > count )
+ {
+ dataPtr.numBytes = -1;
+ }
+ else
+ {
+ dataPtr.numBytes = HDF_get_Bytes( datatype, rCount );
+ }
+ HDFtraceEvent_RT( -HDFmpiReadAtAllID,
+ &dataPtr,dataLen );
+ }
+ return returnVal;
+}
+
+/*======================================================================*
+// Pass call through to regular MPIO entry except in case of Real Time *
+// tracing. *
+// Note: The regular MPIO entry may or may not be instrumented. *
+//======================================================================*/
+int
+HDF_MPI_File_write_at( MPI_File fh,
+ MPI_Offset offset,
+ void *buf,
+ int count,
+ MPI_Datatype datatype,
+ MPI_Status *status )
+{
+
+ int returnVal;
+ HDFsetInfo dataPtr;
+ int dataLen;
+ int rCount;
+
+ if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE )
+ {
+ returnVal = PabloMPI_File_write_at( fh,
+ offset,
+ buf,
+ count,
+ datatype,
+ status );
+ }
+ else
+ {
+ dataLen = sizeof(dataPtr);
+ dataPtr.setID = (long)fh;
+ dataPtr.numBytes = HDF_get_Bytes( datatype, count );
+ HDFtraceEvent_RT( HDFmpiWriteAtID, &dataPtr,dataLen );
+ returnVal = MPI_File_write_at( fh,
+ offset,
+ buf,
+ count,
+ datatype,
+ status );
+ MPI_Get_count(status,datatype,&rCount);
+ if ( rCount < 0 || rCount > count )
+ {
+ dataPtr.numBytes = -1;
+ }
+ else
+ {
+ dataPtr.numBytes = HDF_get_Bytes( datatype, rCount );
+ }
+ HDFtraceEvent_RT( -HDFmpiWriteAtID, &dataPtr,dataLen );
+ }
+ return returnVal;
+}
+
+/*======================================================================*
+// Pass call through to regular MPIO entry except in case of Real Time *
+// tracing. *
+// Note: The regular MPIO entry may or may not be instrumented. *
+//======================================================================*/
+int
+HDF_MPI_File_write_at_all( MPI_File fh,
+ MPI_Offset offset,
+ void *buf,
+ int count,
+ MPI_Datatype datatype,
+ MPI_Status *status )
+{
+ int returnVal;
+ HDFsetInfo dataPtr;
+ int dataLen;
+ int numBytes;
+
+ if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE )
+ {
+ returnVal = PabloMPI_File_write_at_all( fh,
+ offset,
+ buf,
+ count,
+ datatype,
+ status );
+ }
+ else
+ {
+ dataLen = sizeof(dataPtr);
+ dataPtr.setID = (long)fh;
+ dataPtr.numBytes = HDF_get_Bytes( datatype, count );
+ HDFtraceEvent_RT( HDFmpiWriteAtAllID, &dataPtr, dataLen );
+ returnVal = MPI_File_write_at_all( fh,
+ offset,
+ buf,
+ count,
+ datatype,
+ status );
+ if ( returnVal == MPI_SUCCESS )
+ {
+ numBytes = HDF_get_Bytes( datatype, count );
+ }
+ else
+ {
+ numBytes = -1;
+ }
+ dataPtr.numBytes = numBytes;
+ HDFtraceEvent_RT( -HDFmpiWriteAtAllID,
+ &dataPtr,dataLen );
+ }
+ return returnVal;
+}
+
+/*======================================================================*
+// Pass call through to regular MPIO entry except in case of Real Time *
+// tracing. *
+// Note: The regular MPIO entry may or may not be instrumented. *
+//======================================================================*/
+int
+HDF_MPI_File_sync( MPI_File fh )
+{
+ int returnVal;
+ HDFsetInfo dataPtr;
+ int dataLen;
+
+ if ( OUTPUT_SWITCH != MPI_SUMMARY_TRACE )
+ {
+ returnVal = PabloMPI_File_sync ( fh );
+ }
+ else
+ {
+ dataLen = 1;
+ dataPtr.setID = (long)fh;
+ HDFtraceEvent_RT( HDFmpiSyncID,
+ &dataPtr,dataLen );
+ returnVal = MPI_File_sync ( fh );
+ HDFtraceEvent_RT( -HDFmpiSyncID,
+ &dataPtr,dataLen );
+ }
+ return returnVal;
+}
+
+int
+HDF_get_Bytes( MPI_Datatype datatype, int count )
+{
+ int nm_bytes;
+
+ MPI_Type_size( datatype, &nm_bytes );
+ return( nm_bytes * count );
+}
+
+int
+PabloMPI_File_open( MPI_Comm comm,
+ char *filename,
+ int amode,
+ MPI_Info info,
+ MPI_File *fh )
+{
+ int returnVal;
+
+ struct mpiOpenBeginArgs mpiOpenBeginArguments;
+ struct mpiOpenEndArgs mpiOpenEndArguments;
+
+#ifdef DEBUG
+ fprintf( debugFile, "PabloMPI_File_open\n" );
+ fflush( debugFile );
+#endif /* DEBUG */
+
+ MPI_Comm_rank( comm, &HDFlocalNode );
+ MPI_Comm_rank( MPI_COMM_WORLD, &HDFmyNode );
+
+ mpiOpenBeginArguments.localNode = HDF_get_source( HDFlocalNode );
+ mpiOpenBeginArguments.globalNode = HDFmyNode;
+ mpiOpenBeginArguments.communicatorID = HDF_get_comm( comm );
+ mpiOpenBeginArguments.mode = amode;
+ strcpy( mpiOpenBeginArguments.fileName, filename );
+
+ /* Generate entry record */
+ HDFtraceIOEvent( mpiOpenBeginID,
+ (char *) &mpiOpenBeginArguments,
+ sizeof( mpiOpenBeginArguments ) );
+
+ returnVal = MPI_File_open( comm, filename, amode, info, fh );
+
+ mpiOpenEndArguments.localNode = HDF_get_source( HDFlocalNode );
+ mpiOpenEndArguments.globalNode = HDFmyNode;
+ /* the fileID is mapped to the fp's address */
+ myHDFid++;
+ mpiOpenEndArguments.fileID = myHDFid;
+
+ /* Generate exit record */
+ HDFtraceIOEvent( mpiOpenEndID,
+ (char *) &mpiOpenEndArguments,
+ sizeof( mpiOpenEndArguments ) );
+
+ return returnVal;
+}
+
+int
+PabloMPI_File_close( MPI_File *fh )
+{
+ int returnVal;
+
+ struct mpiCloseBeginArgs mpiCloseBeginArguments;
+ struct mpiCloseEndArgs mpiCloseEndArguments;
+
+#ifdef DEBUG
+ fprintf( debugFile, "MPI_File_close\n" );
+ fflush( debugFile );
+#endif /* DEBUG */
+
+ mpiCloseBeginArguments.localNode = HDFlocalNode;
+ mpiCloseBeginArguments.globalNode = HDFmyNode;
+ mpiCloseBeginArguments.fileID = myHDFid;
+
+ /* Generate entry record */
+ HDFtraceIOEvent( mpiCloseBeginID,
+ (char *) &mpiCloseBeginArguments,
+ sizeof( mpiCloseBeginArguments ) );
+
+ returnVal = MPI_File_close( fh );
+
+ mpiCloseEndArguments.localNode = HDFlocalNode;
+ mpiCloseEndArguments.globalNode = HDFmyNode;
+ mpiCloseEndArguments.fileID = myHDFid;
+
+ /* Generate exit record */
+ HDFtraceIOEvent( mpiCloseEndID,
+ (char *) &mpiCloseEndArguments,
+ sizeof( mpiCloseEndArguments ) );
+
+ return returnVal;
+}
+
+int
+PabloMPI_File_set_size( MPI_File fh, MPI_Offset size )
+{
+ int returnVal;
+
+ struct mpiSetSizeBeginArgs mpiSetSizeBeginArguments;
+ struct mpiSetSizeEndArgs mpiSetSizeEndArguments;
+
+#ifdef DEBUG
+ fprintf( debugFile, "MPI_File_set_size\n" );
+ fflush( debugFile );
+#endif /* DEBUG */
+
+ mpiSetSizeBeginArguments.localNode = HDFlocalNode;
+ mpiSetSizeBeginArguments.globalNode = HDFmyNode;
+ /* mpiSetSizeBeginArguments.fileID = (long) (&fh); */
+ mpiSetSizeBeginArguments.fileID = myHDFid;
+
+ mpiSetSizeBeginArguments.fileSize = (long) size;
+
+ /* Generate entry record */
+ HDFtraceIOEvent( mpiSetSizeBeginID,
+ (char *) &mpiSetSizeBeginArguments,
+ sizeof( mpiSetSizeBeginArguments ) );
+
+ returnVal = MPI_File_set_size( fh, size );
+
+ mpiSetSizeEndArguments.localNode = HDFlocalNode;
+ mpiSetSizeEndArguments.globalNode = HDFmyNode;
+ mpiSetSizeEndArguments.fileID = myHDFid;
+
+ /* Generate entry record */
+ HDFtraceIOEvent( mpiSetSizeEndID,
+ (char *) &mpiSetSizeEndArguments,
+ sizeof( mpiSetSizeEndArguments ) );
+
+ return returnVal;
+}
+
+int
+PabloMPI_File_get_size( MPI_File fh, MPI_Offset *size )
+{
+ int returnVal;
+
+ struct mpiGetSizeBeginArgs mpiGetSizeBeginArguments;
+ struct mpiGetSizeEndArgs mpiGetSizeEndArguments;
+
+#ifdef DEBUG
+ fprintf( debugFile, "MPI_File_get_size\n" );
+ fflush( debugFile );
+#endif /* DEBUG */
+
+ mpiGetSizeBeginArguments.localNode = HDFlocalNode;
+ mpiGetSizeBeginArguments.globalNode = HDFmyNode;
+ /* mpiGetSizeBeginArguments.fileID = (long) (&fh); */
+ mpiGetSizeBeginArguments.fileID = myHDFid;
+
+ /* Generate entry record */
+ HDFtraceIOEvent( mpiGetSizeBeginID,
+ (char *) &mpiGetSizeBeginArguments,
+ sizeof( mpiGetSizeBeginArguments ) );
+
+ returnVal = MPI_File_get_size( fh, size);
+
+ mpiGetSizeEndArguments.localNode = HDFlocalNode;
+ mpiGetSizeEndArguments.globalNode = HDFmyNode;
+ /* mpiGetSizeEndArguments.fileID = (long) ( &fh ); */
+ mpiGetSizeEndArguments.fileID = myHDFid;
+
+ mpiGetSizeEndArguments.fileSize = (long) (*size);
+
+ /* Generate entry record */
+ HDFtraceIOEvent( mpiGetSizeEndID,
+ (char *) &mpiGetSizeEndArguments,
+ sizeof( mpiGetSizeEndArguments ) );
+
+ return returnVal;
+}
+
+int
+PabloMPI_File_set_view( MPI_File fh,
+ MPI_Offset disp,
+ MPI_Datatype etype,
+ MPI_Datatype filetype,
+ char *datarep,
+ MPI_Info info )
+{
+ int returnVal;
+
+ struct mpiSetViewBeginArgs mpiSetViewBeginArguments;
+ struct mpiSetViewEndArgs mpiSetViewEndArguments;
+
+#ifdef DEBUG
+ fprintf( debugFile, "MPI_File_set_view\n" );
+ fflush( debugFile );
+#endif /* DEBUG */
+
+ mpiSetViewBeginArguments.localNode = HDFlocalNode;
+ mpiSetViewBeginArguments.globalNode = HDFmyNode;
+ /* mpiSetViewBeginArguments.fileID = (long) ( &fh ); */
+ mpiSetViewBeginArguments.fileID = myHDFid;
+
+ mpiSetViewBeginArguments.disp = (long) ( disp );
+ mpiSetViewBeginArguments.etype = HDF_get_Datatype( etype );
+ mpiSetViewBeginArguments.fileType = HDF_get_Datatype( filetype );
+ mpiSetViewBeginArguments.dataRep = HDF_get_DataRep( datarep );
+
+ /* Generate entry record */
+ HDFtraceIOEvent( mpiSetViewBeginID,
+ (char *) &mpiSetViewBeginArguments,
+ sizeof( mpiSetViewBeginArguments ) );
+
+ returnVal = MPI_File_set_view( fh,
+ disp,
+ etype,
+ filetype,
+ datarep,
+ info );
+
+ mpiSetViewEndArguments.localNode = HDFlocalNode;
+ mpiSetViewEndArguments.globalNode = HDFmyNode;
+ /* mpiSetViewEndArguments.fileID = (long) ( &fh ); */
+ mpiSetViewEndArguments.fileID = myHDFid;
+
+ /* Generate entry record */
+ HDFtraceIOEvent( mpiSetViewEndID,
+ (char *) &mpiSetViewEndArguments,
+ sizeof( mpiSetViewEndArguments ) );
+
+ return returnVal;
+}
+
+int
+PabloMPI_File_get_view( MPI_File fh,
+ MPI_Offset *disp,
+ MPI_Datatype *etype,
+ MPI_Datatype *filetype,
+ char *datarep )
+{
+ int returnVal;
+
+ struct mpiGetViewBeginArgs mpiGetViewBeginArguments;
+ struct mpiGetViewEndArgs mpiGetViewEndArguments;
+
+#ifdef DEBUG
+ fprintf( debugFile, "MPI_File_get_view\n" );
+ fflush( debugFile );
+#endif /* DEBUG */
+
+ mpiGetViewBeginArguments.localNode = HDFlocalNode;
+ mpiGetViewBeginArguments.globalNode = HDFmyNode;
+ mpiGetViewBeginArguments.fileID = myHDFid;
+
+ /* Generate entry record */
+ HDFtraceIOEvent( mpiGetViewBeginID,
+ (char *) &mpiGetViewBeginArguments,
+ sizeof( mpiGetViewBeginArguments ) );
+
+ returnVal = MPI_File_get_view( fh, disp, etype, filetype, datarep );
+
+ mpiGetViewEndArguments.localNode = HDFlocalNode;
+ mpiGetViewEndArguments.globalNode = HDFmyNode;
+ /* mpiGetViewEndArguments.fileID = (long) ( &fh ); */
+ mpiGetViewEndArguments.fileID = myHDFid;
+
+ mpiGetViewEndArguments.disp = (long) ( *disp );
+ mpiGetViewEndArguments.etype = HDF_get_Datatype( *etype );
+ mpiGetViewEndArguments.fileType = HDF_get_Datatype( *filetype );
+ mpiGetViewEndArguments.dataRep = HDF_get_DataRep( datarep );
+
+ /* Generate entry record */
+ HDFtraceIOEvent( mpiGetViewEndID,
+ (char *) &mpiGetViewEndArguments,
+ sizeof( mpiGetViewEndArguments ) );
+
+ return returnVal;
+}
+
+int
+PabloMPI_File_read_at( MPI_File fh,
+ MPI_Offset offset,
+ void *buf,
+ int count,
+ MPI_Datatype datatype,
+ MPI_Status *status )
+{
+ int returnVal, bcount;
+
+ struct mpiReadAtBeginArgs mpiReadAtBeginArguments;
+ struct mpiReadAtEndArgs mpiReadAtEndArguments;
+
+#ifdef DEBUG
+ fprintf( debugFile, "MPI_File_read_at\n" );
+ fflush( debugFile );
+#endif /* DEBUG */
+
+ mpiReadAtBeginArguments.localNode = HDFlocalNode;
+ mpiReadAtBeginArguments.globalNode = HDFmyNode;
+ /* mpiReadAtBeginArguments.fileID = (long) ( &fh ); */
+ mpiReadAtBeginArguments.fileID = myHDFid;
+
+ mpiReadAtBeginArguments.offset = (long) ( offset );
+ mpiReadAtBeginArguments.count = count;
+ mpiReadAtBeginArguments.dataType = HDF_get_Datatype( datatype );
+ mpiReadAtBeginArguments.numBytes = HDF_get_Bytes( datatype, count );
+
+
+ /* Generate entry record */
+ HDFtraceIOEvent( mpiReadAtBeginID,
+ (char *) &mpiReadAtBeginArguments,
+ sizeof( mpiReadAtBeginArguments ) );
+
+ returnVal = MPI_File_read_at( fh, offset, buf, count, datatype, status );
+
+ mpiReadAtEndArguments.localNode = HDFlocalNode;
+ mpiReadAtEndArguments.globalNode = HDFmyNode;
+ /* mpiReadAtEndArguments.fileID = (long) ( &fh ); */
+ mpiReadAtEndArguments.fileID = myHDFid;
+
+ MPI_Get_count( status, datatype, &bcount );
+ if ( bcount < 0 || bcount > count )
+ {
+ mpiReadAtEndArguments.rCount = -1;
+ mpiReadAtEndArguments.numBytes = -1;
+ }
+ else
+ {
+ mpiReadAtEndArguments.rCount = bcount;
+ mpiReadAtEndArguments.numBytes = HDF_get_Bytes( datatype, bcount );
+ }
+ /* Generate entry record */
+ HDFtraceIOEvent( mpiReadAtEndID,
+ (char *) &mpiReadAtEndArguments,
+ sizeof( mpiReadAtEndArguments ) );
+
+ return returnVal;
+}
+
+int
+PabloMPI_File_read_at_all( MPI_File fh,
+ MPI_Offset offset,
+ void *buf,
+ int count,
+ MPI_Datatype datatype,
+ MPI_Status *status )
+{
+ int returnVal, bcount;
+
+ struct mpiReadAtAllBeginArgs mpiReadAtAllBeginArguments;
+ struct mpiReadAtAllEndArgs mpiReadAtAllEndArguments;
+
+#ifdef DEBUG
+ fprintf( debugFile, "MPI_File_read_at_all\n" );
+ fflush( debugFile );
+#endif /* DEBUG */
+
+ mpiReadAtAllBeginArguments.localNode = HDFlocalNode;
+ mpiReadAtAllBeginArguments.globalNode = HDFmyNode;
+ /* mpiReadAtAllBeginArguments.fileID = (long) ( &fh ); */
+ mpiReadAtAllBeginArguments.fileID = myHDFid;
+
+ mpiReadAtAllBeginArguments.offset = (long) ( offset );
+ mpiReadAtAllBeginArguments.count = count;
+ mpiReadAtAllBeginArguments.dataType = HDF_get_Datatype( datatype );
+ mpiReadAtAllBeginArguments.numBytes = HDF_get_Bytes( datatype, count );
+
+ /* Generate entry record */
+ HDFtraceIOEvent( mpiReadAtAllBeginID,
+ (char *) &mpiReadAtAllBeginArguments,
+ sizeof( mpiReadAtAllBeginArguments ) );
+
+ returnVal = MPI_File_read_at_all( fh,
+ offset,
+ buf,
+ count,
+ datatype,
+ status );
+
+ mpiReadAtAllEndArguments.localNode = HDFlocalNode;
+ mpiReadAtAllEndArguments.globalNode = HDFmyNode;
+ /* mpiReadAtAllEndArguments.fileID = (long) ( &fh ); */
+ mpiReadAtAllEndArguments.fileID = myHDFid;
+
+ MPI_Get_count( status, datatype, &bcount );
+ if ( bcount < 0 || bcount > count )
+ {
+ mpiReadAtAllEndArguments.rCount = -1;
+ mpiReadAtAllEndArguments.numBytes = -1;
+ }
+ else
+ {
+ mpiReadAtAllEndArguments.rCount = bcount;
+ mpiReadAtAllEndArguments.numBytes = HDF_get_Bytes( datatype, bcount );
+ }
+
+ /* Generate entry record */
+ HDFtraceIOEvent( mpiReadAtAllEndID,
+ (char *) &mpiReadAtAllEndArguments,
+ sizeof( mpiReadAtAllEndArguments ) );
+
+ return returnVal;
+}
+
+int
+PabloMPI_File_write_at( MPI_File fh,
+ MPI_Offset offset,
+ void *buf,
+ int count,
+ MPI_Datatype datatype,
+ MPI_Status *status )
+{
+ int returnVal, bcount;
+
+ struct mpiWriteAtBeginArgs mpiWriteAtBeginArguments;
+ struct mpiWriteAtEndArgs mpiWriteAtEndArguments;
+
+#ifdef DEBUG
+ fprintf( debugFile, "MPI_File_write_at\n" );
+ fflush( debugFile );
+#endif /* DEBUG */
+
+ mpiWriteAtBeginArguments.localNode = HDFlocalNode;
+ mpiWriteAtBeginArguments.globalNode = HDFmyNode;
+ /* mpiWriteAtBeginArguments.fileID = (long) ( &fh ); */
+ mpiWriteAtBeginArguments.fileID = myHDFid;
+
+ mpiWriteAtBeginArguments.offset = (long) ( offset );
+ mpiWriteAtBeginArguments.count = count;
+ mpiWriteAtBeginArguments.dataType = HDF_get_Datatype( datatype );
+ mpiWriteAtBeginArguments.numBytes = HDF_get_Bytes( datatype, count );
+
+ /* Generate entry record */
+ HDFtraceIOEvent( mpiWriteAtBeginID,
+ (char *) &mpiWriteAtBeginArguments,
+ sizeof( mpiWriteAtBeginArguments ) );
+
+ returnVal = MPI_File_write_at( fh,
+ offset,
+ buf,
+ count,
+ datatype,
+ status );
+
+ mpiWriteAtEndArguments.localNode = HDFlocalNode;
+ mpiWriteAtEndArguments.globalNode = HDFmyNode;
+ /* mpiWriteAtEndArguments.fileID = (long) ( &fh ); */
+ mpiWriteAtEndArguments.fileID = myHDFid;
+
+ MPI_Get_count( status, datatype, &bcount );
+ mpiWriteAtEndArguments.wCount = bcount;
+ mpiWriteAtEndArguments.numBytes = HDF_get_Bytes( datatype, bcount );
+
+ /* Generate entry record */
+ HDFtraceIOEvent( mpiWriteAtEndID,
+ (char *) &mpiWriteAtEndArguments,
+ sizeof( mpiWriteAtEndArguments ) );
+
+ return returnVal;
+}
+
+int
+PabloMPI_File_write_at_all( MPI_File fh,
+ MPI_Offset offset,
+ void *buf,
+ int count,
+ MPI_Datatype datatype,
+ MPI_Status *status )
+{
+ int returnVal, bcount;
+ int numBytes;
+
+ struct mpiWriteAtAllBeginArgs mpiWriteAtAllBeginArguments;
+ struct mpiWriteAtAllEndArgs mpiWriteAtAllEndArguments;
+
+#ifdef DEBUG
+ fprintf( debugFile, "MPI_File_write_at\n" );
+ fflush( debugFile );
+#endif /* DEBUG */
+
+ mpiWriteAtAllBeginArguments.localNode = HDFlocalNode;
+ mpiWriteAtAllBeginArguments.globalNode = HDFmyNode;
+ /* mpiWriteAtAllBeginArguments.fileID = (long) ( &fh ); */
+ mpiWriteAtAllBeginArguments.fileID = myHDFid;
+
+ mpiWriteAtAllBeginArguments.offset = (long) ( offset );
+ mpiWriteAtAllBeginArguments.count = count;
+ mpiWriteAtAllBeginArguments.dataType = HDF_get_Datatype( datatype );
+ mpiWriteAtAllBeginArguments.numBytes = HDF_get_Bytes( datatype, count );
+
+ /* Generate entry record */
+ HDFtraceIOEvent( mpiWriteAtAllBeginID,
+ (char *) &mpiWriteAtAllBeginArguments,
+ sizeof( mpiWriteAtAllBeginArguments ) );
+
+ returnVal = MPI_File_write_at_all( fh,
+ offset,
+ buf,
+ count,
+ datatype,
+ status );
+
+ mpiWriteAtAllEndArguments.localNode = HDFlocalNode;
+ mpiWriteAtAllEndArguments.globalNode = HDFmyNode;
+ mpiWriteAtAllEndArguments.fileID = myHDFid;
+
+ if ( returnVal == MPI_SUCCESS )
+ {
+ bcount = count;
+ numBytes = HDF_get_Bytes( datatype, count );
+ }
+ else
+ {
+ bcount = -1;
+ numBytes = -1;
+ }
+ mpiWriteAtAllEndArguments.wCount = bcount;
+ mpiWriteAtAllEndArguments.numBytes = numBytes;
+
+ /* Generate entry record */
+ HDFtraceIOEvent( mpiWriteAtAllEndID,
+ (char *) &mpiWriteAtAllEndArguments,
+ sizeof( mpiWriteAtAllEndArguments ) );
+
+ return returnVal;
+}
+
+int
+PabloMPI_File_sync( MPI_File fh )
+{
+ int returnVal;
+
+ struct mpiSyncBeginArgs mpiSyncBeginArguments;
+ struct mpiSyncEndArgs mpiSyncEndArguments;
+
+#ifdef DEBUG
+ fprintf( debugFile, "MPI_File_sync\n" );
+ fflush( debugFile );
+#endif /* DEBUG */
+
+ mpiSyncBeginArguments.localNode = HDFlocalNode;
+ mpiSyncBeginArguments.globalNode = HDFmyNode;
+ /* mpiSyncBeginArguments.fileID = (long) ( &fh ); */
+ mpiSyncBeginArguments.fileID = myHDFid;
+
+ /* Generate entry record */
+ HDFtraceIOEvent( mpiSyncBeginID,
+ (char *) &mpiSyncBeginArguments,
+ sizeof( mpiSyncBeginArguments ) );
+
+ returnVal = MPI_File_sync ( fh );
+
+ mpiSyncEndArguments.localNode = HDFlocalNode;
+ mpiSyncEndArguments.globalNode = HDFmyNode;
+ /* mpiSyncEndArguments.fileID = (long) ( &fh ); */
+ mpiSyncEndArguments.fileID = myHDFid;
+
+ /* Generate entry record */
+ HDFtraceIOEvent( mpiSyncEndID,
+ (char *) &mpiSyncEndArguments,
+ sizeof( mpiSyncEndArguments ) );
+
+ return returnVal;
+}
+#endif /* _BUILD */
+#else /* H5_HAVE_PARALLEL */
+void HDF_get_NodeNum( int* nodeNum )
+{
+ *nodeNum = 0;
+}
+#endif /* H5_HAVE_PARALLEL */
diff --git a/pablo/PabloHDF_RT.c b/pablo/PabloHDF_RT.c
index 6de90d2..c1289a4 100644
--- a/pablo/PabloHDF_RT.c
+++ b/pablo/PabloHDF_RT.c
@@ -109,6 +109,7 @@
// printFileMappingsRT : print map of named identifiers *
// _hdfNameDescriptor() : writes SDDF descriptor packet for names *
//======================================================================*/
+#ifndef PCF_BUILD
#ifdef _HDF5_
#include "H5config.h"
#endif
@@ -217,6 +218,7 @@ char *FileName; /* Name of Trace file */
HDFsetInfo openInfo; /* Info about file opened */
char openName[256]; /* Name of opened file */
extern char *hdfRecordPointer;
+extern char HDFprocNames[][40];
/*======================================================================*
// NAME *
// HDFinitTrace_RT-- initialize HDF real-time tracing *
@@ -1584,7 +1586,8 @@ void _hdfDescriptorRT( char *recordName, char *recordDescription,
//======================================================================*/
void writeHDFRecDescrptrsRT( void )
{
- char HDFProcNames[][40] = {
+/*
+ char HDFprocNames[][40] = {
"noName",
"noName",
"noName",
@@ -1593,13 +1596,14 @@ void writeHDFRecDescrptrsRT( void )
# include "HDFentryNames.h"
"HDF_Last_Entry"
};
+*/
int j, FAMILY;
char BUF1[256], BUF2[256] ;
_hdfNameDescriptor(); /* Descriptor for named identifiers */
for ( j = 0; j < NumHDFProcs; ++j ) {
if ( HDFQueues[j] != NULL ) {
strcpy( BUF2, "HDF ");
- strcat( BUF2, HDFProcNames[j] );
+ strcat( BUF2, HDFprocNames[j] );
strcat( BUF2, " Procedure Summary");
strcpy( BUF1, BUF2 );
strcat( BUF1, " Trace");
@@ -1690,3 +1694,4 @@ void _hdfNameDescriptor( void )
putBytes( recordBuffer, (unsigned) recordLength );
}
+#endif /* PCF_BUILD */
diff --git a/pablo/PabloHDF_SDDF.c b/pablo/PabloHDF_SDDF.c
index bf42112..4858086 100644
--- a/pablo/PabloHDF_SDDF.c
+++ b/pablo/PabloHDF_SDDF.c
@@ -55,12 +55,9 @@
// Generate a SDDF binary format record descriptor *
// for the HDF procedure exits *
//======================================================================*/
+#ifndef PCF_BUILD
#include <stdio.h>
-#ifdef H5_HAVE_PARALLEL
-#include "mpi.h"
-#endif
-
#include "H5config.h"
#undef H5_HAVE_PABLO
#include "H5private.h"
@@ -112,6 +109,7 @@ void endIOTrace( void );
void endMPIOTrace( void ) {return;}
#endif
extern char *hdfRecordPointer;
+extern char HDFprocNames[][40];
/*======================================================================*
// Prototypes of functions in this file. *
//======================================================================*/
@@ -206,7 +204,7 @@ int *procEntryCalled;
/*======================================================================*
// The HDFProcNames array holds the names of the HDF entries. *
//======================================================================*/
-static char HDFProcNames[][40] = {
+/*static char HDFprocNames[][40] = {
"noName",
"noName",
"noName",
@@ -214,7 +212,7 @@ static char HDFProcNames[][40] = {
"noName",
#include "HDFentryNames.h"
"HDF_LAST_ENTRY"
-};
+};*/
/*=======================================================================
// NAME *
// HDFinitTrace_SDDF -- initalize HDF tracing with SDDF records *
@@ -675,7 +673,7 @@ void createHDFTraceDescriptor( int Inx )
char BUF1[256], BUF2[256] ;
int FAMILY;
strcpy( BUF2, "HDF ");
- strcat( BUF2, HDFProcNames[Inx] );
+ strcat( BUF2, HDFprocNames[Inx] );
strcat( BUF2, " Procedure");
strcpy( BUF1, BUF2 );
strcat( BUF1, " Trace");
@@ -826,4 +824,4 @@ void _hdfMiscDescriptor( void )
putBytes( recordBuffer, (unsigned) recordLength );
}
-/*#endif */ /* H5_HAVE_PABLO */
+#endif /* PCF_BUILD */
diff --git a/pablo/ProcIDs.h b/pablo/ProcIDs.h
index 987f197..3370037 100644
--- a/pablo/ProcIDs.h
+++ b/pablo/ProcIDs.h
@@ -150,9 +150,16 @@ enum MPIeventIDs {
#define ProcIndexForHDFExit( ID ) ProcIndexForHDFEntry(-ID)
#define HDFIXtoEventID( ID ) ( (ID) + BEGIN_HDF )
+#ifdef PCF_BUILD
+#define TRACE_ON(mask, ID) \
+if ( procTrace[mask] || procTrace[ID] ) startHDFtraceEvent( ID )
+#define TRACE_OFF(mask, ID ) \
+if ( procTrace[mask] || procTrace[ID] ) endHDFtraceEvent( ID, 0, NULL, 0 )
+#else
#define TRACE_ON(mask, ID) \
if ( procTrace[mask] || procTrace[ID] ) startHDFtraceEvent( HDFIXtoEventID( ID ) )
#define TRACE_OFF(mask, ID ) \
if ( procTrace[mask] || procTrace[ID] ) endHDFtraceEvent(-HDFIXtoEventID(ID), 0, NULL, 0 )
+#endif /* PCF_BUILD */
#endif /* PROCIDS_H */
diff --git a/pablo/ProcTrace.h b/pablo/ProcTrace.h
index ef8c16b..f4650d5 100644
--- a/pablo/ProcTrace.h
+++ b/pablo/ProcTrace.h
@@ -88,11 +88,13 @@
#undef RUNTIME_TRACE
#endif
enum HDF_IDS {
+NO_TRACE,
RUNTIME_TRACE,
SUMMARY_TRACE,
MPI_RUNTIME_TRACE,
MPI_SUMMARY_TRACE,
-NO_TRACE,
+DETAILED=RUNTIME_TRACE,
+LAST_TRACE_TYPE=MPI_SUMMARY_TRACE,
#include "HDFidList.h"
NUM_HDF_IDS
} ;
diff --git a/pablo/READ_ME b/pablo/READ_ME
index fe5a882..bebf43c 100644
--- a/pablo/READ_ME
+++ b/pablo/READ_ME
@@ -4,10 +4,15 @@ To build the Pablo Instrumented version of the HDF 5 library
2) Make the normal HDF 5 library
-3) Edit the make file in this directory:
- - Find the variable PABLO_INC and set it to the path to the include
- directory for the Pablo TraceLibrary
- - If building to instrument MPI programs, uncomment the line beginning
- PABLO_MPI_FLAGS. In this case, the Pablo TraceLibrary should be built
- to trace the MPI-I/O calls.
- - Issue the make or make install command
+3) set the environment variable PABLO_TRACELIB to the path of the directory
+ continaining the Pablo TraceLibrary. This directory should contain the
+ lib and include directories as subdirectories
+
+4) If building to instrument MPI programs, uncomment the line beginning
+ PABLO_MPI_FLAGS. In this case, the Pablo TraceLibrary should be built
+ to trace the MPI-I/O calls.
+
+5) If you are going to link with the Pablo TraceLibraries, issue the
+ make or make install commands
+ If you are going to link with the Pablo PCF, issue one of the commands
+ make PABLO_BLD=PCF or make PABLO_BLD=PCF install