Commit acc05e4a authored by Shane Snyder's avatar Shane Snyder

resolve minor TODO items

parent 75eee950
......@@ -28,14 +28,11 @@ CFLAGS = -DDARSHAN_CONFIG_H=\"darshan-runtime-config.h\" -I . -I ../ -I $(srcdir
#
CFLAGS_SHARED = -DDARSHAN_CONFIG_H=\"darshan-runtime-config.h\" -I . -I$(srcdir) -I$(srcdir)/../ @CFLAGS@ @CPPFLAGS@ -D_LARGEFILE64_SOURCE -shared -fpic -DPIC -DDARSHAN_PRELOAD
# TODO: BZ2?
LIBS = -lz @LIBBZ2@
lib::
@mkdir -p $@
# TODO make sure the headers are right in these prereqs
lib/darshan-core.o: lib/darshan-core.c darshan-core.h $(DARSHAN_LOG_FORMAT) | lib
$(CC) $(CFLAGS) -c $< -o $@
......@@ -66,7 +63,6 @@ lib/lookup8.o: lib/lookup8.c
lib/lookup8.po: lib/lookup8.c
$(CC) $(CFLAGS_SHARED) -c $< -o $@
# TODO: huh?
#%.i: %.c
# $(CC) -E $(CFLAGS) -c $< -o $@
......
......@@ -12,18 +12,20 @@
#include "darshan.h"
/* TODO: enforce this when handing out ids */
/* TODO: this goes where ? -- shared libs */
#define DARSHAN_MPI_CALL(func) func
#define DARSHAN_CORE_MAX_RECORDS 1024
/* default compression buffer size of 2 MiB */
/* TODO: revisit this default size if we change memory per module */
#define DARSHAN_COMP_BUF_SIZE (2 * 1024 * 1024)
#define DARSHAN_CORE_COMP_BUF_SIZE (2 * 1024 * 1024)
struct darshan_core_module
{
darshan_module_id id;
struct darshan_module_funcs mod_funcs;
};
#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))
/* in memory structure to keep up with job level data */
struct darshan_core_runtime
......@@ -31,12 +33,19 @@ struct darshan_core_runtime
struct darshan_job log_job;
char exe[DARSHAN_EXE_LEN+1];
struct darshan_core_record_ref *rec_hash;
int rec_count;
struct darshan_core_module* mod_array[DARSHAN_MAX_MODS];
char comp_buf[DARSHAN_COMP_BUF_SIZE];
char comp_buf[DARSHAN_CORE_COMP_BUF_SIZE];
double wtime_offset;
char *trailing_data;
};
struct darshan_core_module
{
darshan_module_id id;
struct darshan_module_funcs mod_funcs;
};
struct darshan_core_record_ref
{
struct darshan_record rec;
......
......@@ -25,20 +25,21 @@
/* Environment variable to override __CP_MEM_ALIGNMENT */
#define CP_MEM_ALIGNMENT_OVERRIDE "DARSHAN_MEMALIGN"
/* module developers provide the following functions to darshan-core */
struct darshan_module_funcs
{
/* disable futher instrumentation within a module */
void (*disable_instrumentation)(void);
/* TODO: */
/* perform any necessary steps prior to reducing */
void (*prepare_for_reduction)(
darshan_record_id *shared_recs,
darshan_record_id *shared_recs, /* input list of shared records */
int *shared_rec_count, /* in/out shared record count */
void **send_buf,
void **recv_buf,
int *rec_size
void **send_buf, /* send buffer for shared file reduction */
void **recv_buf, /* recv buffer for shared file reduction (root only) */
int *rec_size /* size of records being stored for this module */
);
/* TODO: */
void (*reduce_record)(
/* reduce records which are shared globally across this module */
void (*reduce_records)(
void* infile_v,
void* inoutfile_v,
int *len,
......@@ -62,13 +63,17 @@ void darshan_core_register_module(
struct darshan_module_funcs *funcs,
int *runtime_mem_limit);
void darshan_core_lookup_record_id(
void darshan_core_register_record(
void *name,
int len,
int printable_flag,
darshan_module_id mod_id,
darshan_record_id *id);
void darshan_core_unregister_record(
darshan_record_id rec_id,
darshan_module_id mod_id);
double darshan_core_wtime(void);
/***********************************************
......
This diff is collapsed.
......@@ -127,7 +127,7 @@ static void posix_file_close_fd(int fd);
static void posix_disable_instrumentation(void);
static void posix_prepare_for_reduction(darshan_record_id *shared_recs,
int *shared_rec_count, void **send_buf, void **recv_buf, int *rec_size);
static void posix_reduce_record(void* infile_v, void* inoutfile_v,
static void posix_reduce_records(void* infile_v, void* inoutfile_v,
int *len, MPI_Datatype *datatype);
static void posix_get_output_data(void **buffer, int *size);
static void posix_shutdown(void);
......@@ -306,7 +306,7 @@ static void posix_runtime_initialize()
{
.disable_instrumentation = &posix_disable_instrumentation,
.prepare_for_reduction = &posix_prepare_for_reduction,
.reduce_record = &posix_reduce_record,
.reduce_records = &posix_reduce_records,
.get_output_data = &posix_get_output_data,
.shutdown = &posix_shutdown
};
......@@ -350,7 +350,8 @@ static void posix_runtime_initialize()
memset(posix_runtime->file_record_array, 0, posix_runtime->file_array_size *
sizeof(struct darshan_posix_file));
DARSHAN_MPI_CALL(PMPI_Comm_rank)(MPI_COMM_WORLD, &my_rank); /* TODO: can we move this out of here? */
/* TODO: can we move this out of here? perhaps register_module returns rank? */
DARSHAN_MPI_CALL(PMPI_Comm_rank)(MPI_COMM_WORLD, &my_rank);
return;
}
......@@ -369,7 +370,7 @@ static struct posix_runtime_file* posix_file_by_name(const char *name)
newname = (char*)name;
/* get a unique id for this file from darshan core */
darshan_core_lookup_record_id(
darshan_core_register_record(
(void*)newname,
strlen(newname),
1,
......@@ -548,7 +549,7 @@ static void posix_prepare_for_reduction(
*rec_size = sizeof(struct darshan_posix_file);
/* TODO: HACK-Y -- how can we do this in a cleaner way?? */
/* TODO: cleaner way to do this? */
if(my_rank == 0)
posix_runtime->red_buf = *recv_buf;
posix_runtime->shared_rec_count = *shared_rec_count;
......@@ -556,7 +557,7 @@ static void posix_prepare_for_reduction(
return;
}
static void posix_reduce_record(
static void posix_reduce_records(
void* infile_v,
void* inoutfile_v,
int *len,
......@@ -605,7 +606,7 @@ static void posix_get_output_data(
{
assert(posix_runtime);
/* TODO: HACK-Y -- how can we do this in a cleaner way?? */
/* TODO: cleaner way to do this? */
/* clean up reduction state */
if(my_rank == 0)
{
......
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