Script started on Wed 04 Aug 2010 02:56:16 PM PDT
/home/demotau/DEMO/hdf5_tau_exec% cat Makefile
CC=gcc
#  With TAU

CWD=`pwd`

TAU_MAKEFILE=${TAU}/Makefile.tau-pdt
include ${TAU_MAKEFILE}
TAUOP='-optCompile=-I$(CWD)/hdfwrapper/wrapper -optLinking="-L$(CWD)/hdfwrapper/wrapper/ -lhdf5_wrap" '

CC_INST = tau_cc.sh -tau_options=$(TAUOP)  
CC_UNINST = gcc


HDF5DIR=/usr/local/ACTS/hdf5-1.6.10
CFLAGS=-I$(HDF5DIR)/include
LIBS=-L$(HDF5DIR)/lib -lhdf5 -lm

all: build run analyze

build: checkhdf wrap

checkhdf: wrap checkhdf.c 
	@echo "Step 6: Building the uninstrumented application..."
	$(CC_UNINST) $(CFLAGS) checkhdf.c -o checkhdf $(LIBS)
	@echo "Done! "
	@echo " "
wrap:
	@echo "Building the wrapper ...: Step 1.: Copy the header interfaces to a wrapper directory"
	mkdir -p hdfwrapper; cp -r $(HDF5DIR)/include/* hdfwrapper
	@echo " "
	@echo "Building the wrapper ...: Step 2.: Copy the optional selective instrumentation file to the wrapper directory"
	cp select.tau hdfwrapper
	@echo " "
	@echo "Building the wrapper ...: Step 3.: Parse the header file containing the external package interfaces"
	cd hdfwrapper; $(PDTDIR)/$(PDTARCHDIR)/bin/cparse hdf5.h; 
	@echo " "
	@echo "Building the wrapper ...: Step 4.: Invoke tau_wrap and specify the PDB file, the header file and the wrapper library sources. "
	@echo "Building the wrapper ...:        : Optionally specify the selective instrumentation file and a group (hdf5)."
	@echo "Building the wrapper ...:        : Specify the runtime library to be pre-loaded using the -r <libname> option."
	cd hdfwrapper; tau_wrap hdf5.h.pdb hdf5.h -o hdf5.inst.c -f select.tau -g hdf5 -r libhdf5.so
	@echo " "
	@echo "Building the wrapper ...: Step 5 : Build the wrapper library using the source generated by the tau_wrap tool."
	cd hdfwrapper/wrapper; gmake  TAU_MAKEFILE=$(TAU_MAKEFILE) AR='$(TAU_AR)'
	@echo " "

run: checkhdf wrap
	@LD_LIBRARY_PATH=${HDF5DIR}/lib:${LD_LIBRARY_PATH}; \
	tau_exec -T serial -loadlib=`pwd`/hdfwrapper/wrapper/libhdf5_wrap.so ./checkhdf
	@echo " "

analyze: run
	pprof

clean:
	/bin/rm -rf checkhdf.o checkhdf profile.* *.trc *.edf MULT* hdfwrapper SDS.h5
/home/demotau/DEMO/hdf5_tau_exec% cat checkhdf.c

/*
 *  This example writes data to the HDF5 file.
 *  Data conversion is performed during write operation.
 */

#include <hdf5.h>

#define FILE        "SDS.h5"
#define DATASETNAME "IntArray"
#define NX     5                      /* dataset dimensions */
#define NY     6
#define RANK   2

int
main (void)
{
    hid_t       file, dataset;         /* file and dataset handles */
    hid_t       datatype, dataspace;   /* handles */
    hsize_t     dimsf[2];              /* dataset dimensions */
    herr_t      status;
    int         data[NX][NY];          /* data to write */
    int         i, j;

    /*
     * Data  and output buffer initialization.
     */
    for (j = 0; j < NX; j++) {
        for (i = 0; i < NY; i++)
            data[j][i] = i + j;
    }
    /*
     * 0 1 2 3 4 5
     * 1 2 3 4 5 6
     * 2 3 4 5 6 7
     * 3 4 5 6 7 8
     * 4 5 6 7 8 9
     */

    /*
     * Create a new file using H5F_ACC_TRUNC access,
     * default file creation properties, and default file
     * access properties.
     */
    file = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);

    /*
     * Describe the size of the array and create the data space for fixed
     * size dataset.
     */
    dimsf[0] = NX;
    dimsf[1] = NY;
    dataspace = H5Screate_simple(RANK, dimsf, NULL);

    /*
     * Define datatype for the data in the file.
     * We will store little endian INT numbers.
     */
    datatype = H5Tcopy(H5T_NATIVE_INT);
    status = H5Tset_order(datatype, H5T_ORDER_LE);

    /*
     * Create a new dataset within the file using defined dataspace and
     * datatype and default dataset creation properties.
     */
    dataset = H5Dcreate(file, DATASETNAME, datatype, dataspace,
                        H5P_DEFAULT);

    /*
     * Write the data to the dataset using default transfer properties.
     */
    status = H5Dwrite(dataset, H5T_NATIVE_INT, H5S_ALL, H5S_ALL,
                      H5P_DEFAULT, data);

    /*
     * Close/release resources.
     */
    H5Sclose(dataspace);
    H5Tclose(datatype);
    H5Dclose(dataset);
    H5Fclose(file);

    return 0;
}

/home/demotau/DEMO/hdf5_tau_exec% make clean
/bin/rm -rf checkhdf.o checkhdf profile.* *.trc *.edf MULT* hdfwrapper SDS.h5
/home/demotau/DEMO/hdf5_tau_exec% make
Building the wrapper ...: Step 1.: Copy the header interfaces to a wrapper directory
mkdir -p hdfwrapper; cp -r /usr/local/ACTS/hdf5-1.6.10/include/* hdfwrapper
 
Building the wrapper ...: Step 2.: Copy the optional selective instrumentation file to the wrapper directory
cp select.tau hdfwrapper
 
Building the wrapper ...: Step 3.: Parse the header file containing the external package interfaces
cd hdfwrapper; /usr/local/packages/pdt/i386_linux/bin/cparse hdf5.h; 
 
Building the wrapper ...: Step 4.: Invoke tau_wrap and specify the PDB file, the header file and the wrapper library sources. 
Building the wrapper ...:        : Optionally specify the selective instrumentation file and a group (hdf5).
Building the wrapper ...:        : Specify the runtime library to be pre-loaded using the -r <libname> option.
cd hdfwrapper; tau_wrap hdf5.h.pdb hdf5.h -o hdf5.inst.c -f select.tau -g hdf5 -r libhdf5.so
 
Building the wrapper ...: Step 5 : Build the wrapper library using the source generated by the tau_wrap tool.
cd hdfwrapper/wrapper; gmake  TAU_MAKEFILE=/usr/local/packages/tau/i386_linux/lib/Makefile.tau-pdt AR='ar             '
gmake[1]: Entering directory `/home/demotau/DEMO/hdf5_tau_exec/hdfwrapper/wrapper'
gcc    -DPROFILING_ON                        -DTAU_GNU -DTAU_DOT_H_LESS_HEADERS                      -DTAU_LINUX_TIMERS                                 -DTAU_LARGEFILE -D_LARGEFILE64_SOURCE                    -DTAU_BFD     -DHAVE_TR1_HASH_MAP     -fPIC  -I/usr/local/packages/tau-2.19.2/include  -I..  -c hdf5.inst.c -o hdf5_wrap.o
gcc    -shared  	         -o libhdf5_wrap.so hdf5_wrap.o  -L/usr/local/packages/tau-2.19.2/i386_linux/lib -lTAUsh-pdt              -lbfd       -Wl,--export-dynamic    -ldl
gmake[1]: Leaving directory `/home/demotau/DEMO/hdf5_tau_exec/hdfwrapper/wrapper'
 
Step 6: Building the uninstrumented application...
gcc -I/usr/local/ACTS/hdf5-1.6.10/include checkhdf.c -o checkhdf -L/usr/local/ACTS/hdf5-1.6.10/lib -lhdf5 -lm
Done! 
 
 
pprof
Reading Profile files in profile.*

NODE 0;CONTEXT 0;THREAD 0:
---------------------------------------------------------------------------------------
%Time    Exclusive    Inclusive       #Call      #Subrs  Inclusive Name
              msec   total msec                          usec/call 
---------------------------------------------------------------------------------------
100.0        0.336            2           1          21       2284 .TAU application 
 57.9            1            1           1           1       1323 hid_t H5Fcreate(const char *, unsigned int, hid_t, hid_t) C
 15.4        0.352        0.352           1           0        352 herr_t H5Fclose(hid_t) C
  5.1        0.117        0.117           1           0        117 hid_t H5Dcreate(hid_t, const char *, hid_t, hid_t, hid_t) C
  2.4        0.054        0.054           1           0         54 herr_t H5Dwrite(hid_t, hid_t, hid_t, hid_t, hid_t, const void *) C
  2.3        0.052        0.052           1           0         52 herr_t H5Dclose(hid_t) C
  0.7        0.017        0.017           3           1          6 hid_t H5FD_sec2_init(void) C
  0.5        0.012        0.012           1           0         12 hid_t H5Screate_simple(int, const hsize_t *, const hsize_t *) C
  0.4         0.01         0.01           1           0         10 herr_t H5check_version(unsigned int, unsigned int, unsigned int) C
  0.3        0.006        0.006           1           0          6 herr_t H5Tset_order(hid_t, H5T_order_t) C
  0.2        0.004        0.004           1           0          4 hid_t H5Tcopy(hid_t) C
  0.1        0.003        0.003           1           0          3 void H5FD_core_term(void) C
  0.1        0.003        0.003           1           0          3 void H5FD_log_term(void) C
  0.1        0.002        0.002           1           0          2 herr_t H5Sclose(hid_t) C
  0.1        0.002        0.002           1           0          2 void H5FD_family_term(void) C
  0.1        0.002        0.002           1           0          2 void H5FD_multi_term(void) C
  0.0        0.001        0.001           1           0          1 herr_t H5Eget_auto(H5E_auto_t *, void **) C
  0.0        0.001        0.001           1           0          1 herr_t H5Tclose(hid_t) C
  0.0        0.001        0.001           2           0          0 herr_t H5open(void) C
  0.0        0.001        0.001           1           0          1 void H5FD_sec2_term(void) C
  0.0        0.001        0.001           1           0          1 void H5FD_stdio_term(void) C

Script done on Wed 04 Aug 2010 02:56:54 PM PDT
