Commit e810279e authored by Shane Snyder's avatar Shane Snyder

Merge branch 'dev-modular' into mmap-dev

Conflicts:
	darshan-runtime/darshan-core.h
	darshan-runtime/lib/darshan-core.c
parents c3c5e597 8731ade9
......@@ -6,7 +6,7 @@ which must be included in the prologue of the code and in all source listings
of the code.
Copyright Notice
+ 2009 University of Chicago
+ 2015 University of Chicago
Permission is hereby granted to use, reproduce, prepare derivative works, and
to redistribute to others. This software was authored by:
......
......@@ -2,6 +2,16 @@
Darshan Release Change Log
--------------------------
Darshan-3.0.0-pre2
=============
* add fix to install appropriate headers for linking external
applications with darshan-util (reported by Matthieu Dorier)
* add darshan-util Ruby bindings for the new modularized version
of Darshan (3.0) (Matthieu Dorier)
* add enhancement to darshan-runtime to allow per-module instrumentation
memory to be user configurable using a configure option or a runtime
environment variable
Darshan-3.0.0-pre1
=============
* new version of Darshan with the following features/improvements:
......@@ -18,6 +28,7 @@ Darshan-3.0.0-pre1
suffixes
- a new instrumentation module for capturing BG/Q-specific parameters
(BG/Q environment is automatically detected at configure time)
(implemented by Kevin Harms)
- new darshan-parser and darshan-job-summary output to utilize the
new modularized log format
* updated documentation outlining changes in this release, as well as
......
......@@ -69,6 +69,11 @@ static char * const darshan_module_names[] =
};
#undef X
/* simple macros for accessing module flag bitfields */
#define DARSHAN_MOD_FLAG_SET(flags, id) flags = (flags | (1 << id))
#define DARSHAN_MOD_FLAG_UNSET(flags, id) flags = (flags & ~(1 << id))
#define DARSHAN_MOD_FLAG_ISSET(flags, id) (flags & (1 << id))
/* compression method used on darshan log file */
enum darshan_comp_type
{
......@@ -80,10 +85,8 @@ typedef uint64_t darshan_record_id;
/* the darshan_log_map structure is used to indicate the location of
* specific module data in a Darshan log. Note that 'off' and 'len' are
* the respective offset and length of the data in the file, in *uncompressed*
* terms -- this is nonintuitive since the data is compressed, but this is
* done so we can utilize the gzread interface for all Darshan log reading
* utilities.
* the respective offset and length of the data in the file, in
* *compressed* terms
*/
struct darshan_log_map
{
......@@ -99,7 +102,7 @@ struct darshan_header
char version_string[8];
int64_t magic_nr;
unsigned char comp_type;
unsigned char partial_flag;
uint32_t partial_flag;
struct darshan_log_map rec_map;
struct darshan_log_map mod_map[DARSHAN_MAX_MODS];
};
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for darshan-runtime 3.0.0-pre1.
# Generated by GNU Autoconf 2.69 for darshan-runtime 3.0.0-pre2.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
......@@ -577,8 +577,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='darshan-runtime'
PACKAGE_TARNAME='darshan-runtime'
PACKAGE_VERSION='3.0.0-pre1'
PACKAGE_STRING='darshan-runtime 3.0.0-pre1'
PACKAGE_VERSION='3.0.0-pre2'
PACKAGE_STRING='darshan-runtime 3.0.0-pre2'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''
......@@ -693,6 +693,7 @@ with_log_hints
with_log_path
with_jobid_env
enable_bgq_mod
with_mod_mem
'
ac_precious_vars='build_alias
host_alias
......@@ -1243,7 +1244,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures darshan-runtime 3.0.0-pre1 to adapt to many kinds of systems.
\`configure' configures darshan-runtime 3.0.0-pre2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1304,7 +1305,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of darshan-runtime 3.0.0-pre1:";;
short | recursive ) echo "Configuration of darshan-runtime 3.0.0-pre2:";;
esac
cat <<\_ACEOF
......@@ -1330,6 +1331,7 @@ Optional Packages:
--with-jobid-env=<name> Name of environment variable that stores the jobid
(specify "NONE" if no appropriate environment variable is available:
Darshan will use rank 0's pid instead)
--with-mod-mem=<num> Maximum amount of memory (in MiB) for each Darshan module
Some influential environment variables:
CC C compiler command
......@@ -1407,7 +1409,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
darshan-runtime configure 3.0.0-pre1
darshan-runtime configure 3.0.0-pre2
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
......@@ -1759,7 +1761,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by darshan-runtime $as_me 3.0.0-pre1, which was
It was created by darshan-runtime $as_me 3.0.0-pre2, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
......@@ -4278,7 +4280,23 @@ fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
DARSHAN_VERSION="3.0.0-pre1"
# Check whether --with-mod-mem was given.
if test "${with_mod_mem+set}" = set; then :
withval=$with_mod_mem; if test x$withval = xyes; then
as_fn_error $? "--with-mod-mem must be given a number" "$LINENO" 5
else
cat >>confdefs.h <<_ACEOF
#define __DARSHAN_MOD_MEM_MAX ${withval}
_ACEOF
fi
fi
DARSHAN_VERSION="3.0.0-pre2"
......@@ -4797,7 +4815,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by darshan-runtime $as_me 3.0.0-pre1, which was
This file was extended by darshan-runtime $as_me 3.0.0-pre2, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -4859,7 +4877,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
darshan-runtime config.status 3.0.0-pre1
darshan-runtime config.status 3.0.0-pre2
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
......
......@@ -5,7 +5,7 @@ dnl Process this file with autoconf to produce a configure script.
dnl You may need to use autoheader as well if changing any DEFINEs
dnl sanity checks, output header, location of scripts used here
AC_INIT([darshan-runtime], [3.0.0-pre1])
AC_INIT([darshan-runtime], [3.0.0-pre2])
AC_CONFIG_SRCDIR([darshan.h])
AC_CONFIG_AUX_DIR(../maint/config)
AC_CONFIG_HEADER(darshan-runtime-config.h)
......@@ -300,6 +300,15 @@ if test x$enable_bgq_mod != xno; then
[]))
fi
AC_ARG_WITH(mod-mem,
[ --with-mod-mem=<num> Maximum amount of memory (in MiB) for each Darshan module],
if test x$withval = xyes; then
AC_MSG_ERROR(--with-mod-mem must be given a number)
else
AC_DEFINE_UNQUOTED(__DARSHAN_MOD_MEM_MAX, ${withval}, Maximum memory (in MiB) for each Darshan module)
fi
)
DARSHAN_VERSION="AC_PACKAGE_VERSION"
AC_SUBST(darshan_lib_path)
......
......@@ -26,18 +26,18 @@
/* Environment variable to override __DARSHAN_MEM_ALIGNMENT */
#define DARSHAN_MEM_ALIGNMENT_OVERRIDE "DARSHAN_MEMALIGN"
/* maximum number of records that can be tracked on a single process */
#define DARSHAN_CORE_MAX_RECORDS 2048
/* Environment variable to override memory per module */
#define DARSHAN_MOD_MEM_OVERRIDE "DARSHAN_MODMEM"
/* TODO: revisit this default size if we change memory per module */
#define DARSHAN_CORE_COMP_BUF_SIZE (2 * 1024 * 1024)
/* Maximum amount of memory per instrumentation module in MiB */
#ifdef __DARSHAN_MOD_MEM_MAX
#define DARSHAN_MOD_MEM_MAX (__DARSHAN_MOD_MEM_MAX * 1024 * 1024)
#else
#define DARSHAN_MOD_MEM_MAX (2 * 1024 * 1024) /* 2 MiB default */
#endif
/* this controls the maximum mmapped memory each module can use */
#define DARSHAN_MMAP_CHUNK_SIZE (4 * 1024)
#define DARSHAN_CORE_MOD_SET(flags, id) (flags | (1 << id))
#define DARSHAN_CORE_MOD_UNSET(flags, id) (flags & ~(1 << id))
#define DARSHAN_CORE_MOD_ISSET(flags, id) (flags & (1 << id))
/* Default runtime compression buffer size */
#define DARSHAN_COMP_BUF_SIZE DARSHAN_MOD_MEM_MAX
/* in memory structure to keep up with job level data */
struct darshan_core_runtime
......@@ -52,7 +52,7 @@ struct darshan_core_runtime
struct darshan_core_record_ref *rec_hash;
int rec_count;
struct darshan_core_module* mod_array[DARSHAN_MAX_MODS];
char comp_buf[DARSHAN_CORE_COMP_BUF_SIZE];
char comp_buf[DARSHAN_COMP_BUF_SIZE];
double wtime_offset;
};
......
......@@ -105,5 +105,8 @@
/* Memory alignment in bytes */
#undef __DARSHAN_MEM_ALIGNMENT
/* Maximum memory (in MiB) for each Darshan module */
#undef __DARSHAN_MOD_MEM_MAX
/* Generalized request type for MPI-IO */
#undef __D_MPI_REQUEST
......@@ -117,18 +117,21 @@ void darshan_core_unregister_module(
* Register the Darshan record given by 'name' with the darshan-core
* runtime, allowing it to be properly tracked and (potentially)
* correlated with records from other modules. 'len' is the size of
* the name pointer (string length for string names), 'printable_flag'
* indicates whether the name is a string, and 'mod_id' is the identifier
* of the calling module. 'rec_id' is an output pointer storing the
* correspoing Darshan record identifier and 'file_alignment' is an
* output pointer storing the file system alignment value for the given
* record.
* the name pointer (string length for string names), and 'printable_flag'
* indicates whether the name is a string. 'mod_limit_flag' is set if
* the calling module is out of memory (to prevent darshan-core from
* creating new records and to just search existing records) and 'mod_id'
* is the identifier of the calling module. 'rec_id' is an output pointer
* storing the correspoing Darshan record identifier and 'file_alignment'
* is an output pointer storing the file system alignment value for the
* given record.
*/
void darshan_core_register_record(
void *name,
int len,
int printable_flag,
darshan_module_id mod_id,
int printable_flag,
int mod_limit_flag,
darshan_record_id *rec_id,
int *file_alignment);
......
......@@ -57,6 +57,8 @@ will be placed.
determine the log path at run time.
* `--with-log-hints=`: specifies hints to use when writing the Darshan log
file. See `./configure --help` for details.
* `--with-mod-mem=`: specifies the maximum amount of memory (in MiB) that
each Darshan module can consume.
* `--with-zlib=`: specifies an alternate location for the zlib development
header and library.
* `CC=`: specifies the MPI C compiler to use for compilation.
......@@ -474,3 +476,4 @@ behavior at runtime:
* DARSHAN_DISABLE_SHARED_REDUCTION: disables the step in Darshan aggregation in which files that were accessed by all ranks are collapsed into a single cumulative file record at rank 0. This option retains more per-process information at the expense of creating larger log files. Note that it is up to individual instrumentation module implementations whether this environment variable is actually honored.
* DARSHAN_LOGPATH: specifies the path to write Darshan log files to. Note that this directory needs to be formatted using the darshan-mk-log-dirs script.
* DARSHAN_LOGFILE: specifies the path (directory + Darshan log file name) to write the output Darshan log to. This overrides the default Darshan behavior of automatically generating a log file name and adding it to a log file directory formatted using darshan-mk-log-dirs script.
* DARSHAN_MODMEM: specifies the maximum amount of memory (in MiB) a Darshan instrumentation module can consume at runtime.
......@@ -163,8 +163,9 @@ void bgq_runtime_initialize()
darshan_core_register_record(
recname,
strlen(recname),
1,
DARSHAN_BGQ_MOD,
1,
0,
&bgq_runtime->record.f_id,
&bgq_runtime->record.alignment);
......
......@@ -100,7 +100,8 @@ static void darshan_get_exe_and_mounts(
static void darshan_block_size_from_path(
const char *path, int *block_size);
static void darshan_get_shared_records(
struct darshan_core_runtime *core, darshan_record_id *shared_recs);
struct darshan_core_runtime *core, darshan_record_id **shared_recs,
int *shared_rec_cnt);
static int darshan_log_open_all(
char *logfile_name, MPI_File *log_fh);
static int darshan_deflate_buffer(
......@@ -274,9 +275,7 @@ void darshan_core_initialize(int argc, char **argv)
/* collect information about command line and mounted file systems */
darshan_get_exe_and_mounts(init_core, argc, argv);
/* TODO: what would be needed in a termination routine? set job end time? */
/* maybe bootstrap modules with static initializers */
/* bootstrap any modules with static initialization routines */
i = 0;
while(mod_static_init_fns[i])
{
......@@ -683,7 +682,6 @@ static void darshan_get_exe_and_mounts_root(struct darshan_core_runtime *core,
truncate_string);
}
/* we make two passes through mounted file systems; in the first pass we
* grab any non-nfs mount points, then on the second pass we grab nfs
* mount points
......@@ -777,32 +775,45 @@ static void darshan_block_size_from_path(const char *path, int *block_size)
}
static void darshan_get_shared_records(struct darshan_core_runtime *core,
darshan_record_id *shared_recs)
darshan_record_id **shared_recs, int *shared_rec_cnt)
{
int i;
int ndx;
int i, j;
int tmp_cnt = core->rec_count;
struct darshan_core_record_ref *tmp, *ref;
darshan_record_id id_array[DARSHAN_CORE_MAX_RECORDS] = {0};
uint64_t mod_flags[DARSHAN_CORE_MAX_RECORDS] = {0};
uint64_t global_mod_flags[DARSHAN_CORE_MAX_RECORDS] = {0};
darshan_record_id *id_array;
uint64_t *mod_flags;
uint64_t *global_mod_flags;
/* broadcast root's number of records to all other processes */
DARSHAN_MPI_CALL(PMPI_Bcast)(&tmp_cnt, 1, MPI_INT, 0, MPI_COMM_WORLD);
/* use root record count to allocate data structures */
id_array = malloc(tmp_cnt * sizeof(darshan_record_id));
mod_flags = malloc(tmp_cnt * sizeof(uint64_t));
global_mod_flags = malloc(tmp_cnt * sizeof(uint64_t));
*shared_recs = malloc(tmp_cnt * sizeof(darshan_record_id));
assert(id_array && mod_flags && global_mod_flags && *shared_recs);
memset(mod_flags, 0, tmp_cnt * sizeof(uint64_t));
memset(global_mod_flags, 0, tmp_cnt * sizeof(uint64_t));
memset(*shared_recs, 0, tmp_cnt * sizeof(darshan_record_id));
/* first, determine list of records root process has opened */
if(my_rank == 0)
{
ndx = 0;
i = 0;
HASH_ITER(hlink, core->rec_hash, ref, tmp)
{
id_array[ndx++] = ref->rec.id;
id_array[i++] = ref->rec.id;
}
}
/* broadcast root's list of records to all other processes */
DARSHAN_MPI_CALL(PMPI_Bcast)(id_array,
(DARSHAN_CORE_MAX_RECORDS * sizeof(darshan_record_id)),
DARSHAN_MPI_CALL(PMPI_Bcast)(id_array, (tmp_cnt * sizeof(darshan_record_id)),
MPI_BYTE, 0, MPI_COMM_WORLD);
/* everyone looks to see if they opened the same records as root */
for(i=0; (i<DARSHAN_CORE_MAX_RECORDS && id_array[i] != 0); i++)
for(i=0; i<tmp_cnt; i++)
{
HASH_FIND(hlink, core->rec_hash, &id_array[i], sizeof(darshan_record_id), ref);
if(ref)
......@@ -815,15 +826,15 @@ static void darshan_get_shared_records(struct darshan_core_runtime *core,
/* now allreduce so everyone agrees which files are shared and
* which modules accessed them collectively
*/
DARSHAN_MPI_CALL(PMPI_Allreduce)(mod_flags, global_mod_flags,
DARSHAN_CORE_MAX_RECORDS, MPI_UINT64_T, MPI_BAND, MPI_COMM_WORLD);
DARSHAN_MPI_CALL(PMPI_Allreduce)(mod_flags, global_mod_flags, tmp_cnt,
MPI_UINT64_T, MPI_BAND, MPI_COMM_WORLD);
ndx = 0;
for(i=0; (i<DARSHAN_CORE_MAX_RECORDS && id_array[i] != 0); i++)
j = 0;
for(i=0; i<tmp_cnt; i++)
{
if(global_mod_flags[i] != 0)
{
shared_recs[ndx++] = id_array[i];
(*shared_recs)[j++] = id_array[i];
/* set global_mod_flags so we know which modules collectively
* accessed this module. we need this info to support shared
......@@ -834,6 +845,7 @@ static void darshan_get_shared_records(struct darshan_core_runtime *core,
ref->global_mod_flags = global_mod_flags[i];
}
}
*shared_rec_cnt = j;
return;
}
......@@ -938,7 +950,7 @@ static int darshan_deflate_buffer(void **pointers, int *lengths, int count,
}
tmp_stream.next_out = (unsigned char *)comp_buf;
tmp_stream.avail_out = DARSHAN_CORE_COMP_BUF_SIZE;
tmp_stream.avail_out = DARSHAN_COMP_BUF_SIZE;
/* loop over the input pointers */
for(i = 0; i < count; i++)
......@@ -999,9 +1011,9 @@ static int darshan_log_write_record_hash(MPI_File log_fh, struct darshan_core_ru
char *hash_buf;
char *hash_buf_off;
/* allocate a buffer to store at most 64 bytes for each of a max number of records */
/* allocate a buffer to store at most 64 bytes for each registered record */
/* NOTE: this buffer may be reallocated if estimate is too small */
hash_buf_sz = DARSHAN_CORE_MAX_RECORDS * 64;
hash_buf_sz = core->rec_count * 64;
hash_buf = malloc(hash_buf_sz);
if(!hash_buf)
{
......@@ -1171,7 +1183,10 @@ void darshan_core_register_module(
int *mmap_buf_size,
int *sys_mem_alignment)
{
int ret;
int tmpval;
struct darshan_core_module* mod;
char *mod_mem_str = NULL;
*mod_mem_limit = 0;
if(!darshan_core || (mod_id >= DARSHAN_MAX_MODS))
......@@ -1215,9 +1230,24 @@ void darshan_core_register_module(
/* register module with darshan */
darshan_core->mod_array[mod_id] = mod;
/* TODO: something smarter than just 2 MiB per module */
*mod_mem_limit = 2 * 1024 * 1024;
/* get the calling process's rank */
DARSHAN_MPI_CALL(PMPI_Comm_rank)(MPI_COMM_WORLD, my_rank);
/* set the maximum amount of memory this module can use */
mod_mem_str = getenv(DARSHAN_MOD_MEM_OVERRIDE);
if(mod_mem_str)
{
ret = sscanf(mod_mem_str, "%d", &tmpval);
/* silently ignore if the env variable is set poorly */
if(ret == 1 && tmpval > 0)
*mod_mem_limit = (tmpval * 1024 * 1024); /* convert to MiB */
else
*mod_mem_limit = DARSHAN_MOD_MEM_MAX;
}
else
{
*mod_mem_limit = DARSHAN_MOD_MEM_MAX;
}
DARSHAN_CORE_UNLOCK();
return;
......@@ -1251,8 +1281,9 @@ void darshan_core_unregister_module(
void darshan_core_register_record(
void *name,
int len,
int printable_flag,
darshan_module_id mod_id,
int printable_flag,
int mod_limit_flag,
darshan_record_id *rec_id,
int *file_alignment)
{
......@@ -1274,16 +1305,14 @@ void darshan_core_register_record(
HASH_FIND(hlink, darshan_core->rec_hash, &tmp_rec_id, sizeof(darshan_record_id), ref);
if(!ref)
{
/* record not found -- add it to the hash if we aren't already tracking the
* maximum number of records
/* record not found -- add it to the hash if this module has not already used
* all of its memory
*/
if(darshan_core->rec_count >= DARSHAN_CORE_MAX_RECORDS)
if(mod_limit_flag)
{
/* if we are already tracking the max records, set a flag to indicate
* that this log file has partial results
*/
//darshan_core->logfile_header_p->partial_flag = 1;
/* if this module is OOM, set a flag in the header to indicate this */
DARSHAN_MOD_FLAG_SET(darshan_core->log_header.partial_flag, mod_id);
DARSHAN_CORE_UNLOCK();
return;
}
......@@ -1301,7 +1330,7 @@ void darshan_core_register_record(
darshan_core->rec_count++;
}
}
ref->mod_flags = DARSHAN_CORE_MOD_SET(ref->mod_flags, mod_id);
DARSHAN_MOD_FLAG_SET(ref->mod_flags, mod_id);
DARSHAN_CORE_UNLOCK();
if(file_alignment)
......@@ -1326,7 +1355,7 @@ void darshan_core_unregister_record(
assert(ref);
/* disassociate this module from the given record id */
ref->mod_flags = DARSHAN_CORE_MOD_UNSET(ref->mod_flags, mod_id);
DARSHAN_MOD_FLAG_UNSET(ref->mod_flags, mod_id);
if(!(ref->mod_flags))
{
/* if no other modules are associated with this rec, delete it */
......
......@@ -263,6 +263,7 @@ static struct hdf5_file_runtime* hdf5_file_by_name(const char *name)
struct hdf5_file_runtime *file = NULL;
char *newname = NULL;
darshan_record_id file_id;
int limit_flag;
if(!hdf5_runtime || instrumentation_disabled)
return(NULL);
......@@ -271,12 +272,15 @@ static struct hdf5_file_runtime* hdf5_file_by_name(const char *name)
if(!newname)
newname = (char*)name;
limit_flag = (hdf5_runtime->file_array_ndx >= hdf5_runtime->file_array_size);
/* get a unique id for this file from darshan core */
darshan_core_register_record(
(void*)newname,
strlen(newname),
1,
DARSHAN_HDF5_MOD,
1,
limit_flag,
&file_id,
NULL);
......@@ -299,19 +303,15 @@ static struct hdf5_file_runtime* hdf5_file_by_name(const char *name)
return(file);
}
if(hdf5_runtime->file_array_ndx < hdf5_runtime->file_array_size);
{
/* no existing record, assign a new file record from the global array */
file = &(hdf5_runtime->file_runtime_array[hdf5_runtime->file_array_ndx]);
file->file_record = &(hdf5_runtime->file_record_array[hdf5_runtime->file_array_ndx]);
file->file_record->f_id = file_id;
file->file_record->rank = my_rank;
/* add new record to file hash table */
HASH_ADD(hlink, hdf5_runtime->file_hash, file_record->f_id, sizeof(darshan_record_id), file);
/* no existing record, assign a new file record from the global array */
file = &(hdf5_runtime->file_runtime_array[hdf5_runtime->file_array_ndx]);
file->file_record = &(hdf5_runtime->file_record_array[hdf5_runtime->file_array_ndx]);
file->file_record->f_id = file_id;
file->file_record->rank = my_rank;
hdf5_runtime->file_array_ndx++;
}
/* add new record to file hash table */
HASH_ADD(hlink, hdf5_runtime->file_hash, file_record->f_id, sizeof(darshan_record_id), file);
hdf5_runtime->file_array_ndx++;
if(newname != name)
free(newname);
......
......@@ -884,6 +884,7 @@ static struct mpiio_file_runtime* mpiio_file_by_name(const char *name)
struct mpiio_file_runtime *file = NULL;
char *newname = NULL;
darshan_record_id file_id;
int limit_flag;
if(!mpiio_runtime || instrumentation_disabled)
return(NULL);
......@@ -892,17 +893,20 @@ static struct mpiio_file_runtime* mpiio_file_by_name(const char *name)
if(!newname)
newname = (char*)name;
limit_flag = (mpiio_runtime->file_array_ndx >= mpiio_runtime->file_array_size);
/* get a unique id for this file from darshan core */
darshan_core_register_record(
(void*)newname,
strlen(newname),
1,
DARSHAN_MPIIO_MOD,
1,
limit_flag,
&file_id,
NULL);
/* if record is set to 0, darshan-core is out of space and will not
* track this record, so we should avoid tracking it, too
/* the file record id is set to 0 if no memory is available for tracking
* new records -- just fall through and ignore this record
*/
if(file_id == 0)
{
......@@ -920,19 +924,15 @@ static struct mpiio_file_runtime* mpiio_file_by_name(const char *name)
return(file);
}
if(mpiio_runtime->file_array_ndx < mpiio_runtime->file_array_size);
{
/* no existing record, assign a new file record from the global array */
file = &(mpiio_runtime->file_runtime_array[mpiio_runtime->file_array_ndx]);
file->file_record = &(mpiio_runtime->file_record_array[mpiio_runtime->file_array_ndx]);
file->file_record->f_id = file_id;
file->file_record->rank = my_rank;
/* add new record to file hash table */
HASH_ADD(hlink, mpiio_runtime->file_hash, file_record->f_id, sizeof(darshan_record_id), file);
/* no existing record, assign a new file record from the global array */
file = &(mpiio_runtime->file_runtime_array[mpiio_runtime->file_array_ndx]);
file->file_record = &(mpiio_runtime->file_record_array[mpiio_runtime->file_array_ndx]);
file->file_record->f_id = file_id;
file->file_record->rank = my_rank;
mpiio_runtime->file_array_ndx++;
}
/* add new record to file hash table */
HASH_ADD(hlink, mpiio_runtime->file_hash, file_record->f_id, sizeof(darshan_record_id), file);
mpiio_runtime->file_array_ndx++;
if(newname != name)
free(newname);
......
......@@ -275,6 +275,7 @@ static struct null_record_runtime* null_record_by_name(const char *name)
{
struct null_record_runtime *rec = NULL;
darshan_record_id rec_id;
int limit_flag;
/* Don't search for a record if the "NULL" module is not initialized or
* if instrumentation has been toggled off.
......@@ -282,15 +283,27 @@ static struct null_record_runtime* null_record_by_name(const char *name)
if(!null_runtime || instrumentation_disabled)
return(NULL);
/* stop tracking new records if we are tracking our maximum count */
limit_flag = (null_runtime->rec_array_ndx >= null_runtime->rec_array_size);
/* get a unique record identifier for this record from darshan-core */
darshan_core_register_record(
(void*)name,
strlen(name),
1,
DARSHAN_NULL_MOD,
1,
limit_flag,
&rec_id,
NULL);
/* the file record id is set to 0 if no memory is available for tracking
* new records -- just fall through and ignore this record
*/
if(rec_id == 0)
{
return(NULL);
}
/* search the hash table for this file record, and return if found */
HASH_FIND(hlink, null_runtime->record_hash, &rec_id, sizeof(darshan_record_id), rec);
if(rec)
......@@ -298,21 +311,17 @@ static struct null_record_runtime* null_record_by_name(const char *name)
return(rec);
}
if(null_runtime->rec_array_ndx < null_runtime->rec_array_size);
{
/* no existing record, assign a new one from the global array */
rec = &(null_runtime->runtime_record_array[null_runtime->rec_array_ndx]);
rec->record_p = &(null_runtime->record_array[null_runtime->rec_array_ndx]);
/* no existing record, assign a new one from the global array */
rec = &(null_runtime->runtime_record_array[null_runtime->rec_array_ndx]);
rec->record_p = &(null_runtime->record_array[null_runtime->rec_array_ndx]);
/* set the darshan record id and corresponding process rank for this record */
rec->record_p->f_id = rec_id;
rec->record_p->rank = my_rank;
/* set the darshan record id and corresponding process rank for this record */
rec->record_p->f_id = rec_id;
rec->record_p->rank = my_rank;
/* add new record to file hash table */
HASH_ADD(hlink, null_runtime->record_hash, record_p->f_id, sizeof(darshan_record_id), rec);
null_runtime->rec_array_ndx++;
}
/* add new record to file hash table */
HASH_ADD(hlink, null_runtime->record_hash, record_p->f_id, sizeof(darshan_record_id), rec);
null_runtime->rec_array_ndx++;
return(rec);
}
......
......@@ -275,6 +275,7 @@ static struct pnetcdf_file_runtime* pnetcdf_file_by_name(const char *name)
struct pnetcdf_file_runtime *file = NULL;
char *newname = NULL;
darshan_record_id file_id;
int limit_flag;
if(!pnetcdf_runtime || instrumentation_disabled)
return(NULL);
......@@ -283,17 +284,20 @@ static struct pnetcdf_file_runtime* pnetcdf_file_by_name(const char *name)
if(!newname)
newname = (char*)name;
limit_flag = (pnetcdf_runtime->file_array_ndx >= pnetcdf_runtime->file_array_size);
/* get a unique id for this file from darshan core */
darshan_core_register_record(
(void*)newname,
strlen(newname),
1,
DARSHAN_PNETCDF_MOD,
1,
limit_flag,
&file_id,
NULL);
/* if record is set to 0, darshan-core is out of space and will not
* track this record, so we should avoid tracking it, too
/* the file record id is set to 0 if no memory is available for tracking
* new records -- just fall through and ignore this record
*/
if(file_id == 0)
{
......@@ -311,19 +315,15 @@ static struct pnetcdf_file_runtime* pnetcdf_file_by_name(const char *name)
return(file);
}