Commit 11fb5ddc authored by Philip Carns's avatar Philip Carns

preliminary support for tracking pnetcdf opens, not finished yet


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@95 3b7491f3-a168-0410-bf4b-c445ed680a29
parent ea9842f5
......@@ -51,6 +51,8 @@ test/gz-bench: test/gz-bench.c mktestdir
lib/darshan-mpi-io.o: lib/darshan-mpi-io.c darshan.h darshan-log-format.h mklibdir
$(CC) $(cp_zlib_include_flags) $(CFLAGS) -c $< -o $@
lib/darshan-pnetcdf.o: lib/darshan-pnetcdf.c darshan.h darshan-log-format.h mklibdir
$(CC) $(cp_zlib_include_flags) $(CFLAGS) -c $< -o $@
lib/darshan-posix.o: lib/darshan-posix.c darshan.h darshan-log-format.h mklibdir
$(CC) $(cp_zlib_include_flags) $(CFLAGS) -c $< -o $@
......@@ -59,7 +61,7 @@ lookup3.o: lookup3.c
lookup8.o: lookup8.c
lib/libdarshan-mpi-io.a: lib/darshan-mpi-io.o
lib/libdarshan-mpi-io.a: lib/darshan-mpi-io.o lib/darshan-pnetcdf.o
ar rcs $@ $^
lib/libdarshan-posix.a: lib/darshan-posix.o lib/lookup3.o lib/lookup8.o
......
......@@ -3377,7 +3377,7 @@ fi
rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
# libc functions wrapped by darshan
CP_WRAPPERS="-Wl,-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,fopen,-wrap,fclose,-wrap,fread,-wrap,fwrite,-wrap,fseek,-wrap,fopen64,-wrap,pread64,-wrap,pwrite64,-wrap,fsync,-wrap,fdatasync"
CP_WRAPPERS="-Wl,-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,fopen,-wrap,fclose,-wrap,fread,-wrap,fwrite,-wrap,fseek,-wrap,fopen64,-wrap,pread64,-wrap,pwrite64,-wrap,fsync,-wrap,fdatasync,-wrap,ncmpi_create"
# ,-u,__wrap___fxstat64,-u,pthread_mutex_lock,-u,pthread_mutex_unlock
......
......@@ -83,7 +83,7 @@ AC_TRY_COMPILE([#include <mpi.h>], [int ret = MPI_Init(0, (void*)0)],
)
# libc functions wrapped by darshan
CP_WRAPPERS="-Wl,-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,fopen,-wrap,fclose,-wrap,fread,-wrap,fwrite,-wrap,fseek,-wrap,fopen64,-wrap,pread64,-wrap,pwrite64,-wrap,fsync,-wrap,fdatasync"
CP_WRAPPERS="-Wl,-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,fopen,-wrap,fclose,-wrap,fread,-wrap,fwrite,-wrap,fseek,-wrap,fopen64,-wrap,pread64,-wrap,pwrite64,-wrap,fsync,-wrap,fdatasync,-wrap,ncmpi_create"
# ,-u,__wrap___fxstat64,-u,pthread_mutex_lock,-u,pthread_mutex_unlock
......
......@@ -12,7 +12,7 @@
#include "darshan-config.h"
/* update this on file format changes */
#define CP_VERSION "1.21"
#define CP_VERSION "1.22"
/* size (in bytes) of job record */
#define CP_JOB_RECORD_SIZE 1024
......@@ -52,6 +52,9 @@ enum darshan_indices
CP_POSIX_FSEEKS,
CP_POSIX_FSYNCS,
CP_POSIX_FDSYNCS,
/* pnetcdf stuff */
CP_INDEP_NC_OPENS,
CP_COLL_NC_OPENS,
/* type categories */
CP_COMBINER_NAMED, /* count of each MPI datatype category */
CP_COMBINER_DUP,
......
......@@ -32,6 +32,8 @@ char *darshan_names[] = {
"CP_POSIX_FSEEKS",
"CP_POSIX_FSYNCS",
"CP_POSIX_FDSYNCS",
"CP_POSIX_FOPENS",
"CP_POSIX_FSEEKS",
"CP_COMBINER_NAMED", /* count of each MPI datatype category */
"CP_COMBINER_DUP",
"CP_COMBINER_CONTIGUOUS",
......
......@@ -111,6 +111,7 @@ int main(int argc, char **argv)
printf("# CP_SPIT_*: MPI split collective operation counts.\n");
printf("# CP_NB_*: MPI non blocking operation counts.\n");
printf("# READS,WRITES,OPENS,SEEKS,STATS, and MMAPS are types of operations.\n");
printf("# CP_*_NC_OPENS: number of indep. and collective pnetcdf opens.\n");
printf("# CP_COMBINER_*: combiner counts for MPI mem and file datatypes.\n");
printf("# CP_HINTS: number of times MPI hints were used.\n");
printf("# CP_VIEWS: number of times MPI file views were used.\n");
......@@ -185,6 +186,8 @@ int main(int argc, char **argv)
CP_PRINT(&job, &cp_file, CP_COMBINER_F90_COMPLEX);
CP_PRINT(&job, &cp_file, CP_COMBINER_F90_INTEGER);
CP_PRINT(&job, &cp_file, CP_COMBINER_RESIZED);
CP_PRINT(&job, &cp_file, CP_INDEP_NC_OPENS);
CP_PRINT(&job, &cp_file, CP_COLL_NC_OPENS);
CP_PRINT(&job, &cp_file, CP_HINTS);
CP_PRINT(&job, &cp_file, CP_VIEWS);
CP_PRINT(&job, &cp_file, CP_MODE);
......
......@@ -60,10 +60,13 @@ struct darshan_file_runtime
struct darshan_file* log_file;
MPI_File fh;
int fd;
int ncid;
struct darshan_file_runtime* name_next;
struct darshan_file_runtime* name_prev;
struct darshan_file_runtime* fd_next;
struct darshan_file_runtime* fd_prev;
struct darshan_file_runtime* ncid_next;
struct darshan_file_runtime* ncid_prev;
struct darshan_file_runtime* fh_next;
struct darshan_file_runtime* fh_prev;
void* access_root;
......@@ -88,6 +91,7 @@ struct darshan_job_runtime
int file_count;
struct darshan_file_runtime* name_table[CP_HASH_SIZE];
struct darshan_file_runtime* fd_table[CP_HASH_SIZE];
struct darshan_file_runtime* ncid_table[CP_HASH_SIZE];
struct darshan_file_runtime* fh_table[CP_HASH_SIZE];
struct darshan_file_runtime* darshan_mru_file;
};
......
/*
* (C) 2009 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include <stdio.h>
#include <pthread.h>
#include <string.h>
#include "mpi.h"
#include "darshan.h"
#include "darshan-config.h"
extern int __real_ncmpi_create(MPI_Comm comm, const char *path,
int cmode, MPI_Info info, int *ncidp);
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);
int __wrap_ncmpi_create(MPI_Comm comm, const char *path,
int cmode, MPI_Info info, int *ncidp)
{
int ret;
struct darshan_file_runtime* file;
char* tmp;
int comm_size;
int hash_index;
ret = __real_ncmpi_create(comm, path, cmode, info, ncidp);
if(ret == 0)
{
CP_LOCK();
/* use ROMIO approach to strip prefix if present */
/* strip off prefix if there is one, but only skip prefixes
* if they are greater than length one to allow for windows
* drive specifications (e.g. c:\...)
*/
tmp = strchr(path, ':');
if (tmp > path + 1) {
path = tmp + 1;
}
file = darshan_file_by_name(path);
/* TODO: handle the case of multiple concurrent opens */
if(file && (file->ncid == 0))
{
file->ncid = *ncidp;
}
PMPI_Comm_size(comm, &comm_size);
if(comm_size == 1)
{
CP_INC(file, CP_INDEP_NC_OPENS, 1);
}
else
{
CP_INC(file, CP_COLL_NC_OPENS, 1);
}
hash_index = file->ncid & CP_HASH_MASK;
file->ncid_prev = NULL;
file->ncid_next = darshan_global_job->ncid_table[hash_index];
if(file->ncid_next)
file->ncid_next->ncid_prev = file;
darshan_global_job->ncid_table[hash_index] = file;
CP_UNLOCK();
}
return(ret);
}
/*
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* End:
*
* vim: ts=8 sts=4 sw=4 expandtab
*/
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