Commit c63c1ba8 authored by Rob Latham's avatar Rob Latham

first pass at instrumenting some pnetcdf overheads. Still have a lot more

functions to wrap if we want to do this right but this will be enough for some
flash runs.


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/branches/more-pnetcdf@285 3b7491f3-a168-0410-bf4b-c445ed680a29
parent 7d998640
This diff is collapsed.
......@@ -131,7 +131,7 @@ CFLAGS="$old_cflags"
# libc functions wrapped by darshan
CP_WRAPPERS="-Wl,-u,MPI_Wtime,-wrap,write,-wrap,open,-wrap,creat,-wrap,creat64,-wrap,open64,-wrap,close,-wrap,read,-wrap,lseek,-wrap,lseek64,-wrap,pread,-wrap,pwrite,-wrap,readv,-wrap,writev,-wrap,__xstat,-wrap,__lxstat,-wrap,__fxstat,-wrap,__xstat64,-wrap,__lxstat64,-wrap,__fxstat64,-wrap,mmap,-wrap,mmap64,-wrap,fopen,-wrap,fclose,-wrap,fread,-wrap,fwrite,-wrap,fseek,-wrap,fopen64,-wrap,pread64,-wrap,pwrite64,-wrap,fsync,-wrap,fdatasync,-wrap,ncmpi_create,-wrap,ncmpi_open,-wrap,ncmpi_close,-wrap,H5Fcreate,-wrap,H5Fopen,-wrap,H5Fclose"
CP_WRAPPERS="-Wl,-u,MPI_Wtime,-wrap,write,-wrap,open,-wrap,creat,-wrap,creat64,-wrap,open64,-wrap,close,-wrap,read,-wrap,lseek,-wrap,lseek64,-wrap,pread,-wrap,pwrite,-wrap,readv,-wrap,writev,-wrap,__xstat,-wrap,__lxstat,-wrap,__fxstat,-wrap,__xstat64,-wrap,__lxstat64,-wrap,__fxstat64,-wrap,mmap,-wrap,mmap64,-wrap,fopen,-wrap,fclose,-wrap,fread,-wrap,fwrite,-wrap,fseek,-wrap,fopen64,-wrap,pread64,-wrap,pwrite64,-wrap,fsync,-wrap,fdatasync,-wrap,ncmpi_create,-wrap,ncmpi_open,-wrap,ncmpi_close,-wrap,ncmpi_iput_vara,-wrap,ncmpi_put_vara_all,-wrap,ncmpi_put_vara_int_all,-wrap,ncmpi_wait_all,-wrap,H5Fcreate,-wrap,H5Fopen,-wrap,H5Fclose"
# ,-u,__wrap___fxstat64,-u,pthread_mutex_lock,-u,pthread_mutex_unlock
......
/* darshan-config.h.in. Generated from configure.in by autoheader. */
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
/* Name of the environment variable that stores the jobid */
#undef CP_JOBID
......@@ -51,29 +48,18 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* The size of `long int', as computed by sizeof. */
/* The size of a `long int', as computed by sizeof. */
#undef SIZEOF_LONG_INT
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
# undef WORDS_BIGENDIAN
# endif
#endif
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
/* Location to store log files at run time */
#undef __CP_LOG_PATH
......
......@@ -12,7 +12,7 @@
#include "darshan-config.h"
/* update this on file format changes */
#define CP_VERSION "2.00"
#define CP_VERSION "2.01"
/* magic number for validating output files and checking byte order */
#define CP_MAGIC_NR 6567223
......@@ -203,6 +203,8 @@ enum f_darshan_indices
CP_F_MPI_WRITE_TIME, /* cumulative mpi-io write time */
CP_F_MAX_READ_TIME,
CP_F_MAX_WRITE_TIME,
CP_F_NC_READ_TIME,
CP_F_NC_WRITE_TIME,
CP_F_NUM_INDICES,
};
......
......@@ -172,6 +172,8 @@ char *darshan_f_names[] = {
"CP_F_MPI_WRITE_TIME", /* cumulative mpi-io write time */
"CP_F_MAX_READ_TIME",
"CP_F_MAX_WRITE_TIME",
"CP_F_NC_READ_TIME", /* cumulative time in pnetcdf reads */
"CP_F_NC_WRITE_TIME", /* cumulative time in pnetcdf writes */
"CP_F_NUM_INDICES",
};
......@@ -238,7 +240,8 @@ int darshan_log_getjob(darshan_fd file, struct darshan_job *job)
return(-1);
}
if(strcmp(file->version, "2.00") == 0)
if( strcmp(file->version, "2.00") == 0 ||
strcmp(file->version, "2.01") == 0)
{
getjob_internal = getjob_internal_200;
getfile_internal = getfile_internal_200;
......
......@@ -1344,7 +1344,7 @@ static void darshan_file_reduce(void* infile_v,
}
/* sum */
for(j=CP_F_POSIX_READ_TIME; j<=CP_F_MPI_WRITE_TIME; j++)
for(j=CP_F_POSIX_READ_TIME; j<=CP_F_NC_WRITE_TIME; j++)
{
tmp_file.fcounters[j] = infile->fcounters[j] +
inoutfile->fcounters[j];
......
......@@ -16,8 +16,45 @@ extern int __real_ncmpi_open(MPI_Comm comm, const char *path,
int omode, MPI_Info info, int *ncidp);
extern int __real_ncmpi_close(int ncid);
extern int __real_ncmpi_iput_vara(int ncid, int varid,
const MPI_Offset *start, const MPI_Offset *count,
const void *buf, MPI_Offset bufcount, MPI_Datatype datatype,
int *reqid);
extern int __real_ncmpi_put_vara_all(int ncid, int varid,
const MPI_Offset start[], const MPI_Offset count[],
const void *buf, MPI_Offset bufcount,
MPI_Datatype datatype);
extern int __real_ncmpi_put_vara_int_all(int ncid, int varid,
const MPI_Offset start[], const MPI_Offset count[],
const void *buf);
extern int __real_ncmpi_wait_all(int ncid, int num_reqs,
int *req_ids, int *statuses);
static int nr_writes=0;
static int nr_reads=0;
static struct darshan_file_runtime* darshan_file_by_ncid(int ncid);
#define NC_NOERR 0
#define CP_RECORD_PNETCDF_WRITE(__ret, __ncid, __tim1, __tim2) do {\
struct darshan_file_runtime*file;\
if (__ret != NC_NOERR) break;\
file = darshan_file_by_ncid(__ncid);\
CP_F_INC(file, CP_F_NC_WRITE_TIME, (__tim2-__tim1));\
} while (0)
#define CP_RECORD_PNETCDF_READ(__ret, __ncid, __tim1, __tim2) do {\
struct darshan_file_runtime*file;\
if (__ret != NC_NOERR) break;\
file = darshan_file_by_ncid(__ncid);\
CP_F_INC(file, CP_F_NC_READ_TIME, (__tim2-__tim1));\
} while (0)
int __wrap_ncmpi_create(MPI_Comm comm, const char *path,
int cmode, MPI_Info info, int *ncidp)
{
......@@ -162,6 +199,87 @@ int __wrap_ncmpi_close(int ncid)
}
int __wrap_ncmpi_put_vara_all(int ncid, int varid,
const MPI_Offset start[], const MPI_Offset count[],
const void *buf, MPI_Offset bufcount, MPI_Datatype datatype)
{
int ret;
double tm1, tm2;
tm1 = darshan_wtime();
ret = __real_ncmpi_put_vara_all(ncid, varid, start, count, buf, bufcount,
datatype);
tm2 = darshan_wtime();
CP_LOCK();
CP_RECORD_PNETCDF_WRITE(ret, ncid, tm1, tm2);
CP_UNLOCK();
return (ret);
}
int __wrap_ncmpi_put_vara_int_all(int ncid, int varid,
const MPI_Offset start[], const MPI_Offset count[],
const void *buf)
{
int ret;
double tm1, tm2;
tm1 = darshan_wtime();
ret = __real_ncmpi_put_vara_int_all(ncid, varid, start, count, buf);
tm2 = darshan_wtime();
CP_LOCK();
CP_RECORD_PNETCDF_WRITE(ret, ncid, tm1, tm2);
CP_UNLOCK();
return (ret);
}
int __wrap_ncmpi_iput_vara(int ncid, int varid,
const MPI_Offset *start, const MPI_Offset *count,
const void *buf, MPI_Offset bufcount, MPI_Datatype datatype,
int *reqid)
{
int ret;
double tm1, tm2;
tm1 = darshan_wtime();
ret = __real_ncmpi_iput_vara(ncid, varid, start, count, buf, bufcount, datatype, reqid);
tm2 = darshan_wtime();
CP_LOCK();
nr_writes++;
CP_RECORD_PNETCDF_WRITE(ret, ncid, tm1, tm2);
CP_UNLOCK();
return (ret);
}
int __wrap_ncmpi_wait_all(int ncid,
int num_reqs,
int *req_ids,
int *statuses)
{
int ret;
double tm1, tm2;
tm1 = darshan_wtime();
ret = __real_ncmpi_wait_all(ncid, num_reqs, req_ids, statuses);
tm2 = darshan_wtime();
CP_LOCK();
/* TODO: problem: ncmpi_wait{,_all} take both read and write operations.
* Need a good way to sort out how much of this wait is read and how much
* is write. This is good enough for now... */
if ( (nr_reads > 0 && nr_writes == 0) )
CP_RECORD_PNETCDF_READ(ret, ncid, tm1, tm2);
else
CP_RECORD_PNETCDF_WRITE(ret, ncid, tm1, tm2);
nr_writes=0;
nr_reads=0;
CP_UNLOCK();
return ret;
}
static struct darshan_file_runtime* darshan_file_by_ncid(int ncid)
{
int hash_index;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment