Commit e6dad0ee authored by Shane Snyder's avatar Shane Snyder
Browse files

first cut at refactor of darshan-core for no mpi

parent 07e48c11
......@@ -263,6 +263,7 @@ void darshan_common_val_counter(
int64_t *val_p,
int64_t *cnt_p);
#ifdef HAVE_MPI
/* darshan_variance_reduce()
*
* MPI reduction operation to calculate variances on counters in
......@@ -279,5 +280,6 @@ void darshan_variance_reduce(
void *inoutvec,
int *len,
MPI_Datatype *dt);
#endif
#endif /* __DARSHAN_COMMON_H */
......@@ -7,12 +7,19 @@
#ifndef __DARSHAN_CORE_H
#define __DARSHAN_CORE_H
#include "darshan-runtime-config.h"
#include <unistd.h>
#include <sys/types.h>
#include <stdint.h>
#include <limits.h>
#ifdef HAVE_MPI
#include <mpi.h>
#endif
#include "uthash.h"
#include "darshan.h"
#include "darshan-log-format.h"
/* Environment variable to override __DARSHAN_JOBID */
......@@ -48,13 +55,32 @@
/* default name record buf can store 2048 records of size 100 bytes */
#define DARSHAN_NAME_RECORD_BUF_SIZE (2048 * 100)
typedef union
{
int nompi_fd;
#ifdef HAVE_MPI
MPI_File mpi_fh;
#endif
} darshan_core_log_fh;
/* FS mount information */
#define DARSHAN_MAX_MNTS 64
#define DARSHAN_MAX_MNT_PATH 256
#define DARSHAN_MAX_MNT_TYPE 32
struct darshan_core_mnt_data
{
char path[DARSHAN_MAX_MNT_PATH];
char type[DARSHAN_MAX_MNT_TYPE];
struct darshan_fs_info fs_info;
};
/* structure to track registered modules */
struct darshan_core_module
{
void *rec_buf_start;
void *rec_buf_p;
int rec_mem_avail;
darshan_module_shutdown mod_shutdown_func;
darshan_module_funcs mod_funcs;
};
/* strucutre for keeping a reference to registered name records */
......
......@@ -10,7 +10,10 @@
#include <unistd.h>
#include <sys/types.h>
#include <stdint.h>
#ifdef HAVE_MPI
#include <mpi.h>
#endif
#include "darshan-log-format.h"
#include "darshan-common.h"
......@@ -76,22 +79,36 @@
/* default number of records to attempt to store for each module */
#define DARSHAN_DEF_MOD_REC_COUNT 1024
/* module developers must define a 'darshan_module_shutdown' function
#ifdef HAVE_MPI
/*
* module developers _can_ define a 'darshan_module_redux' function
* to run collective MPI operations at shutdown time. Typically this
* functionality has been used to reduce records shared globablly (given
* in the 'shared_recs' array) into a single data record. Set to NULL
* avoid any reduction steps.
*/
typedef void (*darshan_module_redux)(
MPI_Comm mod_comm, /* MPI communicator to run collectives with */
darshan_record_id *shared_recs, /* list of shared data record ids */
int shared_rec_count /* count of shared data records */
);
#endif
/*
* module developers _must_ define a 'darshan_module_shutdown' function
* for allowing darshan-core to call into a module and retrieve final
* output data to be saved in the log.
*
* NOTE: module developers can use this function to run collective
* MPI operations at shutdown time. Typically this functionality
* has been used to reduce records shared globablly (given in the
* 'shared_recs' array) into a single data record.
*/
typedef void (*darshan_module_shutdown)(
MPI_Comm mod_comm, /* MPI communicator to run collectives with */
darshan_record_id *shared_recs, /* list of shared data record ids */
int shared_rec_count, /* count of shared data records */
void **mod_buf, /* output parameter to save module buffer address */
int *mod_buf_sz /* output parameter to save module buffer size */
);
typedef struct darshan_module_funcs
{
#ifdef HAVE_MPI
darshan_module_redux mod_redux_func;
#endif
darshan_module_shutdown mod_shutdown_func;
} darshan_module_funcs;
/* stores FS info from statfs calls for a given mount point */
struct darshan_fs_info
......@@ -124,10 +141,10 @@ void darshan_instrument_fs_data(
*
* Register module identifier 'mod_id' with the darshan-core runtime
* environment, allowing the module to store I/O characterization data.
* 'mod_shutdown_func is a pointer to a function responsible for
* shutting down the module and returning final output data to darshan-core.
* 'inout_mod_buf_size' is an input/output argument, with it being
* set to the requested amount of module memory on input, and set to
* 'mod_funcs' is a set of function pointers that implement module-specific
* shutdown functionality (including a possible data reduction step when
* using MPI). 'inout_mod_buf_size' is an input/output argument, with it
* being set to the requested amount of module memory on input, and set to
* the amount allocated by darshan-core on output. If given, 'rank' is
* a pointer to an integer which will contain the calling process's
* MPI rank on return. If given, 'sys_mem_alignment' is a pointer to
......@@ -136,7 +153,7 @@ void darshan_instrument_fs_data(
*/
void darshan_core_register_module(
darshan_module_id mod_id,
darshan_module_shutdown mod_shutdown_func,
darshan_module_funcs mod_funcs,
int *inout_mod_buf_size,
int *rank,
int *sys_mem_alignment);
......
This diff is collapsed.
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